formulas in conjunctive normal propositional ...fmv.jku.at/logic/lecture1.pdfpropositional logic:...

67
FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere, Martina Seidl Institute for Formal Models and Verification Johannes Kepler University Linz

Upload: others

Post on 05-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

PROPOSITIONAL LOGIC:FORMULAS IN CONJUNCTIVE NORMALFORM (CNF)

VL Logic, Lecture 1, WS 20/21

Armin Biere, Martina Seidl

Institute for Formal Models and VerificationJohannes Kepler University Linz

Page 2: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

A VERY, VERY SHORT PRIMER ON(PROPOSITIONAL) LOGIC

VL LogicPart I: Propositional Logic

Page 3: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Example: Party Planning

We want to plan a party.

Unfortunately, the selection of the guests is not straight forward.

We have to consider the following rules.

1. If two people are married, we have to invite them both or none of them. Alice is married toBob and Cecile is married to David.

2. If we invite Alice then we also have to invite Cecile.Cecile does not care if we invite Alice but not her.

3. David and Eva can’t stand each other, so it is not possible to invite both.

4. We want to invite Bob and Fred.

Question: Can we find a guest list?

1/8

Page 4: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Party Planning with Propositional Logic

� propositional variables:inviteAlice, inviteBob, inviteCecile, inviteDavid, inviteEva, inviteFred

� constraints:1. invite married: inviteAlice↔ inviteBob, inviteCecile↔ inviteDavid2. if Alice then Cecile: inviteAlice→ inviteCecile3. either David or Eva: ¬ (inviteEva↔ inviteDavid)4. invite Bob and Fred: inviteBob ∧ inviteFred

� encoding in propositional logic:

(inviteAlice↔ inviteBob) ∧ (inviteCecile↔ inviteDavid) ∧(inviteAlice→ inviteCecile) ∧ ¬ (inviteEva↔ inviteDavid) ∧inviteBob ∧ inviteFred

2/8

Page 5: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Defining a Language: Syntax

What do expressions (words, sentences) of a language look like?

� set of words: basic building blocks� grammar: rules for composing sentences from words and smaller sentences� sometimes multiple (equivalent) representations

� different goals (user-friendliness vs processability)

example:

� syntactically incorrect formula: ∧(a ∨ ∧b) ∧ (¬a ∨ ¬b)

� syntactically correct propositional formula (over variables a and b):(a ∨ b) ∧ (¬a ∨ ¬b)

� different representation:1 2 0

-1 -2 0

3/8

Page 6: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Defining a Language: Syntax

What do expressions (words, sentences) of a language look like?

� set of words: basic building blocks� grammar: rules for composing sentences from words and smaller sentences� sometimes multiple (equivalent) representations

� different goals (user-friendliness vs processability)

example:

� syntactically incorrect formula: ∧(a ∨ ∧b) ∧ (¬a ∨ ¬b)

� syntactically correct propositional formula (over variables a and b):(a ∨ b) ∧ (¬a ∨ ¬b)

� different representation:1 2 0

-1 -2 0

3/8

Page 7: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Defining a Language: Semantics

What do expressions mean?

� evaluation of syntactically correct expressions

� logic-based languages have a concise semantics� no ambiguities� no vagueness

Let propositional variable a be true and propositional variable b be false.Then the truth value of the propositional formula

(a ∨ b) ∧ (¬a ∨ ¬b)

is true.

4/8

Page 8: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Defining a Language: Semantics

What do expressions mean?

� evaluation of syntactically correct expressions

� logic-based languages have a concise semantics� no ambiguities� no vagueness

Let propositional variable a be true and propositional variable b be false.Then the truth value of the propositional formula

(a ∨ b) ∧ (¬a ∨ ¬b)

is true.

4/8

Page 9: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Using a Language: Pragmatics

What does an expression stand for?

� many application problems can be formulated as logical reasoning problems

� interpretation of expression dependends on context and user1. encoding of an application problem to be solved2. evaluation of expression gives solution for application problem

In the formula(a ∨ b) ∧ (¬a ∨ ¬b)

