0% found this document useful (0 votes)
21 views76 pages

First Order Logic: Dr. Shachi Natu

First-order logic (FOL) is more expressive than propositional logic and can represent complex sentences involving objects, properties, relations and functions. FOL involves terms, atomic sentences, complex sentences using connectives, and quantified sentences using quantifiers like universal and existential. It also distinguishes between free and bound variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views76 pages

First Order Logic: Dr. Shachi Natu

First-order logic (FOL) is more expressive than propositional logic and can represent complex sentences involving objects, properties, relations and functions. FOL involves terms, atomic sentences, complex sentences using connectives, and quantified sentences using quantifiers like universal and existential. It also distinguishes between free and bound variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

First Order Logic

Dr. Shachi Natu


• in propositional logic, we can only represent the facts, which are
either true or false. PL is not sufficient to represent the complex
sentences
• The propositional logic has very limited expressive power. Consider
the following sentence, which we cannot represent using PL logic.
• "Some humans are intelligent", or
• "Sachin likes cricket."
First-order logic
• First-order logic (FOL) models the world in terms of
• Objects, which are things with individual identities
• Properties of objects that distinguish them from other
objects
• Relations that hold among sets of objects
• Functions, which are a subset of relations where there is
only one “value” for any given “input”
• Examples:
• Objects: Students, lectures, companies, cars ...
• Relations: Brother-of, bigger-than, outside, part-of, has-
color, occurs-after, owns, visits, precedes, ...
• Properties: blue, oval, even, large, ...
• Functions: father-of, best-friend, second-half, one-more-
than ...
User provides
• Constant symbols, which represent individuals in the
world
• Mary
• 3
• Green
• Function symbols, which map individuals to individuals
• father-of(Mary) = John
• color-of(Sky) = Blue
• Predicate symbols, which map individuals to truth
values
• greater(5,3)
• green(Grass)
• color(Grass, Green)
FOL Provides
• Variable symbols
• E.g., x, y, foo
• Connectives
• Same as in PL: not (), and (), or (), implies (), if
and only if (biconditional )
• Quantifiers
• Universal x or (Ax)
• Existential x or (Ex)
Sentences are built from terms and atoms

• A term (denoting a real-world individual) is a constant


symbol, a variable symbol, or an n-place function of n terms.
x and f(x1, ..., xn) are terms, where each xi is a term.
A term with no variables is a ground term
• An atomic sentence (which has value true or false) is an n-
place predicate of n terms
• A complex sentence is formed from atomic sentences
connected by the logical connectives:
P, PQ, PQ, PQ, PQ where P and Q are sentences
• A quantified sentence adds quantifiers  and 
• A well-formed formula (wff) is a sentence containing no
“free” variables. That is, all variables are “bound” by
universal or existential quantifiers.
(x)P(x,y) has x bound as a universally quantified variable, but y is
free.
Atomic sentences:

• Atomic sentences are the most basic sentences of first-order logic.


These sentences are formed from a predicate symbol followed by a
parenthesis with a sequence of terms.
• We can represent atomic sentences as Predicate (term1, term2, ......,
term n).
• Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).

Complex Sentences:
• Complex sentences are made by combining atomic sentences using
connectives.
• 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.
• Consider the statement: "x is an integer.", it consists of two parts, the first
part x is the subject of the statement and second part "is an integer," is
known as a predicate.

Quantifiers
• Universal quantification
• (x)P(x) means that P holds for all values of x in the
domain associated with that variable
• E.g., (x) dolphin(x)  mammal(x)
• Existential quantification
• ( x)P(x) means that P holds for some value of x in the
domain associated with that variable
• E.g., ( x) mammal(x)  lays-eggs(x)
• Permits one to make a statement about some object
without naming it
Quantifiers
• Universal quantifiers are often used with “implies” to form “rules”:
(x) student(x)  smart(x) means “All students are smart”
• Universal quantification is rarely used to make blanket statements
about every individual in the world:
(x)student(x)smart(x) means “Everyone in the world is a student and is
smart”
• Existential quantifiers are usually used with “and” to specify a list of
properties about an individual:
(x) student(x)  smart(x) means “There is a student who is smart”
• A common mistake is to represent this English sentence as the FOL
sentence:
(x) student(x)  smart(x)
• But what happens when there is a person who is not a student?
Quantifier Scope
• Switching the order of universal quantifiers does not change the
meaning:
• (x)(y)P(x,y) ↔ (y)(x) P(x,y)
• Similarly, you can switch the order of existential quantifiers:
• (x)(y)P(x,y) ↔ (y)(x) P(x,y)
• Switching the order of universals and existentials does change
meaning:
• Everyone likes someone: (x)(y) likes(x,y)
• Someone is liked by everyone: (y)(x) likes(x,y)
• Some Examples of FOL using quantifier:
• 1. All birds fly.
In this question the predicate is "fly(bird)."
And since there are all birds who fly so it will be represented as follows.
∀x bird(x) →fly(x).
• 2. Every man respects his parent.
In this question, the predicate is "respect(x, y)," where x=man, and y= parent.
Since there is every man so will use ∀, and it will be represented as follows:
∀x man(x) → respects (x, parent).
• 3. Some boys play cricket.
In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since there
are some boys so we will use ∃, and it will be represented as:
∃x boys(x)  play(x, cricket).

