propositional logic
play

Propositional Logic Combinatorial Problem Solving (CPS) Albert - PowerPoint PPT Presentation

Propositional Logic Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodr guez-Carbonell May 15, 2020 Overview of the session Definition of Propositional Logic General Concepts in Logic Reduction to SAT CNFs and


  1. Propositional Logic Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodr´ ıguez-Carbonell May 15, 2020

  2. Overview of the session ■ Definition of Propositional Logic General Concepts in Logic ■ Reduction to SAT ◆ CNFs and DNFs ■ Tseitin Transformation ◆ Problem Solving with SAT ■ Resolution ■ 1 / 18

  3. Definition of Propositional Logic SYNTAX (what is a formula?) : There is a set P of propositional variables, ■ usually denoted by (subscripted) p, q, r, . . . The set of propositional formulas over P is defined as: ■ Every propositional variable is a formula ◆ If F is a formula, ¬ F is also a formula ◆ If F and G are formulas, ( F ∧ G ) is also a formula ◆ If F and G are formulas, ( F ∨ G ) is also a formula ◆ Nothing else is a formula ◆ Formulas are usually denoted by (subscripted) F, G, H, . . . ■ Examples: ■ ¬ p ( p ∨ q ) ¬ ( p ∧ q ) p ( p ∧ ( ¬ p ∨ q )) (( p ∧ q ) ∨ ( r ∨ ¬ q )) . . . 2 / 18

  4. Definition of Propositional Logic SEMANTICS (what is an interpretation I , when I satisfies F ?) : An interpretation I over P is a function I : P → { 0 , 1 } . ■ eval I : Formulas → { 0 , 1 } is a function defined as follows: ■ eval I ( p ) = I ( p ) ◆ eval I ( ¬ F ) = 1 − eval I ( F ) ◆ eval I ( ( F ∧ G ) ) = min { eval I ( F ) , eval I ( G ) } ◆ eval I ( ( F ∨ G ) ) = max { eval I ( F ) , eval I ( G ) } ◆ I satisfies F (written I | = F ) if and only if eval I ( F ) = 1 . ■ If I | = F we say that ■ I is a model of F or, equivalently ◆ F is true in I . ◆ 3 / 18

  5. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ Is there any I such that I | = F ? ■ 4 / 18

  6. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = Is there any I such that I | = F ? ■ 4 / 18

  7. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = min { eval I ( p ) , eval I (( q ∨ ¬ r )) } Is there any I such that I | = F ? ■ 4 / 18

  8. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = min { eval I ( p ) , eval I (( q ∨ ¬ r )) } = min { eval I ( p ) , max { eval I ( q ) , eval I ( ¬ r ) } } Is there any I such that I | = F ? ■ 4 / 18

  9. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = min { eval I ( p ) , eval I (( q ∨ ¬ r )) } = min { eval I ( p ) , max { eval I ( q ) , eval I ( ¬ r ) } } = min { eval I ( p ) , max { eval I ( q ) , 1 − eval I ( r ) } } Is there any I such that I | = F ? ■ 4 / 18

  10. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = min { eval I ( p ) , eval I (( q ∨ ¬ r )) } = min { eval I ( p ) , max { eval I ( q ) , eval I ( ¬ r ) } } = min { eval I ( p ) , max { eval I ( q ) , 1 − eval I ( r ) } } = min { I ( p ) , max { I ( q ) , 1 − I ( r ) } } Is there any I such that I | = F ? ■ 4 / 18

  11. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = min { eval I ( p ) , eval I (( q ∨ ¬ r )) } = min { eval I ( p ) , max { eval I ( q ) , eval I ( ¬ r ) } } = min { eval I ( p ) , max { eval I ( q ) , 1 − eval I ( r ) } } = min { I ( p ) , max { I ( q ) , 1 − I ( r ) } } = min { 1 , max { 0 , 1 − 1 } } Is there any I such that I | = F ? ■ 4 / 18

  12. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = min { eval I ( p ) , eval I (( q ∨ ¬ r )) } = min { eval I ( p ) , max { eval I ( q ) , eval I ( ¬ r ) } } = min { eval I ( p ) , max { eval I ( q ) , 1 − eval I ( r ) } } = min { I ( p ) , max { I ( q ) , 1 − I ( r ) } } = min { 1 , max { 0 , 1 − 1 } } = 0 Is there any I such that I | = F ? ■ 4 / 18

  13. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = min { eval I ( p ) , eval I (( q ∨ ¬ r )) } = min { eval I ( p ) , max { eval I ( q ) , eval I ( ¬ r ) } } = min { eval I ( p ) , max { eval I ( q ) , 1 − eval I ( r ) } } = min { I ( p ) , max { I ( q ) , 1 − I ( r ) } } = min { 1 , max { 0 , 1 − 1 } } = 0 Is there any I such that I | = F ? ■ 4 / 18

  14. Definition of Propositional Logic EXAMPLE: Let F be the formula ( p ∧ ( q ∨ ¬ r )) . ■ Let I be such that I ( p ) = I ( r ) = 1 and I ( q ) = 0 . ■ Let us compute eval I ( F ) (use your intuition first!) ■ eval I (( p ∧ ( q ∨ ¬ r ))) = min { eval I ( p ) , eval I (( q ∨ ¬ r )) } = min { eval I ( p ) , max { eval I ( q ) , eval I ( ¬ r ) } } = min { eval I ( p ) , max { eval I ( q ) , 1 − eval I ( r ) } } = min { I ( p ) , max { I ( q ) , 1 − I ( r ) } } = min { 1 , max { 0 , 1 − 1 } } = 0 Is there any I such that I | = F ? ■ YES, I ( p ) = I ( q ) = I ( r ) = 1 is a possible model. 4 / 18

  15. Definition of Propositional Logic EXAMPLE We have 3 pigeons and 2 holes. ■ If each hole can have at most one pigeon, is it possible to place all pigeons in the holes? Vocabulary: p i,j means i -th pigeon is in j -th hole ■ Each pigeon is placed in at least one hole: ■ ( p 1 , 1 ∨ p 1 , 2 ) ∧ ( p 2 , 1 ∨ p 2 , 2 ) ∧ ( p 3 , 1 ∨ p 3 , 2 ) Each hole can hold at most one pigeon: ■ ¬ ( p 1 , 1 ∧ p 2 , 1 ) ∧ ¬ ( p 1 , 1 ∧ p 3 , 1 ) ∧ ¬ ( p 2 , 1 ∧ p 3 , 1 ) ∧ ¬ ( p 1 , 2 ∧ p 2 , 2 ) ∧ ¬ ( p 1 , 2 ∧ p 3 , 2 ) ∧ ¬ ( p 2 , 2 ∧ p 3 , 2 ) Resulting formula has no model ■ 5 / 18

  16. Definition of Propositional Logic A small syntax extension: We will write ( F → G ) as an abbreviation for ( ¬ F ∨ G ) ■ Similarly, ( F ↔ G ) is an abbreviation of (( F → G ) ∧ ( G → F )) ■ 6 / 18

  17. Overview of the session Definition of Propositional Logic ■ ■ General Concepts in Logic Reduction to SAT ◆ CNFs and DNFs ■ Tseitin Transformation ◆ Problem Solving with SAT ■ Resolution ■ 6 / 18

  18. General Concepts in Logic Let F and G be arbitrary formulas. Then: F is satisfiable if it has at least one model ■ F is unsatisfiable (also a contradiction) if it has no model ■ F is a tautology if every interpretation is a model of F ■ G is a logical consequence of F , denoted F | = G , ■ if every model of F is a model of G F and G are logically equivalent, denoted F ≡ G , ■ if F and G have the same models Note that: All definitions are only based on the concept of model. ■ Hence they are independent of the logic. ■ 7 / 18

  19. General Concepts in Logic p Circuit corresponds to formula ( ¬ p ∧ p ) ■ Formula unsatisfiable amounts to “circuit output is always 0” ■ p Circuit corresponds to formula ( ¬ p ∨ p ) ■ Formula is a tautology amounts to “circuit output is always 1” ■ 8 / 18

  20. General Concepts in Logic p p q q Circuit on the left corresponds to formula F := ¬ ( p ∧ q ) ■ Circuit on the right corresponds to formula G := ( ¬ p ∨ ¬ q ) ■ They are functionally equivalent, i.e. same inputs produce same output ■ That corresponds to saying F ≡ G ■ Cheapest / fastest / less power-consuming circuit is then chosen ■ 9 / 18

  21. General Concepts in Logic p e 1 q e 3 e 4 r e 2 s Is e 1 always dif- e 6 p ferent from e 5 ? e 5 q e 7 ↔ ( p ∧ q ) ∧ e 1   ↔ ( r ∨ s ) ∧  e 2     ↔ ( e 1 ∧ e 2 ) ∧ e 3    e 1 � = e 5 in the circuit amounts to ↔ ( e 3 ∨ e 5 ) ∧ | = e 1 ↔ ¬ e 5 e 4 ↔ ( e 6 ∧ e 7 ) ∧ e 5     ↔ ( ¬ p ) ∧ e 6     ↔ ( ¬ q ) e 7  10 / 18

  22. Reduction to SAT Assume we have a black box SAT that given a formula F : SAT ( F ) = YES iff F is satisfiable ■ SAT ( F ) = NO iff F is unsatisfiable ■ How to reuse SAT for detecting tautology, logical consequences, ...? F tautology iff SAT ( ¬ F ) = NO ■ F | = G iff SAT ( F ∧ ¬ G ) = NO ■ F ≡ G iff SAT ( ( F ∧ ¬ G ) ∨ ( ¬ F ∧ G ) ) = NO ■ 11 / 18

Recommend


More recommend