a could stand “invite David” and b could stand for “invite Eva”. The formula is true if onlyone of the two persons is invited.

5/8

Page 10: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Using a Language: Pragmatics

What does an expression stand for?

� many application problems can be formulated as logical reasoning problems

� interpretation of expression dependends on context and user1. encoding of an application problem to be solved2. evaluation of expression gives solution for application problem

In the formula(a ∨ b) ∧ (¬a ∨ ¬b)

a could stand “invite David” and b could stand for “invite Eva”. The formula is true if onlyone of the two persons is invited.

5/8

Page 11: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Automated Reasoning and Inferences

� Logical languages allow the inference of new knowledge (“reasoning”).

� For reasoning, a logic provides various sets of rules (calculi).

� Reasoning is often based on certain syntactical patterns.

example: (modus ponens)

x holds.If x holds, then also y holds.y holds.

6/8

Page 12: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Some Remarks on Inferences

A system is inconsistent if we can infer that a statement holds and that a statement does nothold at the same time.

Assume we have modelled the following system

� A comes to the party.

� B comes to the party.

� If A comes to the party, then B does not come to the party.

With the modus ponens, we can infer that B does not come to the party.So, we have some inconsistency in our party model.

7/8

Page 13: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Logics in this Lecture

In this lecture, we consider different logic-based languages:

� part 1: propositional logic (SAT)� simple language: only atoms and connectives� low expressiveness, low complexity

� part 2: first-order logic (predicate logic)� rich language: predicates, functions, terms, quantifiers� great power of expressiveness, high complexity

� part 3: satisfiability modulo theories (SMT)� customizable language: user decides� as much expressiveness as required

as much complexity as necessary

8/8

Page 14: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Logics in this Lecture

In this lecture, we consider different logic-based languages:

� part 1: propositional logic (SAT)� simple language: only atoms and connectives� low expressiveness, low complexity

� part 2: first-order logic (predicate logic)� rich language: predicates, functions, terms, quantifiers� great power of expressiveness, high complexity

� part 3: satisfiability modulo theories (SMT)� customizable language: user decides� as much expressiveness as required

as much complexity as necessary

8/8

Page 15: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Logics in this Lecture

In this lecture, we consider different logic-based languages:

� part 1: propositional logic (SAT)� simple language: only atoms and connectives� low expressiveness, low complexity

� part 2: first-order logic (predicate logic)� rich language: predicates, functions, terms, quantifiers� great power of expressiveness, high complexity

� part 3: satisfiability modulo theories (SMT)� customizable language: user decides� as much expressiveness as required

as much complexity as necessary

8/8

Page 16: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Logics in this Lecture

In this lecture, we consider different logic-based languages:

� part 1: propositional logic (SAT)� simple language: only atoms and connectives� low expressiveness, low complexity

� part 2: first-order logic (predicate logic)� rich language: predicates, functions, terms, quantifiers� great power of expressiveness, high complexity

� part 3: satisfiability modulo theories (SMT)� customizable language: user decides� as much expressiveness as required

as much complexity as necessary

8/8

Page 17: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

SYNTAX OFPROPOSITIONAL FORMULAS IN CNF

VL LogicPart I: Propositional Logic

Page 18: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Constants, Variables, Literals

� truth constant:� true (also verum, top): >� false (also falsum, bottom): ⊥

� propositional variable (also atom, atomic proposition):� proposition without any further internal structure� we denote variables by symbols x, y, z, a, b, c, p, q

(possibly with subscript)

� literal:� (negated) truth constant: >,⊥,¬>,¬⊥� (negated) propositional variable x,¬x, y,¬y, . . .� we denote literals by symbols l, k (possibly with subscript)

1/5

Page 19: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Constants, Variables, Literals

� truth constant:� true (also verum, top): >� false (also falsum, bottom): ⊥

� propositional variable (also atom, atomic proposition):� proposition without any further internal structure� we denote variables by symbols x, y, z, a, b, c, p, q

(possibly with subscript)