• 4. Not all students like both Mathematics and Science.
In this question, the predicate is "like(x, y)," where x= student, and y= subject.
Since there are not all students, so we will use ∀ with negation, so following
representation for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].
• 5. Only one student failed in Mathematics.
In this question, the predicate is "failed(x, y)," where x= student, and y= subject.
Since there is only one student who failed in Mathematics, so we will use
following representation for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y)
→ ¬failed (x, Mathematics)].

Free and Bound Variables:
The quantifiers interact with variables which appear in a
suitable way. There are two types of variables in First-
order logic which are given below:

Free Variable: A variable is said to be a free variable in a


formula if it occurs outside the scope of the quantifier.
Example: ∀x ∃(y)[P (x, y, z)], where z is a free
variable.

Bound Variable: A variable is said to be a bound variable


in a formula if it occurs within the scope of the quantifier.
Example: ∀x [A (x) B( y)], here x and y are the
bound variables.
Connections between All and Exists

We can relate sentences involving  and 


using De Morgan’s laws:
(x) P(x) ↔ (x) P(x)
(x) P ↔ (x) P(x)
(x) P(x) ↔  (x) P(x)
(x) P(x) ↔ (x) P(x)
Quantified inference rules
• Universal instantiation
• x P(x)  P(A) (A is ground term here. i.e. a term without variables)
• Universal generalization
• P(A)  P(B) …  x P(x)
• Existential instantiation
• x P(x) P(F)  skolem constant F
• Existential generalization
• P(A)  x P(x)
Universal instantiation
(a.k.a. universal elimination)
• If (x) P(x) is true, then P(C) is true, where C is any constant in the
domain of x
• Example:
(x) eats(Ziggy, x)  eats(Ziggy, IceCream)
• The variable symbol can be replaced by any ground term, i.e., any
constant symbol or function symbol applied to ground terms only
Existential instantiation
(a.k.a. existential elimination)
• From (x) P(x) infer P(c)
• Example:
• (x) eats(Ziggy, x)  eats(Ziggy, Stuff)
• Note that the variable is replaced by a brand-new
constant not occurring in this or any other sentence in
the KB
• Also known as skolemization; constant is a skolem
constant
• In other words, we don’t want to accidentally draw
other inferences about it by introducing the constant
• Convenient to use this to reason about the unknown
object, rather than constantly manipulating the
existential quantifier
Existential generalization
(a.k.a. existential introduction)
• If P(c) is true, then (x) P(x) is inferred.
• Example
eats(Ziggy, IceCream)  (x) eats(Ziggy, x)
• All instances of the given constant symbol are replaced by the new
variable symbol
• Note that the variable symbol cannot already exist anywhere in the
expression
A Predicate Logic Example
1. Marcus was a man.

2. Marcus was a Pompeian.

3. All Pompeian were Romans.

4. Caesar was a ruler.

5. All Romans were either loyal to Caesar or


hated him.

6. Everyone is loyal to someone.

7. People only try to assassinate rulers they


are not loyal to.

8. Marcus tried to assassinate Caesar.

102
A Predicate Logic Example

103
Three Ways of Representing
Class Membership

105
Another Predicate Logic Example

1. Marcus was a man.

2. Marcus was a Pompeian.

3. Marcus was born in 40 A.D.

4. All men are mortal.

5. All Pompeians died when the volcano erupted in 79 A.D.

6. No mortal lives longer than 150 years.

7. It is now 1991.

8. Alive means not dead.

9. If someone dies, then he is dead at all later times.


107
A Set of Facts about Marcus

