29
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of {, , , }, {, , }, {, } and {, } Every formula is logically equivalent to one in conjunctive normal form (or disjunctive normal form)

EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , , }, {

  • View
    225

  • Download
    1

Embed Size (px)

Citation preview

Page 1: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 1

EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of {, , , }, {, , }, {, }

and {, } Every formula is logically equivalent to one

in conjunctive normal form (or disjunctive normal form)

Page 2: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 2

Truth tables So far we have seen how to build a truth

table T for a given formula f in propositional logic

Today we’ll look at the opposite problem: Given a set of atomic propositions p1,…,pN and a truth table T, can we construct a formula f such that T is the truth table for f ?

Page 3: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 3

Adequacy A set of propositional connectives is

adequate if For any set of atomic propositions p1,

…,pN and For any truth table for these propositions, There is a formula involving only the

given connectives, which has the given truth table.

Page 4: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 4

Adequacy The goal of today’s lecture is to show that

the set {, , , } is adequate and contains redundancy, in the sense that it contains subsets which are themselves adequate

We shall also introduce other sets of adequate connectives

Page 5: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 5

Some more definitions… f1, f2,…,fn a set of n formulae

f1 f2 … fn is called the disjunction of f1,

f2,…,fn

f1 f2 … fn is called the conjunction of f1,

f2,…,fn

Let p be an atomic proposition. A formula of the form p or p is called a literal

Page 6: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 6

Disjunctive Normal Form A formula is in Disjunctive Normal Form

(DNF) if it is a disjunction of conjunctions of literals.

Examples: (p, q, r and s atomic propositions)p q

(p) (q)

(p q) (p r s)

Page 7: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 7

Conjunctive Normal Form A formula is in Conjunctive Normal Form

(CNF) if it is a conjunction of disjunctions of literals

Examples:p q(p) (q)(p q) (p)….

Page 8: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 8

Truth Functions A truth function is a function which

assigns to a set of atomic propositions {p1,…,pN} a truth table (p1,…,pN) in which one of the truth values T or F is assigned to each possible assignment of truth values to the atomic propositions {p1,…,pN}.

Page 9: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 9

Truth functions p, q and r atomic propositions Example truth function in {p, q}

p q  

T T F

T F T

F T T

F F F

22 rows

Page 10: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 10

Truth functions

Example truth function in 3 atomic propositions {p, q, r}

p q r  

T T T T

T T F F

T F T T

T F F T

F T T F

F T F T

F F T F

F F F F

23 rows

Page 11: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 11

First Theorem (Disjunctive Normal Form)

Theorem: Let be a truth function. Then there is a formula in disjunctive normal form whose truth table is given by

Corollary: Any formula is logically equivalent to a formula in disjunctive normal form

Corollary: {, ,} is an adequate set of connectives

Page 12: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 12

Proof of theorem Let p1, p2,…,pn be the atomic propositions Want a formula in disjunctive normal

form whose truth table is given by If assigns the value F to every row of the

truth table, just choose = Otherwise, there will be at least one row for

which the truth value is T. Let that row be row r

Page 13: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 13

Proof (continued) let be the formula defined by:

Let fr be the conjunction

f(r)1 f(r)2 f(r)3 …f(r)n

fr takes the truth value T for the rth row of the truth table and F for all other rows.

by rowin F value theassigned is if

by rowin T value theassigned is if )(

rpp

rpprf

ii

iii

irf

Page 14: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 14

Proof (continued) Suppose that there are R rows r1,…,rR for

which the truth value is T. Define = Clearly is in disjunctive normal form By construction has the truth table

defined by

Rrrr fff ...21

Page 15: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 15

Corollary 1 Any formula is logically equivalent to a

formula in disjunctive normal form Any formula g defines a truth table By the above theorem there is a formula f in

disjunctive normal form which has the same truth table as g

Hence f is logically equivalent to g

Page 16: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 16

Corollary 2 {, ,} is an adequate set of connectives

From the theorem, any truth table can be satisfied by a formula in disjunctive normal form.

By definition, such a formula only employs the connectives , and .

Page 17: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 17

Corollary 3 {, } is an adequate set of connectives

Enough to show that and can both be expressed in terms of the symbols and .

To see this, note that if f and g are formulae in propositional logic:

f g is logically equivalent to (f g)

f g is logically equivalent to f g

Page 18: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 18

Corollary 4 {, } and {, } are both adequate sets of

connectives Proof – homework

Page 19: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 19

The symbol The symbol means logical equivalence Next look at some standard equivalences

using the set {, ,}

Page 20: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 20

Standard equivalences

(a) f g g f, f g g f Commutativity

(b) (f g) h f (g h)(f g) h f (g h)

Associativity

(c) f (g h) (f g) (f h)f (g h) (f g) (f h)

Distributivity

(d) (f g) (f) (g)(f g) (f) (g)

De Morgan’s Laws

(e) f f Rule of double negation

(f) f f is a tautologyf f is a contradiction

 

Page 21: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 21

Theorem 2

Let be a truth function. Then there is a formula in Conjunctive Normal Form (CNF) whose truth table is given by

Page 22: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 22

DNF - Example

Let p, q and r be atomic propositions

Consider f = (p(q r)) ((p q) r)

How do we put this in disjunctive normal form?

Use the construction from the proof of the theorem.

Page 23: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 23

Truth table for f(p (q r)) ((p q) r)

T T T T T T T T T T T

T F T F F T T T T F F

T T F T T T T F F T T

T T F T F T T F F T F

F T T T T T F T T T T

F T T F F F F T T F F

F T F T T T F T F T T

F T F T F F F T F F F

Page 24: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 24

Example (continued) From row 1: (pq r) From row 2: (pq r) From row 3: (pqr) From row 4: (pqr) From row 5: (pqr) From row 7: (pqr) Hence the desired formula is:(pq r)(pq r)(pqr)(pqr)

(pqr)(pqr)

Page 25: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 25

Switching Circuits Connections between propositional logic and

switching circuits Can think of a truth table as indicating the ‘output’

of a particular circuit once its inputs have been set to ‘On’ or ‘Off’

Now know that any desired behaviour can be obtained provided that the gates of the circuit can instantiate the connectives , and

Page 26: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 26

nand and nor gates Most common gates are nand gates and nor

gates. Their truth tables are given by Truth tables for nand and nor

p q p nand q p nor q

T T F F

T F T F

F T T F

F F T T

Page 27: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 27

Theorem 3Adequacy of nand and nor Theorem: The sets {nand} and {nor} are both

adequate Proof

{nand}: Since {, } is adequate, enough to show that and can be expressed in terms of nand.

Let p and q be atomic propositions. Then:

p p nand p

and

p q (p nand q) nand (p nand q)

Page 28: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 28

Proof (continued) For {nor}: It is enough to notice that:

p p nor p

p q (p nor p) nor (q nor q)

Page 29: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 5 Adequacy of a set of connectives Disjunctive and conjunctive normal form Adequacy of { , , ,  }, {

EE1J2 - Slide 29

Summary of Lecture 5

Adequacy of a set of connectives defined Disjunctive and conjunctive normal form

defined Adequacy of {, , , }, {, , }, {, },

{, }, {nand} and {nor} Every formula is logically equivalent to one

in disjunctive normal form (DNF)