� literal:� (negated) truth constant: >,⊥,¬>,¬⊥� (negated) propositional variable x,¬x, y,¬y, . . .� we denote literals by symbols l, k (possibly with subscript)

1/5

Page 20: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Constants, Variables, Literals

� truth constant:� true (also verum, top): >� false (also falsum, bottom): ⊥

� propositional variable (also atom, atomic proposition):� proposition without any further internal structure� we denote variables by symbols x, y, z, a, b, c, p, q

(possibly with subscript)

� literal:� (negated) truth constant: >,⊥,¬>,¬⊥� (negated) propositional variable x,¬x, y,¬y, . . .� we denote literals by symbols l, k (possibly with subscript)

1/5

Page 21: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Clauses

A clause is a disjunction (∨) of literals.

� examples: x ∨ y x ∨ y ∨ ¬z ¬⊥ ∨ x ∨ a ∨ > ∨ ¬x

� size of a clause: number of its literals

� special clauses

empty clause (size 0): also written as ⊥ or ∅unary clause (size 1): ¬⊥ x ¬zbinary clauses (size 2): x ∨ yternary clauses (size 3): x ∨ y ∨ ¬z

� for (l1 ∨ . . . ∨ ln) we also write∨n

i=1 li

� we denote clauses by symbols C,D (possibly with subscript)

2/5

Page 22: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Clauses

A clause is a disjunction (∨) of literals.

� examples: x ∨ y x ∨ y ∨ ¬z ¬⊥ ∨ x ∨ a ∨ > ∨ ¬x

� size of a clause: number of its literals

� special clauses

empty clause (size 0): also written as ⊥ or ∅unary clause (size 1): ¬⊥ x ¬zbinary clauses (size 2): x ∨ yternary clauses (size 3): x ∨ y ∨ ¬z

� for (l1 ∨ . . . ∨ ln) we also write∨n

i=1 li

� we denote clauses by symbols C,D (possibly with subscript)

2/5

Page 23: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Clauses

A clause is a disjunction (∨) of literals.

� examples: x ∨ y x ∨ y ∨ ¬z ¬⊥ ∨ x ∨ a ∨ > ∨ ¬x

� size of a clause: number of its literals

� special clauses

empty clause (size 0): also written as ⊥ or ∅unary clause (size 1): ¬⊥ x ¬zbinary clauses (size 2): x ∨ yternary clauses (size 3): x ∨ y ∨ ¬z

� for (l1 ∨ . . . ∨ ln) we also write∨n

i=1 li

� we denote clauses by symbols C,D (possibly with subscript)

2/5

Page 24: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Clauses

A clause is a disjunction (∨) of literals.

� examples: x ∨ y x ∨ y ∨ ¬z ¬⊥ ∨ x ∨ a ∨ > ∨ ¬x

� size of a clause: number of its literals

� special clauses

empty clause (size 0): also written as ⊥ or ∅unary clause (size 1): ¬⊥ x ¬zbinary clauses (size 2): x ∨ yternary clauses (size 3): x ∨ y ∨ ¬z

� for (l1 ∨ . . . ∨ ln) we also write∨n

i=1 li

� we denote clauses by symbols C,D (possibly with subscript)

2/5

Page 25: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Clauses

A clause is a disjunction (∨) of literals.

� examples: x ∨ y x ∨ y ∨ ¬z ¬⊥ ∨ x ∨ a ∨ > ∨ ¬x

� size of a clause: number of its literals

� special clauses

empty clause (size 0): also written as ⊥ or ∅unary clause (size 1): ¬⊥ x ¬zbinary clauses (size 2): x ∨ yternary clauses (size 3): x ∨ y ∨ ¬z

� for (l1 ∨ . . . ∨ ln) we also write∨n

i=1 li

� we denote clauses by symbols C,D (possibly with subscript)

2/5

Page 26: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Clauses

A clause is a disjunction (∨) of literals.

� examples: x ∨ y x ∨ y ∨ ¬z ¬⊥ ∨ x ∨ a ∨ > ∨ ¬x

� size of a clause: number of its literals

� special clauses

empty clause (size 0): also written as ⊥ or ∅unary clause (size 1): ¬⊥ x ¬zbinary clauses (size 2): x ∨ yternary clauses (size 3): x ∨ y ∨ ¬z

� for (l1 ∨ . . . ∨ ln) we also write∨n

i=1 li

� we denote clauses by symbols C,D (possibly with subscript)

2/5

Page 27: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Propositional Formulas in CNF

A propositional formula in conjunctive normal form is a conjunction (∧) of clauses.

� examples:

� (x ∨ >) ∧ (y ∨ ¬z) ∧ (¬y ∨ ¬x)� (¬x ∨ y ∨ ¬z) ∧ z� (x ∨ ¬y) ∧ (x ∨ ¬y ∨ z) ∧ (y ∨ ¬z)� ((l11 ∨ . . . ∨ l1m1 ) ∧ . . . ∧ (ln1 ∨ . . . ∨ lnmn ))

� for (C1 ∧ . . . ∧Cn) we also write∧n

i=1 Ci.

� we denote formulas by symbols φ, ψ (possibly with subscript)

3/5

Page 28: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Propositional Formulas in CNF

A propositional formula in conjunctive normal form is a conjunction (∧) of clauses.

� examples:

� (x ∨ >) ∧ (y ∨ ¬z) ∧ (¬y ∨ ¬x)� (¬x ∨ y ∨ ¬z) ∧ z� (x ∨ ¬y) ∧ (x ∨ ¬y ∨ z) ∧ (y ∨ ¬z)� ((l11 ∨ . . . ∨ l1m1 ) ∧ . . . ∧ (ln1 ∨ . . . ∨ lnmn ))

� for (C1 ∧ . . . ∧Cn) we also write∧n

i=1 Ci.

� we denote formulas by symbols φ, ψ (possibly with subscript)

3/5

Page 29: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Propositional Formulas in CNF

A propositional formula in conjunctive normal form is a conjunction (∧) of clauses.

� examples:

� (x ∨ >) ∧ (y ∨ ¬z) ∧ (¬y ∨ ¬x)� (¬x ∨ y ∨ ¬z) ∧ z� (x ∨ ¬y) ∧ (x ∨ ¬y ∨ z) ∧ (y ∨ ¬z)� ((l11 ∨ . . . ∨ l1m1 ) ∧ . . . ∧ (ln1 ∨ . . . ∨ lnmn ))

� for (C1 ∧ . . . ∧Cn) we also write∧n

i=1 Ci.

� we denote formulas by symbols φ, ψ (possibly with subscript)

3/5

Page 30: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Propositional Formulas in CNF

A propositional formula in conjunctive normal form is a conjunction (∧) of clauses.

� examples:

� (x ∨ >) ∧ (y ∨ ¬z) ∧ (¬y ∨ ¬x)� (¬x ∨ y ∨ ¬z) ∧ z� (x ∨ ¬y) ∧ (x ∨ ¬y ∨ z) ∧ (y ∨ ¬z)� ((l11 ∨ . . . ∨ l1m1 ) ∧ . . . ∧ (ln1 ∨ . . . ∨ lnmn ))

� for (C1 ∧ . . . ∧Cn) we also write∧n

i=1 Ci.

� we denote formulas by symbols φ, ψ (possibly with subscript)

3/5

Page 31: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Alternative Notations

in the literature, different symbols might be used for building propositional formulas

in this lecture alternative notationstruth constant “true” > 1 t truetruth constant “false” ⊥ 0 f falsenegation ¬x !x x −x NOTxdisjunction k ∨ l l || k l + k l OR kconjunction C ∧ D C && D C ∗ D C AND D

4/5

Page 32: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Summary

We introduced a sublanguage of the language of propositional logic:propositional formulas in conjunctive normal form (CNF)

� formula in CNF: conjunction of clauses

� clause: disjunction of literals

� literal: (negated) variable / (negated) truth constant

Any propositional formula can be translated into CNF.

5/5

Page 33: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

SEMANTICS OFPROPOSITIONAL FORMULAS IN CNF

VL LogicPart I: Propositional Logic

