You are on page 1of 16

Lecture #4 First-Order Predicate Logic I

Topics
1) Syntax
2) Semantics

1 First-Order Predicate Logic


1.1 Syntax
 We want to reason as follows.

Suppose that

Ber likes everyone who like Logic.


Sombat likes Logic.
Lalita likes Logic.
Thus, we want to conclude that

Ber likes Sombat.


Ber likes Lalita.
 First-order predicate logic (FOL) is also called Predicate Calculus.
 FOL is more expressive than the propositional calculus since FOL allows

quanti cation over objects of interests.


 This example can be formalised in FOL by using universal quanti er 8 as

follows.
8X

[ likes(ber,X)

likes(X,logic) ]

likes(sombat,logic)
likes(lalita,logic)
Thus, we can conclude that

likes(ber,sombat)
likes(ber,lalita)
2

 The universal quanti cation of

p(X), ie. 8X p(X), is the proposition

\p(X) is true for all objects X in the domain of interest (or the universe of
discourse)".
 In the above example, all values of

(persons) in the domain of interest

are ber, sombat, lalita and logic.

Example 1.1 Universal Quanti cation


1) The statement \Every student in this class has studied English." can be
expressed as follows:
8X [

in-this-class(X) ! studied-english(X) ]

Note that the domain of interest consists of all students (in a university).
In this example, the domain is implicit.
2) The statement \For every X in the set of natural numbers, X + 1 > X ."
can be expressed in FOL as follows:
8X 2

N[X+1>X]

In this example, the domain is explicit.


 The domain of interest can be represented as a set of objects.
 Suppose a domain of interest is f1, 2, 3, 4, 5g.
8X
 The

p(X) means p(1) ^ p(2) ^ p(3) ^ p(4) ^ p(5).


existential quanti cation of p(X ), ie. 9X p(X), is the proposition

\There exists an element

in the domain of interest such that p(X ) is

true."

Example 1.2 Existential Quanti cation


1) The statement \There is some student in this class who has studied both
English and Computer-Security" can be written as follows.
9X [

in-this-class(X) ^ studied-english(X) ^ studied-comp-sec(X) ]

2) The statement \There is a natural number which is greater than 4" can
be expressed as follows:
9X 2

N[X

>

4]

 Suppose a domain of interest is f1, 2, 3, 4, 5g.


9X

p(X) means p(1) _ p(2) _ p(3) _ p(4) _ p(5).

Example 1.3 More examples of translating English sentences into FOL


statements
1) \All lions are erce."
8X [

lion(X) ! erce(X) ]

Note that the domain may be a set of all animals.


2) \Some lions do not drink co ee."
9X [

lion(X) ^ :drink-co ee(X) ].

3) \No large birds live on honey."


:9X [

large-bird(X) ^ live-on-honey(X) ]

4) \Birds that do not live on honey are dull in colour."


8X [ (

bird(X) ^ :live-on-honey(X) ) ! dull-colour(X) ]

5) \Everyone has exactly one best friend."


8Y 9X 8Z [

is-best-friend(X,Y) ^ ( is-best-friend(Z,Y) ! X = Z ) ]
4

6) \If somebody is female and is a parent, then this person is someone's


mother."
8X [

female(X) ^ is-parent(X) ! 9Y mother-of(X,Y) ]

7) \Everyone is loved by someone"


8X 9Y [

loves(Y,X) ]

where loves(Y,X) means that Y loves X .


8) \There is someone who is loved by everyone."
9X 8Y [

loves(Y,X) ]

The sentences in 7 and 8 are di erent. For example, in Thailand everyone


loves the King. But no one loves the bad corrupted politicians for what
they did.
Thus the order of the universal and existential quanti ers is signi cant.
 Universal and Existential quati ers have a relationship. For example,

\Every lion is erce." means that \There is no lion which is not erce."
Formally, this is captured by
8X [

lion(X) ! erce(X) ] is the same as

:9X [

lion(X) ^ : erce(X) ] which is equivalent to

:9X :[

lion(X) ! erce(X) ]

 Thus, 8X

