LECTURE 5
First Order Logic
Instructor : Yousef Aburawi
Cs411 -Artificial Intelligence
Misurata University
Faculty of Information Technology
Spring 2022/2023
First Order Logic
Outline
I. Syntax of FOL
II. Quantifiers
III. Model for FOL
IV. Assertions & queries in FOL
I. Propositional Logic: Strength and Weakness
 Programming languages lack a general mechanism for deriving facts
from other facts.
 They lack the expressiveness required to handle partial information.
 Propositional logic addresses the above issues.
 It also has compositionality – the meaning of a sentence is a function
of the meanings of its parts.
¬ rain ∨ ¬ outside ∨ wet
 It lacks the expressive power to describe an environment with many objects.
𝐵1,1 ⇔ (𝑃1,2 ∨ 𝑃2,1)
𝐵1,2 ⇔ (𝑃1,1 ∨ 𝑃1,3 ∨ 𝑃2,2)
⋮
// Squares adjacent to pits are breezy.
 Propositional logic assumes the world contains facts only.
Combining Formal and Natural Languages
 Objects: people, houses, cars, trees, colors, days, …
 Relations:
 unary properties such as big, windy, …
 𝑛-ary properties such as bigger than, parent of, on, owns, …
 Functions: square of, best friend, age, …
First-order logic
 built around objects and relations
 capable of expressing facts about some or all objects
Formal Languages
Alphabet of First-Order Logic
 Logical symbols
 connectives: ∧, ∨, ⇒, ⇔, ¬
 quantifiers: ∀ (universal quantification), ∃ (existential quantification)
 parenthesis: (, ) and punctuation ,
 variables: 𝑥, 𝑦, 𝑧, … ; 𝑥1, 𝑥2, …
 equality: =
 Non-logical symbols
 constants: Socrates, Turing, 1, earth, …
 predicate symbols: true, false Father(𝑥, 𝑦) // 𝑥 is father of 𝑦
Female(𝑥) // 𝑥 is female
 function symbols:
gcd(𝑥, 𝑦) // greatest common divisor of 𝑥 and 𝑦
FatherOf(𝑥) // father of 𝑥
Terms and Atomic Sentences
 Terms
 variables: 𝑥, 𝑦, 𝑧, … ; 𝑥1, 𝑥2, …
 constants: Socrates, Turing, 1, earth, …
 functions: gcd(𝑥, 𝑦), FatherOf(𝑥), …
𝑓(𝑥1, 𝑥2, … , 𝑥𝑛)
function symbol terms
 Atomic sentences
 predicates: true, false
Mother(Aphrodite, Harmonia)
Male(John)
FatherOf(Apollo) = Zeus
 term equalities
Complex Sentences
 made of atomic sentences using logical connectives
Father(𝑥, 𝑦) ⇒ Male(𝑥)
Likes(Mary, John) ⇔ Likes(John, Mary)
(Parent(𝑥, 𝑦) ∧ Parent(𝑦, 𝑧)) ⇒ GrandParent(𝑥, 𝑧)
Female(𝑥) ∨ ¬Mother(𝑥, 𝑦)
 universal quantification
∀𝑥 Circle 𝑥 ⇒ Ellipse(𝑥) // Every circle is an ellipse.
¬∀𝑥 Likes 𝑥, sushi // Not everyone likes sushi.
 existential quantification
∃𝑥 Star 𝑥 ∧ ¬ (𝑥 = Sun)
∃𝑥 Whale 𝑥 ∧ (Age(𝑥) = 200)
∀𝑥 Integer 𝑥 ⇒ (Even 𝑥 ∨ Odd 𝑥 ) // Every integer is either even or odd.
// There are stars other than the sun.
// Some whales live to 200 years.
Syntax of First-Order Logic
II. Scope of a Quantifier
 Quantifiers ∀ and ∃ have the lowest precedence.
∀𝑥 𝑃 𝑥 ⇒ 𝑄 𝑥 ≡ ∀𝑥 (𝑃 𝑥 ⇒ 𝑄 𝑥 )
scope of ∀
∀𝑥 𝑃 𝑥 ⇒ 𝑄 𝑥 ∨ ∃𝑦 𝑅(𝑥, 𝑦) ∨ 𝑆 𝑦 ∧ 𝑇 𝑥, 𝑦
≡ ∀𝑥 (𝑃 𝑥 ⇒ (𝑄 𝑥 ∨ ∃𝑦 (𝑅 𝑥, 𝑦 ∨ (𝑆 𝑦 ∧ 𝑇 𝑥, 𝑦 ))))
scope of ∃
scope of ∀
 Each of ∀ and ∃ quantifies the remaining scope of the innermost
pair of parentheses containing it.
⋯ ⋯ ⋯ ⋯ ∀𝑥 ⋯ ⋯ ⋯ ⋯
scope of ∀
Free and Bound Variables
A variable occurrence is free in a formula if it is not quantified.
A variable occurrence is bound in a formula if it is quantified.
∀𝑥 Father(𝑥, 𝑦) ⇒ Male(𝑥) 𝑥 is bound while 𝑦 is free.
¬∀𝑥∃𝑦∃𝑧∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) 𝑥, 𝑦, 𝑧, 𝑠, 𝑡 are all bound
∀𝑥 ∀𝑦 (𝑃(𝑥) ⇒ 𝑄(𝑥, 𝑓(𝑦), 𝑧)) 𝑥, 𝑦 are bound while 𝑧 is free.
𝑃 𝑥 ⇒ ∃𝑥 𝑄(𝑥)
Free and bound variables can have the same name.
free bound
𝑃 𝑥 ⇒ (∃𝑥 𝑄 𝑥 ) ∧ 𝑅(𝑥)
same free variable
different bound
variable
Nested Quantifiers
∀𝑥∃𝑦 Student 𝑥 ∧ Course(y) ∧ Enrolled(𝑥, 𝑦)
∀𝑥∃𝑦 Brother 𝑥, 𝑦 ⇒ Sibiling(𝑥, 𝑦)
Order matters for quantifiers of different types:
∀𝑥∃𝑦 Loves 𝑥, 𝑦 // Everybody (𝑥) loves somebody (𝑦)
∃𝑥∀𝑦 Loves 𝑦, 𝑥 // There is someone (𝑥) whom everyone (𝑦) loves.
∃𝑥∃𝑦 Loves 𝑥, 𝑦 ≡ ∃𝑦∃𝑥 Loves 𝑥, 𝑦
∀𝑥∀𝑦 (Brother 𝑥, 𝑦 ⇒ Sibiling(𝑥, 𝑦))
≡ ∀𝑦∀𝑥 (Brother 𝑥, 𝑦 ⇒ Sibiling(𝑥, 𝑦))
but not for those of the same type and appearing next to each other:
Connections Between ∀ and ∃ Through ¬
∀𝑥 ¬Likes 𝑥, Parsnips ≡ ¬ ∃𝑥 Likes 𝑥, Parsnips
∀𝑥 Likes 𝑥, Icecream ≡ ¬ ∃𝑥 ¬ Likes 𝑥, Icecream
De Morgan’s rules still apply:
¬∀𝑥 𝑃(𝑥) ≡ ∃𝑥 ¬𝑃(𝑥)
¬∃𝑥 𝑃 𝑥 ≡ ∀𝑥 ¬𝑃(𝑥)
¬∀𝑥∃𝑦∃𝑧∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) ≡ ∃𝑥¬∃𝑦∃𝑧∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡)
≡ ∃𝑥∀𝑦¬∃𝑧∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡)
≡ ∃𝑥∀𝑦∀𝑧¬∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡)
≡ ∃𝑥∀𝑦∀𝑧∃𝑠¬∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡)
≡ ∃𝑥∀𝑦∀𝑧∃𝑠∃𝑡 ¬𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡)
Move negation inward,
flipping the quantifiers:
III. Model for First-Order Logic
 Sentences are true with respect to a model 𝑀.
 The model 𝑀 contains objects (called domain elements) and
interpretations of symbols.
 constant symbols → objects in domain 𝐷
 predicate symbols → relations
 function symbols → functional relations
 Each predicate 𝑃(𝑥1, … , 𝑥𝑘) is mapped to a relation over 𝐷.
 Each function 𝑓(𝑥1, … , 𝑥𝑘) is mapped to a function to 𝐷.
Model Example
Model for the family relationships of the Greek gods (incomplete).
domain 𝐷
Zeus
Ares
Hera
Aphrodite
Harmonia
Hermes
Athena
Artemis
Dionysus
Hades
Apollo Poseidon
Demeter
Hephaestus
Persephone
⋮
Father(Zeus, Hermes)
Mother(Hera, Ares)
Mother(Aphrodite, Harmonia)
Father(Zeus, Athena)
predicates
Weapon(Zeus) // ≡ Thunderbolt
Carry(Hermes) // ≡ Flute
Weapon(Apollo) // ≡ BowAndArrows
Carry(Aphrodite) // ≡ Apple
⋮
functions
Truth in First-Order Logic
 A predicate 𝑃 𝑡1, … , 𝑡𝑘 is true if the objects referred to by the terms
𝑡1, … , 𝑡𝑘 are in the relation referred to by the predicate.
 𝑡1 = 𝑡2 is true if the two terms 𝑡1 and 𝑡2 refer to the same object.
 The semantics of sentences formed with logical connectives are
identical to those in propositional logic.
Quantifiers allow us to express properties of a collection of objects
instead of enumerating them by name.
∀ (universal): “for all”
∃ (existential): “there exists”
Truths with Quantifications
 ∀𝑥 𝑃 𝑥 is true in a model 𝑀 iff 𝑃(𝑥) is true with 𝑥 assuming
every object in the model
∀𝑥 Father(𝑥, 𝑦) ⇒ Male(𝑥) true (in every model)
∀𝑥 Ellipse(𝑥) ⇒ Circle 𝑥 true (in every model)
 ∃𝑥 𝑃 𝑥 is true in a model 𝑀 iff 𝑃(𝑥) is true with 𝑥 assuming
some object in the model.
∃𝑥 Mother(𝑥, Ares) ∧ Mother(𝑥, Harmonia) false (in the model of
Greek mythology)
∃𝑥 ¬ Likes 𝑥, sushi true (in a model that includes
all the people in the world)
IV. Using FOL
A domain is some part of the world about which we wish to express
some knowledge.
Knowledge engineering represents information about the world
in a form that can be utilized by a computer to solve complex tasks
such as:
 medical diagnosis
 dialog in a natural language
 etc.
 Knowledge representation (logical rules, semantic nets, etc.)
 Automated reasoning (inference engines, theorem provers, etc.)
Assertions and Queries in FOL
 Add sentences, called assertions, to a KB using TELL.
TELL(KB, ∀𝑥∃𝑦 Brother 𝑥, 𝑦 ⇒ Sibiling(𝑥, 𝑦))
TELL(KB, Father(Zeus, Athena))
TELL(KB, Likes(John, Icecream))
 Ask the KB questions using ASK.
ASK(KB, Likes(John, Icecream))
Query: question asked
Any query is entailed by the KB should be answered affirmatively.
Substitution
Suppose another KB has the following predicates:
Bird(Swan), Bird(Crane), Bird(Parrot),
ASK(KB, ∃𝑥 Bird(𝑥))
 To know what values of 𝑥 make the sentence true
{𝑥/ Swan}, {𝑥/ Crane}, and {𝑥/ Parrot}
substitution or binding list
returns true
 Quantified query
ASKVARS(KB, Bird(𝑥))
The query returns
The Kinship Domain
Kinship relations are represented by binary predicates.
∀𝑚, 𝑐 Mother 𝑐 = 𝑚 ⇔ Female(𝑚) ∧ Parent(𝑚, 𝑐)
∀𝑤, ℎ Husband ℎ, 𝑤 ⇔ Male(ℎ) ∧ Spouse(ℎ, 𝑤)
// One’s mother is the person’s female parent.
// One’s husband is the person’s male spouse.
∀𝑝, 𝑐 Parent 𝑝, 𝑐 ⇔ Child(𝑐, 𝑝)
// Parent and child are inverse relations.
∀𝑔, 𝑐 GrandParent 𝑔, 𝑐 ⇔ ∃𝑝 (Parent(𝑔, 𝑝) ∧ Parent(𝑝, 𝑐))
// A grand parent is a parent of one’s parent
∀𝑥, 𝑠 Sibling 𝑥, 𝑠 ⇔ 𝑥 ≠ 𝑠 ∧ ∃𝑝 (Parent(𝑝, 𝑥) ∧ Parent(𝑝, 𝑠))
// A sibling is another child of one’s parent
Axioms
Axioms and Theorems
 Theorems are logical sentences entailed by axioms.
∀𝑥, 𝑦 Sibling 𝑥, 𝑦 ⇔ Sibling(𝑦, 𝑥)
// entailed by
// ∀𝑥, 𝑠 Sibling 𝑥, 𝑠 ⇔ 𝑥 ≠ 𝑠 ∧ ∃𝑝 (Parent(𝑝, 𝑥) ∧ Parent(𝑝, 𝑠))
ASK(KB, ∀𝑥, 𝑦 Sibling 𝑥, 𝑦 ⇔ Sibling(𝑦, 𝑥)) should return true.
 Axioms in a domain are logical sentences that are taken to be
true without being derived.
Readings
 Chapters 8 of Textbox.
1-23
The End

More Related Content

PDF
PDF
Exchanging More than Complete Data
PPT
Jarrar.lecture notes.aai.2011s.ch8.fol.introduction
PPTX
Introduction of predicate logics
PPTX
First order logic in artificial Intelligence.pptx
PPTX
Rough Set Semantics for Identity Management on the Web
Exchanging More than Complete Data
Jarrar.lecture notes.aai.2011s.ch8.fol.introduction
Introduction of predicate logics
First order logic in artificial Intelligence.pptx
Rough Set Semantics for Identity Management on the Web

Similar to AI_05_First Order Logic.pptx (20)

PPTX
First order logic
PDF
mathematics Lecture I______________________________
PPT
Basic Knowledge Representation in First Order Logic.ppt
PPT
basic knowledge represenatation in first order logic
PPTX
First Order Logic for MBA Graduates studets
PPT
PDF
Homogeneous Components of a CDH Fuzzy Space
PDF
L2_First_Order_Logic - AI_for_Beginners, Logic Maths
PDF
FERMAT’S LAST THEOREM PROVED BY INDUCTION (accompanied by a philosophical com...
PDF
PLEASE USE TuProlog for this. Also the facts need to be Binary Fac.pdf
PPTX
Untitled presentation unification algorithm.pptx
PPT
dfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.ppt
PDF
The Intersection Axiom of Conditional Probability
PPTX
Knowledge Representation and Reasoning.pptx
PDF
"reflections on the probability space induced by moment conditions with impli...
PDF
Presentation X-SHS - 27 oct 2015 - Topologie et perception
PPTX
MAT-314 Relations and Functions
PDF
On a Diophantine Proofs of FLT: The First Case and the Secund Case z≡0 (mod p...
PDF
First order logic
First order logic
mathematics Lecture I______________________________
Basic Knowledge Representation in First Order Logic.ppt
basic knowledge represenatation in first order logic
First Order Logic for MBA Graduates studets
Homogeneous Components of a CDH Fuzzy Space
L2_First_Order_Logic - AI_for_Beginners, Logic Maths
FERMAT’S LAST THEOREM PROVED BY INDUCTION (accompanied by a philosophical com...
PLEASE USE TuProlog for this. Also the facts need to be Binary Fac.pdf
Untitled presentation unification algorithm.pptx
dfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.ppt
The Intersection Axiom of Conditional Probability
Knowledge Representation and Reasoning.pptx
"reflections on the probability space induced by moment conditions with impli...
Presentation X-SHS - 27 oct 2015 - Topologie et perception
MAT-314 Relations and Functions
On a Diophantine Proofs of FLT: The First Case and the Secund Case z≡0 (mod p...
First order logic
Ad

More from Yousef Aburawi (7)

PPTX
AI_07_Deep Learning.pptx
PPTX
AI_06_Machine Learning.pptx
PPTX
AI_04_Logical Agents.pptx
PPTX
AI_03_Solving Problems by Searching.pptx
PPTX
AI_02_Intelligent Agents.pptx
PPTX
AI_01_introduction.pptx
PPTX
AI_08_NLP.pptx
AI_07_Deep Learning.pptx
AI_06_Machine Learning.pptx
AI_04_Logical Agents.pptx
AI_03_Solving Problems by Searching.pptx
AI_02_Intelligent Agents.pptx
AI_01_introduction.pptx
AI_08_NLP.pptx
Ad

Recently uploaded (20)

PDF
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PDF
Advancing precision in air quality forecasting through machine learning integ...
PPTX
future_of_ai_comprehensive_20250822032121.pptx
PPTX
Training Program for knowledge in solar cell and solar industry
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Connector Corner: Transform Unstructured Documents with Agentic Automation
PDF
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
EIS-Webinar-Regulated-Industries-2025-08.pdf
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
Rapid Prototyping: A lecture on prototyping techniques for interface design
Advancing precision in air quality forecasting through machine learning integ...
future_of_ai_comprehensive_20250822032121.pptx
Training Program for knowledge in solar cell and solar industry
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Connector Corner: Transform Unstructured Documents with Agentic Automation
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Introduction to MCP and A2A Protocols: Enabling Agent Communication
Improvisation in detection of pomegranate leaf disease using transfer learni...
NewMind AI Weekly Chronicles – August ’25 Week IV
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Co-training pseudo-labeling for text classification with support vector machi...
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
Comparative analysis of machine learning models for fake news detection in so...
EIS-Webinar-Regulated-Industries-2025-08.pdf
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Lung cancer patients survival prediction using outlier detection and optimize...

AI_05_First Order Logic.pptx

  • 1. LECTURE 5 First Order Logic Instructor : Yousef Aburawi Cs411 -Artificial Intelligence Misurata University Faculty of Information Technology Spring 2022/2023
  • 2. First Order Logic Outline I. Syntax of FOL II. Quantifiers III. Model for FOL IV. Assertions & queries in FOL
  • 3. I. Propositional Logic: Strength and Weakness  Programming languages lack a general mechanism for deriving facts from other facts.  They lack the expressiveness required to handle partial information.  Propositional logic addresses the above issues.  It also has compositionality – the meaning of a sentence is a function of the meanings of its parts. ¬ rain ∨ ¬ outside ∨ wet  It lacks the expressive power to describe an environment with many objects. 𝐵1,1 ⇔ (𝑃1,2 ∨ 𝑃2,1) 𝐵1,2 ⇔ (𝑃1,1 ∨ 𝑃1,3 ∨ 𝑃2,2) ⋮ // Squares adjacent to pits are breezy.  Propositional logic assumes the world contains facts only.
  • 4. Combining Formal and Natural Languages  Objects: people, houses, cars, trees, colors, days, …  Relations:  unary properties such as big, windy, …  𝑛-ary properties such as bigger than, parent of, on, owns, …  Functions: square of, best friend, age, … First-order logic  built around objects and relations  capable of expressing facts about some or all objects
  • 6. Alphabet of First-Order Logic  Logical symbols  connectives: ∧, ∨, ⇒, ⇔, ¬  quantifiers: ∀ (universal quantification), ∃ (existential quantification)  parenthesis: (, ) and punctuation ,  variables: 𝑥, 𝑦, 𝑧, … ; 𝑥1, 𝑥2, …  equality: =  Non-logical symbols  constants: Socrates, Turing, 1, earth, …  predicate symbols: true, false Father(𝑥, 𝑦) // 𝑥 is father of 𝑦 Female(𝑥) // 𝑥 is female  function symbols: gcd(𝑥, 𝑦) // greatest common divisor of 𝑥 and 𝑦 FatherOf(𝑥) // father of 𝑥
  • 7. Terms and Atomic Sentences  Terms  variables: 𝑥, 𝑦, 𝑧, … ; 𝑥1, 𝑥2, …  constants: Socrates, Turing, 1, earth, …  functions: gcd(𝑥, 𝑦), FatherOf(𝑥), … 𝑓(𝑥1, 𝑥2, … , 𝑥𝑛) function symbol terms  Atomic sentences  predicates: true, false Mother(Aphrodite, Harmonia) Male(John) FatherOf(Apollo) = Zeus  term equalities
  • 8. Complex Sentences  made of atomic sentences using logical connectives Father(𝑥, 𝑦) ⇒ Male(𝑥) Likes(Mary, John) ⇔ Likes(John, Mary) (Parent(𝑥, 𝑦) ∧ Parent(𝑦, 𝑧)) ⇒ GrandParent(𝑥, 𝑧) Female(𝑥) ∨ ¬Mother(𝑥, 𝑦)  universal quantification ∀𝑥 Circle 𝑥 ⇒ Ellipse(𝑥) // Every circle is an ellipse. ¬∀𝑥 Likes 𝑥, sushi // Not everyone likes sushi.  existential quantification ∃𝑥 Star 𝑥 ∧ ¬ (𝑥 = Sun) ∃𝑥 Whale 𝑥 ∧ (Age(𝑥) = 200) ∀𝑥 Integer 𝑥 ⇒ (Even 𝑥 ∨ Odd 𝑥 ) // Every integer is either even or odd. // There are stars other than the sun. // Some whales live to 200 years.
  • 10. II. Scope of a Quantifier  Quantifiers ∀ and ∃ have the lowest precedence. ∀𝑥 𝑃 𝑥 ⇒ 𝑄 𝑥 ≡ ∀𝑥 (𝑃 𝑥 ⇒ 𝑄 𝑥 ) scope of ∀ ∀𝑥 𝑃 𝑥 ⇒ 𝑄 𝑥 ∨ ∃𝑦 𝑅(𝑥, 𝑦) ∨ 𝑆 𝑦 ∧ 𝑇 𝑥, 𝑦 ≡ ∀𝑥 (𝑃 𝑥 ⇒ (𝑄 𝑥 ∨ ∃𝑦 (𝑅 𝑥, 𝑦 ∨ (𝑆 𝑦 ∧ 𝑇 𝑥, 𝑦 )))) scope of ∃ scope of ∀  Each of ∀ and ∃ quantifies the remaining scope of the innermost pair of parentheses containing it. ⋯ ⋯ ⋯ ⋯ ∀𝑥 ⋯ ⋯ ⋯ ⋯ scope of ∀
  • 11. Free and Bound Variables A variable occurrence is free in a formula if it is not quantified. A variable occurrence is bound in a formula if it is quantified. ∀𝑥 Father(𝑥, 𝑦) ⇒ Male(𝑥) 𝑥 is bound while 𝑦 is free. ¬∀𝑥∃𝑦∃𝑧∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) 𝑥, 𝑦, 𝑧, 𝑠, 𝑡 are all bound ∀𝑥 ∀𝑦 (𝑃(𝑥) ⇒ 𝑄(𝑥, 𝑓(𝑦), 𝑧)) 𝑥, 𝑦 are bound while 𝑧 is free. 𝑃 𝑥 ⇒ ∃𝑥 𝑄(𝑥) Free and bound variables can have the same name. free bound 𝑃 𝑥 ⇒ (∃𝑥 𝑄 𝑥 ) ∧ 𝑅(𝑥) same free variable different bound variable
  • 12. Nested Quantifiers ∀𝑥∃𝑦 Student 𝑥 ∧ Course(y) ∧ Enrolled(𝑥, 𝑦) ∀𝑥∃𝑦 Brother 𝑥, 𝑦 ⇒ Sibiling(𝑥, 𝑦) Order matters for quantifiers of different types: ∀𝑥∃𝑦 Loves 𝑥, 𝑦 // Everybody (𝑥) loves somebody (𝑦) ∃𝑥∀𝑦 Loves 𝑦, 𝑥 // There is someone (𝑥) whom everyone (𝑦) loves. ∃𝑥∃𝑦 Loves 𝑥, 𝑦 ≡ ∃𝑦∃𝑥 Loves 𝑥, 𝑦 ∀𝑥∀𝑦 (Brother 𝑥, 𝑦 ⇒ Sibiling(𝑥, 𝑦)) ≡ ∀𝑦∀𝑥 (Brother 𝑥, 𝑦 ⇒ Sibiling(𝑥, 𝑦)) but not for those of the same type and appearing next to each other:
  • 13. Connections Between ∀ and ∃ Through ¬ ∀𝑥 ¬Likes 𝑥, Parsnips ≡ ¬ ∃𝑥 Likes 𝑥, Parsnips ∀𝑥 Likes 𝑥, Icecream ≡ ¬ ∃𝑥 ¬ Likes 𝑥, Icecream De Morgan’s rules still apply: ¬∀𝑥 𝑃(𝑥) ≡ ∃𝑥 ¬𝑃(𝑥) ¬∃𝑥 𝑃 𝑥 ≡ ∀𝑥 ¬𝑃(𝑥) ¬∀𝑥∃𝑦∃𝑧∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) ≡ ∃𝑥¬∃𝑦∃𝑧∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) ≡ ∃𝑥∀𝑦¬∃𝑧∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) ≡ ∃𝑥∀𝑦∀𝑧¬∀𝑠∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) ≡ ∃𝑥∀𝑦∀𝑧∃𝑠¬∀𝑡 𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) ≡ ∃𝑥∀𝑦∀𝑧∃𝑠∃𝑡 ¬𝑃(𝑥, 𝑦, 𝑧, 𝑠, 𝑡) Move negation inward, flipping the quantifiers:
  • 14. III. Model for First-Order Logic  Sentences are true with respect to a model 𝑀.  The model 𝑀 contains objects (called domain elements) and interpretations of symbols.  constant symbols → objects in domain 𝐷  predicate symbols → relations  function symbols → functional relations  Each predicate 𝑃(𝑥1, … , 𝑥𝑘) is mapped to a relation over 𝐷.  Each function 𝑓(𝑥1, … , 𝑥𝑘) is mapped to a function to 𝐷.
  • 15. Model Example Model for the family relationships of the Greek gods (incomplete). domain 𝐷 Zeus Ares Hera Aphrodite Harmonia Hermes Athena Artemis Dionysus Hades Apollo Poseidon Demeter Hephaestus Persephone ⋮ Father(Zeus, Hermes) Mother(Hera, Ares) Mother(Aphrodite, Harmonia) Father(Zeus, Athena) predicates Weapon(Zeus) // ≡ Thunderbolt Carry(Hermes) // ≡ Flute Weapon(Apollo) // ≡ BowAndArrows Carry(Aphrodite) // ≡ Apple ⋮ functions
  • 16. Truth in First-Order Logic  A predicate 𝑃 𝑡1, … , 𝑡𝑘 is true if the objects referred to by the terms 𝑡1, … , 𝑡𝑘 are in the relation referred to by the predicate.  𝑡1 = 𝑡2 is true if the two terms 𝑡1 and 𝑡2 refer to the same object.  The semantics of sentences formed with logical connectives are identical to those in propositional logic. Quantifiers allow us to express properties of a collection of objects instead of enumerating them by name. ∀ (universal): “for all” ∃ (existential): “there exists”
  • 17. Truths with Quantifications  ∀𝑥 𝑃 𝑥 is true in a model 𝑀 iff 𝑃(𝑥) is true with 𝑥 assuming every object in the model ∀𝑥 Father(𝑥, 𝑦) ⇒ Male(𝑥) true (in every model) ∀𝑥 Ellipse(𝑥) ⇒ Circle 𝑥 true (in every model)  ∃𝑥 𝑃 𝑥 is true in a model 𝑀 iff 𝑃(𝑥) is true with 𝑥 assuming some object in the model. ∃𝑥 Mother(𝑥, Ares) ∧ Mother(𝑥, Harmonia) false (in the model of Greek mythology) ∃𝑥 ¬ Likes 𝑥, sushi true (in a model that includes all the people in the world)
  • 18. IV. Using FOL A domain is some part of the world about which we wish to express some knowledge. Knowledge engineering represents information about the world in a form that can be utilized by a computer to solve complex tasks such as:  medical diagnosis  dialog in a natural language  etc.  Knowledge representation (logical rules, semantic nets, etc.)  Automated reasoning (inference engines, theorem provers, etc.)
  • 19. Assertions and Queries in FOL  Add sentences, called assertions, to a KB using TELL. TELL(KB, ∀𝑥∃𝑦 Brother 𝑥, 𝑦 ⇒ Sibiling(𝑥, 𝑦)) TELL(KB, Father(Zeus, Athena)) TELL(KB, Likes(John, Icecream))  Ask the KB questions using ASK. ASK(KB, Likes(John, Icecream)) Query: question asked Any query is entailed by the KB should be answered affirmatively.
  • 20. Substitution Suppose another KB has the following predicates: Bird(Swan), Bird(Crane), Bird(Parrot), ASK(KB, ∃𝑥 Bird(𝑥))  To know what values of 𝑥 make the sentence true {𝑥/ Swan}, {𝑥/ Crane}, and {𝑥/ Parrot} substitution or binding list returns true  Quantified query ASKVARS(KB, Bird(𝑥)) The query returns
  • 21. The Kinship Domain Kinship relations are represented by binary predicates. ∀𝑚, 𝑐 Mother 𝑐 = 𝑚 ⇔ Female(𝑚) ∧ Parent(𝑚, 𝑐) ∀𝑤, ℎ Husband ℎ, 𝑤 ⇔ Male(ℎ) ∧ Spouse(ℎ, 𝑤) // One’s mother is the person’s female parent. // One’s husband is the person’s male spouse. ∀𝑝, 𝑐 Parent 𝑝, 𝑐 ⇔ Child(𝑐, 𝑝) // Parent and child are inverse relations. ∀𝑔, 𝑐 GrandParent 𝑔, 𝑐 ⇔ ∃𝑝 (Parent(𝑔, 𝑝) ∧ Parent(𝑝, 𝑐)) // A grand parent is a parent of one’s parent ∀𝑥, 𝑠 Sibling 𝑥, 𝑠 ⇔ 𝑥 ≠ 𝑠 ∧ ∃𝑝 (Parent(𝑝, 𝑥) ∧ Parent(𝑝, 𝑠)) // A sibling is another child of one’s parent Axioms
  • 22. Axioms and Theorems  Theorems are logical sentences entailed by axioms. ∀𝑥, 𝑦 Sibling 𝑥, 𝑦 ⇔ Sibling(𝑦, 𝑥) // entailed by // ∀𝑥, 𝑠 Sibling 𝑥, 𝑠 ⇔ 𝑥 ≠ 𝑠 ∧ ∃𝑝 (Parent(𝑝, 𝑥) ∧ Parent(𝑝, 𝑠)) ASK(KB, ∀𝑥, 𝑦 Sibling 𝑥, 𝑦 ⇔ Sibling(𝑦, 𝑥)) should return true.  Axioms in a domain are logical sentences that are taken to be true without being derived.
  • 23. Readings  Chapters 8 of Textbox. 1-23