Page 34: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Constants and Variables

� a variable can be assigned one of two values from the two-valued domain B, whereB = {1, 0}

� the mapping ν : P → B is called assignment, where P is the set of variables of a formula

� we sometimes write an assignment ν as set V with V ⊆ P ∪ {¬x | x ∈ P} such that� x ∈ V iff ν(x) = 1� ¬x ∈ V iff ν(x) = 0

� for n variables, there are 2n assignments possible

� > is always true and ⊥ is always false

1/11

Page 35: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Constants and Variables

� a variable can be assigned one of two values from the two-valued domain B, whereB = {1, 0}

� the mapping ν : P → B is called assignment, where P is the set of variables of a formula

� we sometimes write an assignment ν as set V with V ⊆ P ∪ {¬x | x ∈ P} such that� x ∈ V iff ν(x) = 1� ¬x ∈ V iff ν(x) = 0

� for n variables, there are 2n assignments possible

� > is always true and ⊥ is always false

1/11

Page 36: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Constants and Variables

� a variable can be assigned one of two values from the two-valued domain B, whereB = {1, 0}

� the mapping ν : P → B is called assignment, where P is the set of variables of a formula

� we sometimes write an assignment ν as set V with V ⊆ P ∪ {¬x | x ∈ P} such that� x ∈ V iff ν(x) = 1� ¬x ∈ V iff ν(x) = 0

� for n variables, there are 2n assignments possible

� > is always true and ⊥ is always false

1/11

Page 37: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Constants and Variables

� a variable can be assigned one of two values from the two-valued domain B, whereB = {1, 0}

� the mapping ν : P → B is called assignment, where P is the set of variables of a formula

� we sometimes write an assignment ν as set V with V ⊆ P ∪ {¬x | x ∈ P} such that� x ∈ V iff ν(x) = 1� ¬x ∈ V iff ν(x) = 0

� for n variables, there are 2n assignments possible

� > is always true and ⊥ is always false

1/11

Page 38: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Constants and Variables

� a variable can be assigned one of two values from the two-valued domain B, whereB = {1, 0}

� the mapping ν : P → B is called assignment, where P is the set of variables of a formula

� we sometimes write an assignment ν as set V with V ⊆ P ∪ {¬x | x ∈ P} such that� x ∈ V iff ν(x) = 1� ¬x ∈ V iff ν(x) = 0

� for n variables, there are 2n assignments possible

� > is always true and ⊥ is always false

1/11

Page 39: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Negation Operator

� unary connective ¬ (operator with exactly one operand)

� semantics: flipping the truth value of its operand (under a given assignment)

truth table:x ¬x0 11 0

examples:� ¬⊥ is true.

� ¬> is false.

� Given assignment ν and variable a with ν(a) = 1 then ¬a is false under ν.

� Given assignment ν and variable a with ν(a) = 0 then ¬a is true under ν.

2/11

Page 40: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Binary Disjunction Operator

� binary operator ∨ (operator with exactly two operands)

� semantics: true iff at least one operand is true

truth table:

l k l ∨ k0 0 00 1 11 0 11 1 1

examples:� (a ∨ ¬a) is always true.

� (> ∨ a) is always true.

� The truth value of (⊥ ∨ a) depends on the truth value of a.

3/11

Page 41: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Properties of Disjunction

� commutative: k ∨ l is true iff l ∨ k is true, i.e.,

k ∨ l and l ∨ k are equivalent : k ∨ l⇔ l ∨ k

� idempotent: l ∨ l is true iff l is true, i.e.,

l ∨ l and l are equivalent : l ∨ l⇔ l

� associative: l1 ∨ (l2 ∨ l3) is true iff (l1 ∨ l2) ∨ l3 is true, i.e.,

l1 ∨ (l2 ∨ l3) and (l1 ∨ l2) ∨ l3 are equivalent : l1 ∨ (l2 ∨ l3)⇔ (l1 ∨ l2) ∨ l3

clauses are also written as sets

� (l1 ∨ l2 ∨ . . . ∨ ln−1 ∨ ln) = {l1, l2, . . . , ln−1, ln}