108
Translating English to FOL
Every gardener likes the sun.
x gardener(x)  likes(x,Sun)
You can fool some of the people all of the time.
x t person(x) time(t)  can-fool(x,t)
You can fool all of the people some of the time.
x t (person(x)  time(t) can-fool(x,t))
x (person(x)  t (time(t) can-fool(x,t)))
Equivalent
All purple mushrooms are poisonous.
x (mushroom(x)  purple(x))  poisonous(x)
No purple mushroom is poisonous.
x purple(x)  mushroom(x)  poisonous(x)
x (mushroom(x)  purple(x))  poisonous(x) Equivalent
There are exactly two purple mushrooms.
x y mushroom(x)  purple(x)  mushroom(y)  purple(y) ^ (x=y)  z
(mushroom(z)  purple(z))  ((x=z)  (y=z))
Clinton is not tall.
tall(Clinton)
X is above Y iff X is on directly on top of Y or there is a pile of one or more other
objects directly on top of one another starting with X and ending with Y.
x y above(x,y) ↔ (on(x,y)  z (on(x,z)  above(z,y)))
Example knowledge base
... it is a crime for an American to sell weapons to hostile nations:
American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x)
Nono … has some missiles
x Owns(Nono,x)  Missile(x)

… all of its missiles were sold to it by Colonel West


Missile(x)  Owns(Nono,x)  Sells(West,x,Nono)
Missiles are weapons:

Missile(x)  Weapon(x)
An enemy of America counts as "hostile“:
Enemy(x,America)  Hostile(x)
West, who is American …

American(West)
The country Nono, an enemy of America …

