First Order Logic
First Order Logic
Intelligence
FIRST ORDER LOGIC
Presented by:
DEEBA MUSHTAQ
BHARGAVI S R
AAYUSHI MAHESHWARI
FIDA KHANUM
Page 1
ASHMITA CHAVAN
DISHA A
Introduction to Representation in AI
Why structured Representation Matters in
AI ?
• Need for Structured Representation
AI systems require structured ways to represent knowledge to reason
about complex environments and make informed decisions.
• Enhanced Expressiveness:
FOL allows us to represent general statements and relationships concisely.
Example: FOL can express “All squares adjacent to pits are breezy” in a single statement, unlike
propositional logic.
• Ontological Commitment
Assumes the existence of objects and relations, ideal for environments with complex interactions.
•First-order logic is a powerful language that develops information about the objects in a more easy
way and can also express the relationship between those objects.
•We can represent atomic sentences as Predicate (term1, term2, ......, term n).
Page 3
Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
First-order logic statements can be divided into two parts:
•Subject: Subject is the main part of the statement.
•Predicate: A predicate can be defined as a relation, which binds two atoms together in a
statement.
Page 6
Quantifiers:
Quantifiers are essential in first-order logic (FOL) because they allow us to make general or specific
statements about objects within a domain. In FOL, there are two main quantifiers:
1. Universal Quantifier ( ∀)
•Symbol: ∀ (read as "for all")
•Purpose: It states that a property or relation holds for all objects in the domain.
•Usage: If we want to say that "all humans are mortal," we can represent it as:
∀
x(Human(x)→Mortal(x))
This means that for any object x, if x is a human, then x is also mortal.
•Interpretation: The statement is true only if the property holds for every single object in the domain.
2. Existential Quantifier ( ∃)
•Symbol: ∃ (read as "there exists" or "for some")
•Purpose:
• It states that there is at least one object in the domain for which a property or relation holds.
Usage: If we want to say "there exists a human who is a philosopher," we can represent it as:
∃ x ( Human(x)∧Philosopher(x))
This means that there is at least one object x such that x is a human and x is a philosopher.
•Interpretation: The statement is true if at least one object in the domain satisfies the property.
Syntax and Semantics
Operator Precedence
∧ ∨ ⇒ ⇔
Negation (¬), Equality (=),Conjunction ( ),Disjunction ( ),Implication ( ),Biconditional ( )
Page 5
USING FIRST-ORDER LOGIC
TELL(KB, King(John)) .
∀ ⇒
TELL(KB, x King(x) Person(x)) .
ASK(KB, King(John))
ASK(KB, ∃ x Person(x)) .
The kinship domain
The kinship domain in first-order logic (FOL) is a structured way to represent
relationships within a family, such as parent, sibling, child, cousin, etc.
0 is a natural number, and for every object n, if n is a natural number, then S(n) is
a natural number. So the natural numbers are 0, S(0), S(S(0)), and so on.
x+0=x
x + S(y) = S(x + y) x*0=0
x * S(y) = (x * y) + x
Sets are collections of elements, typically defined with membership and other operations like union, intersection, and
subset.
Membership:Member(x, S)
Empty Set:Member(x, ∅)
List(Head, Tail)
Knowledge engineering is the process of building a formal Application: used for special-purpose knowledge bases with a
knowledge base for a specific domain. well-defined scope and known query range. This process
A knowledge engineer investigates a domain, identifies key emphasizes clear and structured representation of domain
concepts, and formalizes objects and relationships within it. knowledge.
.
Page 8
The Electronic circuits domain
.
Page 10
The Electronic circuits domain
.
Page 10
The Electronic circuits domain
.
Page 10
The Electronic circuits domain
.
This query searches for i1,i2,i3 values which would satisfy these output values.
These combinations of i/p values { 1,1,0}, {1,0,1},{0,1,1} in C1 would give sum bit as
0 and carry bit as 1.
These i/o values verify the circuit.
Objects
Relations
Functions
Domain
1.Objects:
The model includes five objects:
Richard the Lionheart, King John,
their respective left legs, and a
crown.
2.Binary relation:
•Brotherhood Relation: {(Richard, John),
(John, Richard)}, indicating that Richard
is John’s brother and vice versa.
•On Head Relation: (crown, John),
, showing that the crown is on John's
head.
3.Unary relation:
•Person property: Both Richard and
John
•King Property: Only John has the "king"
property
•Crown Property: Only the crown has
this property
4. Functions:
Left Leg Function: The function maps
each person (Richard and John) to their
left leg. In mathematical notation:
•left-leg(Richard) = Richard's left leg
•left-leg(John) = John's left leg
,
5.Domain :
The domain of the model
includes all objects present:
Richard, John, both left legs, and
the crown.
Symbols:
The symbols come in three kinds:
• ‘Richard’ refers to Richard the Lionheart and ‘John’ refers to the evil King John.
‘Brother’ refers to the brotherhood relation, that is, the set of tuples of objects;
‘OnHead’ refers to the “on head” relation that holds between the crown and King
John;
‘Person’, ‘King’, and ‘Crown’ refer to the sets of objects that are persons, kings, and
crowns. •
•Constant symbols are therefore terms, but it is not always convenient to have
a distinct symbol to name every object .
•Consider a term f(t1,...,tn). The function symbol f refers to some function in the
model (call it F); the argument terms refer to objects in the domain (call them
d1,...,dn); and the term as a whole refers to the object that is the value of the
function F applied to d1,...,dn.
•For example, suppose the LeftLeg function symbol refers to the function and
John refers to King John, then LeftLeg(John) refers to King John’s left leg.
Atomic sentence:
•An atomic sentence (or atom for short) is formed from a predicate symbol
optionally followed by a parenthesized list of terms,
such as Brother(Richard , John).
•This states, under the intended interpretation given earlier, that Richard the
Lionheart is the brother of King John.
Presented by:
• 1DT22CS003
• 1DT22CS020
• 1DT22CS033
• 1DT22CS042
• 1DT22CS044
Page 13
• 1DT22CS046