0% found this document useful (0 votes)
138 views

First Order Logic

Uploaded by

akbar mirza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views

First Order Logic

Uploaded by

akbar mirza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Artificial Intelligence

Lecturer
Rabiya Tahir
[email protected]

Rabiya Tahir
Lecture # 11
First Order Logic
(FOL)
Limitation of PL

• Propositions can only represent knowledge as complete


sentences, e.g. a = the ball’s color is blue.
• Cannot analyze the internal structure of the sentence
• No quantifiers are available, e.g. for-all, there-exists
• Propositional logic provides no framework for proving statements
such as:
• All humans are mortal
• All women are humans
• Therefore, all women are mortals
• This is a limitation in its representational power.
Predicate Calculus (PC)
• Predicate Calculus is an extension of propositional logic that
allows the structure of facts and sentences to be defined.
With predicate logic, we can use expressions like

• Color( ball, blue)

• This allows the relationship of sub-sentence units to be


expressed, e.g. the relationship between color, ball and blue in
the above example. Due to its greater representational power,
predicate calculus provides a mechanism for proving statements
and can be used as a logic system for proving logical theorems .
Predicate Calculus (PC)
• Propositional logic combines atoms
– An atom contains no propositional connectives
– Have no structure (today_is_wet, john_likes_apples)

• Predicates allow us to talk about objects


– Properties: is_wet(today)
– Relations: likes(john,
lik (j h apples)
l )
– True or false
• In predicate logic each atom is a predicate
– e.g. first order logic, higher‐order logic
First Order Logic
• More expressive logic than propositional
• Enhances processing by allowing the use of variables and
functions.
Use symbols that represent
constants are objects: john,
apples
predicates
are properties and relations:
lik (j h apples)
likes(john, l )

variables
represent any object: likes(X, apples)
functions
transform objects:
likes(john,
fruit_of(apple_tree))
• Operate on these symbols using PL operators.
FOL Provides

• Variable symbols
• E.g., x, y, foo
• Connectives
• Same as in PL: not (), and (), or (), implies (), if
and only if (biconditional )
• Quantifiers
• Universal x or (Ax)
• Existential x or (Ex)

7
Example
• Universal quantification
• (x)P(x) means that P holds for all
values of x in the domain associated
with that variable
• E.g., (x) dolphin(x)  mammal(x)
Quantifiers • Existential quantification
• ( x)P(x) means that P holds for some
value of x in the domain associated
with that variable
• E.g., ( x) mammal(x)  lays-eggs(x)
• Permits one to make a statement
about some object without naming it
9
( ∃ x) (Person (x) ∧ father
(x, Ahmed) ).

Example

In words this reads as:


there exists some person,
x who is Ahmed’s father.
Universal quantifiers are often used
with “implies” to form “rules”:
• (x) student(x)  smart(x) means “All students
are smart”

Universal quantification is rarely used


to make blanket statements about
Quantifiers every individual in the world:
• (x)student(x)smart(x) means “Everyone in the
world is a student and is smart”

Existential quantifiers are usually used


with “and” to specify a list of properties
about an individual:
• (x) student(x)  smart(x) means “There is a
student who is smart” 11
Quantifier Scope
• Parentheses are used to indicate the scope of quantification

• ∀ X (likes(X,mary) ∧ nice(mary) → nice (X))

– determines all instances of X who like Mary and if Mary is


nice, then it is implied that those who like Mary are also

nice.

© Tariq 2017 Department of Computer Science | Bahria University 31


Switching the order of universal quantifiers does
not change the meaning:
(x)(y)P(x,y) ↔ (y)(x) P(x,y)

Quantifier
Similarly, you can switch the order of existential
Scope quantifiers:
(x)(y)P(x,y) ↔ (y)(x) P(x,y)

Switching the order of universals and existentials


does change meaning:
Everyone likes someone: Someone is liked by
(x)(y) likes(x,y) everyone: (y)(x) likes(x,y)13
We can relate sentences
involving  and  using De
Morgan’s laws:
Connections (x) P(x) ↔ (x) P(x)
between All
(x) P ↔ (x) P(x)
and Exists
(x) P(x) ↔  (x) P(x)
(x) P(x) ↔ (x) P(x)

14
x y is the same as y x

x y is the same as y x
• x y Loves(x, y)
Properties • “There is a person who loves
of everyone in the world”
Quantifiers • y x Loves(x, y)
• “Everyone in the world is loved by
at least one person”

x y is not the same as x y


To say “everyone likes McDonalds”,
the following is too broad!
• x, likes(x, McDonalds)
• Rush’s example: likes (McDonalds,
McDonalds)
Other We mean: Everyone (who is a
Comments human) likes McDonalds
About • x, person(x)  likes(x, McDonalds)
Quantification
Essentially, the left side of the rule
declares the class of the variable x

Constraints like this are often called


“domain constraints”
Every gardener likes the sun.

You can fool some of the people all of the


time.

Translating You can fool all of the people some of the


time.
English to
FOL
All purple mushrooms are poisonous.

No purple mushroom is poisonous.

Clinton is not tall.


17
Translating English to FOL
Every gardener likes the sun.
x gardener(x)  likes(x,sun)

You can fool some of the people all of the time.


x t person(x) time(t)  can-fool(x,t)
Equivalent
You can fool all of the people some of the time.
x t (person(x)  time(t) can-fool(x,t))
x (person(x)  t (time(t) can-fool(x,t))
All purple mushrooms are poisonous.
Equivalent
x (mushroom(x)  purple(x))  poisonous(x)

No purple mushroom is poisonous.


  x purple(x)  mushroom(x) ^ poisonous(x)
x (mushroom(x)  purple(x))  poisonous(x)
18

Clinton is not tall.


tall(Clinton)
• All Trojan are clever.
• Some one in the class is sleeping.
• Every one likes MacDonald.
Exercise • Not Every one likes MacDonald.
• Every one likes MacDonald unless
they are allergic to it.
• Every one like some kind of food.
• Brothers are siblings.

You might also like