p(X) is equivalent to :9X :p(X).

 FOL also o ers the use of function symbols.


 Functions are very useful components which can be used to refer to speci c

objects.
5

 For example, \The square of an odd number is odd" can be expressed in

FOL as
8X [

odd(X) ! odd(square(X)) ]

 \Any number is always less than its successor."


8X [

X < X

8X [

X <

+ 1 ] which can be written as

+(X ,1) ]

 \An item is on the oor at a situation which results from dropping the

item at the initial situation (s0 )."

holds(on- oor, result(drop,s0))


 \An item is broken at a situation which results from dropping the item

at the initial situation if the item is fragile."

holds(broken, result(drop,s0))

holds(fragile, s0)

De nition 1.1 Language of FOL


The language of FOL consists of
a) A countable set P of predicate symbols,
b) A countable set F of function symbols,
c) A countable set C of constant symbols,
d) A countable set V of variable symbols,
e) Two special symbols : true and false,
f) A set of usual boolean operators (logical connectives), and
g) The universal quanti er (8) and the existential quanti er (9).
 As a matter of notation, predicate, function and constant symbols begin

with lower case letters. Variable symbols start with upper case letters.
6

De nition 1.2 Terms


A term is de ned inductively as follows.
1. A variable is a term.
2. A constant is a term.
3. If

is an n-ary function symbol and t1,...,tn are terms, then f (t1,...,tn)

is a term.
 Any constant symbol can be seen as a function symbol without any ar-

guement (ie.

= 0).

 For simplicity, sometimes we shall treat constants as functions.

De nition 1.3 Well-formed Formulae


A well-formed formula is de ned inductively as follows:
1. If

is an n-ary predicate symbol and t1,...,tn are terms, then p(t1,...,tn)

is a formula (called an atomic formula), where n  0.


2. If F and G are formulae, then so are (:F ), (F ^ G), (F _ G), (F ! G)
and (F $ G).
3. If

is a formula and

is a variable, then (8X

formulae.

Example 1.4 Well-formed formulae


1. p(c)
2. p(X)
3. 8X p(X)
4. 9X p(c)
7

) and (9X

) are

5.

is not a well-formed formula, since X is a variable.

De nition 1.4 Quanti ers, Variables and Scope


1. 8 is the universal quanti er and is read \for all".
2. 9 is the existential quanti er and is read \there exists".
3. The scope of 8 (respectively 9) in 8X

(respectively 9X

) is F .

4. A bound variable in a formula is a variable which occurs within the scope


of its quanti er.
5. Any other occurrence of a variable than that speci ed in 4 is called free.

Example 1.5 Scope of Quanti ers and Bound Variables


1) 9X ( p(X ) ) ^ q(X )
The scope of 9X is just p(X ). Thus
X

in p(X ) is a bound variable while

in q(X ) is a free variable.

2) 8X ( p(X ) ^ q(X ) )
The scope of 8X is p(X ) ^ q(X ). Thus, X is a bound variable.

De nition 1.5 Closed Terms and Closed Formulae


1. A term is closed if it contains no variables.
2. A closed term is also called a ground term.
3. A formula is closed if it has no free variables.
Example 1.6 Closed Terms and Closed Formulae
1) f(c) in p(f(c)) is a ground term, but f(X) in q(f(X)) is not.
2. p(f(c)) is a closed formula whereas q(f(X)) is not. However, 9X q(f(X))
is a closed formula.
8

 It is important to note that there are two kinds of well-formed formulae:

closed and open.

1.2 Semantics
 Recall that formulae in FOL are associated with a

domain of interest in

that any quanti cation in such formulae refers to elements in the domain.
 Essentially, an interpretation of a rst-order language is

1) an association of the terms of the language with objects in a structured


domain, together with
2) an association of atomic well-formed formulae with relations over the
domain.
 In the following, we shall treat constants as functions without parameters,

and thus we shall focus on predicate and functions symbols.

De nition 1.6 Interpretation


