0% found this document useful (0 votes)
21 views

Module 3 and 4

1) The document discusses artificial intelligence and logical agents. It describes propositional logic and first-order logic. 2) Propositional logic represents facts as symbols and uses Boolean operators like AND, OR, and NOT. Truth tables define valid sentences. Inference rules like modus ponens are used to derive new facts. 3) An example agent uses propositional logic to represent a Wumpus world and find the location of the Wumpus monster based on percepts like stench and breeze.

Uploaded by

wishfor178
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Module 3 and 4

1) The document discusses artificial intelligence and logical agents. It describes propositional logic and first-order logic. 2) Propositional logic represents facts as symbols and uses Boolean operators like AND, OR, and NOT. Truth tables define valid sentences. Inference rules like modus ponens are used to derive new facts. 3) An example agent uses propositional logic to represent a Wumpus world and find the location of the Wumpus monster based on percepts like stench and breeze.

Uploaded by

wishfor178
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

ARTIFICIAL INTELLIGENCE

Logical Agents – propositional logic – inferences – first-order logic – inferences in


first-order logic – forward chaining- backward chaining – unification – resolution
2.0 Logic:
• A knowledge representation language in which syntax and semantics are defined
correctly is known as logic.

• A formal language to represent the knowledge in which reasoning is carried out to


achieve the goal state.

• Logics consists of the following two representations in sequence,


➢ A formal system is used to describe the state of the world
✓ Syntax “ Which describes how to make sentences”
✓ Semantics “ Which describes the meaning of the sentences”
➢ The proof theory “a set of rule for deducing the entailments of a set of
sentences.

• We will represent the sentences using two different logics, They are,
➢ Propositional Logic (or) Boolean logic
➢ Predicate logic (or) First order logic

2.1 Logical Agents:


• The Logical agent has to perform the following task using logic representation. The
tasks are,
✓ To know the current state of the world
✓ How to infer the unseen properties of the world
✓ New changes in the environment
✓ Goal of the agent
1
Page
✓ How to perform actions depends on circumstances

2.2 Propositional Logic:


• Each fact is represented by one symbol.
• Proposition symbols can be connected with Boolean connectives, to give more
complex meaning. Connectives ,
o Λ Logical Conjunction
o V Logical disjunction
o ¬ Negation
o ⇔ Material Equivalence or Biconditional
o ⇒ Material Implication or conditional
• Simple statements are implemented
• The Symbols of propositional logic are the logical constants, (True and False)
• For Example: - P, Q
Connectives
Λ (and) ----------------------- Example: - P Λ Q
V (or) ------------------------- Example: - P V Q
⇒ (implies) ------------------ Example: - (P Λ Q) ⇒ R
- (equivalent) ------------- Example: - (P Λ Q) ⇔ (Q Λ P)
¬ (not) ------------------------ Example: - ¬ P
• A BNF (Backus-Naur Form) grammer of sentence in propositional logic

Sentence ------------------------> Atomic sentence | complex sentence


Atomic sentence -------------- > True | False | P | Q | R |
Complex sentence ---------> (sentence) | sentence connective sentence |
¬ Sentence
Connective ------------------ > Λ | V | ⇒ | ⇔

• Order of precedence ( from highest to lowest) : ¬ , Λ , V , ⇒ and ⇔


• Example : - ¬P VQ ΛR ⇒ S is equivalent to ((¬P )V(Q Λ R)) ⇒ S
• The following truth table shows the five logical connectives

P Q ¬P PΛQ PVQ P ⇒Q P⇔ Q
False False True False False True True
False True True False True True False
True False False False True False False
True True False True True True True

• These truth table can be used to define the validity of a sentence.


• If the sentence is true in every row (i.e. for different types of logical constants) then
the sentence is a valid sentence.
• For Example: - ((P V H) Λ¬H) ⇒ P Check whether the given sentence is a valid
sentence or not.
P H PVH (P V H) Λ¬H ((P V H) Λ¬H) ⇒ P
False False False False True
False True True False True
True False True True True
2

True True True False True


Page
• The given sentence is ((P V H) Λ¬H) ⇒ P valid sentence, because the sentence is TRUE
in every row for different types of logical statements.

2.3 Inference Rules for Propositional logic:

• The propositional logic has seven inference rules.


• Inference means conclusion reached by reasoning from data or premises; speculation.
• A procedure which combines known facts to produce ("infer") new facts.
• Logical inference is used to create new sentences that logically follow from a given set
of predicate calculus sentences (KB).
• An inference rule is sound if every sentence X produced by an inference rule operating
on a KB logically follows from the KB. (That is, the inference rule does not create any
contradictions)
• An inference rule is complete if it is able to produce every expression that logically
follows from (is entailed by) the KB. (Note the analogy to complete search algorithms.)
• Here are some examples of sound rules of inference
A rule is sound if its conclusion is true whenever the premise is true

Rule Premise Conclusion


Modus Ponens A, A → B B
And Introduction A, B AB
And Elimination AB AB
Or Introduction A, B A
Double Negation A A
Unit Resolution A  B, B A
Resolution A  B, B  C AC

2.4 An Agent for the Wumpus world – Propositional logic


• We will discuss the knowledge base representation and a method to find the wumpus
using propositional logic representation.
• From the following figure assume that the agent has reached the square (1,2)

3
Page
• The Knowledge Base: The agent percepts are converted into sentences and entered into
the knowledge base, with some valid sentences that are entailed by the percept sentences
• From the above figure we can perceive the following percept sentences and it is added to
the knowledge base.

 S1, 1 B1, 1 ----- for the square (1, 1)


 S2, 1 B2, 1 ----- for the square (2, 1)
S1, 2 B1, 2 ----- for the square (1, 2)
S1, 2 ----- There is a stench in (1, 2)
 B1, 2 ----- There is a breeze in (1, 2)
 S2, 1 ----- There is a stench in (2, 1)
B2, 1 ----- There is a breeze in (2, 1)
 S1, 1 ----- There is a stench in (1, 1)
 B1, 1 ----- There is a breeze in (1, 1)
• The rule of three squares,
▪ R1 :-  S1, 1 ⇒  W1 1   W1 2   W2 1
▪ R2:-  S2, 1 ⇒  W1 1   W2 2   W2 1   W3 1
▪ R3:-  S1, 2 ⇒  W1 1   W1 2   W2 2   W1 3
▪ R4:-  S1, 2 ⇒ W1 3  W1 2  W2 2  W1 1

• Finding the wumpus as, We can prove that the Wumpus is in (1, 3) using the four
rules given.
o Apply Modus Ponens with S1 1 and R1:
▪  W1 1   W1 2   W2 1
o Apply And-Elimination to this, yielding three sentences:
▪  W1 1,  W1 2,  W2 1
o Apply Modus Ponens to S21 and R2, then apply And-elimination:
▪  W2 2,  W2 1,  W3 1
o Apply Modus Ponens to S12 and R4 to obtain:
▪ W1 3  W1 2  W2 2  W1 1
o Apply Unit resolution on (W1 3  W1 2  W2 2  W1 1) and  W1 1:
▪ W1 3  W1 2  W2 2
o Apply Unit Resolution with (W1 3  W1 2  W2 2) and W2 2:
▪ W1 3  W1 2
o Apply Unit Resolution with (W1 3  W1 2) and W1 2:
▪ W1 3

2.5 First-Order Logic:


• First-Order Logic is a logic which is sufficiently expressive to represent a good deal
of our commonsense knowledge.

• It is also either includes or forms the foundation of many other representation


languages.

• It is also called as First-Order Predicate calculus.


4

• It is abbreviated as FOL or FOPC


Page
2.5.1 Representation Revisited:
• It is necessary to know about the nature of representation languages.

• The following are the some languages,


✓ Programming languages
✓ Propositional logic languages
✓ Natural languages

Programming languages:
• Programming languages like C++ or Java are the largest class of formal languages
in common use.

• Programs represent only computational processes.

• Data structures within programs can represent facts.

• For Example, 4 x 4 arrays can be used by a program to represent the contents


of the Wumpus world.

• Thus the programming language statement World [2, 2] Pit is a fairly


natural way to assert that there is a pit in square [2, 2].

Disadvantages:

• Programming languages lack is any general mechanism for deriving facts from
other facts; each update to a data structure is done by a domain-specific procedure
whose details are derived by the programmer from his or her own knowledge of
the domain.

• A second drawback of data structures in programs is the lack of any easy way to
say

• For Example, “There is a Pit in [2,2] or [3,1]” or “If the Wumpus is in [I,I]
then he is not in [2,2]”.

• Programs lack the expressiveness required to handle partial information.

Propositional Logic Languages:


• Propositional logic is a declarative language

• The following are the properties of propositional logic

• Its semantics is based on a truth relation between sentences and possible


worlds.

• It also has sufficient expressive power to deal with partial information, using
disjunction and negation.
5
Page
• It also has compositionality that is desirable in representation languages
namely compositionality.

• In a compositionality language, the meaning of a sentence is function of the


meaning of its parts.

• For Example, “S1,4 Λ S 1,2” is related to the meanings of “S 1,4 ” and “S 1,2

• It would be very strange if “S1,4” meant that there is a stench in square [1,4] and
“S1,2” meant that there is a stench in square [1,2], but “S1,4 Λ S1,2” meant that
France and Poland drew 1-1 in last week’s ice hockey qualifying match.

