FAI Unit-2 Module
FAI Unit-2 Module
1
IFETCE R23 Academic Year 2022-2023
• The objects in the model may be related in various ways. In the figure, Richard and John
are brothers. Formally speaking, a relation is just the set of tuples of objects that are related.
Figure 3.1 A model containing five objects, two binary relations, three unary relations
(indicated by labels on the objects), and one unary function, left-leg.
• Thus, the brotherhood relation in this model is the set
{Richard the Lionheart, King John, King John, Richard the Lionheart} (1)
• The crown is on King John’s head, so the “on head” relation contains just one tuple, the
crown, King John. The “brother” and “on head” relations are binary relations—that is, they
relate pairs of objects. The model also contains unary relations, or properties: the “person”
property is true of both Richard and John; the “king” property is true only of John
(presumably because Richard is dead at this point); and the “crown” property is true only
of the crown.
• Certain kinds of relationships are best considered as functions, in that a given object must
be related to exactly one object in this way. For example, each person has one left leg, so
the model has a unary “left leg” function that includes the following mappings:
{Richard the Lionheart} → Richard’s left leg
{King John} → John’s left leg . (2)
• Strictly speaking, models in first-order logic require total functions, that is, there must be a
value for every input tuple. Thus, the crown must have a left leg and so must each of the
left legs.
• There is a technical solution to this awkward problem involving an additional “invisible”
object that is the left leg of everything that has no left leg, including itself. Fortunately, as
2
IFETCE R23 Academic Year 2022-2023
long as one makes no assertions about the left legs of things that have no left legs, these
technicalities are of no import.
Symbols and interpretations
• The impatient reader can obtain a complete description from the formal grammar. The basic
syntactic elements of first-order logic are the symbols that stand for objects, relations, and
functions. The symbols, therefore, come in three kinds: constant symbols, which stand for
objects; predicate symbols, which stand for relations; and function symbols, which stand
for functions.
• We adopt the convention that these symbols will begin with uppercase letters. For example,
we might use the constant symbols Richard and John; the predicate symbols Brother ,
OnHead, Person, King, and Crown; and the function symbol LeftLeg.
• As with proposition symbols, the choice of names is entirely up to the user. Each predicate
and function symbol comes with an arity that fixes the number of arguments.
• As in propositional logic, every model must provide the information required to determine
if any given sentence is true or false. Thus, in addition to its objects, relations, and
functions, each model includes an interpretation that specifies exactly which objects,
relations and functions are referred to by the constant, predicate, and function symbols.
• One possible interpretation for our example—which a logician would call the intended
interpretation— is as follows:
✓ 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 given
in Equation (1); 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.
✓ LeftLeg refers to the “left leg” function, that is, the mapping given in Equation
(2).
3
IFETCE R23 Academic Year 2022-2023
Figure 3.2 The syntax of first-order logic with equality, specified in Backus–Naur form
• There are many other possible interpretations, of course. For example, one
interpretation maps Richard to the crown and John to King John’s left leg.
• There are five objects in the model, so there are 25 possible interpretations just for the
constant symbols Richard and John.
• Notice that not all the objects need have a name—for example, the intended
interpretation does not name the crown or the legs. It is also possible for an object to
have several names; there is an interpretation under which both Richard and John refer
to the crown.
Figure 3.3 Some members of the set of all models for a language with two constant
symbols, R and J, and one binary relation symbol.
• If you find this possibility confusing, remember that, in propositional logic, it is
perfectly possible to have a model in which Cloudy and Sunny are both true; it is the
job of the knowledge base to rule out models that are inconsistent with our knowledge.
• In summary, a model in first-order logic consists of a set of objects and an interpretation
that maps constant symbols to objects, predicate symbols to relations on those objects,
4
IFETCE R23 Academic Year 2022-2023
and function symbols to functions on those objects. Just as with propositional logic,
entailment, validity, and so on are defined in terms of all possible models.
• It shows that models vary in how many objects they contain—from one up to infinity—
and in the way the constant symbols map to objects. If there are two constant symbols
and one object, then both symbols must refer to the same object; but this can still happen
even with more objects. When there are more objects than constant symbols, some of
the objects will have no names.
• Because the number of possible models is unbounded, checking entailment by the
enumeration of all possible models is not feasible for first-order logic (unlike
propositional logic). Even if the number of objects is restricted, the number of
combinations can be very large. For the example in Figure 4.9, there are
137,506,194,466 models with six or fewer objects.
Terms
• A term is a logical expression that refers to an object. Constant symbols are therefore
terms, but it is not always convenient to have a distinct symbol to name every object.
• For example, in English we might use the expression “King John’s left leg” rather than
giving a name to his leg. This is what function symbols are for: instead of using a
constant symbol, we use LeftLeg(John).
• In the general case, a complex term is formed by a function symbol followed by a
parenthesized list of terms as arguments to the function symbol. It is important to
remember that a complex term is just a complicated kind of name. It is not a “subroutine
call” that “returns a value.” There is no LeftLeg subroutine that takes a person as input
and returns a leg.
• We can reason about left legs (e.g., stating the general rule that everyone has one and
then deducing that John must have one) without ever providing a definition of LeftLeg.
• This is something that cannot be done with subroutines in programming languages. The
formal semantics of terms is straightforward. 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 shown in
Equation (8.2) and John refers to King John, then LeftLeg(John) refers to King John’s
left leg. In this way, the interpretation fixes the referent of every term.
Atomic sentences
• We have both terms for referring to objects and predicate symbols for referring to
relations, we can put them together to make atomic sentences that state facts. 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).
5
IFETCE R23 Academic Year 2022-2023
• This states, under the intended interpretation given earlier, that Richard the Lionheart
is the brother of King John. Atomic sentences can have complex terms as arguments.
Thus,
Married(Father (Richard),Mother (John))
states that Richard the Lionheart’s father is married to King John’s mother.
• An atomic sentence is true in a given model if the relation referred to by the predicate
symbol holds among the objects referred to by the arguments.
Complex sentences
• We can use logical connectives to construct more complex sentences, with the same
syntax and semantics as in propositional calculus.
• Here are four sentences that are true in the model of Figure 8.2 under our intended
interpretation:
¬Brother (LeftLeg(Richard), John)
Brother (Richard, John) ∧ Brother (John,Richard)
King(Richard) ∨ King(John)
¬King(Richard) ⇒ King(John) .
Quantifiers
Once we have a logic that allows objects, it is only natural to want to express properties
of entire collections of objects, instead of enumerating the objects by name. Quantifiers let us
do this. First-order logic contains two standard quantifiers, called universal and existential.
Universal quantification (∀)
• The expression of general rules in propositional logic. Rules such as “Squares
neighboring the wumpus are smelly” and “All kings are persons” are the bread and
butter of first-order logic.
• The second rule, “All kings are persons,” is written in first-order logic as
∀ x King(x) ⇒ Person(x) .
• ∀ is usually pronounced “For all . . .”. (Remember that the upside-down A stands for
“all.”) Thus, the sentence says, “For all x, if x is a king, then x is a person.” The symbol
x is called a variable.
• By convention, variables are lowercase letters. A variable is a term all by itself, and as
such can also serve as the argument of a function—for example, LeftLeg(x). A term
with no variables is called a ground term.
• Intuitively, the sentence ∀ x P, where P is any logical expression, says that P is true for
every object x. More precisely, ∀ x P is true in a given model if P is true in all possible
extended interpretations constructed from the interpretation given in the model, where
each extended interpretation specifies a domain element to which x refers.
• This sounds complicated, but it is really just a careful way of stating the intuitive
meaning of universal quantification.
Existential quantification (∃)
6
IFETCE R23 Academic Year 2022-2023
• Universal quantification makes statements about every object. Similarly, we can make
a statement about some object in the universe without naming it, by using an existential
quantifier.
• To say, for example, that King John has a crown on his head, we write
∃ x Crown(x) ∧ OnHead(x, John) .
• ∃x is pronounced “There exists an x such that . . .” or “For some x . . .”.
• Intuitively, the sentence ∃ x P says that P is true for at least one object x. More precisely,
∃ x P is true in a given model if P is true in at least one extended interpretation that
assigns x to a domain element. That is, at least one of the following is true:
Richard the Lionheart is a crown ∧ Richard the Lionheart is on John’s head;
King John is a crown ∧ King John is on John’s head;
Richard’s left leg is a crown ∧ Richard’s left leg is on John’s head;
John’s left leg is a crown ∧ John’s left leg is on John’s head;
The crown is a crown ∧ the crown is on John’s head.
• The fifth assertion is true in the model, so the original existentially quantified sentence
is true in the model. Notice that, by our definition, the sentence would also be true in a
model in which King John was wearing two crowns. This is entirely consistent with the
original sentence “King John has a crown on his head.”
Nested quantifiers
• To express more complex sentences using multiple quantifiers. The simplest case is
where the quantifiers are of the same type. For example, “Brothers are siblings” can be
written as
∀ x ∀ y Brother (x, y) ⇒ Sibling(x, y) .
• Consecutive quantifiers of the same type can be written as one quantifier with several
variables.
• For example, to say that siblinghood is a symmetric relationship, we can write
∀ x, y Sibling(x, y) ⇔ Sibling(y, x) .
• In other cases we will have mixtures. “Everybody loves somebody” means that for
every person, there is someone that person loves:
∀ x ∃ y Loves(x, y) .
• On the other hand, to say “There is someone who is loved by everyone,” we write
∃ y ∀ x Loves(x, y) .
• The order of quantification is therefore very important. It becomes clearer if we insert
parentheses. ∀ x (∃ y Loves(x, y)) says that everyone has a particular property, namely,
the property that they love someone.
• On the other hand, ∃ y (∀ x Loves(x, y)) says that someone in the world has a particular
property, namely the property of being loved by everybody.
Equality
7
IFETCE R23 Academic Year 2022-2023
• First-order logic includes one more way to make atomic sentences, other than using a
predicate and terms as described earlier. We can use the equality symbol to signify that
two terms refer to the same object.
• For example,
Father (John)=Henry
says that the object referred to by Father (John) and the object referred to by Henry are
the same. Because an interpretation fixes the referent of any term, determining the truth
of an equality sentence is simply a matter of seeing that the referents of the two terms
are the same object.
• The equality symbol can be used to state facts about a given function, as we just did for the
Father symbol. It can also be used with negation to insist that two terms are not the same
object.
• To say that Richard has at least two brothers, we would write
∃ x, y Brother (x,Richard) ∧ Brother (y,Richard) ∧ ¬(x=y) .
• The sentence
∃ x, y Brother (x,Richard) ∧ Brother (y,Richard)
does not have the intended meaning. In particular, it is true in the model of Figure 4.10,
where Richard has only one brother. To see this, consider the extended interpretation
in which both x and y are assigned to King John. The addition of ¬(x=y) rules out such
models. The notation x 6= y is sometimes used as an abbreviation for ¬(x=y).
USING FIRST-ORDER LOGIC
First-order logic (FOL), also known as predicate logic, is a powerful representation language
that extends propositional logic by including quantifiers, predicates, and variables.
i. Assertions and Queries in First-Order Logic
First-Order Logic (FOL) is a formal language for representing facts about the world. It is
more expressive than propositional logic because it includes objects, relations, and quantifiers.
Assertions in FOL
• Definition: Assertions in FOL are statements about the world, expressed using
constants, predicates, and quantifiers.
• Structure:
o Constants: Represent specific objects (e.g., John, Paris).
o Predicates: Represent properties or relationships (e.g., Loves(John, Mary)
means "John loves Mary").
o Quantifiers:
▪ Universal (∀): "For all"
▪ Existential (∃): "There exists"
• Example:
o "All humans are mortal" can be written as:
∀x (Human(x) → Mortal(x))
Queries in FOL
8
IFETCE R23 Academic Year 2022-2023
• Queries ask whether certain statements (formulas) can be logically inferred from the
given set of assertions (knowledge base).
• Example:
o Knowledge Base (KB):
Human(Socrates)
∀x (Human(x) → Mortal(x))
o Query: Mortal(Socrates)?
o Answer: Yes (based on the KB and inference rules).
ii. The Kinship Domain
The kinship domain represents relationships between family members, using FOL to capture
complex relational knowledge.
Key Concepts
• Family Relations: Represented as predicates like Parent(x, y), Sibling(x, y), Cousin(x,
y), etc.
• Rules and Assertions: Define relationships using logical expressions.
• Example Assertions:
o Parent(John, Mary) (John is a parent of Mary)
o ∀x ∀y (Parent(x, y) → Ancestor(x, y)) (A parent is an ancestor)
o ∀x ∀y ∀z ((Parent(x, y) ∧ Parent(y, z)) → Grandparent(x, z)) (A parent's parent
is a grandparent)
Query Example
• Query: "Is John an ancestor of Sarah?"
• Knowledge Base:
o Parent(John, Mary)
o Parent(Mary, Sarah)
o ∀x ∀y (Parent(x, y) → Ancestor(x, y))
o ∀x ∀y ∀z ((Parent(x, y) ∧ Ancestor(y, z)) → Ancestor(x, z))
• Answer: Yes, based on the inference rules.
iii. Numbers, Sets, and Lists
Numbers in FOL
• Numbers can be represented with functions and predicates. For example:
o Plus(x, y, z) means x + y = z.
o GreaterThan(x, y) means x > y.
Sets in FOL
• Sets are represented using membership and subset relations:
o Member(x, S) means x is a member of set S.
o Subset(S1, S2) means S1 is a subset of S2.
• Example:
o "All humans belong to the set of mortals" can be expressed as:
∀x (Human(x) → Member(x, Mortals))
Lists in FOL
9
IFETCE R23 Academic Year 2022-2023
10
IFETCE R23 Academic Year 2022-2023
11
IFETCE R23 Academic Year 2022-2023
• Example:
o Query: "Does John have the flu?"
▪ HasDisease(John, Flu)?
▪ Answer: Yes, based on the KB and rules.
7. Debug and Improve the Knowledge Base
Test the knowledge base with different cases, identify inconsistencies, and refine the rules
and facts.
Examples of Domains
1. The Kinship Domain
The kinship domain models family relationships.
• Vocabulary:
o Constants: John, Mary, Sue
o Predicates:
▪ Parent(x, y) (x is a parent of y)
▪ Sibling(x, y) (x and y are siblings)
▪ Ancestor(x, y) (x is an ancestor of y)
• General Rules:
o A parent is an ancestor:
∀x ∀y (Parent(x, y) → Ancestor(x, y))
o A parent's ancestor is also an ancestor:
∀x ∀y ∀z ((Parent(x, y) ∧ Ancestor(y, z)) → Ancestor(x, z))
• Specific Facts:
o Parent(John, Mary)
o Parent(Mary, Sue)
• Query:
"Is John an ancestor of Sue?"
o Answer: Yes, derived using the rules.
2. Numbers, Sets, and Lists
FOL can represent mathematical objects like numbers, sets, and lists.
• Numbers:
o Vocabulary:
▪ Plus(x, y, z) means x + y = z.
▪ GreaterThan(x, y) means x > y.
o Example Rule: Addition is commutative:
∀x ∀y ∀z (Plus(x, y, z) → Plus(y, x, z))
• Sets:
o Vocabulary:
▪ Member(x, S) means x is a member of set S.
▪ Subset(S1, S2) means S1 is a subset of S2.
o Example Rule: If x is in S1 and S1 is a subset of S2, then x is in S2:
∀x ∀S1 ∀S2 ((Member(x, S1) ∧ Subset(S1, S2)) → Member(x, S2))
12
IFETCE R23 Academic Year 2022-2023
• Lists:
o Vocabulary:
▪ Cons(h, t) represents a list with head h and tail t.
▪ Nil is the empty list.
o Example Rule: A list is empty if and only if it is Nil:
∀x (List(x) ↔ (x = Nil ∨ ∃h ∃t (Cons(h, t) = x)))
3. The Wumpus World
The Wumpus World is a classic domain used to demonstrate reasoning in an uncertain
environment.
• Vocabulary:
o Constants: Grid locations (x, y)
o Predicates:
▪ Breeze(x, y) (breeze at location (x, y))
▪ Pit(x, y) (pit at location (x, y))
▪ Stench(x, y) (stench at location (x, y))
▪ Wumpus(x, y) (Wumpus at location (x, y))
• General Rules:
o If there is a breeze at (x, y), a pit is adjacent:
∀x ∀y (Breeze(x, y) → ∃a ∃b (Pit(a, b) ∧ Adjacent(a, b, x, y)))
o If there is a stench at (x, y), the Wumpus is adjacent:
∀x ∀y (Stench(x, y) → ∃a ∃b (Wumpus(a, b) ∧ Adjacent(a, b, x, y)))
• Specific Facts:
o Breeze(2, 2)
o Adjacent(2, 2, 1, 2)
• Query: "Is there a pit at (1, 2)?"
o Answer: Yes, derived using the rules.
Inference in FOL
1. Universal Elimination:
Replace universal quantifiers with specific instances.
Example:
∀x (Human(x) → Mortal(x)) → Human(Socrates) → Mortal(Socrates)
2. Existential Instantiation:
Replace existential quantifiers with specific constants.
Example:
∃x Loves(x, Mary) → Loves(John, Mary)
3. Resolution:
The primary method for inference, combining clauses to resolve queries.
Challenges in Knowledge Engineering
1. Choosing the Right Representation: Ensuring the vocabulary and rules fully capture
the domain.
2. Handling Ambiguity: Avoiding conflicts or incomplete information.
13
IFETCE R23 Academic Year 2022-2023
14
IFETCE R23 Academic Year 2022-2023
16
IFETCE R23 Academic Year 2022-2023
UNIFICATION
Unification:
✓ Unification is a process of making two different logical atomic expressions identical
by finding a substitution. Unification depends on the substitution process.
✓ It takes two literals as input and makes them identical using substitution.
✓ Let Ψ1 and Ψ2 be two atomic sentences and 𝜎 be a unifier such that, Ψ1𝜎 = Ψ2𝜎,
then it can be expressed as UNIFY(Ψ1, Ψ2).
Example: Find the MGU for Unify{King(x), King(John)}
Let Ψ1 = King(x), Ψ2 = King(John),
Substitution θ = {John/x} is a unifier for these atoms and applying this substitution,
and both expressions will be identical.
✓ The UNIFY algorithm is used for unification, which takes two atomic sentences and
returns a unifier for those sentences (If any exist).
✓ Unification is a key component of all first-order inference algorithms. It returns fail if
the expressions do not match with each other.
✓ The substitution variables are called Most General Unifier or MGU.
Example. Let's say there are two different expressions, P(x, y), and P(a, f(z)).
In this example, need to make both above statements identical to each other. For this,will
perform the substitution.
P(x, y) .......... (i)
P(a, f(z)) ......... (ii)
✓ Substitute x with a, and y with f(z) in the first expression, and it will be represented as
a/x and f(z)/y.
✓ With both the substitutions, the first expression will be identical to the second
expression and the substitution set will be: [a/x, f(z)/y].
Conditions for Unification:
Following are some basic conditions for unification:
• Predicate symbol must be same, atoms or expression with different predicate
symbol can never be unified.
• Number of Arguments in both expressions must be identical.
• Unification will fail if there are two similar variables present in the same expression.
Unification Algorithm:
Algorithm: Unify(Ψ1, Ψ2)
Step. 1: If Ψ1 or Ψ2 is a variable or constant, then:
a) If Ψ1 or Ψ2 are identical, then return NIL.
b) Else if Ψ1is a variable,
a. then if Ψ1 occurs in Ψ2, then return FAILURE
b. Else return { (Ψ2/ Ψ1)}.
c) Else if Ψ2 is a variable,
a. If Ψ2 occurs in Ψ1 then return FAILURE,
b. Else return {( Ψ1/ Ψ2)}.
17
IFETCE R23 Academic Year 2022-2023
18
IFETCE R23 Academic Year 2022-2023
θ={f(Y) /X}
S2 =>{ p(b, f(Y), f(g(b))); p(b,
f(Y), f(Y))} SUBST θ= {g(b)
/Y}
S2 =>{ p(b, f(g(b)), f(g(b)); p(b, f(g(b)), f(g(b))}
Unified Successfully. And Unifier = { b/Z, f(Y) /X
, g(b) /Y}.
3. Find the MGU of {p (X, X),
and p (Z, f(Z))} Here,
Ψ1 = {p (X, X), and Ψ2
= p (Z, f(Z)) S0 => {p
(X, X), p (Z, f(Z))}
SUBST θ= {X/Z}
S1 => {p (Z, Z), p (Z, f(Z))}
SUBST θ= {f(Z) / Z}, Unification Failed.
Hence, unification is not possible for these expressions.
3.4 FORWARD CHAINING
Forward chaining is also known as a forward deduction or forward reasoning method
when using an inference engine. Forward chaining is a form of reasoning which start with
atomic sentences in the knowledge base and applies inference rules (Modus Ponens) in the
forward direction to extract more data until a goal is reached.
The Forward-chaining algorithm starts from known facts, triggers all rules whose
premises are satisfied, and add their conclusion to the known facts. This process repeats until
the problem is solved.
Properties of Forward-Chaining:
• It is a down-up approach, as it moves from bottom to top.
• It is a process of making a conclusion based on known facts or data, by
starting from the initial state and reaches the goal state.
• Forward-chaining approach is also called as data-driven as reach to the goal
using available data.
Example:
"As per the law, it is a crime for an American to sell weapons to hostile nations. Country
A, an enemy of America, has some missiles, and all the missiles were sold to it by Robert,
who is an American citizen." Prove that "Robert is criminal."
To solve the above problem, first, convert all the above facts into first-order definite
clauses, and then use a forward-chaining algorithm to reach the goal.
Facts Conversion into FOL:
It is a crime for an American to sell weapons to hostile nations. (Let's say p, q,
and r are variables) American (p) ∧ weapon(q) ∧ sells (p, q, r) ∧ hostile(r) →
Criminal(p) ...(1)
Country A has some missiles. p Owns(A, p) ∧ Missile(p). It can be written in two
19
IFETCE R23 Academic Year 2022-2023
Step-2:
At the second step, see those facts which infer from available facts and with satisfied
premises.
▪ Rule-(1) does not satisfy premises, so it will not be added in the first iteration.
▪ Rule-(2) and (3) are already added.
▪ Rule-(4) satisfy with the substitution {p/T1}, so Sells (Robert, T1, A) is added, which
infers from the conjunction of Rule (2) and (3).
▪ Rule-(6) is satisfied with the substitution(p/A), so Hostile(A) is added and which
infers from Rule- (7).
20
IFETCE R23 Academic Year 2022-2023
Step-3:
21
IFETCE R23 Academic Year 2022-2023
Step-2: At the second step, infer other facts form goal fact which satisfies the rules. So as in
Rule-1, the goal predicate Criminal (Robert) is present with substitution {Robert/P}. So add all
the conjunctive facts below the first level and will replace p with Robert.
Step-4: At step-4, can infer facts Missile(T1) and Owns(A, T1) form Sells(Robert, T1, r)
which satisfies the Rule- 4, with the substitution of A in place of r. So these two statements
are proved here.
22
IFETCE R23 Academic Year 2022-2023
Step-5: At step-5, can infer the fact Enemy(A, America) from Hostile(A) which satisfies
Rule- 6. And hence all the statements are proved true using backward chaining.
1. Forward chaining starts from known Backward chaining starts from the goal and
facts and applies inference rule to works backward through inference rules to
extract more data unit it reaches to find the required facts that support the goal.
the goal.
2. It is a bottom-up approach It is a top-down approach
23
IFETCE R23 Academic Year 2022-2023
5. Forward chaining tests for all the Backward chaining only tests for few
available rules required rules.
6. Forward chaining is suitable Backward chaining is suitable for
for the planning, monitoring, diagnostic, prescription, and debugging
control, and interpretation application.
application.
7. Forward chaining can generate an Backward chaining generates a finite
infinite number of possible number of possible conclusions.
conclusions.
8. It operates in the forward direction. It operates in the backward direction.
9. Forward chaining is aimed for Backward chaining is only aimed for the
any conclusion. required data.
3.5 RESOLUTION
• Resolution is a theorem proving technique that proceeds by building refutation proofs,
i.e., proofs by contradictions. It was invented by a Mathematician John Alan Robinson
in the year 1965.
• Resolution is used, if there are various statements are given, and need to prove a
conclusion of those statements. Unification is a key concept in proofs by resolutions.
Resolution is a single inference rule which can efficiently operate on the conjunctive
normal form or clausal form.
• Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also known
as a unit clause.
Steps for Resolution:
• Conversion of facts into first-order logic.
• Convert FOL statements into CNF
• Negate the statement which needs to prove (proof by contradiction)
• Draw resolution graph (unification).
Example:
John likes all kind of food.
Apple and vegetable are food
Anything anyone eats and not killed is food.
Anil eats peanuts and still alive
Harry eats everything that Anil eats.
Prove by resolution that: John likes peanuts.
Step-1: Conversion of Facts into FOL
In the first step convert all the given statements into its first order logic.
24
IFETCE R23 Academic Year 2022-2023
25
IFETCE R23 Academic Year 2022-2023
Hence the negation of the conclusion has been proved as a complete contradiction with
the given set of statements.
Explanation of Resolution graph
• In the first step of resolution graph, ¬likes(John, Peanuts) , and likes(John,
x) get resolved(canceled) by substitution of {Peanuts/x}, and we are left with ¬
food(Peanuts)
• In the second step of the resolution graph, ¬ food(Peanuts) , and food(z) get
resolved (canceled) by substitution of { Peanuts/z}, and we are left with ¬ eats(y,
Peanuts) V killed(y) .
• In the third step of the resolution graph, ¬ eats(y, Peanuts) and eats (Anil,
26
IFETCE R23 Academic Year 2022-2023
Peanuts) get resolved by substitution {Anil/y}, and we are left with Killed(Anil)
.
• In the fourth step of the resolution graph, Killed(Anil) and ¬ killed(k) get resolve
by substitution
{Anil/k}, and we are left with ¬ alive(Anil) .
In the last step of the resolution graph ¬ alive(Anil) and alive(Anil) get resolved.
27