Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 2: Distributed Programs and their Correctness

Similar presentations


Presentation on theme: "Lecture 2: Distributed Programs and their Correctness"— Presentation transcript:

1 Lecture 2: Distributed Programs and their Correctness
Anish Arora CSE 6333 1

2     Table of Precedence + ─ = < >   
Highest [x := E] substitution . function application + ─ unary prefix operators x / mod gcd binary arith. operators + ─ = < >        Lowest  2

3 Equivalence  Associativity : (P  Q)  R  P  (Q  R)
Symmetry : P  Q  Q  P Identity : true  Q  Q Note:  is not ‘conjunctional’ P  Q  R ? P  Q  Q  R Example: Tom has 2 eyes  Tom has 1 eye  Tom has no eyes ? (Tom has 2 eyes  Tom has 1 eye)  (Tom has 1 eye  Tom has no eyes)

4 Negation  false   true  (P  Q)   P  Q P  Q   (P  Q)
Theorem : (P Q)  (Q P) Proof: (P Q)  (Q P) = { axiom : definition of }  (P  Q)   (Q  P) = { axiom :  (P  Q)   P  Q }  P  Q   Q  P = {  is symmetric, associative }  P  P   Q  Q =  (P  P)   (Q  Q) { definition of false : false   true} = false  false = true

5 Disjunction  , Conjunction 
Symmetry : P  Q  Q  P Associativity : (P  Q)  R  P  (Q  R) Idempotence : P  P  P Distributivity of  over  : P  (Q  R)  P  Q  P  R Excluded miracle : P  P The Golden Rule: P  Q  P  Q  P  Q P  Q  P  Q  P  Q P  Q  P  Q  P  Q Note : P  Q  P  Q  P P  Q  Q  P  Q

6 Quantification : Universal , Existential 
(x : R : P)  (x : true : R  P) (x : R : true)  true (x : R : P)   (x : R :  P) (x : R : P)  (x : true : R  P) (x : R : false)  false Q: (x : false : R)  ?

7 Reasoning with Hoare Triples
{P} g  skip {P} is true {P[x := E]} true  x := E {P} rule of textual substitution {P} g  st {Q} equivales {P g} true  st {Q} and (P g)  Q {P} g  st {P} equivales {P  g} true  st {P}

8 Reasoning with Hoare Triples (contd.)
P  Q and {Q} g  st {R} implies {P} g  st {R} {P} g  st {Q} and Q  R implies {P} g  st {R} {P} g  st {R} and {Q} g  st {R} implies {P  Q} g  st {R} {P} g  st {Q} and {P} g  st {R} implies {P} g  st {Q  R}


Download ppt "Lecture 2: Distributed Programs and their Correctness"

Similar presentations


Ads by Google