• Clearly, non Compositionality makes life much more difficult for the
reasoning system.

Advantages:

• Declarative

• Context-Independent

• Unambiguous

Disadvantages:

• It lacks the expressive power to describe an environment with many objects


concisely.

• For Example, it is forced to write a separate rule about breezes and pits for each
square, such as B1, 1  (P1, 2 V P2, 1).

• The procedural approach of programming languages can be contrasted with the


declarative nature of propositional logic, in which knowledge and inference are
separate and inference is entirely domain-independent.

Natural Languages:
• A moments thought suggests that natural languages like English are very
expressive indeed.

• Natural language is essentially a declarative knowledge representation language


and attempts to pin down its formal semantics.

• The modern view of natural language is that it serves a somewhat different


purpose, namely as a medium for communication rather than pure representation.

• When a speaker points and says, “Look!” the listener comes to know that, say,
Superman has finally appeared over the rooftops.

• The meaning of the above sentence depends both on the sentence itself and on
the context in which the sentence was spoken.
6

Disadvantages:
Page
• It is difficult to understand how the context can be represented.

• This is because one could not store a sentence such as “Look!” in knowledge base
and expect to recover its meaning without also storing a representation of the
context.

• They are also non-compositional

• They suffer from ambiguity, which would cause difficulties for thinking.

• For Example, when people think about spring, they are not confused as to whether
they are thinking about a season or something that goes boing-and if one word
can correspond to two thoughts, thoughts can’t be words.

2.5.2 First-Order Logic:


• First-Order Logic is a logic which is sufficiently expressive to represent a good deal of
our commonsense knowledge.

• It is also either includes or forms the foundation of many other representation languages.

• It is also called as First-Order Predicate calculus.

• It is abbreviated as FOL or FOPC

• FOL adopts the foundation of propositional logic with all its advantages to build a more
expressive logic on that foundation, borrowing representational ideas from natural
language while avoiding its drawbacks

• The Syntax of natural language contains elements such as,


Nouns and noun phrases that refer to objects (Squares, pits, rumpuses)
Verbs and verb phrases that refer to among objects ( is breezy, is adjacent to)

• Some of these relations are functions-relations in which there is only one “Value” for
a given “input”.

• For Example,
Objects: People, houses, numbers
Relations: These can be unary relations or properties such as red, round,

More generally n-ary relations such as brother of, bigger than,

Functions: father of, best friend,…

• Indeed, almost any assertion can be thought of as referring to objects and properties or
relations

• For Example, in the way of Sentence “ One plus Two is Three”


7

• Where,
Page
Objects: One, Two, Three, One plus Two
Relations: equals
Function: plus

• Ontological commitment of First-Order logic language is “Facts”, “Objects”, and


“Relations”.

• Where ontological commitment means “WHAT EXISTS IN THE WORLD”.

• Epistemological Commitment of First-Order logic language is “True”, “False”, and


“Unknown”.

• Where epistemological commitment means “WHAT AN AGENT BELIEVES ABOUT


FACTS”.

Advantages:

• It has been so important to mathematics, philosophy, and Artificial Intelligence precisely


because those fields can be usefully thought of as dealing with objects and the relations
among them.

• It can also express facts about some or all of the objects in the universe.

• It enables one to represent general laws or rules, such as the statement “Squares
neighboring the wumpus are smelly”.

2.5.3 Syntax and Semantics of First-Order Logic:


• The models of a logical language are the formal structures that constitute the possible
worlds under consideration.

• Models for propositional logic are just sets of truth values for the proposition symbols.

• Models for first-order logic are more interesting.

• First they have objects in them.

• The domain of a model is the set of objects it contains; these objects are sometimes called
domain elements.

• The following diagram shows a model with five objects


8
Page
• The five objects are,
✓ Richard the Lionheart
✓ His younger brother
✓ The evil King John
✓ The left legs of Richard and John
✓ A crown

• 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.

• A tuple is a collection of Objects arranged in a fixed order and is written with


angle brackets surrounding the objects.

• Thus, the brotherhood relation in this model is the set

{(Richard the Lionheart, King John),(King John, Richard the Lionheart)}

• The crown is on King John’s head, so the “on head” relation contains just one
tuple, (the crown, King John).

• The relation can be binary relation relating pairs of objects (Ex:- “Brother”) or
unary relation representing a common object (Ex:- “Person” representing both
Richard and John)
9
Page
• Certain kinds of relationships are best considered as functions that relates an
object to exactly one object.

• 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

➢ Symbols and Interpretations:

• The basic syntactic elements of first-order logic are the symbols that stand for
objects, relations and functions

❖ Kinds of Symbols

• The symbols come in three kinds namely,


✓ Constant Symbols standing for Objects (Ex:- Richard)

✓ Predicate Symbols standing for Relations (Ex:- King)


✓ Function Symbols stands for functions (Ex:- LeftLeg)

o Symbols will begin with uppercase letters


o The choice of names is entirely up to the user
o Each predicate and function symbol comes with an arity
o Arity fixes the number of arguments.
• The semantics must relate sentences to models in order to determine truth.

• To do this, an interpretation is needed specifying exactly which objects, relations


and functions are referred to by the constant, predicate and function symbols.

• One possible interpretation called as 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 {(Richard the Lionheart, King John),(King
John, Richard the Lionheart)}

✓ OnHead refers to the “on head” relation that holds between the crown and
King John; Person, King and Crown refer to the set of objects that are
persons, kings and crowns.

✓ Leftleg refers to the “left leg” function, that is, the mapping given in
{(Richard the Lionheart, King John),(King John, Richard the
10

Lionheart)}
Page
• There are many other possible interpretations relating these symbols to this
particular model.

• The truth of any sentence is determined by a model and an interpretation for the
sentence symbols.

• The syntax of the FOL with equality specified in BNF is as follows


Sentence AtomicSentence
| (Sentence Connective Sentence)

| Quantifier Variable,…Sentence
| - Sentence
AtomicSentence Predicate (Term…) | Term = Term
Term Function (Term,….)
| Constatnt
| Variable

Connective ⇒|Λ |V|


Quantifier ∀|∃
Constant A | X1 | John

Variable a|x|s|…

Predicate Before | HasColor | Raining | ….

Function Mother | LeftLeg | ….

• Where,
Λ Logical Conjunction
V Logical disjunction
∀ Universal Quantification
∃ Existential Quantification
- Material Equivalence
⇒ Material Implication
❖ Terms:

• A Term is a logical expression that refers to an object


• Constant symbol 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 Johns left leg” rather
11

than giving a name to his leg.


Page
• A complex term is formed by a function symbol followed by a parenthesized list
of terms as arguments to the function symbol.
• It is just like a complicated kind of name. It’s not a “subroutine call” that returns a
value”.
• The formal semantics of terms is straight forward,

Consider a term f(t1……tn)

Where

f- some function in the model (call it F)

The argument terms – objects in the domain

The term – object that is the value of the function F applied to


the domain

• For Example:- suppose the LeftLeg function symbol refers to the function is,

(Richard the Lionheart) ------- Richards left leg

(King John ) ------- Johns left leg

John refers to King John, then LeftLeg (John) refers to king Johns left leg.

• In this way the Interpretation fixes the referent of every term.

❖ Atomic Sentences:-

• An atomic sentence is formed from a predicate symbol followed by a parenthesized


list of terms:

Brother (Richard, John)

• This states 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, under a given interpretation, if the relation
referred to by the predicate symbol holds among the objects referred to by the
arguments.

❖ Complex Sentences:-

• Logical connectives can be used to construct more complex sentences, just as in


propositional calculus.

12

The semantics of sentences formed with logical connectives is identical to that in the
propositional case.
Page
¬ Brother (LeftLeg (Richard), John)

Brother (Richard, John) Λ Brother (John, Richard)

King (Richard) V King (John)

¬ King (Richard) ⇒ King (John)

¬ it refers “ Logical Negation”

❖ Quantifiers:-

• Quantifiers are used to express properties of entire collections of objects, instead


of enumerating the objects by name if a logic that allows object is found.
• It has two type,
• The following are the types of standard quantifiers,

✓ Universal
✓ Existential

❖ Universal Quantification (∀):-

• Universal Quantification make statement about every object.


• “All Kings are persons”, is written in first-order logic as

∀x king (x) ⇒ Person (x)

• ∀ is usually pronounced “For all….”, Thus the sentences says , “For all x, if x is a
king, then x is a person”.
• The symbol x is called a variable.
• 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.
• Based on our model, we can extend the interpretation in five ways,

x --------- Richard the Lionheart

x --------- King John

x --------- Richard’s Left leg

x --------- John’s Left leg

x --------- the crown

• The universally quantified sentence is equivalent to asserting the following five


13

sentences
Page

Richard the Lionheart ------ Richard the Lionheart is a person


King John is a King --------- King John is a Person

Richard’s left leg is King --------------- Richard’s left leg is a person

John’s left leg is a King ----------------John’s left leg is a person

The crown is a King ----------- The crown is a Person

❖ Existential Quantification (∃):-

• An existential quantifier is used make a statement about some object in the


universe without naming it.
• To say, for example :- that King John has a crown on his head, write ∃x crown
(x) Λ OnHead (x, John).
• ∃x is pronounced “ There exists an x such that..,” or “For some x..”
• Consider the following sentence,

∃x crown (x) ⇒ OnHead (x,John)

