synthesis, analysis, and verification lecture 03b
DESCRIPTION
Synthesis, Analysis, and Verification Lecture 03b. More Hoare Logic. Building Formulas Substitutions. Lectures: Viktor Kuncak. Programs, Relations, Formulas. Forms of Hoare Triple. Transitivity Rule. Expanding Paths. Transitive Closure. More on Hoare Logic. see wiki. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/1.jpg)
Synthesis, Analysis, and VerificationLecture 03b
Lectures: Viktor Kuncak
More Hoare Logic. Building FormulasSubstitutions
![Page 2: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/2.jpg)
Programs, Relations, Formulas
![Page 3: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/3.jpg)
Forms of Hoare Triple
![Page 4: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/4.jpg)
Transitivity Rule
![Page 5: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/5.jpg)
Expanding Paths
![Page 6: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/6.jpg)
Transitive Closure
![Page 7: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/7.jpg)
More on Hoare Logic
• see wiki
![Page 8: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/8.jpg)
Programs, Relations, Formulas
![Page 9: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/9.jpg)
Programs to Formulas (VCG)
Three methods• compositionally compute formulas for
relations– then compare them to spec
• forward propagation – compute sp of pre• backward propagation – compute wp of post
![Page 10: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/10.jpg)
From Programs to Formulas(compositional way)
Given – guarded program p with set of variables V,
Compute– formula F – whose free variables can be x and x’ , for all x in V
such that F holds iff program starting in state given by unprimed variables can end up in state given by primed variables
we should already know the answer
![Page 11: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/11.jpg)
Construct formulas recursively
Guarded program given by treeLeaves: x=E, assume(P)
assume(P)
x=E
![Page 12: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/12.jpg)
Tree nodes (recursion)
Non-deterministic choice []
Sequential composition ;
![Page 13: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/13.jpg)
Consequences
assume(P); c
c; assume(P)
![Page 14: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/14.jpg)
About One-Point Rules
Which formula simplifications are correct?
For each either– find counterexample, or– prove equivalence (how?)
![Page 15: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/15.jpg)
![Page 16: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/16.jpg)
![Page 17: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/17.jpg)
Definition of Formulas
![Page 18: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/18.jpg)
Definition of Substitution
![Page 19: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/19.jpg)
Semantics: Formula Set of states
![Page 20: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/20.jpg)
formula semantics
![Page 21: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/21.jpg)
Formula(‘) Set of Pairs of States
Formulas with primed and unprimed variables
![Page 22: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/22.jpg)
Pairs of Disjoint Functions
Let f1 , f2 - partial functions with disjoint domainThen (f1 , f2) can be represented with (f1 U f2)
Given semantics for sets of partial functions, we also know how to give semantics for relations on such states
![Page 23: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/23.jpg)
Programs, Relations, Formulas
![Page 24: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/24.jpg)
Lemma for One-Point Rule
![Page 25: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/25.jpg)
One Point Rule Proved
![Page 26: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/26.jpg)
Programs to Formulas (VCG)
![Page 27: Synthesis, Analysis, and Verification Lecture 03b](https://reader036.vdocuments.mx/reader036/viewer/2022081515/568164cc550346895dd6eeaf/html5/thumbnails/27.jpg)
Further Reading
• C A R Hoare and He Jifeng. Unifying Theories of Programming. Prentice Hall, 1998
• Semantics-based Program Analysis via Symbolic Composition of Transfer Relations, PhD dissertation by Christopher Colby, 1996