Enemy(Nono,America)
What is 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.
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.
For each pair of the following atomic sentences
find the most general unifier (If exist).
• 1. Find the MGU of {p(f(a), g(Y)) and p(X, X)}
• Sol: S0 => Here, Ψ1 = p(f(a), g(Y)), and Ψ2 = p(X, X)
SUBST θ= {f(a) / X}
S1 => Ψ1 = p(f(a), g(Y)), and Ψ2 = p(f(a), f(a))
SUBST θ= {f(a) / g(y)}, Unification failed.
• 2. Find the MGU of {p(b, X, f(g(Z))) and p(Z, f(Y), f(Y))}
• Here, Ψ1 = p(b, X, f(g(Z))) , and Ψ2 = p(Z, f(Y), f(Y))
S0 => { p(b, X, f(g(Z))); p(Z, f(Y), f(Y))}
SUBST θ={b/Z}
• S1 => { p(b, X, f(g(b))); p(b, f(Y), f(Y))}
SUBST θ={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 θ= {Z/X}
S1 => {p (Z, Z), p (Z, f(Z))}
SUBST θ= {f(Z) / Z}, Unification Failed.
Resolution in FOL
• 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 we
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.
Example:

• We can resolve two clauses which are given below:


• [Animal (g(x) V Loves (f(x), x)] and [¬ Loves(a, b) V ¬Kills(a,
b)]
• Where two complimentary literals are: Loves (f(x), x) and ¬ Loves (a,
b)
• These literals can be unified with unifier θ= [a/f(x), and b/x] , and it
will generate a resolvent clause:
• [Animal (g(x) V ¬ Kills(f(x), x)].
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 we will convert all the given statements into its first
order logic.
CNF
• A sentence is in Conjunctive Normal Form (CNF) if it is a conjunction
of clauses, each clause being a disjunction of literals
• Examples:

A  B  C  D  J  E  G 
Conversion to CNF
P  (Q  R)

1.Eliminate , replacing α  β with (α  β)(β  α).


(P  (Q  R))  ((Q R)  P)

2. Eliminate , replacing α  β with α β.


(P  Q  R)  ((Q R)  P)

3. Move  inwards using de Morgan's rules and double-negation:


(P Q R)  ((Q R)  P)

4. Apply distributivity law ( over ) and flatten:


(P  Q  R)  (Q P)  (R  P)
Step-2: Conversion of FOL into CNF
• Eliminate all implication (→) and
rewrite
• ∀x ¬ food(x) V likes(John, x)
• food(Apple) Λ food(vegetables)
• ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V
food(y)
• eats (Anil, Peanuts) Λ alive(Anil)
• ∀x ¬ eats(Anil, x) V eats(Harry, x)
• ∀x¬ [¬ killed(x) ] V alive(x)
• ∀x ¬ alive(x) V ¬ killed(x)
• likes(John, Peanuts).
Move negation (¬)inwards and rewrite
• Eliminate all implication (→) and
rewrite • ∀x ¬ food(x) V likes(John, x)
• ∀x ¬ food(x) V likes(John, x) • food(Apple) Λ food(vegetables)
• food(Apple) Λ food(vegetables) • ∀x ∀y ¬ eats(x, y) V killed(x) V
• ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)
food(y)
• eats (Anil, Peanuts) Λ alive(Anil) • eats (Anil, Peanuts) Λ alive(Anil)
• ∀x ¬ eats(Anil, x) V eats(Harry, x) • ∀x ¬ eats(Anil, x) V eats(Harry, x)
• ∀x¬ [¬ killed(x) ] V alive(x) • ∀x killed(x) V alive(x)
• ∀x ¬ alive(x) V ¬ killed(x) • ∀x ¬ alive(x) V ¬ killed(x)
• likes(John, Peanuts). • likes(John, Peanuts).
Rename variables or standardize variables
• ∀x ¬ food(x) V likes(John, x)
• food(Apple) Λ food(vegetables)
• ∀y ∀z ¬ eats(y, z) V killed(y) V food(z)
• eats (Anil, Peanuts) Λ alive(Anil)
• ∀w¬ eats(Anil, w) V eats(Harry, w)
• ∀g ¬killed(g) V alive(g)
• ∀k ¬ alive(k) V ¬ killed(k)
• likes(John, Peanuts).
• Eliminate existential instantiation quantifier by
elimination.
• ∀x ¬ food(x) V likes(John, x)
• food(Apple) Λ food(vegetables) • In this step, we will eliminate existential quantifier ∃, and this
process is known as Skolemization. But in this example
• ∀y ∀z ¬ eats(y, z) V killed(y) V food(z) problem since there is no existential quantifier so all the
statements will remain same in this step.
• eats (Anil, Peanuts) Λ alive(Anil) • Drop Universal quantifiers.
• ∀w¬ eats(Anil, w) V eats(Harry, w)
• In this step we will drop all universal quantifier since all the
• ∀g killed(g) V alive(g) statements are not implicitly quantified so we don't need it.
• ∀k ¬ alive(k) V ¬ killed(k) • ¬ food(x) V likes(John, x)
• food(Apple)
• likes(John, Peanuts). • food(vegetables)
• ¬ eats(y, z) V killed(y) V food(z)
• eats (Anil, Peanuts)
• alive(Anil)
• ¬ eats(Anil, w) V eats(Harry, w)
• killed(g) V alive(g)
• ¬ alive(k) V ¬ killed(k)
• likes(John, Peanuts).
• Distribute conjunction ∧ over disjunction ¬.
This step will not make any change in this problem.
• Step-3: Negate the statement to be proved
• In this statement, we will apply negation to the conclusion
statements, which will be written as ¬likes(John, Peanuts)
Step-4: Draw Resolution graph:

• ¬ food(x) V likes(John, x)
• food(Apple)
• food(vegetables)
• ¬ eats(y, z) V killed(y) V food(z)
• eats (Anil, Peanuts)
• alive(Anil)
• ¬ eats(Anil, w) V eats(Harry, w)
• killed(g) V alive(g)
• ¬ alive(k) V ¬ killed(k)
• likes(John, Peanuts).
Using Resolution in First order logic Prove the given Sentence

• The law states that, it is a crime for an American to sell weapons to


hostile nations. The country Nono, an enemy of America, has some
missiles, and all of its missiles were sold to it by Colonel West who is
American.

• Prove that West is a criminal


• it is a crime for an American to sell weapons to hostile nations
• Country Nono has some misssiles.
• all of its missiles were sold to it by Colonel West
• Missiles are weapons
• An enemy of America counts as "hostile“
• West, who is American
• The country Nono, an enemy of America
Example knowledge base
... it is a crime for an American to sell weapons to hostile nations:
American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x)
Nono … has some missiles, i.e., x Owns(Nono,x)  Missile(x): convert to two definite
clauses
Owns(Nono,M1) and Missile(M1)
… all of its missiles were sold to it by Colonel West
Missile(x)  Owns(Nono,x)  Sells(West,x,Nono)
Missiles are weapons:
Missile(x)  Weapon(x)
An enemy of America counts as "hostile“:
Enemy(x,America)  Hostile(x)
West, who is American …
American(West)
The country Nono, an enemy of America …
Enemy(Nono,America)
CNF
Resolution proof: definite clauses
Resolution example
Conversion to CNF
• Everyone who loves all animals is loved by someone:
x [y Animal(y)  Loves(x,y)]  [y Loves(y,x)]

• 1. Eliminate biconditionals and implications



x [y Animal(y)  Loves(x,y)]  [y Loves(y,x)]

• 2. Move  inwards: x p ≡ x p,  x p ≡ x p


x [y (Animal(y)  Loves(x,y))]  [y Loves(y,x)]
x [y Animal(y)  Loves(x,y)]  [y Loves(y,x)]
x [y Animal(y)  Loves(x,y)]  [y Loves(y,x)]
Conversion to CNF contd.
3. Standardize variables: each quantifier should use a different one
x [y Animal(y)  Loves(x,y)]  [z Loves(z,x)]

4. Skolemize: a more general form of existential instantiation.


Each existential variable is replaced by a Skolem function of the enclosing
universally quantified variables:
x [Animal(F(x))  Loves(x, F(x))]  Loves(G(x),x)

5. Drop universal quantifiers:


[Animal(F(x))  Loves(x,F(x))]  Loves(G(x),x)

6. Distribute  over  :
[Animal(F(x))  Loves(G(x),x)]  [Loves(x,F(x))  Loves(G(x),x)]
FOL
CNF
Resolution Proof (who kill the cat?)
Forward chaining
• The inference engine is the component of the intelligent system in
artificial intelligence, which applies logical rules to the knowledge
base to infer new information from known facts. The first inference
engine was part of the expert system. Inference engine commonly
proceeds in two modes, which are:
• Forward chaining
• Backward chaining
• Horn clause and definite clause are the forms of sentences, which enables
knowledge base to use a more restricted and efficient inference algorithm.
Logical inference algorithms use forward and backward chaining
approaches, which require KB in the form of the first-order definite clause.
• Definite clause: A clause which is a disjunction of literals with exactly one
positive literal is known as a definite clause or strict horn clause.
• Horn clause: A clause which is a disjunction of literals with at most one
positive literal is known as horn clause. Hence all the definite clauses are
horn clauses.
• Example: (¬ p V ¬ q V k). It has only one positive literal k.
• It is equivalent to p ∧ q → k.
• 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 we reach
to the goal using available data.
• Forward -chaining approach is commonly used in the expert system,
such as CLIPS, business, and production rule systems.

Example knowledge base
• The law says that it is a crime for an American to sell weapons to hostile nations.
The country Nono, an enemy of America, has some missiles, and all of its missiles
were sold to it by Colonel West, who is American.

• Prove that Col. West is a criminal



Example knowledge base
... it is a crime for an American to sell weapons to hostile nations:
American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x)
Nono … has some missiles, i.e., x Owns(Nono,x)  Missile(x): convert to two definite clauses
Owns(Nono,M1) and Missile(M1)
… all of its missiles were sold to it by Colonel West
Missile(x)  Owns(Nono,x)  Sells(West,x,Nono)
Missiles are weapons:
Missile(x)  Weapon(x)
An enemy of America counts as "hostile“:
Enemy(x,America)  Hostile(x)
West, who is American …
American(West)
The country Nono, an enemy of America …
Enemy(Nono,America)
Forward chaining proof
Forward chaining proof
Forward chaining proof
Backward Chaining:
• Backward-chaining is also known as a backward deduction or backward reasoning method when
using an inference engine. A backward chaining algorithm is a form of reasoning, which starts
with the goal and works backward, chaining through rules to find known facts that support the
goal.
• Properties of backward chaining:
• It is known as a top-down approach.
• Backward-chaining is based on modus ponens inference rule.
• In backward chaining, the goal is broken into sub-goal or sub-goals to prove the facts true.
• It is called a goal-driven approach, as a list of goals decides which rules are selected and used.
• Backward -chaining algorithm is used in game theory, automated theorem proving tools,
inference engines, proof assistants, and various AI applications.
• The backward-chaining method mostly used a depth-first search strategy for proof.

Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
Backward chaining example
S. No. Forward Chaining Backward Chaining

1. Forward chaining starts from known facts and Backward chaining starts from the goal and works backward
applies inference rule to extract more data unit it through inference rules to find the required facts that support
reaches to the goal. the goal.

2. It is a bottom-up approach It is a top-down approach

3. Forward chaining is known as data-driven inference Backward chaining is known as goal-driven technique as we
technique as we reach to the goal using the start from the goal and divide into sub-goal to extract the
available data. facts.

4. Forward chaining reasoning applies a breadth-first Backward chaining reasoning applies a depth-first search
search strategy. strategy.

5. Forward chaining tests for all the available rules Backward chaining only tests for few required rules.

6. Forward chaining is suitable for the planning, Backward chaining is suitable for diagnostic, prescription, and
monitoring, control, and interpretation application. debugging application.

7. Forward chaining can generate an infinite number of Backward chaining generates a finite number of possible
possible conclusions. conclusions.

8. It operates in the forward direction. It operates in the backward direction.

9. Forward chaining is aimed for any conclusion. Backward chaining is only aimed for the required data.

You might also like