• Applying the semantics says that at least one of the following assertion is true,

Richard the Lionheart is a crown Λ Richard the Lionheart is on John’s head


King John is 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

• Now an implication is true if both premise and conclusion are true, or if its
premise is false.

❖ Nested Quantifiers:-

• More complex sentences are expressed using multiple quantifiers.


• The following are the some cases of multiple quantifiers,
• The simplest case 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 as

∀x ,y sibling (x,y) ⇔ sibling (y,z)

• In some cases it is possible to have mixture of quantifiers.


• For Example:- “Everybody loves somebody” means that for every person, there is
14

someone that person loves:


Page
∀x ∃y Loves (x, y).

• On the other hand , to say “There is someone who is loved by everyone”, we can
write as

∃y ∀x Loves (x, y).

❖ Connections between ∀ and ∃


• The two quantifiers are actually intimately connected with each other , through
negation,
• Declaring that everyone dislikes parsnips is the same as declaring there does not
exist someone who likes them, and vice versa:

∀x ¬ Likes (x, Parsnips) is equivalent to ¬ ∃x Likes (x, Parsnips)

• Going one step further: “Everyone likes ice cream” means that there os no one
who does not like ice cream:

∀x ¬ Likes (x, IceCream) is equivalent to ¬ ∃x Likes (x, IceCream)

• Because ∀ is really a conjunction over the universe of objects ∃ is a


disjunction, it should not be surprising that they obey de Morgan’s rules.
• The de Morgan’s rules for quantified and un-quantified sentences are as
follows:
• ≡ it refers definition

∀x ¬ P ≡ ¬ ∃ x P ¬ P Λ ¬ Q ≡ ¬ (P V Q)

¬ ∀x P ≡ ∃x ¬ P ¬ (P Λ Q) ≡ ¬ P V ¬ Q

∀x P ≡ ¬ ∃ x ¬ P P Λ Q ≡ ¬ (¬ P V ¬ Q)

∃x P ≡ ¬ ∀ x ¬ P P V Q ≡ ¬ (¬ P Λ ¬ Q )

❖ Equality:-

• First – order logic includes one more way of using equality symbol to make
atomic sentences.
• Use of equality symbol

✓ The equality symbol can be used to make statements to the effect 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.
✓ Determining the truth of an equality sentence is simply a matter of seeing
that the referents of the two terms are the same object.
15

✓ The equality symbol can be used to state facts about a given function
Page
✓ It can also be used with negation to insist that two terms are not the same
object.
✓ For Example:- To say that Richard has at least two brothers, write as

∃x,y Brother(x, Richard) Λ Brother(y,Richard) Λ ¬ (x = y)

2.5.4 Using First – Order Logic

The best way to learn about FOL is through examples. In Knowledge representation, a
domain is just some part of the world about which some knowledge is to be expressed.

❖ Assertions:-

• Sentences that are added to knowledge base using TELL, exactly as in


propositional logic are called assertion (Declaration/Statement).
• For Example:- It can be declared that “ John is a King and that Kings are persons”

TELL (KB, King(John))


TELL (KB, ∀x King(x) ⇒ Person(x))
❖ Queries:-

• Questions of the knowledge base can be asked using ASK.


• For Example:- ASK(KB, King(John)) returns true.
• Questions asked using ASK are called queries or goals.
• Generally speaking, any query that is logically needed by the knowledge base
should be answered positively.
• For Example:- Given the two assertions in the preceding line, the query