� to add a literal l to clause C, we write C ∪ {l}

� to remove a literal l from clause C, we write C\{l}

4/11

Page 42: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Properties of Disjunction

� commutative: k ∨ l is true iff l ∨ k is true, i.e.,

k ∨ l and l ∨ k are equivalent : k ∨ l⇔ l ∨ k

� idempotent: l ∨ l is true iff l is true, i.e.,

l ∨ l and l are equivalent : l ∨ l⇔ l

� associative: l1 ∨ (l2 ∨ l3) is true iff (l1 ∨ l2) ∨ l3 is true, i.e.,

l1 ∨ (l2 ∨ l3) and (l1 ∨ l2) ∨ l3 are equivalent : l1 ∨ (l2 ∨ l3)⇔ (l1 ∨ l2) ∨ l3

clauses are also written as sets

� (l1 ∨ l2 ∨ . . . ∨ ln−1 ∨ ln) = {l1, l2, . . . , ln−1, ln}

� to add a literal l to clause C, we write C ∪ {l}

� to remove a literal l from clause C, we write C\{l}

4/11

Page 43: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Properties of Disjunction

� commutative: k ∨ l is true iff l ∨ k is true, i.e.,

k ∨ l and l ∨ k are equivalent : k ∨ l⇔ l ∨ k

� idempotent: l ∨ l is true iff l is true, i.e.,

l ∨ l and l are equivalent : l ∨ l⇔ l

� associative: l1 ∨ (l2 ∨ l3) is true iff (l1 ∨ l2) ∨ l3 is true, i.e.,

l1 ∨ (l2 ∨ l3) and (l1 ∨ l2) ∨ l3 are equivalent : l1 ∨ (l2 ∨ l3)⇔ (l1 ∨ l2) ∨ l3

clauses are also written as sets

� (l1 ∨ l2 ∨ . . . ∨ ln−1 ∨ ln) = {l1, l2, . . . , ln−1, ln}

� to add a literal l to clause C, we write C ∪ {l}

� to remove a literal l from clause C, we write C\{l}

4/11

Page 44: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Properties of Disjunction

� commutative: k ∨ l is true iff l ∨ k is true, i.e.,

k ∨ l and l ∨ k are equivalent : k ∨ l⇔ l ∨ k

� idempotent: l ∨ l is true iff l is true, i.e.,

l ∨ l and l are equivalent : l ∨ l⇔ l

� associative: l1 ∨ (l2 ∨ l3) is true iff (l1 ∨ l2) ∨ l3 is true, i.e.,

l1 ∨ (l2 ∨ l3) and (l1 ∨ l2) ∨ l3 are equivalent : l1 ∨ (l2 ∨ l3)⇔ (l1 ∨ l2) ∨ l3

clauses are also written as sets

� (l1 ∨ l2 ∨ . . . ∨ ln−1 ∨ ln) = {l1, l2, . . . , ln−1, ln}

� to add a literal l to clause C, we write C ∪ {l}

� to remove a literal l from clause C, we write C\{l}

4/11

Page 45: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Clause

� a clause is true iff at least one of the literals is true

truth table:

l1 . . . ln l1 ∨ l2 ∨ . . . ∨ ln0 . . . 0 00 . . . 1 1

. . . 11 . . . 0 11 . . . 1 1

� the empty clause is always false

5/11

Page 46: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Clause

� a clause is true iff at least one of the literals is true

truth table:

l1 . . . ln l1 ∨ l2 ∨ . . . ∨ ln0 . . . 0 00 . . . 1 1

. . . 11 . . . 0 11 . . . 1 1

� the empty clause is always false

5/11

Page 47: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Binary Conjunction Operator

� binary operator ∧ (operator with exactly two operands)

� semantics: a conjunction is true iff both operands are true

truth table:

C D C ∧ D0 0 00 1 01 0 01 1 1

examples:� (a ∧ ¬a) is always false.

� (> ∧ a) is true if a is true. (⊥ ∧ φ) is always false.

