Logic for Computer Scientists/Propositional Logic/Equivalence and Normal Forms

From testwiki
Jump to navigation Jump to search

Equivalence and Normal Forms

Until now, we only discussed single formulae and their semantical properties. In this section we start investigating whether formulae can be transformed into another form, without changing their semantics. For this we introduce the concept of logical equivalence, which can be used to investigate the transformation of a given formula into its normal form.

Definition 6

The formulae F and G are called (semantically) equivalent, iff for all assignments 𝒜 for F and G, 𝒜(F)=𝒜(G). We write FG.

Formulae containing different subformulae can be equivalent, e.g. all tautologies are equivalent. More interesting is the following theorem:

Theorem 3 (Substituitivity)

Let FG and H a formula which contains at least one occurrence of the subformula F. Then it holds HH, where H is obtained from H by substituting any occurrence of F by G.

Proof: The proof is by induction over the structure of the subformula H:

Assume for the induction start, that H is atomic, hence H=F holds, and the result of substituting the only occurrence of F by G results in H=G and because FG, we have HH. Assume the theorem holds for all proper subformulae of H: If F=H we have the same argumentation as above in the start of the induction. If FH we have three cases:

  • H=¬h1: Because h1 is a subformula of H we can conclude that h1h1, where h1 is constructed by substituting any occurrence of F by G. From the definition of the semantics of ¬ we conclude that ¬h1¬h1 and hence HH1. Where H_1 is equivalent formula constructed by replacing F in H by G, resulting in H_1
  • H=(h1h2): Assume without loss of generality, that F occurs in h1. Then, again we can conclude from the induction assumption, that h1h1 and from the definition of the semantics of we conclude, that (h1h2)=(h1h2).
  • H=(h1h2) is similar.

Theorem 4

The following equivalences hold:

(FF) F

(FF) F (Idempotence)

(FG) (GF)

(FG) (GF) (Commutativity)

((FG)H) (F(GH))

((FG)H) (F(GH)) (Associativity)

(F(FG)) F

(F(FG)) F (Absorption)

(F(GH)) ((FG)(FH))

(F(GH)) ((FG)(FH)) (Distributivity)

¬¬F F (Double negation)

¬(FG) (¬F¬G)

¬(FG) (¬F¬G) (deMorgan's rule)

(FG) F, if F is a tautology

(FG) G, if F is a tautology (Rule of Tautology)

(FG) G, if F is unsatisfiable

(FG) F, if F is unsatisfiable (Rule of Unsatisfiability)


Proof: All equivalences can be proved by truth tables. This is done here for the second rule of absorption:

F G (FG) (F(FG))
false false
false
false
false true
false
false
true false
false
true
true true
true
true

Let us now use these equivalences together with the theorem of substituitivity (TS) to prove the following equivalence:

((A(BC))(C¬A))((B¬A)C)



((A(BC))(C¬A))


((AB)C)(C¬A)) Associativity and TS

