ee1j2 - slide 1 ee1j2 – discrete maths lecture 6 limitations of propositional logic introduction...

36
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse trees Formalising NL statements in predicate logic Standard equivalences in predicate logic Propositional Logic revisited The Completeness Theorem

Post on 22-Dec-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 1

EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse trees Formalising NL statements in predicate logic Standard equivalences in predicate logic Propositional Logic revisited The Completeness Theorem

Page 2: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 2

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 3: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 3

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 4: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 4

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 5: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 5

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 6: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 6

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 7: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 7

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 8: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 8

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

p p nor p

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

Page 9: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 9

Arithmetic Semantics of a system like arithmetic

cannot be expressed in propositional logic. We’ve already discussed formulae such as

(x < 5). The truth or falsehood of this formula

obviously depends on the value of x

Page 10: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 10

The qualifiers and A more powerful language for describing

arithmetic is provided by the introduction of the qualifiers and .

(x) (x < 5) is clearly true (there exists an x such that x < 5)

(x) (x < 5) is clearly false (for all x, x < 5)

Page 11: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 11

The Predicates = and < Formally, the symbols = and < are (binary)

predicates, since they express properties of pairs of terms in arithmetic

So, instead of x < 5 could write P(x)where P(x) denotes the property x < 5

Page 12: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 12

The functions + and The symbols + and are (binary)

functions A (binary) function associates pairs of

elements in the domain with single elements in the domain

Page 13: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 13

Predicate Logic: Syntax Predicate logic is defined in terms three

types of ingredient: Symbols, Terms, and Formulae

Page 14: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 14

Symbols of Predicate Logic The symbols of predicate logic are

Logical symbols: , , , , and Brackets: (, ) Variables: x, y, z, x0, x1,…

Constants: a, b, c,… Functions: f, g (number of arguments specified) Predicate symbols: P, Q, R,… (number of arguments

specified) Contradiction formula:

Page 15: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 15

Terms of Predicate Logic The terms of predicate logic are defined as

follows: Any variable or constant is a term If f is an n place function and t1,…,tn are terms,

then f(t1,…,tn) is a term

Page 16: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 16

Formulae of Predicate Logic If R is an n place predicate and t1,…,tn are

terms, then R(t1,…,tn) is a formula (called an

atomic formula is a formula If A and B are formulae, then so are A,

AB, AB, AB, (x)(A), (x)(A)

Page 17: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 17

Parse Tree: Formulae Suppose

P is a unary predicate (i.e. a predicate that has one argument),

S is the successor function from arithmetic, which associates each natural number with the next biggest natural number (I.e. S(n)=n+1 )

n is a variable. Consider the formula

P(0) {(n)(P(n) P(S(n)))} (n)P(n)

Page 18: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 18

Parse Tree for Formula

n

P(n)P(0) n

P(n) P(sn) Parse tree for the predicate logic formula

P(0) {(n)(P(n) P(S(n)))} (n)P(n).

The tree shows how the formula is built up from atomic formulae

Page 19: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 19

Formalising ‘NL’ statements in Predicate Logic

“Everyone in the room spoke French or German” In propositional logic look for atomic

propositions In predicate logic look for predicates

Page 20: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 20

Identification of predicates

Everyone in the room spoke French or German

Three predicates: R(x) : x was a person in the room F(x) : x spoke French G(x) : x spoke German

Page 21: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 21

Formalisation Re-state natural language statement in a

form closer to predicate logic:

For every x, if x was a person in the room, then x spoke French or x spoke German

Formally:

(x)(P(x) (F(x) G(x)))

Page 22: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 22

Another example:

“Everyone in the room spoke French or German” becomes:

(x)(P(x) (F(x) G(x)))

“Someone in the room spoke French or German” becomes:

(x)(P(x) (F(x) G(x)))

Page 23: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 23

The Scope of a Quantifier In a formula (x)() or (x)(), the formula is

called the scope of the quantifier x or x The variable x is bound if it falls immediately to

the right of or , or within the scope of the qualifier x or x

If a variable is not bound, then it is free A formula with no free variables is called a

sentence

Page 24: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 24

Example Consider the formula

{(x)(P(x,y))}Q(x,y) First two occurrences of the variable x are

bound and the third is free All occurrences of y are free This formula is not a sentence

Page 25: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 25

Example(x)(x = y x2+x < 5 x < 5) x = 5y2

The variable x occurs 6 times:- First 5 are bound, last is free- All occurrences of y and z are free- Bound occurrences of x can be substituted by

other symbols (not y or z, though)- y and z cannot be substitutedHence, original formula is equivalent to(a)(a = y a2+a < 5 a < 5) x = 5y2

Page 26: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 26

Semantics in Predicate Logic Two formulae f and g in predicate logic are

said to be logically equivalent if for any interpretation, f is true if and only g is true.

In this case we write f g. This is not rigorous, but will do for now!

Page 27: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 27

Some equivalences f and g are formulae in predicate logic x and y are variables such that

x does not occur bound in f or at all in g y does not occur at all in f or g

Then: x(f(x)) x(f(x)), x(f(x)) x(f(x)) (xf ) g (x fg), (x f)g x (f g)

Page 28: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 28

More equivalences… (xf ) g (x f g), (x f) g x (f g)

(xf ) g x( f g), and (xf ) g x( f g)

f (xg) x( f g), and f (xg) x( f g)

xf(x) yf(y), xf(x) yf(y)

Page 29: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 29

Proofs of equivalences x(f(x)) x(f(x))

Suppose x(f(x)) Then it is not true that f(x) holds for all x Therefore there must be at least one x for which

it does not hold, i.e. for which f(x) is false Or, formally, x(f(x))

Conversely, suppose x(f(x)).

Page 30: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 30

Proof (continued) x(f(x)) x(f(x))

suppose x(f(x)) Then there exists an x such that f(x) is false So it is not true that f(x) holds for all x …which is the meaning of x(f(x))

Page 31: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 31

Analysis of Arguments in Propositional Logic So far, our analysis of the ‘soundness’ of

an argument is based on logical consequence:

Given an argument in NL, First identify the set of formulae which are

premises Then identify the formula f which is the

consequence Then demonstrate that ⊨f (or not)

Page 32: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 32

Method We have two techniques to prove or disprove logical

consequence: Proof by contradiction:

To show that ⊨f is true, assume there is a truth function such that each formula in is true and f is false. Deduce that one of the formulae in must be false – contradiction!

Proof by counter-example: To show that ⊨f is false, find a truth function such

that each formula in is true but f is false

Page 33: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 33

‘Syntactic’ Proof ‘Logical Consequence’ is defined in terms

of the semantics of Propositional Logic An alternative definition of the soundness

of an argument might be based solely on the syntax of Propositional Logic

Closer to the intuitive notion of proof

Page 34: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 34

Proofs in Propositional Logic In mathematics, a proof is a sequence of

steps, each of which is: Self-evident (or axiomatic), or An explicitly stated assumption, or Deduced from previous steps by sound logical

reasoning

Page 35: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 35

Completeness Theorem for Propositional Logic If is a set of formulae in Propositional

Logic, and f is a formula in Propositional Logic, then ⊨f if and only if ⊢f

f is a logical consequence of

if and only if

f is provable from

Page 36: EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse

EE1J2 - Slide 36

Summary of Lecture 6 Limitations of propositional logic Introduction to predicate logic Formalising NL statements in predicate

logic Standard equivalences in predicate logic Propositional Logic revisited The Completeness Theorem