ct214 – logical foundations of computing lecture 6 predicate calculus

18
CT214 – Logical Foundations of Computing CT214 – Logical Foundations of Computing Lecture 6 Lecture 6 Predicate Calculus Predicate Calculus

Upload: kristina-george

Post on 04-Jan-2016

226 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

CT214 – Logical Foundations of ComputingCT214 – Logical Foundations of Computing

Lecture 6Lecture 6

Predicate CalculusPredicate Calculus

Page 2: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Predicate Calculus - The extension of propositional calculus that enables the use of variables such that quantified statements such as “there exists an x such that...” or “for any x, it is the case that...”, can be dealt with.

Predicate – A function that returns either true or false.

Quantifier – A symbol that indicates the degree to which the predicate is true for a specified set.

Page 3: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Universal Quantifier ( ) – Indicates that a predicate is true for all members of a specified set.

Equivalent to saying – “For each”

Existential Quantifier ( ) – Indicates that a predicate is true for at least one member of a specified set.

Equivalent to saying – “There exists”

Page 4: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Variables: X, Y, Z

Quantifiers: ,

Symbols: , ( ), { }

Universe: U

where U = {u1, u2, u3, ............., un}

Page 5: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Definition: Universal quantifier

X : U P(X)

Means P(u1) ^ P(u2) ^ P(u3) ............. ^ P(un)

Definition: Existential quantifier

X : U P(X)

Means P(u1) v P(u2) v P(u3) ............. v P(un)

Page 6: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Atomic predicate – Built from predicate symbol, constants, variables and symbols like ( ), but not using connectives.

Predicate Symbol

For example:P ( X ) or P ( joe )

Variable Constant

Page 7: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

P( joe ) “joe is a tall person”

P( X ) “X is a tall person”

U = the set of all people, X is an element of U

Q( joe, cisco ) “joe is employed by cisco”

Q( X, Y ) “person X is employed by company Y”

Page 8: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

R( yuri, russia, russian ) “yuri from russia speaks russian”

R( X, Y, Z ) “person X from country Y speaks language Z”

Predicates can be formed by combining atomic predicates using logical connectives

e.g. P( X ) ^ Q( X, Y ) “X is a tall person AND X is employed by Y”

Page 9: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Relative Quantification – Want to restrict or to some subset of U that satisfies some criteria.

1. Relative Universal Quantification

X : U R( X ) -> P( X )

2. Relative Existential Quantification

X : U R( X ) ^ P( X )

R is a statement which narrows down the universe

Page 10: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

1. Relative Universal Quantification

X : U R( X ) -> P( X )

Page 11: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

2. Relative Existential Quantification

X : U R( X ) ^ P( X )

Page 12: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Example: Each German must vote

X : U G( X ) -> V( X )

G - Germans

V - Voters

U – All people

Page 13: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Note that the universe is important!

Each German must vote

X : U V( X )

V - Voters

U – All Germans

Page 14: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Example: Some French don’t vote

X : U F( X ) ^ ¬V( X )

F - French

¬V – Non-voters

U – All people

Page 15: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Example: London is bigger than any city in Europe

X : U E( X ) -> B( London, X )

E( X ) – X is a European city

B( Y, X ) – City Y is bigger than city X

Page 16: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Empty universes:

U = = { } = null set

X : U P( X ) = True

X : U P( X ) = False

Example:

“All Irish people who went to the moon liked it there”

Page 17: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Example:

“All Irish people who went to the moon liked it there”

U = {All Irish people who went to the moon} =

X : U L( X ) = True

No Irish people every went to the moon so “All Irish people who went to the moon liked it there” is a

true statement.

Page 18: CT214 – Logical Foundations of Computing Lecture 6 Predicate Calculus

Example:

“Some Irish people who went to the moon liked it there”

U = {All Irish people who went to the moon} =

X : U L( X ) = False

There must be at least one Irish person who went to the moon in order for it to be possible for this statement

to be true.