((C(AB))((C¬A)) Commutativity and TS

(C((AB)¬A)) Distributivity

(C(¬A(AB))) Commutativity and TS

(C((¬AA)(¬AB)) Distributivity and TS

(C(¬AB)) Unsatisfiability and TS

(C(B¬A)) Commutativity and TS

((B¬A)C) Commutativity and TS


Problems

Problem 9 (Propositional)

The binary junctor for exclusive disjunction is defined by FG=F(¬G). Show that the following holds for propositional logic formulae F, G and H:

  1. FGGF (Commutativity).

  2. (FG)HF(GH) (Associativity)


Problem 10 (Propositional)

Show the following by equivalence transformation. Give to all remodelling steps the used rules!

  1. (A(BC))(AB)(AC)
  2. (AB)A(BA)(BA)
  3. A¬B¬(AB)
  4. (A(BC))(AB)(AC)
  5. (AB)(BA)BA
  6. (A¬B)((¬A¬C)B)(A¬C)¬B


Problem 11 (Propositional)

Prove with equivalences:

  1. p¬(pq) is a tautology.
  2. (p¬q)(¬pq) is unsatisfiable.


Problem 12 (Propositional)

The binary junctor with the meaning neither-nor is defined by FG=¬(FG). Let F be a propositional logic formula, which contains only the operators and ¬. Prove that for every formula F a formula 𝒯(F) exists, such that F𝒯(F) and 𝒯(F) is built by using only the junctor .


Problem 13 (Propositional)

Let F be a propositional logic formula, which contains only the operators , and ¬. Prove that for every formula F a formula 𝒯(F) exists, such that F𝒯(F) and 𝒯(F) is built by using only the junctors and .

Problem 14 (Propositional)

The following formulae are given:

  • ADB
  • B¬B¬D¬S
  • C(¬SD)¬B



  1. Simplify ABC by using BCC.
  2. Simplify ABC by using equivalences but not BCC.


Definition 7 (Normal Forms)

A literal is an atomic formula or the negation of an atomic formula (positive or negative, resp.) A formula F is in conjunctive normalform (CNF) iff


F=(i=1n(j=1miLi,j))

where Lij is a literal.


A formula F is in disjunctive normalform (DNF) iff

F=(i=1n(j=1miLi,j))

where

Lij

is a literal

Theorem 5

For every formula F there is an equivalent formula which is in DNF and an equivalent formula which is in CNF.

Let us formulate an algorithm to transform a given formula F into an equivalent normalform:

Given: A formula F


1. Substitute in

F

every subformula of the form

¬¬G by G
¬(GH) by (¬G¬H)
¬(GH) by (¬G¬H)

until there is no subformula of this kind.

2. Substitute in the result from the above step every subformula of the form

(F(GH)) by ((FG)(FH))
((FG)H) by ((FH)(GH))

until there is no subformula of this kind.

Result: An equivalent formula in CNF

Until now, we investigate the transformation of a propositional formula into an equivalent normal form. Another problem in the context of normal forms is, to construct a normal form formula from a given truth table; i.e. the formula itself is not known, but its behaviour is given by a truth table. Let's read a normalform formula from a truth table: Assume a formula F, which is given by the following truthtable.


A B C F
false false false true
false false true false
false true false false
false true true false
true false false true
true false true true
true true false false
true true true false

In order to construct a formula in DNF, which is equivalent to F, we have to take into account, that every line of the table which yields the truthvalue true gives one conjunction: if the assignment of the literal Ai is true it is included as Ai, if is false we include ¬Ai. For the above example we get as a DNF:

(¬A¬B¬C)

(A¬B¬C)

(A¬BC)


If we change in the above procedure the roles of true and false and and we arrive at a CNF:

(AB¬C)

(A¬BC)

(A¬B¬C)

(¬A¬BC)

(¬A¬B¬C)


We introduce a special representation for formulae in normalform. In our circuit-example (circuit) from the introduction we already used a very special form of normalforms, namely the implication form for formulae in CNF: every subformula Fi of a conjunction F1,,Fl is written as:

A1AnB1Bm

It is easy to see, that this implication is logically equivalent to a disjunction ¬A1¬AnB1Bm. Sometimes the implication is written as

A1,,AnB1;;Bm

Even the following ambiguous notation is used in some cases, where the comma in the premiss stands for a conjunction and the comma in the conclusion for a disjunction:

A1,,AnB1,,Bm

For some important procedures for logical reasoning it is mandatory to represent the formulae not only in one of the above notations for a normalform, moreover, it is necessary to use the so-called clause-form from the following definition.


Definition 8

If F is a formula in CNF, i.e.

F=(L1,1L1,n1)(Lk,1Lk,nk)

then its corresponding representation in clause form is given as

F={{L1,1,,L1,n1},,{Lk,1,,Lk,nk}}

The sets {Li,1,,Li,ni} are called clauses.

This representation as sets of literals has the advantage that literals occur in no special order and that multiple occurrences of a literal in a disjunction are "merged" in its clause form. Note that as a consequence we have built in associativity, commutativity and Idempotence into the representation.

((A1¬A2)(A3A3))             {{A1,¬A2},{A3}}


(A3(¬A2A1))

Problems

Problem 15 (Propositional)

Create formulae in (a) conjunctive or (b) disjunctive normal form which are equivalent to:

ABC


where

denotes exclusive or.


Problem 16 (Propositional)

The theorem prover OTTER uses the following optimization rules for clause sets:

Subsumption: If the literals of a clause K are a subset of an another clause K remove K from the set of clauses.
Deleting by unit clause: If the set of clauses contains a unit clause L -here L is single literal unit-clause- every occurrence of a complementary literal L in a clause is deleted.

Which laws of the logic justify these procedures?

Problem 17 (Propositional)

Generate truth tables for the following formulae. Give the conjunctive and disjunctive normal forms of the formulae. Which one of the relations FG, GF, FG and F=G holds?

  1. F=(A¬(BC))((AB)(AC),) whereas FG=F(¬G) applies.
  2. G=((A(BA))¬A)C

Problem 18 (Propositional)

Generate a CNF and a DNF form the following truth table for the formula F.

A B C F
0 0 0 0
1 0 0 1
0 1 0 0
1 0 0 1
1 1 0 1
1 0 1 0
0 1 1 1
1 1 1 0

Problem 19 (Propositional)

Generate a CNF from the formula (P(QR)S)

Template:BookCat