� If (a ∨ b) is true and (¬c ∨ d) is true then (a ∨ b) ∧ (¬c ∨ d) is true.

6/11

Page 48: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Properties of Conjunction

� commutative:C ∧ D⇔ D ∧C

� idempotent:C ∧C ⇔ C

� associative:C1 ∧ (C2 ∧C3)⇔ (C1 ∧C2) ∧C3

formulas in CNF are also written as sets of sets

� ((l11 ∨ . . . ∨ l1m1 ) ∧ . . . ∧ (ln1 ∨ . . . ∨ lnmn )) = {{l11, . . . l1m1 }, . . . , {ln1, . . . lnmn }}

� to add a clause C to CNF φ, we write φ ∪ {C}

� to remove a clause C from CNF φ, we write φ\{C}

7/11

Page 49: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Properties of Conjunction

� commutative:C ∧ D⇔ D ∧C

� idempotent:C ∧C ⇔ C

� associative:C1 ∧ (C2 ∧C3)⇔ (C1 ∧C2) ∧C3

formulas in CNF are also written as sets of sets

� ((l11 ∨ . . . ∨ l1m1 ) ∧ . . . ∧ (ln1 ∨ . . . ∨ lnmn )) = {{l11, . . . l1m1 }, . . . , {ln1, . . . lnmn }}

� to add a clause C to CNF φ, we write φ ∪ {C}

� to remove a clause C from CNF φ, we write φ\{C}

7/11

Page 50: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

CNF Formulas

� a formula in CNF is true iff all of its clauses are true

truth table:

C1 . . . Cn C1 ∧C2 ∧ . . . ∧Cn

0 . . . 0 00 . . . 1 0

. . . 01 . . . 0 01 . . . 1 1

� the empty CNF formula is always true

8/11

Page 51: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

CNF Formulas

� a formula in CNF is true iff all of its clauses are true

truth table:

C1 . . . Cn C1 ∧C2 ∧ . . . ∧Cn

0 . . . 0 00 . . . 1 0

. . . 01 . . . 0 01 . . . 1 1

� the empty CNF formula is always true

8/11

Page 52: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Table: Example

the truth table of CNF formula (x ∨ y) ∧ ¬z:

x y z x ∨ y ¬z (x ∨ y) ∧ ¬z0 0 0 0 1 00 0 1 0 0 00 1 0 1 1 10 1 1 1 0 0

1 0 0 1 1 11 0 1 1 0 01 1 0 1 1 11 1 1 1 0 0

� one assignment: ν(x) = 1, ν(y) = 0, ν(z) = 0� alternative notation: V = {x,¬y,¬z}

9/11

Page 53: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Truth Table: Example

the truth table of CNF formula (x ∨ y) ∧ ¬z:

x y z x ∨ y ¬z (x ∨ y) ∧ ¬z0 0 0 0 1 00 0 1 0 0 00 1 0 1 1 10 1 1 1 0 0

→ 1 0 0 1 1 11 0 1 1 0 01 1 0 1 1 11 1 1 1 0 0

� one assignment: ν(x) = 1, ν(y) = 0, ν(z) = 0� alternative notation: V = {x,¬y,¬z}

9/11

Page 54: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Rules of Precedence

� ¬ binds stronger than ∧

� ∧ binds stronger than ∨

example:

� ¬a ∨ b ∧ ¬c ∨ d� is the same as (¬a) ∨ (b ∧ (¬c)) ∨ d,� but not as ((¬a) ∨ b) ∧ ((¬c) ∨ d)

⇒ put clauses into parentheses!

10/11

Page 55: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Rules of Precedence

� ¬ binds stronger than ∧

� ∧ binds stronger than ∨

example:

� ¬a ∨ b ∧ ¬c ∨ d� is the same as (¬a) ∨ (b ∧ (¬c)) ∨ d,� but not as ((¬a) ∨ b) ∧ ((¬c) ∨ d)

⇒ put clauses into parentheses!

10/11

Page 56: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Rules of Precedence

� ¬ binds stronger than ∧

� ∧ binds stronger than ∨

example:

