PROPOSITIONAL LOGIC: MORE ON NORMAL FORMS VL Logic, Lecture 3, WS 20/21 Armin Biere, Martina Seidl Institute for Formal Models and Verification Johannes Kepler University Linz PROPOSITIONAL FORMULAS: SATISFIABILITY EQUIVALENCES VL Logic Part I: Propositional Logic Recap: Semantic Equivalence Two formulas φ and are semanticly equivalent (written as φ , ) iff forall interpreta- tions [:]ν it holds that [φ]ν = [ ]ν. , is a meta-symbol, i.e., it is not part of the language. φ , iff φ $ is valid, i.e., we can express semantics by means of syntactics. If φ and are not equivalent, we write φ 6, . Example: a _:a 6, b !:b (a _ b) ^ :(a _ b) ,? a _:a , b _:b a $ (b $ c) , (a $ b) $ c 1/3 Satisfiability Equivalence Two formulas φ and are satisfiability-equivalent (written as φ ,S AT ) iff both formu- las are satisfiable or both are contradictory. Satisfiability-equivalent formulas are not necessarily satisfied by the same assignments. Satisfiability equivalence is a weaker property than semantic equivalence. Often sufficient for simplification rules: If the complicated formula is satisfiable then also the simplified formula is satisfiable. 2/3 Example: Satisfiability Equivalence positive pure literal elimination rule: If a literal x occurs in an NNF formula but :x does not occur in this formula, then x can be substituted by >. The resulting formula is satisfiability-equivalent. Example: x ,S AT >, but x 6, > (a ^ b) _ (:c ^ a) ,S AT b _:c, but (a ^ b) _ (:c ^ a) 6, b _:c 3/3 PROPOSITIONAL FORMULAS: FUNCTIONAL COMPLETENESS VL Logic Part I: Propositional Logic Examples of Semantic Equivalences (1/2) φ ^ , ^ φ φ _ , _ φ commutativity φ ^ ( ^ γ) , (φ ^ ) ^ γ φ _ ( _ γ) , (φ _ ) _ γ associativity φ ^ (φ _ ) , φ φ _ (φ ^ ) , φ absorption φ ^ ( _ γ) , (φ ^ ) _ (φ ^ γ) φ _ ( ^ γ) , (φ _ ) ^ (φ _ γ) distributivity :(φ ^ ) ,:φ _: :(φ _ ) ,:φ ^ : laws of De Morgan φ $ , (φ ! ) ^ ( ! φ) φ $ , (φ ^ ) _ (:φ ^ : ) synt. equivalence 1/3 Examples of Semantic Equivalences (2/2) φ _ ,:φ ! φ ! ,: !:φ implications φ ^ :φ ,? φ _:φ , > complement ::φ , φ double negation φ ^ > , φ φ _?, φ neutrality φ _ > , > φ ^ ? , ? :> , ? :? , > 2/3 Functional Completeness In propositional logic there are 2 functions of arity 0 (>; ?) 4 functions of arity 1 (e.g., not) 16 functions of arity 2 (e.g., and, or, ...) n 22 functions of arity n. A function of arity n has 2n different combinations of arguments (lines in the truth table). A functions maps its arguments either to 1 or 0. A set of functions is called functional complete for propositional logic iff it is possible to express all other functions of propositional logic with functions from this set. f:; ^g, f:; _g, {nand} are functional complete. 3/3 PROPOSITIONAL FORMULAS: NORMAL FORMS VL Logic Part I: Propositional Logic Negation Normal Form (1/2) Negation Normal Form (NNF) is defined as follows: Literals and truth constants are in NNF; φ ◦ (◦ 2 f_; ^g) is in NNF iff φ and are in NNF; no other formulas are in NNF. In other words: A formula in NNF contains only conjunctions, disjunctions, and negations and negations only occur in front of variables and constants. 1/7 Negation Normal Form (2/2) If a formula is in negation normal form then in the formula tree, nodes with negation symbols only occur directly before leaves. there are no subformulas of the form :φ where φ is something else than a variable or a constant. it does not contain NAND, NOR, XOR, equivalence, and implication connectives. Example: The formula ((x _:x1) ^ (x _ (:z _:x1))) is in NNF but :((x _:x1) ^ (x _ (:z _:x1))) is not in NNF. 2/7 Conjunctive Normal Form (CNF) A propositional formula is in conjunctive normal form (CNF) iff it is a conjunction of clauses. A formula in conjunctive normal form is in negation normal form > if it contains no clauses easy to check whether it can be refuted remark: CNF is the input of most SAT-solvers (DIMACS format) 3/7 Disjunctive Normal Form (DNF) A propositional formula is in disjunctive normal form (DNF) if it is a disjunction of cubes. A formula in disjunctive normal form is in negation normal form ? if it contains no cubes easy to check whether it can be satisfied 4/7 Examples for CNF and DNF Examples CNF > l1 ^ l2 ^ l3 ? l1 _ l2 _ l3 a (a1 _:a2) ^ (a1 _ b2 _ a2) ^ a2 _ _ ^ ^ _ _ :a ((l11 ::: l1m1 ) ::: (ln1 ::: lnmn )) Examples DNF > l1 ^ l2 ^ l3 ? l1 _ l2 _ l3 a (a1 ^ :a2) _ (a1 ^ b2 ^ a2) _ a2 ^ ^ _ _ ^ ^ :a ((l11 ::: l1m1 ) ::: (ln1 ::: lnmn )) 5/7 Representing Functions as CNFs Problem: Given the truth table of a Boolean function φ. How is the function represented in propositional logic? a b c φ clauses 0 0 0 0 a _ b _ c Solution (in CNF): 0 0 1 1 0 1 0 1 1. Represent each assignment ν where φ has 0 1 1 0 a _:b _:c value 0 as clause: 1 0 0 1 If variable x is 1 in ν, add :x to clause. 1 0 1 0 :a _ b _:c If variable x is 0 in ν, add x to clause. 1 1 0 0 :a _:b _ c 1 1 1 1 2. Connect all clauses by conjunction. φ = (a _ b _ c) ^ (a _:b _:c) ^ (:a _ b _:c) ^ (:a _:b _ c) 6/7 Representing Functions as DNFs Problem: Given the truth table of a Boolean function φ. How is the function represented in propositional logic? a b c φ cubes 0 0 0 0 0 0 1 1 :a ^ :b ^ c Solution (in DNF): 0 1 0 1 :a ^ b ^ :c 1. Represent each assignment ν where φ 0 1 1 0 has value 1 as cube: 1 0 0 1 a ^ :b ^ :c 1 0 1 0 If variable x is 1 in ν, add x to cube. 1 1 0 0 : If variable x is 0 in ν, add x to cube. 1 1 1 1 a ^ b ^ c 2. Connect all cubes by disjunction. φ = (:a ^ :b ^ c) _ (:a ^ b ^ :c) _ (a ^ :b ^ :c) _ (a ^ b ^ c) 7/7 PROPOSITIONAL FORMULAS: NORMAL FORM TRANSFORMATION VL Logic Part I: Propositional Logic Transformation to Conjunctive Normal Form 1 Approach 1: Transformation by “multiplication” 1. Remove $; !; ⊕ as follows: φ $ , (φ ! ) ^ ( ! φ) φ ! ,:φ _ ; φ ⊕ , (φ _ ) ^ (:φ _: ) 2. Transform formula to negation normal form (NNF) by application of laws of De Morgan elimination of double negation 3. Transform formula to CNF by laws of distributivity 1/5 Example: Transformation to CNF 1 Transformation of :(a $ b) ! (:(c ^ d) ^ e) to an equivalent formula in CNF by approach 1 1. a) remove equivalences: ,:((a ! b) ^ (b ! a)) ! (:(c ^ d) ^ e) b) remove implications: , ::((:a _ b) ^ (:b _ a)) _ (:(c ^ d) ^ e) 2. NNF: , ((:a _ b) ^ (:b _ a)) _ ((:c _:d) ^ e) 3. , ((:a _ b) _ ((:c _:d) ^ e))) ^ ((:b _ a) _ ((:c _:d) ^ e))) , (:a _ b _:c _:d) ^ (:a _ b _ e) ^ (:b _ a _:c _:d) ^ (:b _ a _ e) 2/5 Transformation to Conjunctive Normal Form 2 Approach 2: Transformation by introducing labels for subformulas Given formula φ. The following approach transforms φ to an equi-satisfiable formula in CNF. 1. Introduce new label ` for each subformula that is not a literal 0 0 2. Collect all definitions ` $ in a big conjunction Φ ( 0 is obtained from by replacing its immediate subformulas by the respective labels) 3. Transform Φ0 to CNF Φ by approach 1 (no exponential blowup!) (Φ ^ `φ) and φ are equi-satisfiable 3/5 Example: Transformation to CNF 2 Transform φ := :(a $ b) ! (:(c ^ d) ^ e) to an equi-satisfiable formula in CNF definitions Φ0 clauses Φ v1 $ (a $ b) (¯v1 _ a¯ _ b); (¯v1 _ a _ b¯); (v1 _ a¯ _ b¯); (v1 _ a _ b) v2 $ :v1 (v1 _ v2); (¯v1 _ v¯2) v3 $ (c ^ d) (¯v3 _ c); (¯v3 _ d); (v3 _ c¯ _ d¯) v4 $ :v3 (v3 _ v4); (¯v3 _ v¯4) v5 $ (v4 ^ e) (¯v5 _ v4); (¯v5 _ e); (v5 _ v¯4 _ e¯) v6 $ (v2 ! v5) (¯v6 _ v¯2 _ v5); (v2 _ v6); (¯v5 _ v6) (Φ ^ v6) and φ are equi-satisfiable. 4/5 Some Remarks on Normal Forms Approach 1 is exponential in the worst case (e.g., transform (a1 ^ b1) _ (a2 ^ b2) _···_ (an ^ bn) to CNF). Approach 2 is polynomial Basic idea: introduce labels for subformulas. Also works for formulas with sharing (circuits). Also known as “Tseitin Encoding”. CNF is usually not easier to solve, but easier to handle: compact data structures: a CNF is simply a list of lists of literals. CNF very popular in practice: standard input format DIMACS To solve satisfiability of CNF, there are many optimization techniques and dedicated algorithms. 5/5 PROPOSITIONAL FORMULAS: RESOLUTION VL Logic Part I: Propositional Logic Resolution the resolution calculus consists of the single resolution rule Example x _ C :x _ D one application of resolution C _ D x _ y _:z :x _ y0 _:z C and D are (possibly empty) clauses y _:z _ y0 the clause C _ D is called resolvent derivation of empty clause: variable x is called pivot y :y usually antecedent clauses x _ C and :x _ D ? are assumed not to be tautological derivation of tautology: resolution is sound and complete.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages26 Page
-
File Size-