Propositional Logic: More on Normal Forms

Total Page:16

File Type:pdf, Size:1020Kb

Propositional Logic: More on Normal Forms 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.
Recommended publications
  • Mathematical Logic, an Introduction
    Mathematical Logic, an Introduction by Peter Koepke Bonn, Winter 2019/20 Wann sollte die Mathematik je zu einem Anfang gelangen, wenn sie warten wollte, bis die Philosophie über unsere Grundbegrie zur Klarheit und Einmüthigkeit gekommen ist? Unsere einzige Rettung ist der formalistische Standpunkt, undenirte Begrie (wie Zahl, Punkt, Ding, Menge) an die Spitze zu stellen, um deren actuelle oder psychologische oder anschauliche Bedeutung wir uns nicht kümmern, und ebenso unbewiesene Sätze (Axiome), deren actuelle Richtigkeit uns nichts angeht. Aus diesen primitiven Begrien und Urtheilen gewinnen wir durch Denition und Deduction andere, und nur diese Ableitung ist unser Werk und Ziel. (Felix Hausdor, 12. Januar 1918) Table of contents 1 Introduction . 4 I First-order Logic and the Gödel Completeness Theorem . 4 2 The Syntax of rst-order logic: Symbols, words, and formulas . 4 2.1 Motivation: a mathematical statement . 5 2.2 Symbols . 5 2.3 Words . 6 2.4 Terms . 7 2.5 Formulas . 8 3 Semantics . 9 4 The satisfaction relation . 11 5 Logical implication and propositional connectives . 14 6 Substitution and term rules . 15 7 A sequent calculus . 20 8 Derivable sequent rules . 22 8.1 Auxiliary derived rules . 22 8.2 Introduction and elimination of ; ; ::: . 23 8.3 Formal proofs about . ._. .^. 24 9 Consistency . 25 1 2 Section 10 Term models and Henkin sets . 27 11 Constructing Henkin sets . 30 12 The completeness theorem . 34 13 The compactness theorem . 35 II Herbrand's Theorem and Automatic Theorem Proving . 38 14 Normal forms . 38 14.1 Negation normal form . 39 14.2 Conjunctive and disjunctive normal form .
    [Show full text]
  • Solving the Boolean Satisfiability Problem Using the Parallel Paradigm Jury Composition
    Philosophæ doctor thesis Hoessen Benoît Solving the Boolean Satisfiability problem using the parallel paradigm Jury composition: PhD director Audemard Gilles Professor at Universit´ed'Artois PhD co-director Jabbour Sa¨ıd Assistant Professor at Universit´ed'Artois PhD co-director Piette C´edric Assistant Professor at Universit´ed'Artois Examiner Simon Laurent Professor at University of Bordeaux Examiner Dequen Gilles Professor at University of Picardie Jules Vernes Katsirelos George Charg´ede recherche at Institut national de la recherche agronomique, Toulouse Abstract This thesis presents different technique to solve the Boolean satisfiability problem using parallel and distributed architec- tures. In order to provide a complete explanation, a careful presentation of the CDCL algorithm is made, followed by the state of the art in this domain. Once presented, two proposi- tions are made. The first one is an improvement on a portfo- lio algorithm, allowing to exchange more data without loosing efficiency. The second is a complete library with its API al- lowing to easily create distributed SAT solver. Keywords: SAT, parallelism, distributed, solver, logic R´esum´e Cette th`ese pr´esente diff´erentes techniques permettant de r´esoudre le probl`eme de satisfaction de formule bool´eenes utilisant le parall´elismeet du calcul distribu´e. Dans le but de fournir une explication la plus compl`ete possible, une pr´esentation d´etaill´ee de l'algorithme CDCL est effectu´ee, suivi d'un ´etatde l'art. De ce point de d´epart,deux pistes sont explor´ees. La premi`ereest une am´eliorationd'un algorithme de type portfolio, permettant d'´echanger plus d'informations sans perte d’efficacit´e.
    [Show full text]
  • My Slides for a Course on Satisfiability
    Satisfiability Victor W. Marek Computer Science University of Kentucky Spring Semester 2005 Satisfiability – p.1/97 Satisfiability story ie× Á Satisfiability - invented in the ¾¼ of XX century by philosophers and mathematicians (Wittgenstein, Tarski) ie× Á Shannon (late ¾¼ ) applications to what was then known as electrical engineering ie× ie× Á Fundamental developments: ¼ and ¼ – both mathematics of it, and fundamental algorithms ie× Á ¼ - progress in computing speed and solving moderately large problems Á Emergence of “killer applications” in Computer Engineering, Bounded Model Checking Satisfiability – p.2/97 Current situation Á SAT solvers as a class of software Á Solving large cases generated by industrial applications Á Vibrant area of research both in Computer Science and in Computer Engineering ¯ Various CS meetings (SAT, AAAI, CP) ¯ Various CE meetings (CAV, FMCAD, DATE) ¯ CE meetings Stressing applications Satisfiability – p.3/97 This Course Á Providing mathematical and computer science foundations of SAT ¯ General mathematical foundations ¯ Two- and Three- valued logics ¯ Complete sets of functors ¯ Normal forms (including ite) ¯ Compactness of propositional logic ¯ Resolution rule, completeness of resolution, semantical resolution ¯ Fundamental algorithms for SAT ¯ Craig Lemma Satisfiability – p.4/97 And if there is enough of time and will... Á Easy cases of SAT ¯ Horn ¯ 2SAT ¯ Linear formulas Á And if there is time (but notes will be provided anyway) ¯ Expressing runs of polynomial-time NDTM as SAT, NP completeness ¯ “Mix and match” ¯ Learning in SAT, partial closure under resolution ¯ Bounded Model Checking Satisfiability – p.5/97 Various remarks Á Expected involvement of Dr. Truszczynski Á An extensive set of notes (> 200 pages), covering most of topics will be provided f.o.c.
    [Show full text]
  • Logic and Computation – CS 2800 Fall 2019
    Logic and Computation – CS 2800 Fall 2019 Lecture 12 Propositional logic continued CNF, DNF, complete Boolean bases Stavros Tripakis Discuss homework 02 survey • How many courses are you taking? • How many hours per course would you like to be spending, ideally? — Including everything: attending lectures, reading, homeworks, projects, piazza, … • How many of those hours on homework? Tripakis Logic and Computation, Fall 2019 2 Outline • Properties of Boolean operators: read and assimilate Section 3.3 of lecture notes! • Normal forms, DNF and CNF • Complete Boolean bases Tripakis Logic and Computation, Fall 2019 3 Properties of Boolean operators • Review lecture notes, section 3.3 Tripakis Logic and Computation, Fall 2019 4 Normal forms, CNF, DNF Tripakis Logic and Computation, Fall 2019 5 Negation Normal Form (NNF) • “Push” all negations all the way to the leaves of the syntax tree of the formula (literals) • Eliminate double negations • Examples: Tripakis Logic and Computation, Fall 2019 6 Negation Normal Form (NNF) • “Push” all negations all the way to the leaves of the syntax tree of the formula (literals) • Eliminate double negations • Examples: Tripakis Logic and Computation, Fall 2019 7 Disjunctive Normal Form (DNF) • A formula is in DNF if it is a disjunction of conjunctions of literals • Literal = either a variable or a negated variable • Examples: which formulas below are in DNF? Tripakis Logic and Computation, Fall 2019 8 Conjunctive Normal Form (CNF) • A formula is in CNF if it is a conjunction of disjunctions of literals • A disjunction of literals is also called a clause • Examples: which formulas below are in CNF? Tripakis Logic and Computation, Fall 2019 9 Can we transform any Boolean formula into DNF? • Yes • Brute‐force method: 1.
    [Show full text]
  • An Expansion-Based QBF Solver for Negation Normal Form
    An Expansion-based QBF Solver For Negation Normal Form MAGISTERARBEIT zur Erlangung des akademischen Grades Diplom-Ingenieur im Magisterstudium INFORMATIK Eingereicht von: Florian Lonsing, 0255959 Angefertigt am: Institut für Formale Modelle und Verifikation Betreuung: Univ.-Prof. Dr. Armin Biere Linz, Dezember 2007 ii Abstract The topic of this master thesis is Nenofex, a solver for quantified boolean formu- lae (QBF) in negation normal form (NNF), which relies on expansion as the core technique for eliminating variables. In contrast to eliminating existentially quan- tified variables by resolution on CNF, which causes the formula size to increase quadratically in the worst case, expansion on NNF is involved with only a linear increase of the formula size. This property motivates the use of NNF instead of CNF combined with expansion. In Nenofex, a formula in NNF is represented as a tree with structural restrictions in order to keep its size small and distances from nodes to the root short. Expansions of variables are scheduled based on estimated expansion costs. The variable with the smallest estimated costs is ex- panded first. In order to remove redundancy from the formula, limited versions of two approaches from the domain of circuit optimization have been integrated. Experimental results show that Nenofex indeed exceeds a given memory limit less frequently than a resolution-based QBF solver for CNF, but also that there is still room for runtime improvements. Kurzfassung In dieser Arbeit wird Nenofex, die Implementierung eines Entscheidungsverfahrens f¨urQuantifizierte Boolesche Formeln (QBF) in Negationsnormalform (NNF), be- schrieben. In Nenofex werden Variablen sukzessive mittels Expansion aus der Formel eliminiert.
    [Show full text]
  • Normal Forms for Boolean Expressions
    Normal Forms for Boolean Expressions A NORMAL FORM defines a class expressions s.t. a. Satisfy certain structural properties b. Are usually universal: able to express every boolean function 1. Disjunctive Normal Form (DNF) - Sum Of Products of literals, i.e., a variable or its negation Example: xy'z + yz + w 2. Conjunctive Normal Form (CNF) - Product of CLAUSES, i.e., sum of literals Example: (z+w).(x+y+z'+w), (x+y'+z).(y+z).w‘ 3. Negation Normal Form (NNF): Negation appears only at leaves Example: (x+yz).y’ Counter Example: (a’.b)’+c’ Propositional Logic Decidability Complexity Theorem: Satisfiability of CNF formulas is NP-complete Theorem: Validity of DNF formulas is NP-complete Theorem: Satisfiability and Validity of arbitrary boolean formulas is NP-complete Intuition behind NP-completeness: Transformation b/w normal forms can have exponential blow-up 2SAT Satisfiability is Polynomial Time Implication Graph Notes: 1. Each clause is an implication e.g., x’+y = x y 2. Vertex for each literal in clause 3. One edge for each implication For each variable Check if there is a path from X to X’ as well as from X’ to X Path checking on graph is Poly!! Reduction of 3SAT CNF to Clique Problem on Graphs Theorem: 3SAT and above is NP-complete Note: Clique is NP-complete Are we doomed then? • No, there are efficient methods that work VERY well for large classes of formulas • We study two techniques that are the basis for widely used tools in practice • ROBDD: A compact cannonical form for arbitrary boolean functions • SAT solving: An efficient heuristic-based
    [Show full text]