� ¬a ∨ b ∧ ¬c ∨ d� is the same as (¬a) ∨ (b ∧ (¬c)) ∨ d,� but not as ((¬a) ∨ b) ∧ ((¬c) ∨ d)

⇒ put clauses into parentheses!

10/11

Page 57: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Semantics of Propositional Logic

Let P be a set of atoms and L be the set of all CNFs over P.

Given assignment ν : P → B, we define the interpretation function [.]ν : L → B by:

� [>]ν = 1, [⊥]ν = 0

� [x]ν = ν(x) (where x ∈ P, i.e., x is a variable)

� [¬p]ν = 1 iff [p]ν = 0 (where p ∈ P ∪ {>,⊥})

� [C]ν = 1 (where C is a clause) iffthere is at least one literal l with l ∈ C and [l]ν = 1

� [φ]ν = 1 (where φ is in CNF) ifffor all clauses C ∈ φ it holds that [C]ν = 1

11/11

Page 58: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

SAT: THE SATISFIABLITY PROBLEM

VL LogicPart I: Propositional Logic

Page 59: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Satisfying/Falsifying Assignments

� an assignment ν is called� satisfying a formula φ iff [φ]ν = 1� falsifying a formula φ iff [φ]ν = 0

� a satisfying assignment for φ is a model of φ

� a falsifying assignment for φ is a counter-model of φ

example:

For formula ((x ∨ y) ∧ ¬z),

� {x, y, z} is a counter-model,

� {x, y,¬z} is a model.

1/5

Page 60: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Properties of Propositional Formulas (1/2)

� formula φ is satisfiable iffthere exists an assignment ν with [φ]ν = 1

� formula φ is valid ifffor all assignments ν it holds that [φ]ν = 1

� formula φ is refutable iffthere exists an assignment ν with [φ]ν = 0

� formula φ is unsatisfiable ifffor all assignments ν it holds that [φ]ν = 0

2/5

Page 61: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Properties of Propositional Formulas (2/2)

� a valid formula is called tautology

� an unsatisfiable formula is called contradiction

example:

� > is valid.

� a ∨ ¬a is a tautology.

� (a ∨ ¬b) ∧ (¬a ∨ b) is refutable.

� ⊥ is unsatisfiable.

� a ∧ ¬a is a contradiction.

� (a ∨ ¬b) ∧ (¬a ∨ b) is satisfiable.

3/5

Page 62: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

SAT: The Boolean Satisfiability Problem

Given a propositional formula φ.Is there an assignment that satisfies φ?

formulation for formulas in CNF: can we find an assignment such that each clause containsat least one true literal?

4/5

Page 63: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

SAT: The Boolean Satisfiability Problem

Given a propositional formula φ.Is there an assignment that satisfies φ?

formulation for formulas in CNF: can we find an assignment such that each clause containsat least one true literal?

4/5

Page 64: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Satisfiability Checking

� oldest NP-complete problem� checking a solution (does the assignment satisfies the formula?) is easy (polynomial effort)� finding a solution is difficult (probably exponential in the worst case)

� many practical applications (used in industry)

� efficient SAT solvers (solving tools) are available

5/5

Page 65: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

THE SAT SOLVER LIMBOOLE

VL LogicPart I: Propositional Logic

Page 66: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

SAT-Solver Limboole

� available at http://fmv.jku.at/limboole

� input:1

� variables are strings over letters, digits and – _ . [ ] $ @� negation symbol ¬ is !� disjunction symbol ∨ is |� conjunction symbol ∧ is &

example

(a ∨ b ∨ ¬c) ∧ (¬a ∨ b) ∧ c is represented as(a | b | !c) & (!a | b) & c

1For now, we will only use subset of the language supported by Limboole.

1/2

Page 67: FORMULAS IN CONJUNCTIVE NORMAL PROPOSITIONAL ...fmv.jku.at/logic/lecture1.pdfPROPOSITIONAL LOGIC: FORMULAS IN CONJUNCTIVE NORMAL FORM (CNF) VL Logic, Lecture 1, WS 20/21 Armin Biere,

Tool Demo

2/2