Let A be a formula such that fp1,...,pig are all the predicates, ff1,...fj g are
all the functions appearing in A. An interpretation I is a tuple
(D,fR1,...,Rig,fF1,...,Fj g )
consisting of:
1. A non-empty domain D (the non-empty set of objects).
2. An assignment of relation Rk with n arguments on D to predicate pk
with n arguments, where 1  k  i.
3. An assignment of function Fk with n arguments on D to function fk with
n

arguments, where 1  k  j .
9

 Note that constant symbols, which are treated as functions, are assigned

to elements in the domain (D).


 Thus, it is the interpretation which determines the assignment of constant,

function and predicate symbols in rst-order language to elements, function


and relations, respectively, on a domain of interest.

Example 1.7 Interpretations


1. Suppose we do not consider function symbols. The following are interpretations of the formula 8X p(a,X). Note that P = fpg, F = fag.
a) I1 = (N, fg, f0g) such that a and

are assigned to 0 and , respec-

tively.
Thus, 8X p(a,X) under I1 means that every number in N is greater than
or equal to 0, ie. 8X 2 N ( 0  X ).
b) I2 = (Z, fg, f0g) such that a and p are assigned to 0 and , respectively.
Thus, 8X p(a,X) under I2 means that every number in Z is greater than
or equal to 0, ie. 8X 2 Z ( 0  X ).
2. An Interpretation of 8X,Y (p(X; Y ) ! p(f (X; a); f (Y ; a))) is as follows.
Note that P = fpg, F = ff , ag.
I3 = (Z, fg, f+, 1g) such that p is assigned to , f is assigned to +, and
a

is assigned to 1.

Thus under this interpretation the formula means that


8X 2

Z 8Y 2 Z ( X  Y ! (X + 1)  (Y + 1) ).
10

 Suppose that p is assigned to relation R. Thus, 8X p(X) can be interpreted

as 8X 2 D R(X).
But how about p(X) where X is a free variable. ????
 In other words, how to interpret open formulae?
 The interpretation of open formula is analogous to the computation of a

procedure with parameters in a Pascal program:

procedure P(X : Integer; Y : Integer)


 The value of the procedure cannot be computed until it is called with

actual parameters, eg. P(10,20).


 In other words, the computation of the procedure can be done under an

environment which contains calling parameters for the procedure.


 Thus, we need to interpret formulae relative to an
 The environments are just look-up tables for

environment.

all variables; such a table l

associates with every variable x a value l(x) of the model.


 Given such a look-up table, we can assign truth values to all formulae.

De nition 1.7 Environment


1) An environment is a function V ! D from the set of all variable symbols
V to the domain D of the underlying interpretation.

2) Let l be a look-up table for a domain D and let d 2 D. l[x 7! d] stands


for the look-up table which maps x to d and any other variable y to l(y).

11

De nition 1.8 Term Assignment


Given a term t, the value vl (t) of the term in the interpretation I , ie.
(D,fR1,...,Rig,fF1,...,Fj g), and the environment l, is de ned inductively as
follows.
a) vl (X ) = l(X )
where X is a variable.
b) vl (fm(t1,...,tn)) = Fm(vl (t1),...,vl(tn))
where fm is a function symbol, Fm is a function on the domain D, and
t1

,...,tn are terms.

Example 1.8 Term Assignment


Consider the interpretation I3 : (Z, fg, f+, 1g), and the environment
in which l(X ) = 2.
1) vl (a) = 1
2) vl (X ) = 2
3) vl[Y 7!4](Y ) = 4
4) vl[X 7!4](X ) = 4
5) vl (f (a; a)) = +(vl (a),vl(a)) = +(1,1) = 2.
6) vl (f (f (a; a); a)) = +( +(1,1), 1) = ... = 3.

12

De nition 1.9 Truth Value of a formula under an interpretation and an


environment
Let

be a formula. The truth value of

under interpretation I and an

environment l, denoted by vl (A), is de ned as follows:


1. If A = pm(t1,...,tn) is an atomic formula, then

l (pm(t1,...,tn)) = T i Rm (vl(t1),...,vl(an)) is true.


where Rm is the relation assigned to pm in I .
2. If A = :B , then vl (A) = T i vl (B ) = F
v

3. If A = B ^ C , then

