First Order Logic - Lecture 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

First Order Logic (FOL)

CHAPTER 8

© DR. JAMIL AL-SAWWA


Problem of propositional logic
➢ Propositional logic has limited expressive power
◦ Unlike natural language
◦ E.g., cannot say “All pits cause breezes in adjacent squares“ in one sentence
◦ except by writing one sentence for each square
➢ Consider the following sentence, which we cannot represent using propositional logic.
1) "Some humans are intelligent"
2) “men likes Football."
First Order Logic (FOL) -1
➢ First-order logic is another way of knowledge representation in artificial intelligence.
➢ It is an extension to propositional logic.

➢ It is also known as Predicate logic or First-order predicate logic


➢ Propositional logic assumes the world contains facts, While First-order logic (like natural language) assumes the
world contains:

➢ Objects: people, houses, numbers, colors, baseball games, pits, Wumpus, …

➢ Relations:
➢ unary relation such as: red, round, is adjacent,
➢ n-any relation such as: the sister of, brother of, has color, brother of, bigger than, part of, …

➢ Functions: father of, best friend, one more than, plus, …

© DR. JAMIL AL-SAWWA


First Order Logic (FOL) -2
➢ Let's consider the statements:
Rana is female
Ali is male
Rana and Ali are siblings

➢In propositional logic the above statements are atomic propositions:


➢ Rana-is-female P , Ali-is-male Q • Rana-and-Ali-are-siblings Z

➢ In FOL atomic statements use predicates, with constants as argument:


➢ Female(Rana) • Male(Ali) • Siblings(Rana, Ali)

© DR. JAMIL AL-SAWWA


Syntax of FOL: basic elements
Constant 1, 2, Red, Ahmad, Amman, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father,....

Function sqrt, Legs, ....

Connectives ∧, ∨, ¬, ⇒, ⇔

Equality ==

Quantifier ∀, ∃
FOL Sentences - 1
➢ Atomic sentences : These sentences are formed from a predicate symbol followed by a parenthesis with a
sequence of terms.
Syntax: Predicate (term1, [term2, ......, term n]).
Example:
Ahmad and Ali are brothers => Brothers(Ahmad, Ali).

BMW is a Car: => Car (BMW).

© DR. JAMIL AL-SAWWA


FOL Sentences -2
➢ Complex Sentences: These sentences are made by combining atomic sentences using
connectives (∧, ∨, ¬, ⇒, ⇔).
➢¬S1
➢ S1 ∧ S2
➢ S1 ∨ S2
➢ S1 ⇒ S2
➢ S1 ⇔ S2
Hint: S1 and S2 are atomic sentences

➢ Example: Brothers(Ahmad, Ali) ^ Father(Shadi, Ali) ⇒ Father(Shadi, Ahmad) .

© DR. JAMIL AL-SAWWA


Quantifiers in First-order logic
➢ A quantifier is a language element which generates quantification (∀, ∃)
➢ There are two types of quantifier:
1. Universal Quantifier ∀, (for all, everyone, everything)

➢ If x is a variable, then ∀x is read as: For all x, For each x, or For every x.
➢ Syntax :
∀⟨variable(s)⟩ ⟨sentence⟩

2. Existential quantifier ∃, (for some, at least one).

➢If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as: There exists a 'x.’, For
some 'x.’, or For at least one ‘x.’
➢Syntax
∃ ⟨variable(s) ⟩ ⟨sentence⟩

© DR. JAMIL AL-SAWWA


Quantifiers in First-order logic
➢Examples
➢ All man drink coffee. ∀x man(x) → drink (x, coffee). Points to remember:
• The main connective for universal
quantifier ∀ is implication →.
➢ Some boys are intelligent. ∃x boys(x) ∧ intelligent(x)
• The main connective for existential
➢ All birds fly. ∀x bird(x) →fly(x). quantifier ∃ is and ∧.

© DR. JAMIL AL-SAWWA


A Common Mistake to Avoid
● Typically, ⇒ is the main connective with ∀
● Common mistake: using ∧ as the main connective with ∀:
Example :
∀x At(x, TTU) ∧ Smart(x)
means “Everyone is at TTU and everyone is smart”

● Correct ∀x At(x, TTU) ⇒ Smart(x)


means “For everyone, if he/she is at TTU, then he/she is smart”

© DR. JAMIL AL-SAWWA


Another Common Mistake to Avoid
● Typically, ∧ is the main connective with ∃
● Common mistake: using ⇒ as the main connective with ∃:
∃ x At(x, TTU) ⇒ Smart(x)
is true if there is anyone who is not at TTU
● Correct ∃ x At(x, TTU) ∧ Smart(x)
is true if there is someone who is at TTU and smart

© DR. JAMIL AL-SAWWA


More Examples: Representing Facts in
First-Order Logic
1. Ahmad is a professor prof(Ahmad)
2. All professors are people. ∀ x ( prof(x) → people(x) )
3. Khalid is the dean. dean(Kalid)
4. Deans are professors. ∀ x (dean(x) → prof(x))
5. Everyone is a friend of someone. ∀ x (∃ y ( friend(x, y) ) )
6. Ahmad criticized Khalid . criticize(Ahmad, Khalid )
7. People only criticize people that are not their friends.
∀ x (∀ y (person(x) ^ person(y) ^ criticize (x,y) → ¬ friend (y,x)))

© DR. JAMIL AL-SAWWA


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

➢Quantifier duality: each can be expressed using the other


➢ x Likes(x,IceCream) → x Likes(x,IceCream)
➢ x Likes(x, IceCream) → x Likes(x, IceCream)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy