CS 512, Spring 2017, Handout 10 Propositional Logic: Conjunctive Normal Forms, Disjunctive Normal Forms, Horn Formulas, and other special forms

Similar documents
A brief introduction to Logic. (slides from

Normal Forms of Propositional Logic

Comp487/587 - Boolean Formulas

Logic: Propositional Logic (Part I)

Description Logics. Foundations of Propositional Logic. franconi. Enrico Franconi

Tecniche di Verifica. Introduction to Propositional Logic

Lecture 2 Propositional Logic & SAT

Part 1: Propositional Logic

Propositional Logic: Models and Proofs

CS156: The Calculus of Computation

Propositional Resolution

Decision Procedures for Satisfiability and Validity in Propositional Logic

Propositional and Predicate Logic - V

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

LOGIC PROPOSITIONAL REASONING

Section 1.2 Propositional Equivalences. A tautology is a proposition which is always true. A contradiction is a proposition which is always false.

A New 3-CNF Transformation by Parallel-Serial Graphs 1

Propositional Logic: Evaluating the Formulas

CS206 Lecture 03. Propositional Logic Proofs. Plan for Lecture 03. Axioms. Normal Forms

Compiling Knowledge into Decomposable Negation Normal Form

ECE473 Lecture 15: Propositional Logic

Language of Propositional Logic

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

CS 512, Spring 2016, Handout 02 Natural Deduction, and Examples of Natural Deduction, in Propositional Logic

CS250: Discrete Math for Computer Science. L6: CNF and Natural Deduction for PropCalc

Propositional and Predicate Logic - II

Propositional Logic. Testing, Quality Assurance, and Maintenance Winter Prof. Arie Gurfinkel

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

Propositional logic. Programming and Modal Logic

A Collection of Problems in Propositional Logic

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Tautologies, Contradictions, and Contingencies

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

Tutorial 1: Modern SMT Solvers and Verification

Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011

Exercises 1 - Solutions

Supplementary exercises in propositional logic

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

CS156: The Calculus of Computation Zohar Manna Autumn 2008

Propositional Resolution Part 1. Short Review Professor Anita Wasilewska CSE 352 Artificial Intelligence

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

INPUT INDEPENDENCE AND COMPUTATIONAL COMPLEXITY

Propositional logic. Programming and Modal Logic

Propositional Resolution Introduction

Computation and Logic Definitions

Formal Modeling with Propositional Logic

Theory of Computer Science

Propositional Logic: Methods of Proof (Part II)

Sec$on Summary. Tautologies, Contradictions, and Contingencies. Logical Equivalence. Normal Forms (optional, covered in exercises in text)

Logic: First Order Logic

Conjunctive Normal Form and SAT

Reduced Ordered Binary Decision Diagram with Implied Literals: A New knowledge Compilation Approach

Advanced Topics in LP and FP

Mathematical Logic Propositional Logic - Tableaux*

Conjunctive Normal Form and SAT

2.5.2 Basic CNF/DNF Transformation

Deductive Systems. Lecture - 3

Equivalences. Proposition 2.8: The following equivalences are valid for all formulas φ, ψ, χ: (φ φ) φ. Idempotency Idempotency Commutativity

Non-Deterministic Time

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Solutions to Sample Problems for Midterm

Truth-Functional Logic

Duality in Knowledge Compilation Techniques

CSC Discrete Math I, Spring Propositional Logic

INPUT RELATION AND COMPUTATIONAL COMPLEXITY

Logic and Inferences

CSE507. Introduction. Computer-Aided Reasoning for Software. Emina Torlak courses.cs.washington.edu/courses/cse507/17wi/

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

NP-Completeness Part II

Critical Reading of Optimization Methods for Logical Inference [1]

Conjunctive Normal Form and SAT

Propositional Resolution

Logic for Computer Scientists

Satisfiability and SAT Solvers. CS 270 Math Foundations of CS Jeremy Johnson

Logic for Computer Scientists

Formal Verification Methods 1: Propositional Logic

Clause/Term Resolution and Learning in the Evaluation of Quantified Boolean Formulas

CHAPTER 10. Gentzen Style Proof Systems for Classical Logic

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

PL: Truth Trees. Handout Truth Trees: The Setup

Resolution Lower Bounds for the Weak Pigeonhole Principle

Foundations of Artificial Intelligence

Solutions to Homework I (1.1)

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

A Lower Bound of 2 n Conditional Jumps for Boolean Satisfiability on A Random Access Machine

Part 1: Propositional Logic

Learning Goals of CS245 Logic and Computation

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

Propositional Fragments for Knowledge Compilation and Quantified Boolean Formulae

Inference in Propositional Logic

A Resolution Method for Modal Logic S5

Reasoning with Quantified Boolean Formulas

Propositional Reasoning

On propositional definability

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

CSE 20 DISCRETE MATH WINTER

Transcription:

CS 512, Spring 2017, Handout 10 Propositional Logic: Conjunctive Normal Forms, Disjunctive Normal Forms, Horn Formulas, and other special forms Assaf Kfoury 5 February 2017 Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 1 of 28

conjunctive normal form & disjunctive normal form Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 2 of 28

conjunctive normal form & disjunctive normal form CNF L ::= p p D ::= L L D C ::= D D C literal disjuntion of literals conjunction of disjunctions Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 3 of 28

conjunctive normal form & disjunctive normal form CNF L ::= p p D ::= L L D C ::= D D C literal disjuntion of literals conjunction of disjunctions DNF L ::= p p C ::= L L C D ::= C C D literal conjunction of literals disjunction of conjunctions Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 4 of 28

Why CNF? Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 5 of 28

Why CNF? A disjunction of literals L 1 L m is valid (equivalently, is a tautology) iff there are 1 i, j m with i j such that L i is L j. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 6 of 28

Why CNF? A disjunction of literals L 1 L m is valid (equivalently, is a tautology) iff there are 1 i, j m with i j such that L i is L j. A conjunction of disjunctions D 1 D n is valid (equivalently, is a tautology) iff for every 1 i n it is the case that D i is valid. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 7 of 28

Why CNF? A disjunction of literals L 1 L m is valid (equivalently, is a tautology) iff there are 1 i, j m with i j such that L i is L j. A conjunction of disjunctions D 1 D n is valid (equivalently, is a tautology) iff for every 1 i n it is the case that D i is valid. CNF allows for a fast and easy syntactic test of validity. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 8 of 28

Why CNF? A disjunction of literals L 1 L m is valid (equivalently, is a tautology) iff there are 1 i, j m with i j such that L i is L j. A conjunction of disjunctions D 1 D n is valid (equivalently, is a tautology) iff for every 1 i n it is the case that D i is valid. CNF allows for a fast and easy syntactic test of validity. Unfortunately, conversion into CNF may lead to exponential blow-up: (x 1 y 1) (x 2 y 2) (x n y n) becomes (x 1 x n 1 x n) (x 1 x n 1 y n) (y 1 y n 1 y n) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size O(2 n ), because each clause in the latter contains either x i or y i for every i. Converting a WFF into an equivalent WFF in CNF, preserving validity, is NP-hard! (However, converting a WFF into another WFF, not necessarily equivalent, preserving satisfiability can be carried out in linear time more in a later handout.) Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 9 of 28

Why DNF? Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 10 of 28

Why DNF? A conjunction of literals L 1 L m is satisfiable iff {L 1,..., L m } does not include both a propositional atom P and its negation P. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 11 of 28

Why DNF? A conjunction of literals L 1 L m is satisfiable iff {L 1,..., L m } does not include both a propositional atom P and its negation P. A disjunction of conjunctions C 1 C n is satisfiable iff there is some 1 i n such that C i is satisfiable. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 12 of 28

Why DNF? A conjunction of literals L 1 L m is satisfiable iff {L 1,..., L m } does not include both a propositional atom P and its negation P. A disjunction of conjunctions C 1 C n is satisfiable iff there is some 1 i n such that C i is satisfiable. DNF allows for a fast and easy syntactic test of satisfiability. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 13 of 28

Why DNF? A conjunction of literals L 1 L m is satisfiable iff {L 1,..., L m } does not include both a propositional atom P and its negation P. A disjunction of conjunctions C 1 C n is satisfiable iff there is some 1 i n such that C i is satisfiable. DNF allows for a fast and easy syntactic test of satisfiability. Unfortunately, conversion into DNF may lead to exponential blow-up: (x 1 y 1) (x 2 y 2) (x n y n) becomes (x 1 x n 1 x n) (x 1 x n 1 y n) (y 1 y n 1 y n) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size O(2 n ), because each clause in the latter contains either x i or y i for every i. Converting a WFF into an equivalent WFF in DNF, preserving satisfiability, is NP-hard! Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 14 of 28

further comments on CNF and DNF, summing up: propositional WFF s can be partitioned into three disjoint subsets: 1. tautologies, or unfalsifiable WFF s 2. contradictions, or unsatisfiable WFF s 3. WFF s that are both satisfiable and falsifiable satisfiability of: CNF is in NP DNF is in P tautology of: CNF is in P DNF is in co-np falsifiability of: CNF is in P DNF is in NP Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 15 of 28

other special forms of propositional WFF s: One such form is that of the WFF s in negation normal form (NNF): the negation operator ( ) is only applied to variables, and the only logical operators are conjunction ( ) and disjunction ( ). Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 16 of 28

other special forms of propositional WFF s: One such form is that of the WFF s in negation normal form (NNF): the negation operator ( ) is only applied to variables, and the only logical operators are conjunction ( ) and disjunction ( ). More formally: L ::= p p ϕ ::= L ϕ ψ ϕ ψ Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 17 of 28

other special forms of propositional WFF s: One such form is that of the WFF s in negation normal form (NNF): the negation operator ( ) is only applied to variables, and the only logical operators are conjunction ( ) and disjunction ( ). More formally: L ::= p p ϕ ::= L ϕ ψ ϕ ψ Fact: Every WFF in CNF or in DNF is also in NNF, but the converse is not true in general. See next slide for an example. Fact: NNF is not a canonical form, in contrast to CNF and DNF. Example: x (y z) and (x y) (x z) are equivalent and both in NNF. Fact: Every propositional WFF ϕ can be translated in linear time into an equivalent propositional WFF ψ in NNF such that ψ < (3/2) ϕ. Proof. Left to you. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 18 of 28

example of a WFF in NNF, which is neither in CNF nor in DNF ( (( p q) ( q p) ) ( (r s) ( s r) ) ) ( (( p q) (q p) ) ( (r s) (s r) ) ) Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 19 of 28

example of a WFF in NNF, which is neither in CNF nor in DNF ( (( p q) ( q p) ) ( (r s) ( s r) ) ) ( (( p q) (q p) ) ( (r s) (s r) ) ) and its parse tree after merging identical leaf nodes, turning it into a more compact dag: p q q p r s s r Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 20 of 28

another special form of propositional WFFs: Decomposable Negation Normal Form (DNNF) Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 21 of 28

another special form of propositional WFFs: Decomposable Negation Normal Form (DNNF) A propositional WFF ϕ is a decomposable negation normal form (DNNF) if it is a NNF satisfying the decomposability property: for every conjunction ψ = ψ 1 ψ n which is a sub-wff of ϕ, no propositional variable/atom is shared by any two distinct conjuncts of ψ: Var(ψ i) Var(ψ j) = for every i j Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 22 of 28

another special form of propositional WFFs: Decomposable Negation Normal Form (DNNF) A propositional WFF ϕ is a decomposable negation normal form (DNNF) if it is a NNF satisfying the decomposability property: for every conjunction ψ = ψ 1 ψ n which is a sub-wff of ϕ, no propositional variable/atom is shared by any two distinct conjuncts of ψ: Var(ψ i) Var(ψ j) = for every i j Example: The NNF shown on page 19 is in fact a DNNF. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 23 of 28

another special form of propositional WFFs: Decomposable Negation Normal Form (DNNF) A propositional WFF ϕ is a decomposable negation normal form (DNNF) if it is a NNF satisfying the decomposability property: for every conjunction ψ = ψ 1 ψ n which is a sub-wff of ϕ, no propositional variable/atom is shared by any two distinct conjuncts of ψ: Var(ψ i) Var(ψ j) = for every i j Example: The NNF shown on page 19 is in fact a DNNF. Fact: Satisfiability of WFF in DNNF is decidable in linear time. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 24 of 28

an important restricted class: Horn formulas Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 25 of 28

an important restricted class: Horn formulas P ::= p A ::= P P A C ::= A P Horn clause H ::= C C H Horn formula Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 26 of 28

an important restricted class: Horn formulas P ::= p A ::= P P A C ::= A P Horn clause H ::= C C H Horn formula Fact: Satisfiability of Horn clauses is decidable in linear time. Proof: To see this, rewrite a Horn clause into an equivalent disjunction of literals: L 1 L n L L 1 L n L. Fact: Satisfiability of Horn formulas is decidable in linear time. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 27 of 28

Exercise Search the Web to identify one or two applications, or areas of computer science, where each of the following forms are encountered: 1. Propositional WFF s in NNF. 2. Propositional WFF s in DNNF. 3. Propositional WFF s that are Horn formulas. Assaf Kfoury, CS 512, Spring 2017, Handout 10 page 28 of 28