You are on page 1of 5

Knowledge Representation and Deduction Page 1 of 5

First Order Predicate Logic (FOPL)


Predicate Logic (FOPL) provides
i) A language to express assertions (axioms) about certain "worlds ".
ii) An inference system or deductive apparatus whereby we may draw conclusions from
such assertions and
iii) A semantics based on set theory.
Example 1 - Blocks world
Blocks World
The above diagram represents a number of rectangular blocks stacked on a table. Suppose we
want to formally express this configuration. Within the confines of PL we could introduce
atomic propositional variables p,q,r,s,... to denote a is on the table, b is on the table, d is
on a , d is above the table etc.. Now, since d is on a and a is on the table we should be
able to deduce that d is above the table. That is {p,r} s. But this is not the case. PL does not
allow us to express relations between objects. It is the purpose of FOPL to redress this
shortcoming
The language of FOPL consists of
i) A set of constant symbols
(to name particular individuals such as table, a,b,c,d,e etc. - these depend on the application)
ii) A set of variables
(to refer to arbitrary individuals)
iii) A set of predicate symbols
(to represent relations such as On, Above etc. -these depend on the application)
iv) A set of function symbols
(to represent functions - these depend on the application)
v) The logical connectives , . , , ,
(to capture and, or, implies, iff and not)
vi) The Universal Quantifier, : and the Existential Quantifer, :
(to capture all, every, some, few, there exists etc.)
vii) Normally a special binary relation of equality (=) is considered (at least in
mathematics) as part of the language.
e
d
a
c
b
table
Knowledge Representation and Deduction Page 2 of 5
Languages in FOPL differ only in their non-logical symbols (constant, predicate and function
symbols). Thus when describing FOPL, we need only specify such symbols.
For example we can represent the language of Blocks World above as follows
constants symbols a,b,c,d,e and table
predicate symbols On, Above
function symbols None in this example
We can then describe Blocks World above axiomatically as
Axioms for the predicate On
On(a,table)
On(b,table)
On(d,a)
On(c,b).
On(e,d)
On(e,c)
x.On(x,x)
Axioms for the predicate Above
x,y.(On(x,y) Above(x,y))
x,y,z.((On(x,y) . Above(y,z) Above(x,z))
Example 2
For example, Suppose we wish to represent in FOPL the following sentences
a) Everyone loves Janet
b) Not everyone loves Daphne
c) Everyone is loved by their mother
Introducing constant symbols j and d to represent Janet and Daphne respectively; a binary
predicate symbol L to represent loves and the unary function symbol
1
m to represent the
mother of a person given as argument.
The above sentences may now be represented in FOPL by
a) x.L(x,j)
b) x.L(x,d)
c) x.L(m(x),x)
Example 3
We will express the following in first order predicate calculus
sam is Kind
Every kind person has someone who loves them
sam loves someone
The non-logical symbols of our language are

