boolean logic
play

Boolean Logic Guan-Shieng Huang Oct. 4, 2006 0-0 Boolean - PowerPoint PPT Presentation

Boolean Logic Guan-Shieng Huang Oct. 4, 2006 0-0 Boolean Expressions X = { x 1 , x 2 , . . . } a countably infinite variables, each can be true or false . Logical connectivities: : logical or; : logical and; :


  1. Boolean Logic Guan-Shieng Huang Oct. 4, 2006 0-0

  2. ✬ ✩ Boolean Expressions • X = { x 1 , x 2 , . . . } a countably infinite variables, each can be true or false . • Logical connectivities: ∨ : logical or; ∧ : logical and; ¬ : logical not. • The syntax: A Boolean expression can be one of 1. a Boolean variable, such as x i ; 2. ¬ φ 1 ; 3. ( φ 1 ∨ φ 2 ); 4. ( φ 1 ∧ φ 2 ); where φ 1 , φ 2 are Boolean expressions. (Inductive definition) ✫ ✪ 1

  3. ✬ ✩ Remarks • ¬ φ 1 : the negation of φ 1 • ( φ 1 ∨ φ 2 ): the disjunction of φ 1 and φ 2 • ( φ 1 ∧ φ 2 ): the conjunction of φ 1 and φ 2 • x i or ¬ x i is called a literal. ✫ ✪ 2

  4. ✬ ✩ The Semantics A truth assignment T is a mapping from a set of variables X ′ ⊂ X to { True , false } . 1. T | = x i if T ( x i ) = true ; 2. T | = ¬ φ if not T | = φ ; 3. T | = ( φ 1 ∨ φ 2 ) if T | = φ 1 or T | = φ 2 ; 4. T | = ( φ 1 ∧ φ 2 ) if T | = φ 1 and T | = φ 2 ; where T is appropriate. ✫ ✪ 3

  5. ✬ ✩ Example φ = (( ¬ x 1 ∨ x 2 ) ∧ x 3 ) and T = { x 1 → true , x 2 → false , x 3 → true } , then T �| = φ . ∵ T �| = ¬ x 1 and T �| = x 2 , ∴ T �| = ( ¬ x 1 ∨ x 2 ). ✫ ✪ 4

  6. ✬ ✩ Remark 1. ( φ 1 ⇒ φ 2 ) as a shorthand of ( ¬ φ 1 ∨ φ 2 ). 2. ( φ 1 ⇔ φ 2 ) as a shorthand of (( φ 1 ⇒ φ 2 ) ∧ ( φ 2 ⇒ φ 1 )). 3. � n i =1 φ i stands for ( φ 1 ∧ φ 2 ∧ · · · ∧ φ n ). 4. � n i =1 φ i stands for ( φ 1 ∨ φ 2 ∨ · · · ∨ φ n ). ✫ ✪ 5

  7. ✬ ✩ Normal Forms Conjunctive-normal form: φ = � n i =1 C i where n ≥ 1 and each C i is the disjunction of literals. C i is called a clause. ( x 1 ∨ ¬ x 2 ) ∧ ( ¬ x 1 ∨ x 2 ) Disjunctive-normal form: φ = � n i =1 D i where n ≥ 1 and each D i is the conjunction of literals. D i is called an implicant. ( x 1 ∧ ¬ x 2 ) ∨ ( ¬ x 1 ∧ x 2 ) ✫ ✪ 6

  8. ✬ ✩ Theorem 4.1 Every Boolean expression is equivalent to one in CNF (also one in DNF). Example ( p ⇒ q ) ∧ ( q ⇒ p ) = ( ¬ p ∨ q ) ∧ ( ¬ q ∨ p ) ( ¬ p ∧ ( ¬ q ∨ p )) ∨ ( q ∧ ( ¬ q ∨ p )) = = ( ¬ p ∧ ¬ q ) ∨ ( ¬ p ∧ p ) ∨ ( q ∧ ¬ q ) ∨ ( q ∧ p ) ( ¬ p ∧ ¬ q ) ∨ ( p ∧ q ) . = ✫ ✪ 7

  9. ✬ ✩ Satisfiability • A Boolean expression φ is satisfiable if there is a truth assignment T such that T | = φ . • An expression φ is valid (or tautology) if T | = φ for all T appropriate to φ . (Written as | = φ ) • φ is unsatisfiable if T �| = φ for all T . Proposition 4.2 A Boolean expression is unsatisfiable if and only if its negation is valid. ( φ is unsatisfiable ⇐ ⇒ | = ¬ φ ) ✫ ✪ 8

  10. ✬ ✩ ✫ ✪ 9

  11. ✬ ✩ Example 4.2 1. ( x 1 ∨ ¬ x 2 ) ∧ ¬ x 1 ; (satisfiable) 2. ( x 1 ∨ x 2 ∨ x 3 ) ∧ ( x 1 ∨¬ x 2 ) ∧ ( x 2 ∨¬ x 3 ) ∧ ( x 3 ∨¬ x 1 ) ∧ ( ¬ x 1 ∨¬ x 2 ∨¬ x 3 ). (unsatisfiable) ✫ ✪ 10

  12. ✬ ✩ SAT Given any Boolean expression φ in conjunctive normal form, is it satisfiable? Remarks 1. SAT ∈ NP . (a) Guess an assignment. (b) Verify it. 2. SAT is NP-complete (Chap. 8). 3. SAT can be easily solved if φ is expressed in disjunctive normal form. (( ¬ p ∧ ¬ q ) ∨ ( p ∧ q )) ✫ ✪ 11

  13. ✬ ✩ Boolean Function 1. An n -ary Boolean function is a function from { true , false } n → { true , false } . 2. A Boolean expression φ expresses a Boolean function f if for all truth value t = ( t 1 , . . . , t n ), f ( t ) = true iff T | = φ, where T ( x i ) = t i for 1 ≤ i ≤ n . ✫ ✪ 12

  14. ✬ ✩ Proposition 4.3 Any n -ary Boolean function f can be expressed as a Boolean expression φ f involving variables x 1 , x 2 , . . . , x n . f x 1 x 2 x 3 0 0 0 1 0 0 1 0 0 1 0 1 1 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 1 1 1 0 ( ¬ x 1 ∧ ¬ x 2 ∧ ¬ x 3 ) ∨ ( ¬ x 1 ∧ x 2 ∧ ¬ x 3 ) ∨ ( x 1 ∧ ¬ x 2 ∧ x 3 ) ✫ ✪ 13

  15. ✬ ✩ Boolean Circuit 1. no cycle in the graph; 2. the in-degree of each node equals to 0, 1, or 2; 3. each node represents either true , false , ∧ , ∨ , ¬ , or a variable x i . ✫ ✪ 14

  16. ✬ ✩ ✫ ✪ 15

  17. ✬ ✩ Given any circuit C , is there a truth assignment CIRCUIT SAT T appropriate to C such that T ( C ) = true ? When an assignment T is given, ask CIRCUIT VALUE whether T ( C ) is true . ✫ ✪ 16

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