ASK(KB, Person(John) should also return true

❖ Substitution/Binding List:-

• Substitution or Binding list is a set of variable/term pairs.


• It is a standard form for an answer of a query with existential variables.
• For Example:- “Is there an x such that…” is solved by providing such an x.
• Given Just the two assertions, the answer would be {x/John}
• If there is more than one possible answer, a list of substitutions can be returned.

❖ The Kinship Domain:-

• Kinship domain is the domain of family relationships, or Kinship.


• This domain includes facts such as “Elizabeth is the mother of Charles” and
“Charles is the father of William” and rules such as
“One’s grandmother is the mother of one’s parent”.
• The objects in this domain are people.
• There will be two unary predicates as “Male” and “Female”

16

Kinship relations will be represented by binary predicates.


Page
• For Example:- parenthood, brotherhood, marriage and so on are represented by Parent,
sibling, Brother, Sister, Child, Daughter,Son,Spouse,Wife, Husband, Grandparents,
Grandchild, Cousin, Aunt, and Uncle.
• For Example:-
• One’s mother is One’s female parent:

∀ m, c Mother(c) = m ⇔ Female (m) Λ Parent (m,c)

❖ Axioms:-

• Axioms are commonly associated with purely mathematical domains.


• The axioms define, the Mother function and the Husband, Male, Parent and
Sibling predicates in terms of other predicates.
• They provide the basic factual information from which useful conclusions can be
derived.
• Kinship axioms are also definitions : they have the form ∀x ,y p(x,y) ⇔ …

❖ Theorems:-

• Not all logical sentences about a domain are axioms.


• Some are Theorems-that is, they are caused by the axioms.
• For Example:-

∀x ,y Sibling(x,y) ⇔ … Sibling (y,x)

• The above declaration that siblinghood is symmetric


• It’s a theorem that follows logically from the axiom that defines siblinghood.
• If ASK Questions the knowledge base this sentence, it should return true
• From logical point of view, a knowledge base need contain only axioms and no
theorems
• From a practical point of view, theorems are essential to reduce the computational
cost of deriving new sentences.

❖ Numbers:-

• Numbers are perhaps the most brilliant example of how a large theory can be built
up from a tiny heart of axioms.
• Requirements

✓ A predicate NatNum is needed that will be true of natural numbers


✓ One constant symbol, 0
✓ One function symbol, S (Successor)

• Peano Axioms:-

✓ The peano axioms define natural numbers and addition.


17

✓ Natural numbers are defined recursively:


Page

NatNum (0)
∀n NatNum (n) ⇒ NatNum (S(n))

✓ That is, 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..

❖ Sets:-

• The domain of sets is also fundamental to mathematics as well as to commonsense


reasoning
• The empty set is a constant written as { }.
• There is one unary predicate, Set, which is true of sets.
• The binary predicates are x € s (x is a member of set s) and s1 ⊆ s2 (set s1 is a
subset, not necessarily proper, of set s2)
• The binary functions are s1 ∩ s2 (the intersection of two sets), s1 𝖴 s2 (the union
of two sets), and {x/s} (the set resulting from adjoining element x to set s)
• One possible set of axioms is as follows,

✓ The only sets are the empty set and those made by adjoining something to
a set

∀s Set(s) ⇔ (s = { }) V (∃x , s2 Set(s2) Λ s = {x/s2}


✓ There is no way to decompose EmptySet into a smaller set and an element:

¬ ∃x, s {x/s} = { }

✓ Adjoining an element already in the set has no effect:

∀x,s x ∈(set membership) s ⇔ s = {x/s}

✓ The only members of a set are the elements that were connected into it.
This can be expressed recursively, saying that x is a member of s if and
only if s is equal to some set S2 connected with some element y, where
either y is the same as x or x is a member of S2

∀x,s x ∈ s ⇔ [∃y, s2 (s={y/s2} Λ (x=y V x ∈ s2)) ]

✓ A set is subset of another set if and only if all of the first sets members are
members of the second set

∀s1, s2 s1 ⊆ s2 ⇔ (∀x x ∈ s1 ⇒ x ∈ s2)

✓ Two sets are equal if and only if each is a subset of the other

∀s1, s2 (s1 = s2) ⇔ (s1 ⊆ s2 Λ s2 ⊆ s1)


18
Page
✓ An object is in the Intersection of two sets if and only if it is a member of
both sets

∀x, s1, s2 x ∈ (s1 ∩ s2) (x ∈ s1 Λ x ∈ s2)

✓ An object is in the union of two sets if and only if it is a member of either


set

∀x, s1, s2 x ∈ (s1 𝖴 s2) (x ∈ s1 V x ∈ s2)

❖ Lists:-

• Lists are similar to sets.


• The differences are that lists are ordered and the same element can appear more
than once in a list.
• Nil is the constant list with no elements
• Cons, Append, First, and Rest are functions.
• Find is the predicate that does for lists what Member does for sets.
• List? is a predicate that is true only of lists.
• The empty list is f1.
• The term Cons (x, y), where y is a nonempty list, is written [x/y].
• The term Cons (x, Nil), (i.e. The list containing the element x), is written as x1.
• A list of several elements, such as [A,B,C] corresponds to the nested term
Cons(A, Cons(B, Cons(C, Nil)))

❖ The Wumpus World:-

• The first order axioms of wumpus world are more concise, capturing in a natural
way what exactly we want to represent the concept.
• Here the more interesting question is “how an agent should organize what it
knows in order to take the right actions”.
• For this purpose we will consider three agent architectures:

✓ Reflex agents - classify their percept and act accordingly


✓ Model based agents - construct an internal representation of the
World and use it to act
✓ Goal based agents - form goals and try to achieve them

• The first step of wumpus world agent construction is to define the interface
between the environment and the agent.
• The percept sentence must include both the percept and the time at which it
occurred, to differentiate between the consequent percepts.
• For Example:-

Percept ([Stench, Breeze, Glitter, None, None], 3)


19

• In this sentence
Page
Percept - predicate
Stench, Breeze, Glitter - Constants
3 - Integer to represent to time.
• The agents action are,
Turn (Right)
Turn (Left)
Forward
Shoot
Grab
Release
Climb
• To determine which is best, the agent program constructs a query such as
∃a BestActions(a,5)
• ASK solves this query and returns a binding list such as {a/Grab}.
• The agent program then calls TELL to record the action which was taken to
update the Knowledge base KB.

❖ Types of Sentences:-

• The percept sentences are classified in to two as,


✓ Synchronic (Same time)
✓ Diachronic (across time)
• Synchronic: - The sentences dealing with time is synchronic if they relate
properties of a world state to other properties of the same world state.
• Diachronic: - The sentences describing the way in which the world changes (or
does not change) are diachronic sentences

❖ Kinds of Synchronic Rules:-

• There are two kinds of synchronic rules that could allow to capture the necessary
information for deductions are,

✓ Diagnostic rules
✓ Casual rules

o Diagnostic Rules: - Infer the presence of hidden properties directly from


the percept – derived (observed) information.
o For Example: - For finding pits, if a square is breezy, some adjacent square
must contain a pit.

∀s Breezy(s) ⇒ ∃r Adjacent (r,s) Λ Pit(r)

o If a square is not breezy, no adjacent square contains a pit.

∀s ¬Breezy(s) ⇒ ¬∃r Adjacent (r,s) Λ Pit(r)

o Combining these two, the derived biconditional sentence is :


20

∀s Breezy(s) ⇔ ∃r Adjacent (r,s) Λ Pit(r)


Page
o Casual Rules: - Reflect the assumed direction of casuality in the world. Some
hidden property of the world causes certain percepts to be generated.
o For Example:- A Pit causes all adjacent squares to be breezy.

∀r Pit(r) ⇒ [∀s Adjacent (r, s) ⇒ Breezy(s)]

o If all squares adjacent to a given square are pitless, the square will not be
breezy

∀s [∀r Adjacent (r,s) ⇒ ¬ Pit(r)] ⇒ ¬ Breezy(s)

o System that reason with casual rules are called model-based reasoning
systems, because the casual rules from a model of how the environment
operates.

2.5.5 KNOWLEDGE ENGINEERING IN FIRST ORDER LOGIC:-

• Knowledge Engineering: - The general process of Knowledge Base KB


Construction.
• Knowledge Engineer: - Who investigates a particular domain, learns what concepts
are important in that domain and creates a formal representation of the objects and
relations in the domain.
• The knowledge engineering projects vary widely in content, scope and difficulty, but
all projects include the following steps,

✓ Identify the Task: - The Knowledge engineer should identify the


PEAS description of the domain.
✓ Assemble the relevant knowledge: - The idea of combining expert’s
knowledge of that domain (i.e.) a process called knowledge acquisition.
✓ Decide on a vocabulary of predicates, functions and constants: -
Translate the important domain-level concepts into logical level name. The
resulting vocabulary is known as ontology of the domain, which
determines what kinds of things exist, but does not determine their specific
properties and interrelationships.
✓ Encode general knowledge about the domain: - The knowledge
engineer writes the axioms (rules) for all the vocabulary terms. The
misconceptions are clarified from step 3 and the process is iterated.
✓ Encode a description of the specific problem instance: - To write simple
atomic sentences about instances of concepts that are already part of the
ontology.
✓ Pose queries to the inference procedure and get answers: - For the
given query the inference procedure operate on the axioms and problem
specific facts to derive the answers.
✓ Debug the knowledge base: - For the given query , if the result is not
a user expected on then KB is updated with relevant or missing axioms.


21

The seven step process is explained with the domain of ELECTRONIC CIRCUITS
DOMAIN.
Page
✓ Identify the task: -
o Analyse the circuit functionality, does the circuit actually add
properly? (Circuit Verification).
✓ Assemble the relevant knowledge: -
o The circuit is composed of wire and gates.
o The four types of gates (AND, OR, NOT, XOR) with two input
terminals and one output terminal knowledge is collected.
✓ Decide on a vocabulary: -
o The functions, predicates and constants of the domain are
identified.
o Functions are used to refer the type of gate.
Type (x1) = XOR,
where x1 ---- Name of the gate and Type ----- function
o The same can be represented by either binary predicate (or)
individual type predicate.
Type (x1, XOR) – binary predicate
XOR (x1) – Individual type
o A gate or circuit can have one or more terminals. For x1, the
terminals are x1In1, x1In2 and x1 out1
Where x1 In1 ------ 1st input of gate x1
x1 In2 ----- 2nd input of gate x1
x1 out1 ----- output of gate x1
o Then the connectivity between the gates represented by the
predicate connected. (i.e.) connected (out(1, x1), In(1,x2)).
o Finally the possible values of the output terminal C1, as true or
false, represented as a signal with 1 or 0.
✓ Encode general knowledge of the domain:-
o This example needs only seven simple rules to describe
everything need to know about circuits
o If two terminals are connected, then they have the same signal:

▪ t1,t2 Connected(t1, t2)  Signal(t1) = Signal(t2)

o The signal at every terminal is either 1 or 0 (but not both):


22

▪ t Signal(t) = 1  Signal(t) = 0
Page

▪ 1≠0
o Connected is a commutative predicate

▪ t1,t2 Connected(t1, t2)  Connected(t2, t1)

o An OR gate’s output is 1 if and only if any of its input is 1:

▪ g Type(g) = OR  Signal(Out(1,g)) = 1  n
Signal(In(n,g)) = 1

o An AND gate’s output is 0 if and only if any of its inputs is 0

▪ g Type(g) = AND  Signal(Out(1,g)) = 0  n


Signal(In(n,g)) = 0

o An XOR gate’s output is 1 if and only if inputs are different:

▪ g Type(g) = XOR  Signal(Out(1,g)) = 1 


Signal(In(1,g)) ≠ Signal(In(2,g))

o A NOT gate’s output is different from its input:

▪ g Type(g) = NOT  Signal(Out(1,g)) ≠


Signal(In(1,g))

✓ Encode the specific problem instance:

o First, we categorize the gates:

Type(X1) = XOR Type(X2) = XOR

Type(A1) = AND Type(A2) = AND

Type(O1) = OR

o Then, we show the connections between them

Connected(Out(1,X1),In(1,X2)) Connected(In(1,C1),In(1,X1))

Connected(Out(1,X1),In(2,A2)) Connected(In(1,C1),In(1,A1))

Connected(Out(1,A2),In(1,O1)) Connected(In(2,C1),In(2,X1))

Connected(Out(1,A1),In(2,O1)) Connected(In(2,C1),In(2,A1))

Connected(Out(1,X2),Out(1,C1)) Connected(In(3,C1),In(2,X2))

Connected(Out(1,O1),Out(2,C1)) Connected(In(3,C1),In(1,A2))

✓ Pose Queries to the inference procedure:


23
Page
o What combinations of inputs would cause the first output of C1(the
sum bit) to be 0 and the second output of C1 (the carry bit) to be
1?

i1,i2,i3 Signal(In(1,C1)) = i1  Signal(In(2,C1)) = i2 


Signal(In(3,C1)) = i3  Signal(Out(1,C1)) = o 
Signal(Out(2,C1)) = 1

o The answers are substitutions for the variables i1,i2 and i3 Such that
the resulting sentence is entailed by the knowledge base.

o There are three such substitutions as:

{ i1/1,i2/1 , i3/0} { i1/1,i2/0 , i3/1} { i1/0,i2/1 , i3/1}

o What are the possible sets of values of all the terminals for the
adder circuit?

i1,i2,i3,o1,o2 Signal(In(1,C1)) = i1  Signal(In(2,C1)) =


i2  Signal(In(3,C1)) = i3  Signal(Out(1,C1)) = o1 
Signal(Out(2,C1)) = o2

✓ Debug the knowledge base:


o The knowledge base is checked with different constraints.
o For Example:- if the assertion 1 ≠ 0 is not included in the
knowledge base then it is variable to prove any output for the
circuit, except for the input cases 000 and 110.

2.6 Inference in First-order Logic:-


• We have learned seven inference rules of propositional logic.
• These rules are applicable for First-order logic also
• With those rules First-order logic holds some additional rules “with quantifiers” in which
substituting particular individual for the variable is done (i.e.) SUBST(Ө, α) to denote the
result of applying the substitution (or) binding list Ө to the sentence α.
• For Example:-
SUBST ( {x/Ram, y/John} Likes(x, y)) = Likes(Ram, John)
• The following are the new three inference rules for First-order Logic.
✓ Universal Elimination
✓ Existential Elimination
✓ Existential Introduction
• Universal Elimination:- For any sentence α, variable v and ground term g;

v α / SUBST( {v/g}, α)
24

Example:-
x likes (x, Icecream) is a sentence α.
Page
SUBST ({x/John}, α) is a substitution Ө = John
Likes (John, Icecream) – Inferred sentence
• Existential Elimination :- For any sentence α variable v, and constant symbol k that
does not appear elsewhere in the Knowledge base:

v α / SUBST( {v/k}, α)
Example:-
x Kill (x, Victim) – α
SUBST({x/Murderer, Victim}, α) where Ө = Murderer
Kill (Murderer, Victim) – Inferred Sentence
• Existential Introduction :- For any sentence α, variable v that does not occur in α, and
ground term g that does occur in α

α / v SUBST( {g/v}, α)
Example:-
Likes (John, Icecream) – α
x Likes (x, Icecream) – Inferred Sentence

2.6.1 AN EXAMPLE PROOF USING FIRST- ORDER LOGIC:-

• An application of inference rule is matching their premise patterns to the sentences in the
KB and then adding their conclusion patterns to the KB.
• Task: - For the given situation described in English, Convert it into its equivalent FOL
representation and prove that “West is a Criminal”.
• Situation: - 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.
• Solution: - The given description is splitted into sentences and is converted into its
corresponding FOL representation.

✓ It is a crime for an American to sell weapons to hostile nations:


x y z American(x)  Weapon(y)  Nation(z)  Hostile(z)  Sells(x, y, z 
Criminal(x)
✓ Nono … has some missiles,
x Owns(Nono,x)  Missile(x)
✓ all of its missiles were sold to it by Colonel West
x Missiles(x)  Owns(Nono,x)  Sells(West,x,Nono)
✓ We will also need to know that missiles are weapons
x Missile(x)  Weapon(x)
✓ An enemy of America counts as "hostile“
x Enemy(x,America)  Hostile(x)
25

✓ West, who is American …


Page

American(West)
✓ Nono, is a nation
Nation (Nono)
✓ Nono, an enemy of America
Enemy (Nono, America)
✓ America is nation
Nation (America)

2.7 Forward Chaining:-


• The Generalized Modus Ponens rule can be used by Forward Chaining.
• From the sentences in the KB which in turn derive new conclusions.
• Forward chaining is preferred when new fact is added to the database and we want to
generate its consequences.
• Forward Chaining Algorithm:-
✓ Forward chaining is triggered by the addition of new fact “p” into the knowledge
base (i.e.) the action TELL is performed.
✓ If the new fact is a rename of any other existing sentence in the KB then it is not
included in KB.
✓ With the new fact “p” find all premises that had “p” as premise and if any other
premise is already known to hold then its consequence is included in KB.
✓ The important operation of forward chaining is renaming : One sentence is a
renaming of another if, they are identical except for the names of the variables.
✓ For Examples:-
o Likes(x, Icecream) and Likes(y, Icecream) are renaming of each other.
o Likes(x,x) and Likes(x,y) are not renaming of each other (i.e.) its variable
differs, the meaning is logically different.
✓ Consider the KB of crime problem represented in Horn form to explain the
concept of forward chaining.
✓ The implication sentences are (i), (iv), (v), (vi)
✓ Two iterations are required:
✓ On the first iteration,
o Step (i) has unsatisfied premises
o Step (iv) is satisfied with {x/M1} and sells (west, M1,Nono) is added
o Step (v) is satisfied with {x/m1} and weapon (M1) is added
o Step (vi) is satisfied with {x/Nono}, and Hostile (Nono) is added
✓ On the second iteration,
o Step (i) is satisfied with {x/West, y/M1, z/Nono} and Criminal(west) is
added.
✓ The following table shows the forward chaining algorithm,
✓ Inputs:- KB, the Knowledge base, a set of first-order definite clauses α, the
query, an atomic sentence
✓ Local variable:- new, the new sentences inferred on each iteration
26
Page
✓ The following figure shows the proof tree generated by forward chaining
algorithm on the Crime Example,

✓ The above discussed inference processes are not directed towards solving any
particular problem: for this reason it is called a data-driven or data-directed
procedure.
✓ In this problem, no new inferences are possible because every sentence concluded
by forward chaining is already exist in the KB. Such a KB is called a fixed point of
the inference process.
✓ FOL-FC-ASK function is sound and complete.
✓ Every inference is an application of generalized modus ponens, which is sound.
✓ Then it is complete for definite clauses KB (i.e.) it answers every query whose
27

answers are entailed by any KB of definite clauses.


2.7.1 Efficient Forward chaining:-
Page

• The above discussed FC Algorithm has three possible types of complexity.


✓ Pattern Matching: - “inner loop” of the algorithm involves finding all possible
unifiers such that the premise of a rule unifies with a suitable set of facts in the
KB.
✓ Matching rules against known facts:- The algorithm re-checks every rule on
every iteration to see whether its premises are satisfied, even if very few additions
are made to the KB on each iteration
✓ Irrelevant facts to the goal are generated
• In forward chaining approach, inference rules are applied to the knowledge base, yielding
new assertions.
• This process repeats forever or until some stopping criterian is met.
• This method is appropriate for the design of an agent, that is on each cycle, we add the
percepts to the knowledge base and run the forward chainer, which chooses an action to
perform according to a set of condition action rules.
• Theoretically a production system can be implemented with a theorem prover, using
resolution to do forward chaining over a full first order knowledge base.
• An efficient language can be used to perform this task, because it reduces the branching
factor.
• The typical production system has three features:
✓ The system maintained a KB called the working memory which has a set of
positive literals with no variable
✓ The system maintains a rule memory. This contains a set of inference rules
P1  P2  act1  act2…. That acti is executed when pi is satisfied, which
performs adding or deleting an element from the working memory
– match phase.
✓ In each cycle, the system computes the subset of rules whose left-hand side
is satisfied by the current contents of the working memory - match phase.
2.8 Backward Chaining:-
• Backward chaining is designed to find all answers to a question asked to the knowledge
base. Therefore it requires a ASK procedure to derive the answer.
• The procedure BACK WARD-CHAIN will check two constraints.
✓ If the given question can derive a answer directly from the sentences of the
knowledge base then it returns with answers.
✓ If the first constraint is not satisfied then it finds all implications whose
conclusion unifies with the query and tries to establish the premises of those
implications. If the premise is a conjunction then BACK-CHAIN processes
the conjunction conjunct by conjunct, building up the unifiers for the whole
premises as it goes.
• Composition of Substitutions:- COMPOSE(Ө1, Ө2) is the substitution whose effect
is identical to the effect of applying each substitution in turn (i.e.),
SUBST (COMPOSE (Ө1, Ө2), p) = SUBST (Ө2, SUBST (Ө1, p))
28

• For Example:-
P – Sells (x,M1, y)
Page
SUBST (Ө2, SUBST (Ө1, p))
SUBST (Ө2, SUBST (x/West, p)) i.e. (Ө1 = x/west)
SUBST ((y/Nono), (x/West, p)) i.e. (Ө2 = y/Nono)
Therefore p – Sells (West, M1, Nono)
• The following table shows the backward chaining algorithm,

• The following graph shows the proof tree to infer that west is a criminal,

• To prove Criminal(x), we have to prove the five conjuncts below it


• Some of which are directly exist in the knowledge base, others require one more
iteration of backward chaining.
• In the search process the substitution of values for the variables has to be done in a
correct way, otherwise it may lead to failure solution.
• The following are the some properties of Backward Chaining,
o Depth-first recursive proof search: space is linear in size of proof
29

o Incomplete due to infinite loops


▪  fix by checking current goal against every goal on stack
Page
o Inefficient due to repeated subgoals (both success and failure)
▪  fix using caching of previous results (extra space)
o Widely used for logic programming

2.8.1 Logic Programming:-


• A system in which KB can be constructed and used.
• A relation between logic and algorithm is summed up in Robert Kowalsh equation
Algorithm = Logic + Control
• Logic programming languages, usually use backward chaining and input/output of
programming languages.
• A logic programming language makes it possible to write algorithms by augmenting
logic sentences with information to control the inference process.
• For Example:- PROLOG
✓ A prolog program is described as a series of logical assertions each of
which is a Horn Clause.
✓ A Horn Clause is a Clause that has atmost one positive literal,
Example: - P, ¬PQ
✓ Implementation: - All inferences are done by backward chaining, with
depth first search. The order of search through the conjuncts of an
antecedent is left to right and the clauses in the KB are applied first-to- last
order.
• Example for FOL to PROLOG conversion:-
o FOL
✓ x Pet(x)  Small(x)  Apartment(x)
✓ x Cat(x) v Dog(x)  Pet(x)
✓ x Product(x)  Dog(x)  Small(x)
✓ Poodle(fluffy)
o Equivalent PROLOG representation
✓ Apartment(x) :- Pet(x), Small(x)
✓ Pet(x) :- Cat(x)
Pet(x) :- Dog(x)
✓ Dog(x) :- Poodle(x)
Small(x) :- Poodle(x)
✓ Poodle(fluffy)
o In the PROLOG representation the consequent or the left hand side is called as
head and the antecedent or the right hand side is called as body.
• Execution of a PROLOG program:-
o The execution of a prolog program can happen in two modes,
1. Interpreters
2. Compilers
o Interpretation:
30

✓ A method which uses BACK-CHAIN algorithm with the program as


the KB.
Page
✓ To maximize the speed of execution, we will consider two different
types of constraints executed in sequence, They are
1. Choice Point: - Generating sub goals one by one to
perform interpretation.
2. Trail: - Keeping track of all the variables that have been
bound in a stack is called as trail.
o Compilation:-
✓ Procedure implementation is done to run the program (i.e.) calling the
inference rules whenever it is required for execution.
2.9 Unification:-

• The process of finding all legal substitutions that make logical expressions look identical
and
• Unification is a "pattern matching" procedure that takes two atomic sentences, called
literals, as input, and returns "failure" if they do not match and a substitution list, Theta,
if they do match.
• Theta is called the most general unifier (mgu)
• All variables in the given two literals are implicitly universally quantified
• To make literals match, replace (universally-quantified) variables by terms
• The unification routine, UNIFY is to take two atomic sentences p and q and returns α
substitution that would make p and q look the same
UNIFY (p, q) = θ where SUBST (θ, p) = SUBST (θ, q)
θ = Unifier of two sentences
• For example:-
p – S1(x, x) q
– S1(y, z)
Assume θ = y
p – S1(y, y) – x/y (Substituting y for x)
q – S1(y, y) – z/y (Substituting y for z)
• In the above two sentences (p, q), the unifier of two sentences (i.e.) θ = y is substituted
in both the sentences, which derives a same predicate name, same number of arguments
and same argument names.
• Therefore the given two sentences are unified sentences.
• The function UNIFY will return its result as fail, for two different types of criteria’s
as follows,
✓ If the given two atomic sentences (p, q) are differs in its predicate name then
the UNIFY will return failure as a result
For Example: - p – hate (M, C), q – try (M, C)
✓ If the given two atomic sentences (p, q) are differs in its number of arguments
then the UNIFY will return failure as a result
For Example: - p – try (M, C), q – try (M, C, R)
31

• For Example: - The Query is Knows (John, x) whom does John Know?
Page
• Some answers to the above query can be found by finding all sentences in the KB that
unify with knows (John, x)
• Assume the KB has as follows,
Knows (John, John)
Knows (y, Leo)
Knows (y, Mother(y))
Knows (x, Elizabeth)
• The results of unification are as follows,
UNIFY (knows (john, x), knows (John, Jane)) = {x/Jane}
UNIFY (knows (john, x), knows (y, Leo)) = {x/Leo, y/John}
UNIFY (knows (john, x), knows (y, Mother(y)) = {y/John, x/Mother (John)}
UNIFY (knows (john, x), knows (x, Elizabeth)) = fail
• x cannot take both the values John and Elizabeth at the same time.
• Knows (x, Elizabeth) means “Everyone knows Elizabeth” from this we able to infer
that John knows Elizabeth.
• This can be avoided by using standardizing apart one of the two sentences being
unified (i.e.) renaming is done to avoid name clashes.
• For Example:-
UNIFY (Knows (john, x), knows (x1, Elizabeth)) = {x/Elizabeth, x1/John}

2.9.1 Most general Unifier (MGU):-

• UNIFY should return a substitution that makes the two arguments look the same, but
there may be a chance of more than one unifier.
• For Example:-
UNIFY (knows (john, x), knows (y, z)) = {y/John, x/z} or {y/John, x/John, z/John}
• The result of applying 1st unifier is knows (John, z) and the 2nd unifier is knows (John,
John).
• Here the first unifier result is more general than the second one, because it places less
restriction on the values of the variables.
• This indicates that every unifiable pair of expressions, a single MGU is exist until
renaming of variables.
• The following table shows the unification algorithm,
• The following are the steps to be done for unification of two sentences p and q is
given below,
✓ Recursively explore the two expressions simultaneously along with unifier
returns failure if two corresponding points in the structure do not match.
Therefore the time complexit y is O(n2) in the size of the expressions being
unified.
✓ When the variable is matched against a complex term, one must check,
whether the variable itself occurs, if it is true then returns failure (consistent
32

unifier is not allowed) – occur check.


Page
• The above table shows the unification algorithm

2.9.2 Storage and retrieval:-


• Once the data type for sentences and terms are defined, we need to maintain asset of
sentences in a KB (i.e.) to store and fetch a sentence or term,
✓ Store (s) – stores a sentence s.
✓ Fetch (q) – returns all unifiers
• Such that the query q unifies with some sentences in the KB.
• For Example: - The unification for Knows (John, x) is an Instance of fetching.
• The simplest way to store and fetch is maintain a long list in sequential order.
• For a Query q, call UNIFY (q, s) for every sentences s in the list, requires O(n) time on
an n-element KB.
• To make the fetch more efficient, indexing the facts in KB is done.
• The different types of indexing are as follows,
33

✓ Table based Indexing


Page

✓ Tree based Indexing


✓ Predicate based Indexing
• A simple form of indexing is predicate indexing puts all the knows facts in one bucket
and all the brother facts in another.
• The buckets are stored in hash table for efficient access,
• Where hash table means “a data structure for storing and retrieving information
indexed by fixed keys”
• Given sentence to be stored, it is possible to construct indices for all possible queries
that unify with it,
• For Example:- For the fact Employs (SSN, John) the queries are as follows,
✓ Employs (SSN, John) Does SSN employ John?
✓ Employs (x, John) who employs John?
✓ Employs (SSN, y) whom does SSN employ?
✓ Employs (x, y) who employs whom?
• These queries form a substitution lattice (i.e.) Properties of Lattice:- child of any node
in the lattice is obtained from its parent by a single substitution and the highest common
descendent of any two nodes is the result of applying their most general unifier.
• For a predicate with n arguments, the lattice contains O(2n) nodes
• The following diagram shows the subsumption lattice,

Employs (x, y)

Employs (x, John) Employs (x, y)

Employs (SSN, John)


2.9.3 Advantages and Disadvantages:-
Advantages:-
• The scheme works very well whenever the lattice contains a small number of nodes.
• For a predicate with n arguments, the lattice contains O(2n) nodes.
Disadvantages:-
• If function symbols are allowed, the number of nodes is also exponential in the size of
the terms in the sentence to be stored. This can lead to a huge number of indices.
• At some point, the benefits of indexing are outweighed by the costs of storing and
maintaining all the indices.

2.10 Resolution:-
• Resolution is a complete inference procedure for first order logic
• Any sentence a entailed by KB can be derived with resolution
34

• Catch: proof procedure can run for an unspecified amount of time


Page
o At any given moment, if proof is not done, don’t know if infinitely looping or
about to give an answer
o Cannot always prove that a sentence a is not entailed by KB
o First-order logic is semidecidable
• Rules used in the resolution procedure are :
o Simple resolution inference rule – premises have exactly two disjuncts
,  or equivalently , 
    

o Resolution inference rule – two disjunctions of any length, if one of disjunct in the
class (pj) unifies with the negation of the disjunct in the other class, then infer the
disjunction of all the disjuncts except for those two,
o Using disjunctions:- For literals pi and qi, where UNIFY (pj, ¬qk) = θ

p1 .......... pj..........  pm, q1  ..........qk ................ qn


SUBST ( , ( p1 ........... pj − 1  pj + 1......... pm  q1...........qk − 1  qk + 1 .................  qn

o Using implications:- For atoms pi, qi, ri, si where UNIFY (pj, qk) = θ

p1 .......... pj  ........... pn1  r1  ...... rn 2

s1  ..........sn3 , q1 ..........qk .............. qn 4


SUBST ( , ( p1 ... pj − 1  pj + 1...... pn1  s1 .....sn3  r1  .......rn 2  q1  ...........qk −1  qk + 1.................  qn 4

2.10.1 Canonical Form (or) Normal form for Resolution:-


• The canonical form representation of sentences for resolution procedure (to derive pa
proof) is done in two ways, they are as follows,
o Conjunctive Normal form (CNF):- All the disjunctions are joined aqs one
big sentences.
o Implicative Normal Form (INF):- All the conjunctions of atoms on the left
and a disjunction of atoms on the right.
• The following table shows the Knowledge base for CNF and INF,

Conjuctive Normal Form Implicative Normal Form


 P(w)  Q(w) P(w) Q(w)
P(x)  R(x) True  P(x)  R(x)
 Q(y)  S(y) Q(y)  S(y)
 R(z)  S(z) R(z)  S(z)

• Resolution is a generalization of Modus Ponen.


• The following is the representation of Modus Ponen rule in resolution as a special
case (i.e.),
35 Page
True  ,
is equivalent to
,   True  

2.10.2 Methods used for resolution technique

• Resolution Proof:- A set of inference rules and resolution rules can be used to derive
a conclusion from the KB.
• Resolution with refutation (or) proof by contradiction (or) reduction and
absurdum:- One complete inference procedure using resolution is refutation. The idea
is to prove P, we assume P is false (i.e. add  P to KB) and prove a contradiction, that
is the KB implies P.
(KB   P  False)  (KB  P)
• Example:
1. Prove that S(A) ts true from KB1 of CNF and INF representation using
✓ Resolution Proof
✓ Resolution with refutation
(a) Resolution Using INF representation:-
Given (KB1):-
1. P(w)  Q(w)
2. True  P(x)  R(x)
3. Q(y)  S(y)
4. R(z)  S(z)
• The following diagram shows the proof that S(A) from KB1 using resolution
P(w)  Q(w) Q(y)  S(y)
{y/w}
(Step1 & Step3)

P(w)  S(w) True  P(x)  R(x)

{w/x}
Step 2

True  S(x)  R(x) R(z)  S(z)


{x/A , z/A}
Step 3

True  S(A)

• Resolution rule:- In the first step transitive implication rule is used


• Substitution of one predicate in the other. (i.e.) P(x)  S(x) is substituted in True
 P(x)  S(x) that is instead of P(x), S(x) is substituted.
36
Page
• Substitution of one predicate in the other. (i.e.) R(A)  S(A) is substituted in True
 S(A)  R(A) that is instead of R(A), S(A) is substituted, which derives True
 S(A)  S(A) is equivalent to True  S(A)
• Therefore S(A) is true is proved using resolution technique for INF representation.
• Where each “Vee” Shape in the proof tree represents a resolution step,
• The two sentences at the top are the premises from the KB, and the one at the bottom
is the conclusion (or) resolvent.

b. Resolution Using CNF representation:-


Given (KB1):-
1. ~P(w)  Q(w)
2. P(x)  R(x)
3. ~Q(y)  S(y)
4. ~R(z)  S(z)
• Resolution rule:-
,  ~P ( w ) Q ( w ) ,~Q (w)S ( w )
(i.e.)
  ~ P( w)  S (w )
• Resolution rule:-
,  R (x)P (x),~P (x)S (x)
(i.e.)
  R ( x)  S ( x )
• Resolution rule:-
,  S (A)R (A),~R (A)S (A)
(i.e.)
  S ( A)  S ( A)

• Therefore S(A) is true is proved using resolution technique for CNF representation.
• The following diagram shows the proof that S(A) from KB1 using resolution.

~P(w)  Q(w) ~Q(y)  S(y)


{y/w}
(Step1 & Step3)

~P(w)  S(w) P(x)  R(x)

{w/x}
Step 2

S(x)  R(x) ~R(z)  S(z)


{x/A , z/A}
Step 3

S(A)  S(A)

S(A)
37
Page
C. Resolution with refutation Proof using INF representation:-
Given (KB1):-
1. P(w)  Q(w)
2. True  P(x)  R(x)
3. Q(y)  S(y)
4. R(z)  S(z)
• Resolution rule:- In this step transitive implication is applied,
  ,  
 
• Substitution of one predicate in the other. (i.e.) P(x)  S(x) is substituted in True
 P(x)  S(x) that is instead of P(x), S(x) is substituted.
• Substitution of one predicate in the other. (i.e.) R(x)  S(x) is substituted in True
 S(x)  R(x) that is instead of R(x), S(x) is substituted, which derives True  S(x)
 S(x) is equivalent to True  S(x)
• To prove using refutation, negation of given proof is added to the KB and derives a
contradiction, then the given statement is true otherwise it is false.
• Therefore in step 4, we assume S(A)  False, derives a contradiction True  False.
• Therefore S(A) is true is proved using refutation technique in INF representation.
• The following diagram shows the proof that S(A) from KB1 using resolution with
refutation in INF representation.

P(w)  Q(w) Q(y)  S(y)


{y/w}
(Step1 & Step3)

P(w)  S(w) True  P(x)  R(x)

{w/x}
Step 2

True  S(x)  R(x) R(z)  S(z)


{z/x}
Step 4

True  S(A) S(A)  False


{x/A}
Negation
True  False
D. Resolution with refutation using CNF representation:-
Given KB1:-
1. ~P(w)  Q(w)
2. P(x)  R(x)
3. ~Q(y)  S(y)
4. ~R(z)  S(z)
• Resolution rule:-
,  ~P(w)Q(w),~Q (w)S ( w )
(i.e.)
  ~ P( w)  S (w )
• Resolution rule:-
,  R (x)P (x),~P (x)S (x)
(i.e.)
  R ( x)  S ( x )
• Resolution rule:-
,  S (A)R (A),~R (A)S (A)
(i.e.)
  S ( A)  S ( A)

• To prove using refutation, the negation of the given statement to be proved is added to
the KB and it derives a empty set, represents that the statement is True in the KB.
• Therefore S(A) is True is proved using resolution with refutation in CNF
representation.
• The following diagram shows the proof that S(A) from KB1 using resolution with
refutation in CNF representation.

~P(w)  Q(w) ~Q(y)  S(y)


{y/w}
(Step1 & Step3)

~P(w)  S(w) P(x)  R(x)

{w/x}
Step 2

S(x)  R(x) ~R(z)  S(z)


{x/A , w/A}
Step 4

S(A)  S(A) S(A)

Negation
{ }
39
Page
2.10. 3 Resolution technique (From FOL Representation):-

• In the previous section we learned how to prove the given fact using two different types of
resolution techniques (Resolution proof, Resolution with refutation proof) from the given
KB representation (CNF, INF).
• Suppose if the KB is given as a English description, to prove a fact , then how to derive the
conclusion? What are the sequence of steps to be done? Are discussed one by one,
o The given KB description is converted into FOL Sentences
o FOL sentences are converted to INF (or) CNF representation without changing the
meaning of it (using conversion to normal form procedure)
o Apply one of the resolution technique (Resolution proof (or) Resolution with
refutation proof), to resolve the conflict.
o Derive the fact to be proved or declare it as a incomplete solution.

2.10.3.1 Conversion to Normal Form or Clause Form (Procedure) :-

1. Eliminate Implications:-
Eliminate Implication by the corresponding disjunctions,
(i.e.) p  q is the same as p  q
2. Move  inwards :-
Negations are allowed only on atoms in CNF and not at all in INF. Therefore eliminate
negations with, Demorgan’s laws, the quantifier equivalences and double negation.
Demorgans Law
( p  q) becomes p  q
( p  q) becomes p  q
Quantifier equivalences
xp becomes xp
xp becomes xp
Double Negation
p becomes p Double negation
3. Standardize variables:-
If the sentence consists of same variable name twice, change the name of one of the
variable. This avoids confusion later when we drop the quantifiers,
(i.e.) (xp(x))  (xQ(x)) is changed into (xp(x))  (yQ( y))
4. Move quantifiers left:-
The quantifiers in the middle of the sentence to be moved to the left, without changing
the meaning of the sentence
(i.e.) p   xq becomes x p  q , which is true because p here is guaranteed
not to contain x.
5. Skolimize:-

Skolimization is the process of removing existential quantifiers by elimination, it is


very similar to the existential elimination rule.
(i.e.) xp(x) into p(A), where A is a constant that does not appear elsewhere
in the KB.

For Example:- “Everyone has a heart”


o FOL : x person(x)  y Heart (y)  Has (x, y)
40

o Replace y......y with a constant H


Page
x person (x)  Heart (H)  Has (x, y)
o The above representation says that everyone has the same heart H, not necessarily
shared between each other. It can be rewritten by applying a function to each
person that maps from person to heart.
x person (x)  Heart (F(x)  Has (x, F(x)) where F is a function that
does not appear elsewhere in the KB and it is called as Skolem function.
6. Distribute  over  :-
(a  b)  c becomes (a  c)  (b  c)
7. Flatten nested conjunctions and disjunctions :-
(a  b)  c becomes (a  b  c)
(a  b)  c becomes (a  b  c)
It is a conjunction where every conjunct is a disjunction of literals.
8. Convert disjunctions to implications :-
From the CNF it is possible to derive the INF, (i.e.) combine the negative literals into
one list, the positive literals into another and build an implication from them,
(i.e.) (a  b  c  d ) becomes (a  b  c  d )
• 1. For Example: - Covert the given axioms into equivalent clasuses form and prove that R is
true using CNF and INF representation.
o Axioms:
▪ P
▪ P  Q R
▪ S  T Q
▪ T
o Proof:
✓ Equivalent Conjunctive Clause Form Representation:
o P
o P  Q  R
o  S  Q,  T  Q
o T
✓ Equivalent INF Representation:
o P
o P  Q R
o S  Q, T  Q
o T
• The negation of the given statement (~R) derives a contradiction ({ }).
• Therefore it is proved that R is true.
• The following diagram shows the proof of resolution with refutation using CNF.
41
Page
~R ~P  ~Q  R

Negation Step b
~P  ~Q P

Step a
~Q ~T  Q

Step c

~T T

Step d

{}

• The negation of the given statements (R  False) derives a contradiction (True  False).
• Therefore it is proved that R is True (i.e. Taken assumption is wrong)
• The following diagram shows the proof of Resolution with refutation using INF.

P Q  R P

(Step a & b)

T  Q Q R

(Step c)

T  R T

(Step d)

R R  False

Negation

False
42
Page
• 2. For Example: - Convert the given sentences (KB2) into its equivalent FOL representation
and then convert it into its CNF and INF representation and solve the task using resolution
with refutation proof.

o Given KB2:-
▪ Marcus was a man
▪ Marcus was a Pompeian
▪ All pompeians were romans
▪ Caesar was a ruler
▪ All romans were either loyalto Caesar or hated him
▪ Everyone is loyal to someone
▪ People only try to assassinate rulers they are not loyal to.
▪ Marcus tried to assassinate Caesar
▪ All man are people
o Task: - Did Marcus hate Caesar?
o Solution:-
✓ FOL Representation:
1. Man (Marcus)
2. Pompeian (Marcus)
3. x Pompeian (x)  Roman (x)
4. Ruler (Caesar)
5. x Roman (x)  Loyalto (x, Caesar)  Hate (x, Caesar)
6. x y Loyalto (x, y)
7. x y Person(x)  Ruler(y)  Trytoassassinate(x, y)   Loyalto(x, y)
8. Trytoassassinate (Marcus, Caesar)
9. x Man (x)  Person (x)
✓ INF Representation:
1. Man (Marcus)
2. Pompeian (Marcus)
3. Pompeian (x)  Roman (x)
4. Ruler (Caesar)
5. Roman (x)  Loyalto (x, Caesar)  Hate (x, Caesar)
6. Loyalto (x, y)
7. Person(x)  Ruler(y)  Trytoassassinate(x, y)  Loyalto(x, y)
8. Trytoassassinate (Marcus, Caesar)
9. Man (x)  Person (x)
✓ CNF Representation :
1. Man (Marcus)
2. Pompeian (Marcus)
3. ~Pompeian (x)  Roman (x)
4. Ruler (Caesar)
5. ~Roman (x)  Loyalto (x, Caesar)  Hate (x, Caesar)
6. Loyalto (x, y)
7. ~Person(x)  ~Ruler(y)  ~Trytoassassinate(x, y)  ~Loyalto(x, y)
8. Trytoassassinate (Marcus, Caesar)
9. ~Man (x)  Person (x)
43
Page
• To prove the given fact, we assumed the negation of it (i.e.) Hate(Marcus, Caesar)  False and
using inference rules we derive a contradiction False, which means that the assumption must
be false, and Hate(Marcus, Caesar) is True.
• Therefore it is proved that Hate (Marcus, Caesar) is True using INF Representation.
• The following diagram shows the proof of Resolution with refutation using INF
representation.

Pompeian (Marcus) Pompeian (x)  Roman (x)


2&3
{ x/Marcus}
Roman (Marcus) Roman (x)  Loyalto (x,
{x/Marcus} Caesar)  Hate (x, Caesar)
5
10
Loyalto (Marcus, Caesar)  Hate (Marcus, Caesar)

Person (x)  Ruler Trytoassassinate (Marcus,


(y)  Trytoassassinate (x, y)
 ~Loyalto (x, y) Caesar)

7 & 8 {x/Marcus, y/Marcus}


Person (Marcus)  Ruler (Caesar) Ruler (Caesar)
 ~Loyalto (Marcus, Caesar)
4

Person (Marcus)  ~Loyalto Man (x)  Person (x)


(Marcus, Caesar)
{x/Marcus} 9
Man (Marcus) Man (Marcus)  ~Loyalto
(Marcus, Caesar)
1

~Loyalto (Marcus, Caesar) Loyalto (Marcus, Caesar)


 Hate (Marcus, Caesar)

10
Hate (Marcus, Caesar) Hate (Marcus, Caesar) 
False
Negation
False
• To prove the given fact, we assumed that the negation of it (i.e.) ~ Hate (Marcus, Caesar) and
using inference rules, we derive a contradiction as empty set, which means that the
assumption must be false, and Hate (Marcus, Caesar) is true in the given KB.
• Therefore it is proved that Hate (Marcus, Caesar) is true using CNF representation.
• The following diagram shows the proof of Resolution with refutation using CNF
representation.

~Hate (Marcus, Caesar) ~Roman (x)  Loyalto (x, Caesar)  Hate (x, Caesar)
(Negation & 5) {x/Marcus}

Pompeian (x)  Roman(x)


Caesar)
{x/Marcus} 3

~Pompeian (Marcus)  Loaylto (Marcus, Pompeian (Marcus)


Caesar) 2

Loyalto (Marcus, Caesar)


~Person(x)  ~Ruler (y) ~trytoassassinate
(x, y)  ~Loyalto (x, y)
{x/Marcus, y/Caesar}

7
~Man(x)  Person (x) ~Person(Marcus)  ~Ruler (Caesar)
 ~Trytoassassinate (Marcus, Caesar)
{x/Marcus}
9

~Man(Caesar)  ~Ruler (Caesar) Man(Marcus)


 ~Trytoassassinate (Marcus, Caesar)
1

~Ruler(Marcus)  ~Trytoassassinate Ruler (Caesar)


(Marcus, Caesar)
4

~Trytoassassinate (Marcus, Caesar) ~Trytoassassinate (Marcus, Caesar)

{}
.10.4 Dealing with equality:-

• The unification algorithm is used to find a equality between variables with other terms (i.e.)
p(x) unifies with p(A), but p(A) and p(B) fails to unify, even if the sentence A=B in the KB.

• The unification does only a syntactic test based on the appearance of the argument terms, not
a true semantic test (meaning) based on the objects they represent.

• To solve this problem, one of the way is, the properties can be followed as,
1. x x=x - Reflexive

2. x, y x = y y = x - Symmetric

3. x, y, z x = y y = z x= z - Transitive

4. x, y x = y  ( p1(x)  p1( y)) x = y , if the predicate name

x, y x = y  ( p2(x)  p2( y)) and arguments are same.

5. w, x, y, z w = y  x = z  (F1(w, x) = F1( y, z))

w = y  x = z  (F 2(w, x) = F 2( y, z))

• The other way to deal with equality is demodulation rule. For any terms x, y and z where
UNIFY (x, z) =  , defined as :
x = y,(......z ..... )
(.....SUBST ( , y) .... )

• A more powerful rule named paramodulation deals with the case where we do not know
x = y , but we do know x = y  p(x) .

2.10.5 Resolution strategies:-

• A strategy which is used to guide the search towards a proof of the resolution inference rule.
Different types of strategies are as follows,

✓ Unit Preferences:-
This strategy prefers a sentence with single literal, to produce a very short sentence
For Example:- P and P  Q  R derives the sentence Q  R .

✓ Set of support:-

A subset of the sentence are identified (set of support) and resolution combines a set
of support with another sentence and adds the resolvent into the set off support, which
reduces the size of a sentence in the KB.
Disadvantage: - Bad choice for the set of support will make the algorithm incomplete.
46
Page
Advantage: - Goal directed proof trees are generated

✓ Input resolution:-
This strategy combines one of the input sentences (from the KB or the query)
with some other sentence.
For Example:- Resolution proof, Resolution with refutation proof.
Input resolution is complete for KB that are in Horn form, but incomplete in
the general case.

✓ Linear resolution:-
Two predicates are resolved (P and Q), if either P is in the original KB or if P is an
ancestor of Q in the proof tree.

✓ Subsumption:-
A strategy which eliminate all sentences that are more specific than the
existing sentence.

For example:- if P(x) is in the KB, then there is no sense in adding P(A) to
KB.

2.10.6 Theorem Provers (or) Automated reasoners

• Theorem provers use resolution or some other inference procedure to prove sentences in full
first order logic, often used for mathematical and scientific reasoning tasks.

• For Example:- MRS, LIFE.


Logic Programming language (PROLOG) Theorem Provers

Handles only the horn clauses Handles full FOL representation

Choice of writing sentences in different form Does not affects the execution order derives
with same meaning affects the execution order the same conclusion

Example:- writing A  B  C instead of Example:- User can write either A  B  C or


A  C  B affects the execution of the A  C  B or another form B  C  A and
program the results will be exactly same.

Design of a Theorem Prover:-

• An example for theorem prover is: OTTER=> Organized Techniques for Theorem proving
and Effective Research, with particular attention to its control strategy.
• To prepare a problem for OTTER, the user must divide the knowledge into four parts;
1. SetOfSupport (SOS): A set of clauses, which defines the important facts about the
47

problem. Resolution step resolves the member of SOS with another axiom.
Page
2. Usable axioms: - A set of axioms that are outside the set of support, provides background
knowledge about the problem area. The boundary between SOS and the axiom is up to the
user’s judgement.
3. Rewrites (or) Demodulators :- A set of equations evaluated or reduced from left-to-right
order (i.e.) x + 0 = x in which x + 0 should be replaced by the term x.
4. A set of parameters and clauses that defines the control strategy that is,
a. Heuristic function :- to control the search
b. Filtering function :- eliminates some subgoals which are uninteresting
2.10.7 Execution:-

• Resolution takes place by combining the element of SOS with useful axiom, generally prefers
unit strategy.
• The process continuous until a reputation is found or there are no more clauses in the SOS.
• The following shows the algorithm of execution,

Algorithm:-

Procedure OTTER(sos, usable)

Inputs: sos, a set of support-clauses defining the problem (global variable)

Usable background knowledge potentially relevant to the problem


Repeat:
clause the lightest member of sos
move clause from sos to usable
PROCESS (INFER(clause, usable),sos)
Until sos = [] or a refutation has been found
function INFER(clause, usable) returns clauses
resolve clause with each member of usable
return the resulting clauses after applying FILTER

Procedure PROCESS (clauses, sos)


for each clause in clauses do
clause SIMPLIFY (clause)
merge identical literals
discard clause if it is a tautology
sos [clause | sos]
if clause has no literals then a refutation has been found
if clause has one literal then look for unit refutation
end

2.10.8 Extending Prolog:-

• Theorem prover can be build using prolog compiler as a base and a sound complete reasoned
of full first order logic is done using PTTP.

48

Where PTTP is Prolog Technology Theorem Prover.


Page
• PTTP includes five significant changes to prolog to restore the completeness and
expensiveness.

Prolog PTTP
Depth First Search Iterative deepening search
Not possible like a PTTP implementation Negated literals are allowed (i.e.) in the
implementation P,  P can be derived using
two separate routines
Locking is not allowed Locking is allowed (i.e.) A clause with n atoms
is stored as n different rules. Example:-
A  B  X is equivalent to
B  X  A, X  B  A
Inference is not complete Inference is complete since refutation is
allowed
Unification is less efficient Unification is more eficient

Drawback of PTTP:-

• Each inference rule is used by the system both in its original form and contrapositive form
Example:- ( f (x, y) = f (a,b))  (x = a)  ( y = b)
• Prolog proves that two f terms are equal, But PTTP would also generate the contrapositive
(x  a)  ( f (x, y)  f (a, b))  ( y = b)
• This is a wasteful way to prove that any two terms x and a are different.

You might also like