06 Predicate Logic
06 Predicate Logic
Topics
• Universal quantification
• Existential quantification
• Satisfaction and validity
• The negation of quantifiers
• Free and bound variables
• Substitution
• Restriction
• Uniqueness
• Equational reasoning
• Natural deduction
• One point rule
Page 2
Syntax of FOL: Basic
elements
• Constants KingJohn, 2,…
• Functions Sqrt, Likes...
• Variables x, y, a, b,...
• Connectives ¬, ⇒, ∧, ∨, ⇔
• Equality =
• Quantifiers ∀, ∃
Predicates
• A predicate is a proposition whose truth
depends on the value of one or more
variables.
• For example, “n is a perfect square” is a
predicate whose truth depends on the
value of n.
• A function like notation is used to
denote a predicate supplied with
specific variable values. P(n)=“n is a
perfect square”
• P(4) is true and P(5) is false.
Page 4
Universal Quantification
• Universal Quantification denoted as
• Universal Quantification allows us to capture
statements of the form “for all” or “for every”.
• For example, “every natural number is
greater than or equal to zero” can be written
formally as
Page 5
Universal Quantification
• A quantified statement consists of three
parts: the quantifier, the quantification,
and the predicate
• Every predicate logic statement can be
considered as follows
Page 6
Universal Quantification
Page 7
Exercise
• Everybody likes Jaffa cakes
• All vegetarians don’t like Jaffa
cakes
• Everybody either likes Jaffa cakes
or is a vegetarian
• Either every body likes Jaffa cakes
or everybody is a vegetarian
Page 8
Solution
Page 9
Universal Quantification
• Law 1
• Example
Page 10
Universal Quantification
• Law 2
• Example
Page 11
Existential quantification
• Existential quantifier denoted by
• Existential quantification is used to
assert that a property holds of some
(or at least one) elements of a set
• “Some natural numbers are divisible
by 3” may be written as
Page 12
Exercise
• Some people like Jaffa cakes
• Some vegetarians don’t like Jaffa
cakes
• Some people either like Jaffa cakes
or are vegetarian
• Either some people like Jaffa cakes
or some people are vegetarian
Page 13
Solution
Page 14
Existential quantification
• Law 3
• Example
Page 15
Existential quantification
• Law 4
• Example
Page 16
Satisfaction and validity
• The predicate n>3 can be considered neither
true nor false unless we know the value
associated with n
• Example
Page 17
Satisfaction and validity
• A predicate p is satisfiable if and only if
it is true for some values of the
appropriate type. That is, if a predicate
p is associated with a variable x of type
X, then p is satisfiable if, and only if ,
• Example
Page 18
Satisfaction and validity
• A predicate p is unsatisfiable if, and only
if, it is false for all possible values of the
appropriate type.
Page 19
Satisfaction and validity
• Valid predicates and tautologies are
always true
• Satisfiable predicates and contingencies
are sometimes true and sometimes
false
• Unsatisfiable predicates and
contradictions are never true
Page 20
Exercise
• Everyone likes everyone
• Everyone likes someone
• Someone likes everyone
• Someone likes someone
Page 21
The negation of quantifiers
• The statement “some body like Brian”
may be expressed via predicate logic
as
• And
• are equivalent.
Page 23
The negation of quantifiers
• Law 5
Page 24
Free and bound variables
• Consider two predicates
• n>5…..Eq. 1
Page 26
Substitution
• Consider statement,
Page 27
Substitution
• Also, we may denote the substitution of
3+4 for n in n>5 by
n>5[3+4/n]
Page 28
Substitution
• More than one substitution in case of more than
one free variable
• Consider predicate,
• Here x and y are both free variables. We may
substitute nigel for x as follows,
Page 29
Substitution
• Similarly, in one step, overall substitution
may be denoted as,
Page 30
Substitution
• To illustrate the difference between sequential
and simultaneous substitution, consider the
example,
Page 33
Solution
Page 34
Restriction
• Law 6
• Law 7
Page 35
Uniqueness
• Existential quantifier, allows us to
represent statements such as “there is
at least one x, such that…”.
• In order to be more specific, consider,
“there is exactly one x, such that…”
• Consider an example statement,
• As an example,
Page 37
Uniqueness
• Assuming the statement
Page 38
Uniqueness
• On the other hand, µ expressions that are not
associated with a unique element generate an
undefined value.
• As an example, the µ expressions
(µn:N | n is even)
and
(µc:Country | population (c) > 10,000,000)
are both undefined
Page 39
Uniqueness
• Expressions of the form,
Page 40
Uniqueness
• If there is no unique element which
possesses the relevant property, then the
result is undefined
• and
Page 41
Exercise
• Write the following in terms of µ
expressions
– The tallest mountain in the world
– The height of the tallest mountain
– The oldest person in the world
– The nationality of the oldest person in
the world
Page 42
Solution
Page 43
Equational Reasoning
• Two methods of reasoning
– Equational reasoning
– Natural deduction
Page 44
Equational Reasoning
• Law 8
If a predicate holds for all elements of a
set, then it holds for some of them
• Law 9
If a predicate holds for exactly one
element of a set, then it holds for at
least one of them
Page 45
Equational Reasoning
• Law 10
If p holds for all elements of X and t is of type
X, then p holds for t
Example,
The predicate
holds for all natural numbers. The term 3+4 is of
type N and as such,
holds.
Page 46
Equational Reasoning
• Law 11
This law states that if t is a term of
type X and p holds of t, then we can
conclude that p holds for some
elements of X
• Example
The proposition 7εN is true and
furthermore 7 is prime. As such,
Page 47
Equational Reasoning
• Law 16
It states that as x does not appear free
in q, the following holds
• Example,
Page 48
Equational Reasoning
• Law 17
It states that as x does not appear free
in q, the following holds,
• Example
Page 49
Equational Reasoning
• Law 18
It states as x does not appear free in q,
the following holds
• Example
Page 50
Equational Reasoning
• Law 19
It states as x does not appear free in q,
the following holds
• Example
Page 51
Equational Reasoning
• Example: A theorem in predicate
logic
• Proof:
Page 52
Equational Reasoning
• Example Theorem
Page 53
Exercise
Page 54
Solution
Page 55
Natural deduction
• Natural deduction can also be extended to
predicate logic
• Natural deduction rules for universal
quantification
Page 56
Natural deduction
• Example:
All natural numbers which are prime and
greater than 2 are odd. 7 is prime and greater
than 2 and we may conclude that it is odd.
Page 57
Natural deduction
• Rules for existential quantification
If xεX such that p holds for x, then if
we are able to define further
predicate, q in which x does not
appear free, then we may conclude
q
Page 58
Natural deduction
• Intro rule
• If p is true for any term t of set X, then
we conclude that, holds
Page 59
The one-point rule
• It states that p is a person that likes
chocolates, but also that the name of person
is Rick
• We can conclude that rick ε Person and rick
likes chocolates are both true
• Law 20
Page 60
The one-point rule
• Example
Page 61
Thank you!
Page 62