1
a function is a special kind of relation.
Knowledge Representation and Deduction Page 3 of 5
the constant sam and
the unary predicate (or property) Kind and
the binary predicate Loves.
We may represent the above sentences as
1. Kind(sam)
2. x.(Kind(x) y.Loves(y,x))
3. y Loves(sam,y)
Within, the context of Prolog, we require that all variables be universally quantified. This
requires us to eliminate existentially quantifier variables by means of introducing Skolem
constants and functions.
The 1
st
sentence has no existential quantifier so nothing need be done, thus
Kind(sam)
The 2
nd
sentence has an existentially quantified variable (namely y). In general, the value of y
depends upon the value of x, in which case we introduce a Skolem function (y = f(x), (we
could interpret f as a friend of )) and we can now write the sentence as
x.(Kind(x) Loves(f(x),x))
The 3
rd
sentence also has an existentially quantified variable but in this case since its value
does not depend on any other variable, this can be replaced by a Skolem constant, c, thus
Loves(sam,c)
Some Semantic Issues
An interpretation (of the language of FOPL) consists of
a) a non empty set of objects (the Universe of Discourse, D) containing designated
individuals named by the constant symbols
b) for each function symbol in the language of FOPL, a corresponding function over D.
c) for each predicate symbol in the language of FOPL, a corresponding relation over D.
An interpretation is said to be a model for a set of sentences , if each sentence of is true
under the given interpretation.
A sentence, A is said to be universally valid (written A), if every interpretation of A is a
model of A. That is, A is true under any interpretation we wish to give the symbols in its
construction. All tautologies are universally valid. The sentence x.A(x) A(c) where A is a
unary predicate symbol and c is a constant symbol of the language, although not a tautology,
nevertheless is universally valid.
As in the case of tautologies, universally valid sentences contain no semantic content. For
example the sentence if everything is ephemeral then fido is ephemeral does not tell us the
meaning of the word ephemeral nor for that matter who or what is fido but all the same is true
in any interpretation of the non logical symbols.
Sentences which hold true only in some interpretations are of more interest. These describe
particular worlds which we want to formally represent.
Knowledge Representation and Deduction Page 4 of 5
For example, the sentence x.O(m(x),x) is true in the natural world that we know if we
interpret O(x,y) as x is Older than y and m(x) as the mother of x.
Whereas if we interpret O(x,y) as the relation x Outlives y then the sentence is no longer
true. We normally have an interpretation in mind for which we represent in the language of
FOPL, this is known as the intended interpretation.
In a like manner to PL, we say that the sentence A is a logical consequences of a set of
sentences if whenever all the sentences in the set are true in a given interpretation then so
is the sentence A - in which case we write A.
Unification (or substitution)
The rules governing unification are as follows:-
A literal is taken here as either
i) a constant symbol
ii) a variable
iii) if f is a function symbol of arity n and a1,...,an are literals then so is f (a1,...,an)
iv) if P is a predicate symbol of arity n and a1,...,an are literals then so is P (a1,...,an)
Two literals A and B may be unified if
i) A and B are both variables
ii) A is a variable and B is a literal of the form f((a1,...,an)) which does not contain the
variable A
iii) A and B are both the same constant
iv) A and B are both of the form f (a1,...,an) and f (b1,...,bn) and each pair ai, bi can be
unified
2
.
v) A and B are both of the form P(a1,...,an) and P (b1,...,bn) and each pair ai, bi can be
unified.
There is a unification algorithm which generates what is called the most general unifier
(mgu). We will not be concerned with the details of this algorithm here but use a rule of
thumb instead.
The following terms can be unified
x and y with x = y
mother(x) and y with y = mother(x)
OlderThan(tom,x) and OlderThan(y,mother(y)) with y = tom and x = mother(tom)
OlderThan(tom,x) and OlderThan(tom,fred) with x = fred
person(age(44),male,z) with person(age(x),y,cm(180)) with x = 44, y = male, z = cm(180)
The following terms cannot be unified
tom and dick
mother(x) and x
age(22) and age(32)
OlderThan(tom,y) and YoungerThan(y,tom)
person(age(x),male,cm(x)) and person(age(22),male,cm(30))

2
Provided there is no clash of the variables of unification.
Knowledge Representation and Deduction Page 5 of 5
Exercise 1
1. Tom and Jerry
Express the following set of sentences in FOPL
Tom chases jerry.
Tom is a cat
Jerry is a mouse
Some cat likes jerry
Every mouse is chased by some cat
And eliminate the existential quantifiers
2. War and Peace
Express in first order predicate logic the following theory presentation of War and Peace
Peace is Good (g.1)
Anything that leads to something that is good is itself good. (g.2)
Suffering is bad. (b.1)
Anything that leads to something that is bad is itself bad. (b.2)
War leads to peace (l.1)
War leads to suffering. (l.2)
Use the predicates symbols
G(x) - x is good
B(x) - x is bad
L(x,y) - x leads to y
and the constant symbols w, p and s to denote war, peace and suffering respectively.
3. Sam and the Barber
By choosing suitable non-logical symbols, express in first order predicate logic the following
sentence of Sam and the Barber
Sam does not tremble.
Sam is not old
Nobody who trembles shaves themselves
Only old men have beards
Nobody shaves anybody who has a beard
The barber shaves all men without beards who do not shave themselves
4. Unify the following terms specifying the most general values for the variables of
unification
Loves(x,sam) and Loves(tom,y)
Old(mother(tom)) and Old(y)
Young(son(x)) and Young(son(father(mary))
5. Construct models for examples 2 and 3 above.

You might also like