the calculus of computation decision procedures with 2
play

The Calculus of Computation: Decision Procedures with 2. - PowerPoint PPT Presentation

The Calculus of Computation: Decision Procedures with 2. First-Order Logic (FOL) Applications to Verification by Aaron Bradley Zohar Manna Springer 2007 2- 1 2- 2 First-Order Logic (FOL) quantifiers existential quantifier x . F [ x ]


  1. The Calculus of Computation: Decision Procedures with 2. First-Order Logic (FOL) Applications to Verification by Aaron Bradley Zohar Manna Springer 2007 2- 1 2- 2 First-Order Logic (FOL) quantifiers existential quantifier ∃ x . F [ x ] Also called Predicate Logic or Predicate Calculus “there exists an x such that F [ x ]” universal quantifier ∀ x . F [ x ] FOL Syntax “for all x , F [ x ]” variables x , y , z , · · · constants a , b , c , · · · FOL formula literal, application of logical connectives functions f , g , h , · · · ( ¬ , ∨ , ∧ , → , ↔ ) to formulae, terms variables, constants or or application of a quantifier to a formula n-ary function applied to n terms as arguments a , x , f ( a ) , g ( x , b ) , f ( g ( x , g ( b ))) predicates p , q , r , · · · atom ⊤ , ⊥ , or an n-ary predicate applied to n terms literal atom or its negation p ( f ( x ) , g ( x , f ( x ))) , ¬ p ( f ( x ) , g ( x , f ( x ))) Note: 0-ary functions: constant 0-ary predicates: P , Q , R , . . . 2- 3 2- 4

  2. Example: FOL formula Translations of English Sentences into FOL ◮ The length of one side of a triangle is less than the sum of the ∀ x . p ( f ( x ) , x ) → ( ∃ y . p ( f ( g ( x , y )) , g ( x , y )) ) ∧ q ( x , f ( x )) lengths of the other two sides � �� � G � �� � ∀ x , y , z . triangle ( x , y , z ) → length ( x ) < length ( y )+ length ( z ) F The scope of ∀ x is F . ◮ Fermat’s Last Theorem. The scope of ∃ y is G . ∀ n . integer ( n ) ∧ n > 2 The formula reads: → ∀ x , y , z . “for all x, integer ( x ) ∧ integer ( y ) ∧ integer ( z ) if p ( f ( x ) , x ) ∧ x > 0 ∧ y > 0 ∧ z > 0 then there exists a y such that → x n + y n � = z n p ( f ( g ( x , y )) , g ( x , y )) and q ( x , f ( x ))” 2- 5 2- 6 FOL Semantics Example: F : p ( f ( x , y ) , z ) → p ( y , g ( z , x )) An interpretation I : ( D I , α I ) consists of: Interpretation I : ( D I , α I ) ◮ Domain D I D I = Z = {· · · , − 2 , − 1 , 0 , 1 , 2 , · · · } integers non-empty set of values or objects α I : { f �→ + , g �→ − , p �→ > } cardinality | D I | finite (eg, 52 cards), Therefore, we can write countably infinite (eg, integers), or F I : x + y > z → y > z − x uncountably infinite (eg, reals) ◮ Assignment α I (This is the way we’ll write it in the future!) ◮ each variable x assigned value x I ∈ D I Also ◮ each n-ary function f assigned α I : { x �→ 13 , y �→ 42 , z �→ 1 } f I : D n I → D I Thus F I : 13 + 42 > 1 → 42 > 1 − 13 In particular, each constant a (0-ary function) assigned value a I ∈ D I Compute the truth value of F under I ◮ each n-ary predicate p assigned 1 . | = x + y > z since 13 + 42 > 1 I p I : D n I → { true , false } 2 . I | = y > z − x since 42 > 1 − 13 3 . | = by 1, 2, and → I F In particular, each propositional variable P (0-ary predicate) assigned truth value (true, false) F is true under I 2- 7 2- 8

  3. Semantics: Quantifiers Example For Q , the set of rational numbers, consider x variable. x -variant of interpretation I is an interpretation J : ( D J , α J ) such F I : ∀ x . ∃ y . 2 × y = x that Compute the value of F I ( F under I ): ◮ D I = D J Let ◮ α I [ y ] = α J [ y ] for all symbols y , except possibly x J 2 : J 1 ⊳ { y �→ v J 1 : I ⊳ { x �→ v } 2 } That is, I and J agree on everything except possibly the value of x x -variant of I y -variant of J 1 for v ∈ Q . Denote J : I ⊳ { x �→ v } the x -variant of I in which α J [ x ] = v for some v ∈ D I . Then Then ◮ I | = ∀ x . F iff for all v ∈ D I , I ⊳ { x �→ v } | = F since 2 × v ◮ I | = ∃ x . F iff there exists v ∈ D I s.t. I ⊳ { x �→ v } | = F 1 . J 2 | = 2 × y = x 2 = v 2 . | = ∃ y . 2 × y = x J 1 3 . I | = ∀ x . ∃ y . 2 × y = x since v ∈ Q is arbitrary 2- 9 2- 10 Satisfiability and Validity Second case 1 . I �| = ∀ x . p ( x ) assumption F is satisfiable iff there exists I s.t. I | = F 2 . | = ¬∃ x . ¬ p ( x ) assumption I F is valid iff for all I , I | = F 3 . I ⊳ { x �→ v } �| = p ( x ) 1 and ∀ , for some v ∈ D I 4 . I �| = ∃ x . ¬ p ( x ) 2 and ¬ F is valid iff ¬ F is unsatisfiable 5 . I ⊳ { x �→ v } �| = ¬ p ( x ) 4 and ∃ 6 . I ⊳ { x �→ v } | = p ( x ) 5 and ¬ Example: F : ( ∀ x . p ( x )) ↔ ( ¬∃ x . ¬ p ( x )) valid? Suppose not. Then there is I s.t. 3 and 6 are contradictory. 0 . I �| = ( ∀ x . p ( x )) ↔ ( ¬∃ x . ¬ p ( x )) Both cases end in contradictions for arbitrary I ⇒ F is valid. First case 1 . I | = ∀ x . p ( x ) assumption 2 . I �| = ¬∃ x . ¬ p ( x ) assumption 3 . I | = ∃ x . ¬ p ( x ) 2 and ¬ 4 . I ⊳ { x �→ v } | = ¬ p ( x ) 3 and ∃ , for some v ∈ D I 5 . I ⊳ { x �→ v } | = p ( x ) 1 and ∀ 4 and 5 are contradictory. 2- 11 2- 12

  4. Example: Prove Example: Show F : p ( a ) → ∃ x . p ( x ) is valid. F : ( ∀ x . p ( x , x )) → ( ∃ x . ∀ y . p ( x , y )) is invalid. Assume otherwise. Find interpretation I such that 1 . I �| = F assumption I | = ¬ [( ∀ x . p ( x , x )) → ( ∃ x . ∀ y . p ( x , y ))] 2 . | = p ( a ) 1 and → I 3 . I �| = ∃ x . p ( x ) 1 and → i.e. 4 . I ⊳ { x �→ α I [ a ] } �| = p ( x ) 3 and ∃ I | = ( ∀ x . p ( x , x )) ∧ ¬ ( ∃ x . ∀ y . p ( x , y )) Choose D I = { 0 , 1 } 2 and 4 are contradictory. Thus, F is valid. p I = { (0 , 0) , (1 , 1) } i.e. p I (0 , 0) and p I (1 , 1) are true p I (1 , 0) and p I (1 , 0) are false I falsifying interpretation ⇒ F is invalid. 2- 13 2- 14 Safe Substitution F σ Rename x by x ′ : replace x in ∀ x by x ′ and all free x in the scope of ∀ x by x ′ . Example: ∀ x ′ . G [ x ′ ] ∀ x . G [ x ] ⇔ scope of ∀ x � �� � F : ( ∀ x . p ( x , y ) ) → q ( f ( y ) , x ) Same for ∃ x տ free տ free bound by ∀ x ր free ր ∃ x ′ . G [ x ′ ] ∃ x . G [ x ] ⇔ where x ′ is a fresh variable free ( F ) = { x , y } substitution Proposition (Substitution of Equivalent Formulae) σ : { x �→ g ( x ) , y �→ f ( x ) , q ( f ( y ) , x ) �→ ∃ x . h ( x , y ) } σ : { F 1 �→ G 1 , · · · , F n �→ G n } F σ ? s.t. for each i , F i ⇔ G i 1. Rename F ′ : ∀ x ′ . p ( x ′ , y ) → q ( f ( y ) , x ) If F σ a safe substitution, then F ⇔ F σ ↑ ↑ where x ′ is a fresh variable 2. F ′ σ : ∀ x ′ . p ( x ′ , f ( x )) → ∃ x . h ( x , y ) 2- 15 2- 16

  5. Formula Schema Substitution σ of H Formula σ : { F 1 �→ , . . . , F n �→ } ( ∀ x . p ( x )) ↔ ( ¬∃ x . ¬ p ( x )) mapping place holders F i of H to FOL formulae, (obeying the side conditions of H ) Formula Schema H 1 : ( ∀ x . F ) ↔ ( ¬∃ x . ¬ F ) Proposition (Formula Schema) ↑ place holder If H is valid formula schema and Formula Schema (with side condition) σ is a substitution obeying H ’s side conditions then H σ is also valid. H 2 : ( ∀ x . F ) ↔ F provided x / ∈ free ( F ) Example: Valid Formula Schema H : ( ∀ x . F ) ↔ F provided x / ∈ free ( F ) is valid H is valid iff valid for any FOL formula F i obeying the side conditions σ : { F �→ p ( y ) } obeys the side condition Therefore H σ : ∀ x . p ( y ) ↔ p ( y ) is valid Example: H 1 and H 2 are valid. 2- 17 2- 18 Proving Validity of Formula Schema Normal Forms 1. Negation Normal Forms (NNF) Example: Prove validity of Augment the equivalence with (left-to-right) H : ( ∀ x . F ) ↔ F provided x / ∈ free ( F ) Proof by contradiction. Consider the two directions of ↔ . ¬∀ x . F [ x ] ⇔ ∃ x . ¬ F [ x ] First case: ¬∃ x . F [ x ] ⇔ ∀ x . ¬ F [ x ] 1 . I | = ∀ x . F assumption Example 2 . �| = assumption I F 3 . I | = F 1, ∀ , since x �∈ free( F ) 4 . | = ⊥ 2, 3 I G : ∀ x . ( ∃ y . p ( x , y ) ∧ p ( x , z )) → ∃ w . p ( x , w ) . Second Case: 1. ∀ x . ( ∃ y . p ( x , y ) ∧ p ( x , z )) → ∃ w . p ( x , w ) 1 . I �| = ∀ x . F assumption 2. ∀ x . ¬ ( ∃ y . p ( x , y ) ∧ p ( x , z )) ∨ ∃ w . p ( x , w ) 2 . | = assumption I F F 1 → F 2 ⇔ ¬ F 1 ∨ F 2 3 . I | = ∃ x . ¬ F 1 and ¬ 3. ∀ x . ( ∀ y . ¬ ( p ( x , y ) ∧ p ( x , z ))) ∨ ∃ w . p ( x , w ) 4 . I | = ¬ F 3, ∃ , since x �∈ free( F ) ¬∃ x . F [ x ] ⇔ ∀ x . ¬ F [ x ] 5 . I | = ⊥ 2, 4 4. ∀ x . ( ∀ y . ¬ p ( x , y ) ∨ ¬ p ( x , z )) ∨ ∃ w . p ( x , w ) Hence, H is a valid formula schema. 2- 19 2- 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend