Using First Order Logic (FOL)
First Order Logic (FOL) is used to represent knowledge about objects and their relationships using
predicates, variables, and quantifiers.
It allows us to write statements like “all”, “some”, “exists”, “every” in a mathematical logical form.
Important Points
1. Universal Quantifier ( ∀ )
Symbol: ∀
Meaning: “for all” or “every”
It is usually used with implication ( → )
Form:
∀ x P( x)→Q(x )
Meaning:
For every x, if P(x) is true then Q(x) is true.
Example
Sentence:
All birds fly.
Predicate representation:
∀ x Bird (x)→ Fly ( x)
Meaning:
For every x, if x is a bird then x can fly.
2. Existential Quantifier ( ∃ )
Symbol: ∃
Meaning: “there exists” or “some”
It is usually used with AND ( ∧ )
Form
∃ x P(x )∧Q (x)
Meaning:
There exists an x such that P(x) and Q(x) are true.
Example
Sentence:
Some boys are intelligent.
Predicate representation:
∃ x Boy(x )∧ Intelligent ( x)
Meaning:
There exists x such that x is a boy and intelligent.
Properties of Quantifiers
1. Universal Quantifier Property
∀ x ∀ y ≡∀ y ∀ x
Order does not matter.
Example:
∀x ∀y P(x,y)
∀y ∀x P(x,y)
is same as
2. Existential Quantifier Property
∃ x ∃ y ≡∃ y ∃ x
Order does not matter.
3. Mixed Quantifier Property
∃x ∀ y≠ ∀ y∃ x
Order matters.
Example difference:
∃x∀y P(x,y) → There exists one x that works for all y
∀y∃x P(x,y) → For every y there exists some x
These meanings are different.
Summary
First Order Logic uses:
Symbol Meaning
∀ For all / Every
∃ There exists / Some
∧ AND
∨ OR
→ Implication
¬ NOT
Universal quantifier (∀) → used for all objects
Existential quantifier (∃) → used for some objects
Using First Order Logic (FOL)
Using First Order Logic means representing real-world statements, facts, and relationships in a
formal logical form using predicates, variables, and quantifiers.
In simple words, it is the process of converting natural language sentences into logical expressions
so that a computer or AI system can understand and reason about them.
Key Components Used in FOL
1. Predicates
Predicates represent properties or relationships between objects.
Example:
o Man(x) → x is a man
o Likes(x, y) → x likes y
2. Variables
Variables represent objects in the domain.
Examples:
o x, y, z
3. Quantifiers
Universal Quantifier (∀) – means for all / every
Example:
All birds fly
∀ x (Bird (x )→ Fly ( x))
Meaning: If x is a bird, then x can fly.
Existential Quantifier (∃) – means there exists / some
Example:
Some boys are intelligent
∃ x (Boy (x)∧ Intelligent ( x))
Meaning: There exists a boy who is intelligent.
Using First Order Logic is the method of representing knowledge and relationships between
objects using predicates, variables, and quantifiers to perform logical reasoning in Artificial
Intelligence.
8.3 Using First-Order Logic (Simple Explanation)
First-Order Logic (FOL) is used to represent knowledge about objects and relationships.
Example objects:
People
Numbers
Family members
Sets
We store knowledge in a Knowledge Base (KB) and then ask questions to it.
Two important operations:
TELL → Add information to KB
ASK → Ask questions from KB
1. Assertions and Queries
Assertions (Adding facts)
Assertions are sentences added to knowledge base.
Example:
TELL(KB, King(John))
Meaning:
➡ John is a king.
TELL(KB, Person(Richard))
Meaning:
➡ Richard is a person.
TELL(KB, ∀x King(x) → Person(x))
Meaning:
➡ All kings are persons.
Queries (Asking questions)
Queries ask if something is true or false.
Example:
ASK(KB, King(John))
Answer → True
Because KB already contains that fact.
Another query:
ASK(KB, Person(John))
Answer → True
Why?
Because:
John is a king
All kings are persons
So logically → John is a person.
Quantified Queries
Example:
ASK(KB, ∃x Person(x))
Meaning:
➡ Is there at least one person?
Answer → True
ASKVAR
If we want to know which values satisfy a query, we use:
ASKVARS(KB, Person(x))
Answer:
{x / John}
{x / Richard}
Meaning:
x can be:
John
Richard
This is called a substitution or binding list.
2. Kinship Domain (Family Relationships)
This section explains family relations using logic.
Objects in this domain:
People
Predicates used:
Predicate Meaning
Male(x) x is male
Female(x) x is female
Parent(x,y) x is parent of y
Sibling(x,y) x and y are siblings
Spouse(x,y) x married to y
Child(x,y) x child of y
Example Definitions
Mother
Mother(c) = m ⇔ Female(m) ∧ Parent(m,c)
Meaning:
m is mother of c if
m is female
m is parent of c
Husband
Husband(h,w) ⇔ Male(h) ∧ Spouse(h,w)
Meaning:
h is husband of w if
h is male
h is spouse of w
Male and Female
∀x Male(x) ⇔ ¬Female(x)
Meaning:
A person cannot be both male and female.
Parent and Child
Parent(p,c) ⇔ Child(c,p)
Meaning:
If p is parent of c
then c is child of p.
Grandparent
Grandparent(g,c) ⇔ ∃p Parent(g,p) ∧ Parent(p,c)
Meaning:
g is grandparent of c if:
g is parent of p
p is parent of c
Sibling
Sibling(x,y) ⇔ x ≠ y ∧ ∃p Parent(p,x) ∧ Parent(p,y)
Meaning:
x and y are siblings if:
they are different persons
they have the same parent
3. Axioms and Theorems
Axioms
Axioms = basic facts or rules
Example:
Male(Jim)
Spouse(Jim, Laura)
These are stored in KB.
Theorems
Theorems = results derived from axioms
Example:
Sibling relation is symmetric:
Sibling(x,y) ⇔ Sibling(y,x)
Meaning:
If x is sibling of y
then y is sibling of x.
4. Numbers in First-Order Logic
FOL can also represent natural numbers.
Basic elements:
Symbol Meaning
0 First number
S(n) Successor of n
Example:
NatNum(0)
0 is a natural number.
∀n NatNum(n) ⇒ NatNum(S(n))
Meaning:
If n is natural number
then S(n) is also natural number.
Examples:
0
S(0) = 1
S(S(0)) = 2
Addition Definition
Addition is defined using successor.
+(0,m) = m
Meaning:
0+m=m
+(S(m),n) = S(+(m,n))
Meaning:
(m+1)+n = (m+n)+1
5. Sets in First-Order Logic
Sets can also be represented.
Symbols:
Symbol Meaning
{} empty set
x∈s x is element of set s
s1 ⊆ s2 subset
Important Rules
1. Set creation
s = {} OR s = {x|s2}
Meaning:
A set is either:
empty set
element added to another set
2. Empty set
Empty set has no elements.
3. Adding existing element
If element already exists, adding again does nothing.
4. Membership
x belongs to set s if it was added to that set.
5. Subset
s1 ⊆ s2 ⇔ ∀x (x ∈ s1 → x ∈ s2)
Meaning:
All elements of s1 are in s2.
6. Equality of sets
s1 = s2 ⇔ s1 ⊆ s2 AND s2 ⊆ s1
Meaning:
Two sets are equal if both are subsets of each other.
Super Simple Summary (For Exam)
First-Order Logic is used to represent knowledge about objects, relationships, numbers, and sets.
Important concepts:
1️⃣ Assertions → Facts added to KB using TELL
2️⃣ Queries → Questions asked using ASK
3️⃣ Kinship domain → Represents family relations
4️⃣ Axioms → Basic rules or facts
5️⃣ Theorems → Derived conclusions
6️⃣ Numbers → Defined using successor function S(n)
7️⃣ Sets → Defined using membership and subset rules