l (B ^ C ) = T i vl (B ) = T and vl (C ) = T ,
and similarly for the other logical connectives.
v

4. If A = 8X

, then

l (8X B ) = T i for all d 2 D, vl[X 7!d](B ) = T .


5. If A = 9X B , then
v

l (9X

) = T i for some

, vl[X 7!d](B ) = T .

Example 1.9 Truth value in an interpretation


Suppose the constant

and

are assigned to 0 and 1 (respectively),

is

assigned to +, the predicate p is assigned to  as speci ed in the interpretation I1 = (Z, fg, f+,0,1g). Suppose that l is an environment.
Thus, in I1 and l the following holds.

l ( p(a,a) ) = T i 0  0 holds.
vl ( p(a,f(a,b)) ) = T i 0  (0 + 1).
v

13

Z, vl[X 7!d](p(X,a)) = T .
i for all d 2 Z, (vl[X 7!d](X), vl[X 7!d](a)).
i for all d 2 Z, (d, 0).
v ( 8X 9Y p(X,Y) ) = T , i for all X 2 Z for some Y 2 Z (X  Y ).
v ( 9X 8Y p(X,Y) ) = T , i for some X 2 Z for all Y 2 Z (X  Y ).
v( 8X p(X,a) ) T i for all

De nition 1.10 Model


a) If a formula A is true in I and environment l, eg. vl (A) = T , then I is
a model for A under the environment l.
b) We use I j=l A to represent that I is a model of A under the environment
l

Example 1.10 Model


1) Recall Example 1.7. The following holds. For any environment l,
I1 j=l 8X (p(a,X) )
I2 6j=l 8X (p(a,X) ) Discuss why ????
I3 j=l 8X ,Y (p(X,Y) !

p(f(X,a), f(Y,a)))

2) In the example 1.9,


I1 j=l

p(a,f(a,b))

I1 j=l 8X 9Y

p(X,Y)

De nition 1.11 Satis ability for a formula


a) A formula A is satis able i there is an interpretation I and an environment l such that I j=l A.
14

b) A is valid, denoted by j= A, i for all interpretations I and all environment l, I j=l A.


 The following gure illustrates a list of valid formulae some of which shows

logical equivalence.
8X A(X) $ :9X:A(X)
9X A(X) $ :8X:A(X)
8X A(X) ! 9X A(X)
9X8Y A(X,Y) ! 8Y9X A(X,Y)
8X8Y A(X,Y) $ 8Y8X A(X,Y)
9X9Y A(X,Y) $ 9Y9X A(X,Y)
9X (A(X) _ B(X)) $ (9X A(X) _ 9X B(X))
8X (A(X) ^ B(X)) $ (8X A(X) ^ 8X B(X))
8X A(X) _ 8X B(X) ! 8X (A(X) _ B(X))
9X (A(X) ^ B(X)) ! (9X A(X) ^ 9X B(X))
8X (A(X) $ B(X)) ! (8X A(X) $ 8X B(X))
8X (A(X) $ B(X)) ! (9X A(X) $ 9X B(X))

(9X A(X) _ B) $ 9X (A(X) _ B)


(8X A(X) _ B) $ 8X (A(X) _ B)
(9X A(X) ^ B) $ 9X (A(X) ^ B)
(8X A(X) ^ B) $ 8X (A(X) ^ B)
8X (A ! B(X)) $ (A ! 8X B(X))
15

8X (A(X) ! B) $ (9X A(X) ! B)


9X (A(X) ! B(X)) $ (8X A(X) ! 9X B(X))

(9X A(X) ! 8X B(X)) ! 8X (A(X) ! B(X))


8X (A(X) ! B(X)) ! (8X A(X) ! 8X B(X))
8X (A(X) ! B(X)) ! (9X A(X) ! 9X B(X))
8X (A(X) ! B(X)) ! (8X A(X) ! 9 B(X))

De nition 1.12 Logical Consequences


Let U be a set of formulae and A a formula.
Formula A is a logical consequence of U , denoted by U j= A, i
(for each interpretation I and each environment l, if I j=l U , then I j=l A).

16

You might also like