SlideShare a Scribd company logo
Artificial Intelligence
Chap.3 Knowledge Representation
Issues
Prepared by:
Prof. Khushali B Kathiriya
Outline for 8th semester
 Representations And Mappings
 Approaches To Knowledge Representation
Prepared by: Prof. Khushali B Kathiriya
2
Artificial Intelligence
Chap.3 Logical Agents & First
Order Logic
Prepared by:
Prof. Khushali B Kathiriya
Outline for 6th semester
 Logical Agents:
 Knowledge–based agents
 The Wumpus world
 Logic
 Propositional logic
 Propositional theorem proving
 Effective propositional model checking
 Agents based on propositional logic
 First Order Logic:
 Representation Revisited
 Syntax and Semantics of First Order logic
 Using First Order logic
Prepared by: Prof. Khushali B Kathiriya
4
What is Knowledge?
 Knowledge is a general term. Knowledge is a progression that starts with
data which is of limited utility.
 By organizing or analyzing the data, we understand what the data means
and this becomes information.
 The interpretation or evaluation of information yield knowledge.
 An understanding of the principles embodied within the knowledge is
wisdom.
Prepared by: Prof. Khushali B Kathiriya
5
6
Prepared by: Prof. Khushali B Kathiriya
What is Knowledge representation ?
 Humans are best at understanding, reasoning, and interpreting knowledge.
Human knows things, which is knowledge and as per their knowledge they
perform various actions in the real world. But how machines do all these
things comes under knowledge representation and reasoning.
Prepared by: Prof. Khushali B Kathiriya
7
What is Knowledge representation ?
(Cont.)
 Hence we can describe Knowledge representation as following:
1. Knowledge representation and reasoning (KR, KRR) is the part of Artificial
intelligence which concerned with AI agents thinking and how thinking
contributes to intelligent behavior of agents.
2. It is responsible for representing information about the real world so that a
computer can understand and can utilize this knowledge to solve the complex
real world problems such as diagnosis a medical condition or communicating
with humans in natural language.
3. It is also a way which describes how we can represent knowledge in artificial
intelligence. Knowledge representation is not just storing data into some
database, but it also enables an intelligent machine to learn from that
knowledge and experiences so that it can behave intelligently like a human.
Prepared by: Prof. Khushali B Kathiriya
8
What to represent?
 Object: All the facts about objects in our world domain. E.g., Guitars
contains strings, trumpets are brass instruments.
 Events: Events are the actions which occur in our world.
 Performance: It describe behavior which involves knowledge about how to
do things.
 Meta-knowledge: It is knowledge about what we know.
 Facts: Facts are the truths about the real world and what we represent.
 Knowledge-Base: The central component of the knowledge-based agents
is the knowledge base. It is represented as KB. The Knowledgebase is a
group of the Sentences (Here, sentences are used as a technical term and
not identical with the English language).
 Knowledge: Knowledge is awareness or familiarity gained by experiences
of facts, data, and situations.
Prepared by: Prof. Khushali B Kathiriya
9
Framework of Knowledge Representation
Prepared by: Prof. Khushali B Kathiriya
10
Artificial Intelligence
Knowledge-Based Agent in AI
Prepared by:
Prof. Khushali B Kathiriya
Knowledge-Based Agent in AI
 An intelligent agent needs knowledge about the real world for
taking decisions and reasoning to act efficiently.
 Knowledge-based agents are those agents who have the
capability of maintaining an internal state of knowledge, reason
over that knowledge, update their knowledge after observations
and take actions. These agents can represent the world with some
formal representation and act intelligently.
 Knowledge-based agents are composed of two main parts:
1. Knowledge-base and
2. Inference system.
Prepared by: Prof. Khushali B Kathiriya
12
The architecture of knowledge-based
agent
Prepared by: Prof. Khushali B Kathiriya
13
The architecture of knowledge-based
agent (Cont.)
 The diagram is representing a generalized architecture for a knowledge-
based agent. The knowledge-based agent (KBA) take input from the
environment by perceiving the environment. The input is taken by the
inference engine of the agent and which also communicate with KB to
decide as per the knowledge store in KB. The learning element of KBA
regularly updates the KB by learning new knowledge.
Prepared by: Prof. Khushali B Kathiriya
14
Why use knowledge base?
 Knowledge base: Knowledge-base is a central component of a
knowledge-based agent, it is also known as KB. It is a collection of
sentences (here 'sentence' is a technical term and it is not identical to
sentence in English). These sentences are expressed in a language which is
called a knowledge representation language. The Knowledge-base of KBA
stores fact about the world.
 Knowledge-base is required for updating knowledge for an agent to learn
with experiences and take action as per the knowledge.
Prepared by: Prof. Khushali B Kathiriya
15
Inference System
 Inference means deriving new sentences from old. Inference system
allows us to add a new sentence to the knowledge base. A
sentence is a proposition about the world. Inference system applies
logical rules to the KB to deduce new information.
 Inference system generates new facts so that an agent can update
the KB. An inference system works mainly in two rules which are
given as:
1. Forward chaining
2. Backward chaining
Prepared by: Prof. Khushali B Kathiriya
16
Artificial Intelligence
Techniques of Knowledge Representation
Prepared by:
Prof. Khushali B Kathiriya
Techniques/ Approaches of Knowledge
Representation
 Knowledge can be represented using the following
approaches/techniques:
Prepared by: Prof. Khushali B Kathiriya
18
Artificial Intelligence
Logical Representation
Prepared by:
Prof. Khushali B Kathiriya
1. Logical Representation
 Logical representation is a language with some concrete rules which
deals with propositions and has no ambiguity in representation. Logical
representation means drawing a conclusion based on various
conditions.
 This representation lays down some important communication rules. It
consists of precisely defined syntax and semantics which supports the
sound inference. Each sentence can be translated into logics using
syntax and semantics.
 Logical representation can be categorized into:
1. Propositional Logic
2. First Order Predicate Logic
3. Higher order Predicate Logic
4. Fuzzy Logic
Prepared by: Prof. Khushali B Kathiriya
20
1. Logical Representation (Cont.)
1. Propositional Logics:
 All propositions either true/false (1/0).
 We can not identify relation between 2 sentences.
 For example…..
Prepared by: Prof. Khushali B Kathiriya
21
Sentences Truth value Proposition value
Sky is blue True True
Roses are red True True
2+2=5 False True
1. Logical Representation (Cont.)
2. First Order Predicated Logic:
 These are much more expressive and make use of variables, constants,
predicates, functions and quantifiers along with the connective explained
already in previous section.
Prepared by: Prof. Khushali B Kathiriya
22
1. Logical Representation (Cont.)
Advantages of logical representation Disadvantages of logical representation
Logical representation enables us to
do logical reasoning.
Logical representations have some
restrictions and are challenging to work
with.
Logical representation is the basis for
the programming languages.
Logical representation technique may
not be very natural, and inference may
not be so efficient.
Prepared by: Prof. Khushali B Kathiriya
23
Artificial Intelligence
Semantic net representation
Prepared by:
Prof. Khushali B Kathiriya
2. Semantic net representation
 Semantic networks are alternative of predicate logic for knowledge
representation. In Semantic networks, we can represent our knowledge in
the form of graphical networks. This network consists of nodes representing
objects and arcs which describe the relationship between those objects.
Semantic networks can categorize the object in different forms and can
also link those objects. Semantic networks are easy to understand and can
be easily extended.
Prepared by: Prof. Khushali B Kathiriya
25
2. Semantic net representation (Cont.)
 Following are some statements which we need to represent in the form of
nodes and arcs.
1. Jerry is a cat.
2. Jerry is a mammal
3. Jerry is owned by Priya.
4. Jerry is brown colored.
5. All Mammals are animal.
Prepared by: Prof. Khushali B Kathiriya
26
2. Semantic net representation (Cont.)
 Drawbacks in Semantic representation:
1. Semantic networks take more computational time at runtime as we need to
traverse the complete network tree to answer some questions. It might be
possible in the worst case scenario that after traversing the entire tree, we
find that the solution does not exist in this network.
2. Semantic networks try to model human-like memory (Which has 1015
neurons and links) to store the information, but in practice, it is not possible
to build such a vast semantic network.
3. These types of representations are inadequate as they do not have any
equivalent quantifier, e.g., for all, for some, none, etc.
4. Semantic networks do not have any standard definition for the link names.
5. These networks are not intelligent and depend on the creator of the system.
Prepared by: Prof. Khushali B Kathiriya
27
2. Semantic net representation (Cont.)
 Advantages of Semantic network:
1. Semantic networks are a natural representation of knowledge.
2. Semantic networks convey meaning in a transparent manner.
3. These networks are simple and easily understandable.
Prepared by: Prof. Khushali B Kathiriya
28
2. Semantic net representation (Cont.)
 Represent following sentences using semantic networks.
 Isa(person, mammal)
 Instance(Mike-Hall, person)
 Team(Mike-Hall, Cardiff)
Prepared by: Prof. Khushali B Kathiriya
29
2. Semantic net representation (Cont.)
Prepared by: Prof. Khushali B Kathiriya
30
Artificial Intelligence
Frame Representation
Prepared by:
Prof. Khushali B Kathiriya
3. Frame Representation
 This concept was introduced by Marvin Minsky in 1975. they are mostly used
when the task becomes quite complex and needs more structured
representation.
 More structured the system becomes more would be the requirement of
using frames which would prove beneficial. Generally frames are record
like structures that consists of a collection of slots or attributes and the
corresponding slot values.
 Slots can be of any size and type. The slots have names and values called
as facts. Facets can have names or numbers too. A simple frame is shown
in fig for person ram.
Prepared by: Prof. Khushali B Kathiriya
32
3. Frame Representation (Cont.)
Prepared by: Prof. Khushali B Kathiriya
33
Ram Brothers Laxman Cat
Bharat
Grey
Color
3. Frame Representation (Cont.)
Sr. No. Slot Value
1 Ram -
2 Profession Professor
3 Age 50
4 Wife Sita
5 Children Luv Kush
6 Address 4C gb Road
7 City Banaras
8 State UP
9 Zip 400615
Prepared by: Prof. Khushali B Kathiriya
34
3. Frame Representation (Cont.)
 Advantages of frame representation:
1. The frame knowledge representation makes the programming easier by
grouping the related data.
2. The frame representation is comparably flexible and used by many
applications in AI.
3. It is very easy to add slots for new attribute and relations.
4. It is easy to include default data and to search for missing values.
5. Frame representation is easy to understand and visualize.
Prepared by: Prof. Khushali B Kathiriya
35
3. Frame Representation (Cont.)
 Disadvantages of frame representation:
1. In frame system inference mechanism is not be easily processed.
2. Inference mechanism cannot be smoothly proceeded by frame
representation.
3. Frame representation has a much generalized approach.
Prepared by: Prof. Khushali B Kathiriya
36
4. Production Rules
 Production rules system consist of (condition, action) pairs which
mean, "If condition then action". It has mainly three parts:
 The set of production rules
 Working Memory
 The recognize-act-cycle
Prepared by: Prof. Khushali B Kathiriya
37
4. Production Rules (Cont.)
 Example:
 IF (at bus stop AND bus arrives) THEN action (get into the bus)
 IF (on the bus AND paid AND empty seat) THEN action (sit down).
 IF (on bus AND unpaid) THEN action (pay charges).
 IF (bus arrives at destination) THEN action (get down from the bus).
Prepared by: Prof. Khushali B Kathiriya
38
4. Production Rules (Cont.)
 Advantages of Production rule:
1. The production rules are expressed in natural language.
2. The production rules are highly modular, so we can easily remove, add
or modify an individual rule.
 Disadvantages of Production rule:
1. Production rule system does not exhibit any learning capabilities, as it
does not store the result of the problem for the future uses.
2. During the execution of the program, many rules may be active hence
rule-based production systems are inefficient.
Prepared by: Prof. Khushali B Kathiriya
39
Artificial Intelligence
Issues in Knowledge Representation
Prepared by:
Prof. Khushali B Kathiriya
Issues in Knowledge Representation
 Important Attributes:
 There can be attributes that occur in many different types of problem with
different names.
 For example, instance and isa and each is important because each supports
property inheritance.
 Relationships:
 The relationships, such as, inverses, existence; among various attributes of an
object need to be represented without any ambiguity.
 For example, band(John, NewYork City)
Prepared by: Prof. Khushali B Kathiriya
41
Issues in Knowledge Representation
(Cont.)
 Granularity:
 This represents at what level should the knowledge be represented and what are
primitives. Choosing the granularity of representation primitives are fundamental
concepts such as holding, seeing, playing and as English is a very rich language
with over half a million words to choose as our primitives in a series of situations.
 For example, if Tom feeds a dog then it could become: feeds(tom,dog)
 If tom gives the dog a bone like: gives(tom,dog,bone) are these the same?
Prepared by: Prof. Khushali B Kathiriya
42
Artificial Intelligence
Propositional Logic
Prepared by:
Prof. Khushali B Kathiriya
Propositional Logic
 Propositional logic (PL) is the simplest form of logic where all the
statements are made by propositions. A proposition is a declarative
statement which is either true or false. It is a technique of
knowledge representation in logical and mathematical form.
 Example:
 It is Sunday. T
 The Sun rises from West . F
 3+3= 7. F
 Some students are intelligent. T/F both
Prepared by: Prof. Khushali B Kathiriya
44
PL
Semantic
Syntax
Propositional Logic (Cont.)
 Following are some basic facts about propositional logic:
 Propositional logic is also called Boolean logic as it works on 0 and 1.
 In propositional logic, we use symbolic variables to represent the logic,
and we can use any symbol for a representing a proposition, such A, B,
C, P, Q, R, etc.
 Propositions can be either true or false, but it cannot be both.
 Propositional logic consists of an object, relations or function,
and logical connectives.
 These connectives are also called logical operators.
Prepared by: Prof. Khushali B Kathiriya
45
PL
Complex
Atomic
Syntax in Propositional Logic (Cont.)
 Rules for conjunction: NEGATIVE operator
 A sentence such as ¬ P is called negation of P. A literal can be
either Positive literal or negative literal.
 Example,
P= Today is Sunday.
 1 is represent as a true
 0 is represent as a false
Prepared by: Prof. Khushali B Kathiriya
47
P ¬ P
1 0
0 1
Syntax in Propositional Logic (Cont.)
 Rules for conjunction: AND operator
 A sentence which has ∧ connective such as, P ∧ Q is called a
conjunction.
 Example: Rohan is intelligent and hardworking.
 It can be written as,
P= Rohan is intelligent.
Q= Rohan is hardworking.
 So we can write it as P ∧ Q.
Prepared by: Prof. Khushali B Kathiriya
48
P Q P ^ Q
1 1 1
1 0 0
0 1 0
0 0 0
Syntax in Propositional Logic (Cont.)
 Rules for Disjunction: OR operator
 A sentence which has ∨ connective, such as P ∨ Q. is called
disjunction, where P and Q are the propositions.
 Example: "Ritika is a doctor or Engineer",
 It can be written as,
P= Ritika is Doctor.
Q= Ritika is Engineer,
 So we can write it as P ∨ Q.
Prepared by: Prof. Khushali B Kathiriya
49
P Q P v Q
1 1 1
1 0 1
0 1 1
0 0 0
Syntax in Propositional Logic (Cont.)
 Rules for conjunction: CONDITIONAL
 A sentence such as P → Q, is called an implication. Implications
are also known as if-then rules.
 Example: If it is raining, then the street is wet.
Let P= It is raining,
Q= Street is wet,
 so it is represented as P → Q
Prepared by: Prof. Khushali B Kathiriya
50
P Q P → Q
1 1 1
1 0 0
0 1 1
0 0 1
Syntax in Propositional Logic (Cont.)
 Rules for conjunction: BICONDITIONAL
 A sentence such as P⇔ Q is a BiConditional sentence,
 Example: If I am breathing, then I am alive
P= I am breathing
Q= I am alive
 It can be represented as P ⇔ Q.
Prepared by: Prof. Khushali B Kathiriya
51
P Q P ⇔ Q
1 1 1
1 0 0
0 1 0
0 0 1
Summarized table Propositional Logic
Connectives (Cont.)
Prepared by: Prof. Khushali B Kathiriya
52
Artificial Intelligence
Example of Propositional Logic
Prepared by:
Prof. Khushali B Kathiriya
Properties of Operators
 Commutatively
 P∧ Q= Q ∧ P, or
 P ∨ Q = Q ∨ P.
 Associativity
 (P ∧ Q) ∧ R= P ∧ (Q ∧ R),
 (P ∨ Q) ∨ R= P ∨ (Q ∨ R)
 Identity element
 P ∧ True = P,
 P ∨ True= True.
Prepared by: Prof. Khushali B Kathiriya
54
 Distributive
 P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
 P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
 DE Morgan's Law
 ¬ (P ∧ Q) = (¬P) ∨ (¬Q)
 ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
 Double-negation elimination
 ¬ (¬P) = P.
What is Propositional Logic?
 A ^ B and B ^ A should have same meaning but in natural language words
and sentences may have different meaning
 Example,
1. Radha started feeling feverish and Radha went to the doctor.
2. Radha went to doctor and Radha stared feeling feverish.
 Here, sentence 1 and sentence 2 have different meaning
 In AI propositional logic is a relation between the truth value of one
statement to that of the truth table of other statement.
Prepared by: Prof. Khushali B Kathiriya
55
Example of Propositional Logic
1. ¬(P ^ Q) , P → ¬Q
Prepared by: Prof. Khushali B Kathiriya
56
P Q ¬Q (P ^ Q) ¬(P ^ Q) P → ¬Q
1 1 0 1 0 0
1 0 1 0 1 1
0 1 0 0 1 1
0 0 1 0 1 1
P Q IF P → Q
1 1 1
1 0 0
0 1 1
0 0 1
P Q IF P ^ Q
1 1 1
1 0 0
0 1 0
0 0 0
P Q IF P v Q
1 1 1
1 0 1
0 1 1
0 0 0
Example of Propositional Logic (Cont.)
2. ¬P v ¬Q v R , Q v R, P→R
Prepared by: Prof. Khushali B Kathiriya
57
P Q R ¬P ¬Q ¬P v ¬Q v R (Q v R) P → R
0 0 0 1 1 1 0 1
0 0 1 1 1 1 1 1
0 1 0 1 0 1 1 1
0 1 1 1 0 1 1 1
1 0 0 0 1 1 0 0
1 0 1 0 1 1 1 1
1 1 0 0 0 0 1 0
1 1 1 0 0 1 1 1
Example of Propositional Logic (Cont.)
3. (P v Q) v ~(P v (Q ^ R))=1
Prepared by: Prof. Khushali B Kathiriya
58
P Q R P v Q Q ^ R P v (Q ^ R) ~(P v (Q ^ R)) (P v Q) v ~(P v (Q ^ R))
0 0 0 0 0 0 1 1
0 0 1 0 0 0 1 1
0 1 0 1 0 0 1 1
0 1 1 1 1 1 0 1
1 0 0 1 0 1 0 1
1 0 1 1 0 1 0 1
1 1 0 1 0 1 0 1
1 1 1 1 1 1 0 1
Example of Propositional Logic (Cont.)
4. ~[{~P v ~(Q ^ R)} v (P ^ R)]
Prepared by: Prof. Khushali B Kathiriya
59
I1
I2
I3
P Q R ~ P I1 ~ I1 I2 I3 I2 v I3 ~ (I2 v I3)
0 0 0 1 0 1 1 0 1 0
0 0 1 1 0 1 1 0 1 0
0 1 0 1 0 1 1 1 1 0
0 1 1 1 1 0 1 0 1 0
1 0 0 0 0 1 1 0 1 0
1 0 1 0 0 1 1 1 1 0
1 1 0 0 0 1 1 0 1 0
1 1 1 0 1 0 0 1 1 0
Example of Propositional Logic (Cont.)
5. (P→(Q→R)) → ((P→Q) → (P→R))
Prepared by: Prof. Khushali B Kathiriya
60
P Q R Q→R I1 I2 I3 I4 I1→I4
0 0 0 1 1 1 1 1 1
0 0 1 1 1 1 1 1 1
0 1 0 0 1 1 1 1 1
0 1 1 1 1 1 1 1 1
1 0 0 1 1 0 0 1 1
1 0 1 1 1 0 1 1 1
1 1 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 1
I1 I2 I3
I4
P Q IF P → Q
1 1 1
1 0 0
0 1 1
0 0 1
Example of Propositional Logic (Cont.)
 Try out your self:
1. (P ⇔ (Q→ R)) ⇔ ((P ⇔ Q)→ R)
2. ((P ⇔ Q) ^ (~ Q → R)) ⇔ (~ (P ⇔ R) → Q)
Prepared by: Prof. Khushali B Kathiriya
61
Limitation of Propositional Logic
 We cannot represent relations like ALL, some, or none with
propositional logic.
 Example:
 All the girls are cute.
 Some apples are sweet.
 Few students are intelligent.
 Propositional logic has limited expressive power.
 In propositional logic, we cannot describe statements in terms of
their properties or logical relationships.
Prepared by: Prof. Khushali B Kathiriya
62
Artificial Intelligence
Inference Rules
Prepared by:
Prof. Khushali B Kathiriya
Inference Rules
 Inference:
 In artificial intelligence, we need intelligent computers which can
create new logic from old logic or by evidence, so generating the
conclusions from evidence and facts is termed as Inference.
 Inference Rule:
 Inference rules are the templates for generating valid arguments.
Inference rules are applied to derive proofs in artificial intelligence, and
the proof is a sequence of the conclusion that leads to the desired
goal.
 In inference rules, the implication among all the connectives plays an
important role.
Prepared by: Prof. Khushali B Kathiriya
64
Inference Rules (Cont.)
1. Modus Ponens
2. Modus Tollens
3. Hypothetical Syllogism
4. Disjunctive Syllogism
Prepared by: Prof. Khushali B Kathiriya
65
Inference Rules (Cont.)
1. Modus Ponens
 The Modus Ponens rule is one of the most important rules of inference,
and it states that if P and P → Q is true, then we can infer that Q will be
true. It can be represented as:
66
Prepared by: Prof. Khushali B Kathiriya
Inference Rules (Cont.)
1. Modus Ponens
 Example:
 Statement-1: "If I am sleepy then I go to bed" ==> P → Q
 Statement-2: "I am sleepy" ==> P
 Conclusion: "I go to bed." ==> Q
 Hence, we can say that, if P→ Q is true and P is true then Q will be true.
67
Prepared by: Prof. Khushali B Kathiriya
Inference Rules (Cont.)
2. Modus Tollens
 The Modus Tollens rule state that if P→ Q is true and ¬ Q is true, then
¬ P will also true. It can be represented as:
Prepared by: Prof. Khushali B Kathiriya
68
Inference Rules (Cont.)
2. Modus Tollens
 Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
 Statement-2: "I do not go to the bed."==> ~Q
 Statement-3: Which infers that "I am not sleepy" => ~P
Prepared by: Prof. Khushali B Kathiriya
69
Inference Rules (Cont.)
3. Hypothetical Syllogism
 The Hypothetical Syllogism rule state that if P→R is true whenever P→Q
is true, and Q→R is true. It can be represented as the following
notation:
 Notation is : P → Q, Q → R
P → R
Prepared by: Prof. Khushali B Kathiriya
70
Inference Rules (Cont.)
3. Hypothetical Syllogism
 Statement-1: If you have my password, then you can log on to
my face book.
 Statement-2: If you can log onto my face book account then you
can delete my face book account.
 Statement-3: If you have my password then you can delete my
face book account.
71
Prepared by: Prof. Khushali B Kathiriya
Inference Rules (Cont.)
4. Disjunctive Syllogism
 The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true,
then Q will be true. It can be represented as:
Prepared by: Prof. Khushali B Kathiriya
72
Inference Rules (Cont.)
4. Disjunctive Syllogism
 Statement-1: Today is Sunday or Monday. ==>P∨Q
 Statement-2: Today is not Sunday. ==> ¬P
 Conclusion: Today is Monday. ==> Q
Prepared by: Prof. Khushali B Kathiriya
73
Inference Rules (Cont.)
 In short inference rule says that new sentence can be create by logically
following the set of sentences of knowledge base.
Prepared by: Prof. Khushali B Kathiriya
74
Sr. No. Inference Rules Premises (KB) Conclusion
1 Modus Ponens X, X → Y Y
2 Substitution X → Y & Y → Z X = Y
3 Chain Rule X → Y, Y → Z X → Z
4 AND introduction X, Y X ^ Y
5 Transposition X →Y ~X → ~Y
Artificial Intelligence
Horn Clause
Prepared by:
Prof. Khushali B Kathiriya
Horn Clause
 A Horn clause is a clause (a disjunction of literals) with at most one positive
literal.
~A1 V ~A2 V ~A3 V . . . . . V ~An V B
 Lets take one example,
 (A1 ^ A2 ^ A3 ^ . . . . . ^ An) → B
 Apply DE Morgan's Law on given equation,
 ~(A1 ^ A2 ^ A3 ^ . . . . . ^ An) V B
 Apply Distributive Law,
 ~A1 V ~A2 V ~A3 V . . . . . V ~An V B
Prepared by: Prof. Khushali B Kathiriya
76
Horn clause
Properties of Operators
 Commutatively
 P∧ Q= Q ∧ P, or
 P ∨ Q = Q ∨ P.
 Associativity
 (P ∧ Q) ∧ R= P ∧ (Q ∧ R),
 (P ∨ Q) ∨ R= P ∨ (Q ∨ R)
 Identity element
 P ∧ True = P,
 P ∨ True= True.
Prepared by: Prof. Khushali B Kathiriya
77
 Distributive
 P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
 P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
 DE Morgan's Law
 ¬ (P ∧ Q) = (¬P) ∨ (¬Q)
 ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
 Double-negation elimination
 ¬ (¬P) = P.
Horn Clause (Cont.)
1. (A ^ B ) → C
= (A ^ B) → C
Apply DE Morgan's Law
= ~ (A ^ B) V C
Apply Distributive Law
= ~A V ~B V C
Prepared by: Prof. Khushali B Kathiriya
78
Horn clause
Horn Clause (Cont.)
2. (A V B) → C
= (A V B ) → C
Apply DE Morgan's Law
= ~(A V B ) V C
Apply Distributive Law
= (~A ^ ~B) V C
= (~A V C) ^ (~A V ~B)
= (~A V C) , (~B V C)
Prepared by: Prof. Khushali B Kathiriya
79
Horn Clause (Cont.)
3. ( A ^ ~B ) → C
= ( A ^ ~B ) → C
Apply DE Morgan's Law
= ~(A ^ ~B) V C
Apply Distributive Law
= (~A V B) V C
= ~A V B V C
Prepared by: Prof. Khushali B Kathiriya
80
Not Possible
Artificial Intelligence
Wampus World
Prepared by:
Prof. Khushali B Kathiriya
Wampus World
 The Wumpus world is a cave which has 4/4 rooms connected with
passageways. So there are total 16 rooms which are connected with each
other. We have a knowledge-based agent who will go forward in this
world. The cave has a room with a beast which is called Wumpus, who eats
anyone who enters the room. The Wumpus can be shot by the agent, but
the agent has a single arrow.
 In the Wumpus world, there are some Pits rooms which are bottomless, and
if agent falls in Pits, then he will be stuck there forever. The exciting thing
with this cave is that in one room there is a possibility of finding a heap of
gold. So the agent goal is to find the gold and climb out the cave without
fallen into Pits or eaten by Wumpus. The agent will get a reward if he comes
out with gold, and he will get a penalty if eaten by Wumpus or falls in the
pit.
Prepared by: Prof. Khushali B Kathiriya
82
Wampus World (Cont.)
 Following is a sample diagram for representing the Wumpus world. It is
showing some rooms with Pits, one room with Wumpus and one agent at
(1,1) square location of the world.
Prepared by: Prof. Khushali B Kathiriya
83
Wampus World (Cont.)
 There are also some components which can help the agent to navigate
the cave. These components are given as follows:
1. The rooms adjacent to the Wumpus room are smelly, so that it would have some
stench.
2. The room adjacent to PITs has a breeze, so if the agent reaches near to PIT, then
he will perceive the breeze.
3. There will be glitter in the room if and only if the room has gold.
4. The Wumpus can be killed by the agent if the agent is facing to it, and Wumpus
will emit a horrible scream which can be heard anywhere in the cave.
Prepared by: Prof. Khushali B Kathiriya
84
Wampus World (Cont.)
 PEAS description of Wumpus world
 To explain the Wumpus world we have given PEAS description as
below:
 Performance measure
 Environment
 Actuators
 Sensors
 The Wumpus world Properties
 Exploring the Wumpus world
Prepared by: Prof. Khushali B Kathiriya
85
Wampus World (Cont.)
 Performance measure:
 +1000 reward points if the agent comes out of the cave with the gold.
 -1000 points penalty for being eaten by the Wumpus or falling into the
pit.
 -1 for each action, and -10 for using an arrow.
 The game ends if either agent dies or came out of the cave.
Prepared by: Prof. Khushali B Kathiriya
86
Wampus World (Cont.)
 Environment:
 A 4*4 grid of rooms.
 The agent initially in room square [1, 1], facing toward the right.
 Location of Wumpus and gold are chosen randomly except the first
square [1,1].
 Each square of the cave can be a pit with probability 0.2 except the
first square.
Prepared by: Prof. Khushali B Kathiriya
87
Wampus World (Cont.)
 Actuators:
 Left turn,
 Right turn
 Move forward
 Grab
 Release
 Shoot
Prepared by: Prof. Khushali B Kathiriya
88
Wampus World (Cont.)
 Sensors:
 The agent will perceive the stench if he is in the room adjacent to the
Wumpus. (Not diagonally).
 The agent will perceive breeze if he is in the room directly adjacent to
the Pit.
 The agent will perceive the glitter in the room where the gold is present.
 The agent will perceive the bump if he walks into a wall.
 When the Wumpus is shot, it emits a horrible scream which can be
perceived anywhere in the cave.
 These percepts can be represented as five element list, in which we will
have different indicators for each sensor.
 Example if agent perceives stench, breeze, but no glitter, no bump, and
no scream then it can be represented as:
[Stench, Breeze, None, None, None].
Prepared by: Prof. Khushali B Kathiriya
89
Wampus World (Cont.)
 The Wumpus world Properties:
 Partially observable: The Wumpus world is partially observable because
the agent can only perceive the close environment such as an
adjacent room.
 Deterministic: It is deterministic, as the result and outcome of the world
are already known.
 Sequential: The order is important, so it is sequential.
 Static: It is static as Wumpus and Pits are not moving.
 Discrete: The environment is discrete.
 One agent: The environment is a single agent as we have one agent
only and Wumpus is not considered as an agent.
Prepared by: Prof. Khushali B Kathiriya
90
Wampus World (Cont.)
 Exploring the Wumpus world:
 Agent's First step:
 Initially, the agent is in the first room or on
the square [1,1], and we already know
that this room is safe for the agent, so to
represent on the below diagram (a) that
room is safe we will add symbol OK.
Symbol A is used to represent agent,
symbol B for the breeze, G for Glitter or
gold, V for the visited room, P for pits, W
for Wumpus.
 At Room [1,1] agent does not feel any
breeze or any Stench which means the
adjacent squares are also OK.
Prepared by: Prof. Khushali B Kathiriya
91
Wampus World (Cont.)
Prepared by: Prof. Khushali B Kathiriya
92
Wampus World (Cont.)
 Agent's second Step:
 Now agent needs to move forward, so it will either move to [1, 2], or
[2,1]. Let's suppose agent moves to the room [2, 1], at this room agent
perceives some breeze which means Pit is around this room. The pit can
be in [3, 1], or [2,2], so we will add symbol P? to say that, is this Pit room?
 Now agent will stop and think and will not make any harmful move. The
agent will go back to the [1, 1] room. The room [1,1], and [2,1] are
visited by the agent, so we will use symbol V to represent the visited
squares.
Prepared by: Prof. Khushali B Kathiriya
93
Wampus World (Cont.)
 Agent's third step:
 At the third step, now agent will move to the room [1,2] which is OK. In
the room [1,2] agent perceives a stench which means there must be a
Wumpus nearby. But Wumpus cannot be in the room [1,1] as by rules of
the game, and also not in [2,2] (Agent had not detected any stench
when he was at [2,1]). Therefore agent infers that Wumpus is in the room
[1,3], and in current state, there is no breeze which means in [2,2] there
is no Pit and no Wumpus. So it is safe, and we will mark it OK, and the
agent moves further in [2,2].
Prepared by: Prof. Khushali B Kathiriya
94
Wampus World (Cont.)
Prepared by: Prof. Khushali B Kathiriya
95
Wampus World (Cont.)
 Agent's fourth step:
 At room [2,2], here no stench and no breezes present so let's suppose
agent decides to move to [2,3]. At room [2,3] agent perceives glitter, so
it should grab the gold and climb out of the cave.
Prepared by: Prof. Khushali B Kathiriya
96
Artificial Intelligence
Chap.3 First Order Predicate Logic
Prepared by:
Prof. Khushali B Kathiriya
First Order Predicate Logic
 In the topic of Propositional logic, we have seen that how to represent
statements using propositional logic. But unfortunately, in propositional
logic, we can only represent the facts, which are either true or false.
 PL is not sufficient to represent the complex sentences or natural language
statements. The propositional logic has very limited expressive power.
Consider the following sentence, which we cannot represent using PL logic.
 "Some humans are intelligent“.
 "Sachin likes cricket."
 To represent the above statements, PL logic is not sufficient, so we required
some more powerful logic, such as first-order logic (FOL).
Prepared by: Prof. Khushali B Kathiriya
98
First Order Predicate Logic (Cont.)
 First-order logic is another way of knowledge representation in artificial
intelligence. It is an extension to propositional logic.
 FOL is sufficiently expressive to represent the natural language statements in
a concise way.
 First-order logic is also known as Predicate logic or First-order predicate
logic. First-order logic is a powerful language that develops information
about the objects in a more easy way and can also express the relationship
between those objects.
Prepared by: Prof. Khushali B Kathiriya
99
First Order Predicate Logic (Cont.)
 First-order logic (like natural language) does not only assume that the world
contains facts like propositional logic but also assumes the following things in the
world:
1. Constant term: A, B, people, numbers, colors, wars, theories, squares, pits,
Wumpus, etc.
2. Variable term : It can be unary relation such as: red, round, is adjacent, or
n-any relation such as: the sister of, brother of, has color, comes between
3. Function: Father of, best friend, third inning of, end of, etc.
 As a natural language, first-order logic also has two main parts:
1. Syntax
2. Semantics
Prepared by: Prof. Khushali B Kathiriya
100
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, temp3,
......, term n).
 Example:
 Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
 Chinky is a cat: => cat (Chinky).
Prepared by: Prof. Khushali B Kathiriya
101
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.
 Example:
 "x is an integer."
Prepared by: Prof. Khushali B Kathiriya
102
Quantifiers in First-Order Logic
 A quantifier is a language element which generates quantification, and
quantification specifies the quantity of specimen in the universe of
discourse.
 These are the symbols that permit to determine or identify the range and
scope of the variable in the logical expression. There are two types of
quantifier:
1. Universal Quantifier, (for all, everyone, everything)
2. Existential quantifier, (for some, at least one).
Prepared by: Prof. Khushali B Kathiriya
103
Universal Quantifier
 Universal quantifier is a symbol of logical representation, which specifies
that the statement within its range is true for everything or every instance of
a particular thing.
 The Universal quantifier is represented by a symbol ∀, which resembles an
inverted A.
 If x is a variable, then ∀x is read as:
• For all x
• For each x
• For every x.
Prepared by: Prof. Khushali B Kathiriya
104
Universal Quantifier (Cont.)
Prepared by: Prof. Khushali B Kathiriya
105
Existential Quantifier
 Existential quantifiers are the type of quantifiers, which express that the
statement within its scope is true for at least one instance of something.
 It is denoted by the logical operator ∃, which resembles as inverted E.
When it is used with a predicate variable then it is called as an existential
quantifier.
 If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be
read as:
• There exists a 'x.'
• For some 'x.'
• For at least one 'x.'
Prepared by: Prof. Khushali B Kathiriya
106
Existential Quantifier (Cont.)
Prepared by: Prof. Khushali B Kathiriya
107
Properties of Quantifiers
 In Universal quantifier, ∀x∀y is similar to ∀y∀x.
 In Existential quantifier, ∃x∃y is similar to ∃y∃x.
 ∃x∀y is not similar to ∀y∃x.
Prepared by: Prof. Khushali B Kathiriya
108
Artificial Intelligence
Example of FOL
Prepared by:
Prof. Khushali B Kathiriya
Example of FOL
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).
Prepared by: Prof. Khushali B Kathiriya
110
Example of FOL
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).
Prepared by: Prof. Khushali B Kathiriya
111
Example of FOL (Cont.)
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).
Prepared by: Prof. Khushali B Kathiriya
112
Example of FOL (Cont.)
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)].
Prepared by: Prof. Khushali B Kathiriya
113
Example of FOL (Cont.)
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)].
Prepared by: Prof. Khushali B Kathiriya
114
Artificial Intelligence
Representation Simple Facts in logic
Prepared by:
Prof. Khushali B Kathiriya
Representation Simple Facts in logic
1. All students are smart.
 ∀x (Student(x) ⇒ Smart(x))
2. There exists a student.
 ∃x Student(x)
3. There exists a smart student.
 ∃x (Student(x) ∧ Smart(x))
Prepared by: Prof. Khushali B Kathiriya
117
Representation Simple Facts in logic
(Cont.)
4. Every student loves some student.
 ∀x (Student(x) ⇒ ∃y (Student(y) ∧ Loves(x,y)))
5. Every student loves some other student.
 ∀x (Student(x) ⇒ ∃y (Student(y) ∧¬(x=y) ∧ Loves(x,y)))
6. There is a student who is loved by every other student.
 ∃x (Student(x) ∧∀y (Student(y) ∧¬(x=y) ⇒Loves(y,x)))
Prepared by: Prof. Khushali B Kathiriya
118
Representation Simple Facts in logic
(Cont.)
1. Bill is a student.
 Student(Bill)
2. Bill takes either Analysis or Geometry (but not both).
 Takes(Bill,Analysis) ⇔ ¬Takes(Bill,Geometry)
3. Bill takes Analysis or Geometry (or both).
 Takes(Bill,Analysis) ∨ Takes(Bill,Geometry)
4. Bill takes Analysis and Geometry.
 Takes(Bill,Analysis) ∧ Takes(Bill,Geometry)
5. Bill does not take Analysis.
 ¬Takes(Bill,Analysis)
Prepared by: Prof. Khushali B Kathiriya
119
Representation Simple Facts in logic
(Cont.)
6. No student loves Bill.
 ¬∃x (Student(x) ∧ Loves(x,Bill)
7. Bill has at least one sister.
 ∃x SisterOf(x,Bill)
8. Bill has no sister.
 ¬∃x SisterOf(x,Bill)
9. Bill has at most one sister.
 ∀x,y (SisterOf(x,Bill) ∧ SisterOf(y,Bill) ⇒x=y))
10.Bill has exactly one sister.
 ∃x (SisterOf(x,Bill) ∧∀y (SisterOf(y,Bill) ⇒x=y))
11.Bill has at least two sisters.
 ∃x,y (SisterOf(x,Bill) ∧ SisterOf(y,Bill) ∧¬(x=y))
Prepared by: Prof. Khushali B Kathiriya
120
Representation Simple Facts in logic
(Cont.)
1. Anyone whom Mary loves is a football star.
2. Any student who does not pass does not play.
3. John is a student.
4. Any student who does not study does not pass.
5. Anyone who does not play is not a football star.
6. If John does not study, then Mary does not love John.
Prepared by: Prof. Khushali B Kathiriya
121
Representation Simple Facts in logic
(Cont.)
1. Anyone whom Mary loves is a football star.
 ∀ x (LOVES(Mary,x) → STAR(x))
2. Any student who does not pass does not play.
 ∀ x (STUDENT(x) ∧ ¬ PASS(x) → ¬ PLAY(x))
3. John is a student.
 STUDENT(John)
4. Any student who does not study does not pass.
 ∀ x (STUDENT(x) ∧ ¬ STUDY(x) → ¬ PASS(x))
5. Anyone who does not play is not a football star.
 ∀ x (¬ PLAY(x) → ¬ STAR(x))
6. If John does not study, then Mary does not love John.
 ¬ STUDY(John) → ¬ LOVES(Mary,John)
Prepared by: Prof. Khushali B Kathiriya
122
Representation Simple Facts in logic
(Cont.)
1. Every child loves Santa.
2. Everyone who loves Santa loves any reindeer.
3. Rudolph is a reindeer, and Rudolph has a red nose.
4. Anything which has a red nose is weird or is a clown.
5. No reindeer is a clown.
6. Scrooge does not love anything which is weird.
7. Scrooge is not a child.
Prepared by: Prof. Khushali B Kathiriya
123
Representation Simple Facts in logic
(Cont.)
1. Every child loves Santa.
 ∀ x (CHILD(x) → LOVES(x, Santa))
2. Everyone who loves Santa loves any reindeer.
 ∀ x (LOVES(x, Santa) → ∀ y (REINDEER(y) → LOVES(x, y)))
3. Rudolph is a reindeer, and Rudolph has a red nose.
 REINDEER(Rudolph) ∧ REDNOSE(Rudolph)
4. Anything which has a red nose is weird or is a clown.
 ∀ x (REDNOSE(x) → WEIRD(x) ∨ CLOWN(x))
Prepared by: Prof. Khushali B Kathiriya
124
Representation Simple Facts in logic
(Cont.)
5. No reindeer is a clown.
 ¬ ∃ x (REINDEER(x) ∧ CLOWN(x))
6. Scrooge does not love anything which is weird.
 ∀ x (WEIRD(x) → ¬ LOVES(Scrooge, x))
7. Scrooge is not a child.
 ¬ CHILD(Scrooge)
Prepared by: Prof. Khushali B Kathiriya
125
Representation Simple Facts in logic
(Cont.)
1. Anyone who buys carrots by the bushel owns either a rabbit or a grocery
store.
2. Every dog chases some rabbit.
3. Mary buys carrots by the bushel.
4. Anyone who owns a rabbit hates anything that chases any rabbit.
5. John owns a dog.
6. Someone who hates something owned by another person will not date
that person.
7. If Mary does not own a grocery store, she will not date John.
Prepared by: Prof. Khushali B Kathiriya
126
Representation Simple Facts in logic
(Cont.)
1. Anyone who buys carrots by the bushel owns either a rabbit or a grocery
store.
 ∀ x (BUY(x) → ∃ y (OWNS(x,y) ∧ (RABBIT(y) ∨ GROCERY(y))))
2. Every dog chases some rabbit.
 ∀ x (DOG(x) → ∃ y (RABBIT(y) ∧ CHASE(x,y)))
3. Mary buys carrots by the bushel.
 BUY(Mary)
4. Anyone who owns a rabbit hates anything that chases any rabbit.
 ∀ x ∀ y (OWNS(x,y) ∧ RABBIT(y) → ∀ z ∀ w (RABBIT(w) ∧ CHASE(z,w) → HATES(x,z)))
Prepared by: Prof. Khushali B Kathiriya
127
Representation Simple Facts in logic
(Cont.)
5. John owns a dog.
 ∃ x (DOG(x) ∧ OWNS(John,x))
6. Someone who hates something owned by another person will not date
that person.
 ∀ x ∀ y ∀ z (OWNS(y,z) ∧ HATES(x,z) → ¬ DATE(x,y))
7. (Conclusion) If Mary does not own a grocery store, she will not date John.
 (( ¬ ∃ x (GROCERY(x) ∧ OWN(Mary,x))) → ¬ DATE(Mary,John))
Prepared by: Prof. Khushali B Kathiriya
128
Artificial Intelligence
Chap.4 Inference in First Order
Logic
Prepared by:
Prof. Khushali B Kathiriya
Artificial Intelligence
Comparison between Propositional
Logic and First Order Logic
Prepared by:
Prof. Khushali B Kathiriya
Comparison between Propositional
Logic and First Order Logic (Cont.)
Propositional Logic (PL) First Order Logic (FOL)
PL can not represent small worlds like
vacuum cleaner world.
FOL can very well represent small
world’s problems.
PL is a weak knowledge
representation language.
FOL is a strong way of representing
language.
PL uses propositions in which the
complete sentence is denoted by a
symbol.
FOL uses predicated which involve
constants, variables, functions,
relations.
PL can not directly represent
properties of individual entities or
relation between entities.
i.e., Hiral is short.
FOL can directly represent properties
of individual entities or relation
between entities.
i.e., Hiral is short.
Ans is: short (Hiral)
Prepared by: Prof. Khushali B Kathiriya
131
Comparison between Propositional
Logic and First Order Logic
Propositional Logic (PL) First Order Logic (FOL)
PL can not express specialization,
generalization, or patterns, etc.
i.e., all rectangle have 4 sides
FOL can express specialization,
generalization, or patterns, etc.
i.e., all rectangle have 4 sides
Ans. is: no of size(rectangle,4)
Foundation level language Higher level language
PL is not sufficiently expressive to
represent complex statements.
FOL is represent complex statements.
In PL meaning of the facts is context-
independent unlike natural language.
In FOL meaning of the sentences is
context dependent like natural
language.
Declarative in nature Derivative in nature
Prepared by: Prof. Khushali B Kathiriya
132
Artificial Intelligence
Inference in First Order Logic
Prepared by:
Prof. Khushali B Kathiriya
Inference in First Order Logic
 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:
1. Forward chaining
2. Backward chaining
Prepared by: Prof. Khushali B Kathiriya
134
Artificial Intelligence
Forward Chaining/ Resolution
Prepared by:
Prof. Khushali B Kathiriya
1. Forward Chaining
 Forward chaining is also known as a forward deduction or forward
reasoning method when using an inference engine. Forward chaining is a
form of reasoning which start with atomic sentences in the knowledge base
and applies inference rules (Modus Ponens) in the forward direction to
extract more data until a goal is reached.
 The Forward-chaining algorithm starts from known facts, triggers all rules
whose premises are satisfied, and add their conclusion to the known facts.
This process repeats until the problem is solved.
 Forward chaining is called as a data driven inference technique.
Prepared by: Prof. Khushali B Kathiriya
136
1. Forward Chaining (Cont.)
 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.
Prepared by: Prof. Khushali B Kathiriya
137
1. Forward Chaining / Resolution
(Cont.)
 Example:
 If it is raining then, we will take umbrella.
Data: It is raining
Decision: we will take umbrella
 That’s means we already known that it’s raining that’s why it decided to
take umbrella.
Prepared by: Prof. Khushali B Kathiriya
138
Data
Decision
1. Forward Chaining / Resolution
(Cont.)
 Facts:
1. It is a crime for an American to sell weapons to enemy of America.
2. Country Nono is an enemy of America.
3. Nono has a some missiles.
4. All of the missiles were sold to Nono by colonel west.
5. Missiles are weapons.
6. Colonel west is American.
 We have prove that west is a criminal.
Prepared by: Prof. Khushali B Kathiriya
139
1. Forward Chaining / Resolution
(Cont.)
 Facts conversion into FOL:
1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) →
Criminal(X)
2. Enemy (Nono, America)
3. Owns ( Nono, X), Missile (X)
4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono)
5. Missile (X) → Weapon (x)
6. American (West)
Prepared by: Prof. Khushali B Kathiriya
140
1. Forward Chaining / Resolution
(Cont.)
 Forward chaining proof:
 STEP: 1
Prepared by: Prof. Khushali B Kathiriya
141
American (West) Missiles (X) Owns (Nono, X)
Enemy (Nono,
America)
1. Forward Chaining / Resolution
(Cont.)
 Forward chaining proof:
 STEP: 2 apply rule number 4 and 5
4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono)
5. Missile (X) → Weapon (x)
Prepared by: Prof. Khushali B Kathiriya
142
1. Forward Chaining / Resolution
(Cont.)
Prepared by: Prof. Khushali B Kathiriya
143
American (West) Missiles (X) Owns (Nono, X)
Enemy (Nono,
America)
Weapon (X) Sell (West, X, Nono)
5
4
1. Forward Chaining / Resolution
(Cont.)
 Forward chaining proof:
 STEP: 3 apply rule number 1
1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) →
Criminal(X)
Prepared by: Prof. Khushali B Kathiriya
144
1. Forward Chaining / Resolution
(Cont.)
Prepared by: Prof. Khushali B Kathiriya
145
American (West) Missiles (X) Owns (Nono, X)
Enemy (Nono,
America)
Weapon (X) Sell (West, X, Nono)
5
4
Criminal (West)
1
Artificial Intelligence
Backward Chaining/ Resolution
Prepared by:
Prof. Khushali B Kathiriya
2. Backward Chaining/ Resolution
 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.
Prepared by: Prof. Khushali B Kathiriya
147
Decision
Data
2. Backward Chaining/ Resolution
(Cont.)
 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.
Prepared by: Prof. Khushali B Kathiriya
148
2. Backward Chaining/ Resolution
(Cont.)
 Facts:
1. It is a crime for an American to sell weapons to enemy of America.
2. Country Nono is an enemy of America.
3. Nono has a some missiles.
4. All of the missiles were sold to Nono by colonel west.
5. Missiles are weapons.
6. Colonel west is American.
 We have know that west is a criminal.
Prepared by: Prof. Khushali B Kathiriya
149
2. Backward Chaining/ Resolution
(Cont.)
 Facts conversion into FOL:
1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) →
Criminal(X)
2. Enemy (Nono, America)
3. Owns ( Nono, X), Missile (X)
4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono)
5. Missile (X) → Weapon (x)
6. American (West)
Prepared by: Prof. Khushali B Kathiriya
150
2. Backward Chaining/ Resolution
(Cont.)
 Backward chaining proof:
 STEP: 1 Take conclusion (leaf node)
Prepared by: Prof. Khushali B Kathiriya
151
Criminal (West)
2. Backward Chaining/ Resolution
(Cont.)
 Backward chaining proof:
 STEP: 2 Apply 1st rule
Prepared by: Prof. Khushali B Kathiriya
152
Criminal (West)
American (West) Missiles (X) Sell (West, X, Z)
Enemy (Nono,
America)
1
2. Backward Chaining/ Resolution
(Cont.)
 Backward chaining proof:
 STEP: 3 Apply rules
Prepared by: Prof. Khushali B Kathiriya
153
2. Backward Chaining/ Resolution
(Cont.)
Prepared by: Prof. Khushali B Kathiriya
154
Criminal (West)
American (West) Weapon (X) Sell (West, X, Z)
Enemy (Nono,
America)
1
Missiles (X) Owns (Nono, X)
Missiles (X)
Artificial Intelligence
Unification Algorithm
Prepared by:
Prof. Khushali B Kathiriya
Unification Algorithm
 Algorithm Unify(L1,L2):
1. If L1 and L2 is a variable or constant then,
a. If L1 and L2 are identical return NIL,
b. Else if L1 is a variable, then if L1 occurs in L2 then return fail, else return { (L1/L2) }
c. Else if L2 is a variable, then if L2 occurs in L1 then return fail, else return { (L2/L1) }
d. Else return fail
2. If the initial predicate symbols in L1 and L2 are identical, then return Fail
3. If L1 and L2 have different number of arguments, then fails
a. i.e., P(L1,L2) and P(L1,L2,L3)
4. Set SUBST to nil.
5. Loop (apply for all variable/constant)
6. Return SUBST.
Prepared by: Prof. Khushali B Kathiriya
156
Unification Example
 Unification is all about making the expressions look identical. So, for the
given expressions to make them look identical we need to do substitution.
 (x, y)=(2,3)
 So we can say like,
 x=2, {2 for X}
 y=3 {3 for y}
 P(x, F(y)) = P (a, F(g(z))
 In our case, P(x, F(y)) and P (a, F(g(z))
 x=a (a for x)
 y=g(z) (g(z) for y)
 [a/x , g(z)/y]
Prepared by: Prof. Khushali B Kathiriya
157
Unification Example(Cont.)
 Food (Peanuts) and Food (x)
 So here we can say like this,
 Peanuts for X
 {X / Peanuts}
 Like (Ravi, P) and like (Ravi, Apple)
 So here we can say like this,
 Apple for P
 {P / Apple)
Prepared by: Prof. Khushali B Kathiriya
158
Artificial Intelligence
Resolution
Prepared by:
Prof. Khushali B Kathiriya
Resolution
 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.
Prepared by: Prof. Khushali B Kathiriya
160
Conversion from FOL Clausal Normal
Form (CNF)
 Steps for Resolution :
1. Conversion of facts into FOL.
2. Convert FOL to CNF
A. Elimination of implication
 Eliminate all ”→” sign
 Replace P → Q with ~P V Q
B. Distribute negations
 Replace ~~P with P
 Replace ~(P V Q) with ~P ^ ~Q (pVQ) → R
Prepared by: Prof. Khushali B Kathiriya
161
Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
2. Convert FOL to CNF. (Cont.)
C. Eliminate existential quantifiers by replacing with skolem constants or
skolem function
 ∀X ∃Y ((P1(X,Y) v (P2(X,Y))) ≡ ∀X ((P1(X,F(Y)) v (P2(X,F(Y)))
D. Rename variables/ use standard variable to avoid duplicate
quantifiers.
E. Drop all universal quantifiers.
 (P1(X,F(Y)) v (P2(X,F(Y))
Prepared by: Prof. Khushali B Kathiriya
162
Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
3. Negate the statement which needs to prove (proof by
contradiction)
 In this statement, we will apply negation to the conclusion statements,
which will be written as
 ¬ likes(John, Peanuts)
4. Draw Resolution graph
 Now in this step, we will solve the problem by resolution tree using
substitution.
Prepared by: Prof. Khushali B Kathiriya
163
Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
 Facts:
1. It is a crime for an American to sell weapons to enemy of America.
2. Country Nono is an enemy of America.
3. Nono has a some missiles.
4. All of the missiles were sold to Nono by colonel west.
5. Missiles are weapons.
6. Colonel west is American.
 Prove: We have know that west is a criminal.
Prepared by: Prof. Khushali B Kathiriya
164
Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
 Step 1: Convert English to FOL
1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) →
Criminal(X)
2. Enemy (Nono, America)
3. Owns ( Nono, X), Missile (X)
4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono)
5. Missile (X) → Weapon (x)
6. American (West)
Prepared by: Prof. Khushali B Kathiriya
165
Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
 Step 2: Remove → sign from the FOL
1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) → Criminal(X)
~(American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America)) V Criminal(X)
Apply ~ sign in whole sentence ,
 ~American (X) V ~weapon(Y) V ~sells (X,Y,Z) V ~enemy(Z, America) V Criminal(X)
2. Enemy (Nono, America)
3. Owns ( Nono, X), Missile (X)
Owns ( Nono, X)
Missile (X)
Prepared by: Prof. Khushali B Kathiriya
166
Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
 Step 2: Remove ‘→’ sign from the FOL
4. Missile (X) ^ owns (Nono, X) → Sell (West, X, Nono)
~(Missile (X) ^ owns (Nono, X)) V Sell (West, X, Nono)
Apply ~ sign in whole sentence ,
~Missile (X) V ~owns (Nono, X) V Sell (West, X, Nono)
5. Missile (X) → Weapon (x)
~Missile (X) V Weapon (x)
6. American (West)
7. Criminal (West)
Prepared by: Prof. Khushali B Kathiriya
167
Artificial Intelligence
Example for Conversion from FOL
Clausal Normal Form (CNF)
Prepared by:
Prof. Khushali B Kathiriya
Example for Conversion from FOL
Clausal Normal Form (CNF)
 Step 1: Convert English to FOL
Prepared by: Prof. Khushali B Kathiriya
169
Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
 Step 2: Eliminate all implication (→) and rewrite
Prepared by: Prof. Khushali B Kathiriya
170
Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
 Step 3: Move negation (¬)inwards and rewrite
Prepared by: Prof. Khushali B Kathiriya
171
Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
 Step 4: Rename variables or standardize variables
Prepared by: Prof. Khushali B Kathiriya
172
Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
 Step 5: Eliminate existential instantiation quantifier by elimination.
 In this step, we will eliminate existential quantifier ∃, and this process is
known as Skolemization. But in this example problem since there is no
existential quantifier so all the statements will remain same in this step.
Prepared by: Prof. Khushali B Kathiriya
173
Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
 Step 6: Drop Universal quantifiers
Prepared by: Prof. Khushali B Kathiriya
174
175
Prepared by: Prof. Khushali B Kathiriya
¬ likes(John, Peanuts) ¬ food(x) V likes(John, x)
¬ food(Peanuts)
{Peanuts/x}
¬ eats(y, z) V killed(y) V food(z)
{Peanuts/z}
¬ eats(y, z) V killed(y) eats (Anil, Peanuts)
{Anil/y}
killed(Anil) ¬ alive(k) V ¬ killed(k)
¬ alive(Anil)
{Anil/k}
alive(Anil)
{ }
Step
7:
Draw
Resolution
graph

More Related Content

What's hot

Uncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial IntelligenceUncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial Intelligence
Experfy
 
Unit4: Knowledge Representation
Unit4: Knowledge RepresentationUnit4: Knowledge Representation
Unit4: Knowledge Representation
Tekendra Nath Yogi
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & ReasoningSajid Marwat
 
Knowledge representation and reasoning
Knowledge representation and reasoningKnowledge representation and reasoning
Knowledge representation and reasoning
Maryam Maleki
 
Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence
Yasir Khan
 
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Ashish Duggal
 
Planning
PlanningPlanning
Planning
ahmad bassiouny
 
Artificial Intelligence Notes Unit 1
Artificial Intelligence Notes Unit 1 Artificial Intelligence Notes Unit 1
Artificial Intelligence Notes Unit 1
DigiGurukul
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
Amey Kerkar
 
AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)
Tajim Md. Niamat Ullah Akhund
 
Knowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceKnowledge representation In Artificial Intelligence
Knowledge representation In Artificial Intelligence
Ramla Sheikh
 
Semantic Networks
Semantic NetworksSemantic Networks
Semantic Networks
Jenny Galino
 
Ai notes
Ai notesAi notes
Ai notes
AbdullahGubbi1
 
Knowledge Engineering in FOL.
Knowledge Engineering in FOL.Knowledge Engineering in FOL.
Knowledge Engineering in FOL.
Megha Sharma
 
AI: Learning in AI
AI: Learning in AI AI: Learning in AI
AI: Learning in AI
DataminingTools Inc
 
AI_Unit I notes .pdf
AI_Unit I notes .pdfAI_Unit I notes .pdf
AI_Unit I notes .pdf
Asst.prof M.Gokilavani
 
Stuart russell and peter norvig artificial intelligence - a modern approach...
Stuart russell and peter norvig   artificial intelligence - a modern approach...Stuart russell and peter norvig   artificial intelligence - a modern approach...
Stuart russell and peter norvig artificial intelligence - a modern approach...
Lê Anh Đạt
 
Knowledge Representation & Reasoning AI UNIT 3
Knowledge Representation & Reasoning AI UNIT 3Knowledge Representation & Reasoning AI UNIT 3
Knowledge Representation & Reasoning AI UNIT 3
SURBHI SAROHA
 

What's hot (20)

Uncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial IntelligenceUncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial Intelligence
 
Unit4: Knowledge Representation
Unit4: Knowledge RepresentationUnit4: Knowledge Representation
Unit4: Knowledge Representation
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & Reasoning
 
Frames
FramesFrames
Frames
 
First order logic
First order logicFirst order logic
First order logic
 
Knowledge representation and reasoning
Knowledge representation and reasoningKnowledge representation and reasoning
Knowledge representation and reasoning
 
Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence
 
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
 
Planning
PlanningPlanning
Planning
 
Artificial Intelligence Notes Unit 1
Artificial Intelligence Notes Unit 1 Artificial Intelligence Notes Unit 1
Artificial Intelligence Notes Unit 1
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
 
AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)
 
Knowledge representation In Artificial Intelligence
Knowledge representation In Artificial IntelligenceKnowledge representation In Artificial Intelligence
Knowledge representation In Artificial Intelligence
 
Semantic Networks
Semantic NetworksSemantic Networks
Semantic Networks
 
Ai notes
Ai notesAi notes
Ai notes
 
Knowledge Engineering in FOL.
Knowledge Engineering in FOL.Knowledge Engineering in FOL.
Knowledge Engineering in FOL.
 
AI: Learning in AI
AI: Learning in AI AI: Learning in AI
AI: Learning in AI
 
AI_Unit I notes .pdf
AI_Unit I notes .pdfAI_Unit I notes .pdf
AI_Unit I notes .pdf
 
Stuart russell and peter norvig artificial intelligence - a modern approach...
Stuart russell and peter norvig   artificial intelligence - a modern approach...Stuart russell and peter norvig   artificial intelligence - a modern approach...
Stuart russell and peter norvig artificial intelligence - a modern approach...
 
Knowledge Representation & Reasoning AI UNIT 3
Knowledge Representation & Reasoning AI UNIT 3Knowledge Representation & Reasoning AI UNIT 3
Knowledge Representation & Reasoning AI UNIT 3
 

Similar to AI_ 3 & 4 Knowledge Representation issues

AI_ 8 Weak Slot and Filler Structure
AI_ 8 Weak Slot and Filler  StructureAI_ 8 Weak Slot and Filler  Structure
AI_ 8 Weak Slot and Filler Structure
Khushali Kathiriya
 
Artificial Intelligence_ Knowledge Representation
Artificial Intelligence_ Knowledge RepresentationArtificial Intelligence_ Knowledge Representation
Artificial Intelligence_ Knowledge Representation
ThenmozhiK5
 
AI_1 Introduction of AI
AI_1 Introduction of AIAI_1 Introduction of AI
AI_1 Introduction of AI
Khushali Kathiriya
 
UNIT 2.pdf
UNIT 2.pdfUNIT 2.pdf
1029 1026-1-pb
1029 1026-1-pb1029 1026-1-pb
1029 1026-1-pb
mustafa sarac
 
Opening the door to the Chinese Room: Intersubjectivity and the Phenomenology...
Opening the door to the Chinese Room: Intersubjectivity and the Phenomenology...Opening the door to the Chinese Room: Intersubjectivity and the Phenomenology...
Opening the door to the Chinese Room: Intersubjectivity and the Phenomenology...
Robert Farrow
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
Dr. Jasmine Beulah Gnanadurai
 
Intelligence and artificial intelligence
Intelligence and artificial intelligenceIntelligence and artificial intelligence
Intelligence and artificial intelligence
Dr. Uday Saikia
 
DNA Information
DNA InformationDNA Information
DNA Information
Hans Rudolf Tremp
 
ARtificial Intelligence Knowledge Representation.pptx
ARtificial Intelligence Knowledge Representation.pptxARtificial Intelligence Knowledge Representation.pptx
ARtificial Intelligence Knowledge Representation.pptx
RanjithaM32
 
Lecture 1-3-Logics-In-computer-science.pptx
Lecture 1-3-Logics-In-computer-science.pptxLecture 1-3-Logics-In-computer-science.pptx
Lecture 1-3-Logics-In-computer-science.pptx
PriyalMayurManvar
 
FLCT Chapter 5 Module.docx
FLCT Chapter 5 Module.docxFLCT Chapter 5 Module.docx
FLCT Chapter 5 Module.docx
MarilouOTamayo
 
Knowldge reprsentations
Knowldge reprsentationsKnowldge reprsentations
Knowldge reprsentations
Tribhuvan University
 
What is knowledge representation and reasoning ?
What is knowledge representation and reasoning ?What is knowledge representation and reasoning ?
What is knowledge representation and reasoning ?
Anant Soft Computing
 
6. kr paper journal nov 11, 2017 (edit a)
6. kr paper journal nov 11, 2017 (edit a)6. kr paper journal nov 11, 2017 (edit a)
6. kr paper journal nov 11, 2017 (edit a)
IAESIJEECS
 
Inductive Essay
Inductive EssayInductive Essay
Knowledge base system
Knowledge base systemKnowledge base system
Knowledge base system
RanjithaM32
 
Ai lecture 01(unit03)
Ai lecture  01(unit03)Ai lecture  01(unit03)
Ai lecture 01(unit03)
vikas dhakane
 
Ai lecture 01(unit03)
Ai lecture  01(unit03)Ai lecture  01(unit03)
Ai lecture 01(unit03)
vikas dhakane
 
Psychological processes in language acquisition
Psychological processes in language acquisitionPsychological processes in language acquisition
Psychological processes in language acquisition
srnaz
 

Similar to AI_ 3 & 4 Knowledge Representation issues (20)

AI_ 8 Weak Slot and Filler Structure
AI_ 8 Weak Slot and Filler  StructureAI_ 8 Weak Slot and Filler  Structure
AI_ 8 Weak Slot and Filler Structure
 
Artificial Intelligence_ Knowledge Representation
Artificial Intelligence_ Knowledge RepresentationArtificial Intelligence_ Knowledge Representation
Artificial Intelligence_ Knowledge Representation
 
AI_1 Introduction of AI
AI_1 Introduction of AIAI_1 Introduction of AI
AI_1 Introduction of AI
 
UNIT 2.pdf
UNIT 2.pdfUNIT 2.pdf
UNIT 2.pdf
 
1029 1026-1-pb
1029 1026-1-pb1029 1026-1-pb
1029 1026-1-pb
 
Opening the door to the Chinese Room: Intersubjectivity and the Phenomenology...
Opening the door to the Chinese Room: Intersubjectivity and the Phenomenology...Opening the door to the Chinese Room: Intersubjectivity and the Phenomenology...
Opening the door to the Chinese Room: Intersubjectivity and the Phenomenology...
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
 
Intelligence and artificial intelligence
Intelligence and artificial intelligenceIntelligence and artificial intelligence
Intelligence and artificial intelligence
 
DNA Information
DNA InformationDNA Information
DNA Information
 
ARtificial Intelligence Knowledge Representation.pptx
ARtificial Intelligence Knowledge Representation.pptxARtificial Intelligence Knowledge Representation.pptx
ARtificial Intelligence Knowledge Representation.pptx
 
Lecture 1-3-Logics-In-computer-science.pptx
Lecture 1-3-Logics-In-computer-science.pptxLecture 1-3-Logics-In-computer-science.pptx
Lecture 1-3-Logics-In-computer-science.pptx
 
FLCT Chapter 5 Module.docx
FLCT Chapter 5 Module.docxFLCT Chapter 5 Module.docx
FLCT Chapter 5 Module.docx
 
Knowldge reprsentations
Knowldge reprsentationsKnowldge reprsentations
Knowldge reprsentations
 
What is knowledge representation and reasoning ?
What is knowledge representation and reasoning ?What is knowledge representation and reasoning ?
What is knowledge representation and reasoning ?
 
6. kr paper journal nov 11, 2017 (edit a)
6. kr paper journal nov 11, 2017 (edit a)6. kr paper journal nov 11, 2017 (edit a)
6. kr paper journal nov 11, 2017 (edit a)
 
Inductive Essay
Inductive EssayInductive Essay
Inductive Essay
 
Knowledge base system
Knowledge base systemKnowledge base system
Knowledge base system
 
Ai lecture 01(unit03)
Ai lecture  01(unit03)Ai lecture  01(unit03)
Ai lecture 01(unit03)
 
Ai lecture 01(unit03)
Ai lecture  01(unit03)Ai lecture  01(unit03)
Ai lecture 01(unit03)
 
Psychological processes in language acquisition
Psychological processes in language acquisitionPsychological processes in language acquisition
Psychological processes in language acquisition
 

More from Khushali Kathiriya

Chap.3 Knowledge Representation Issues Chap.4 Inference in First Order Logic
Chap.3 Knowledge Representation  Issues  Chap.4 Inference in First Order  LogicChap.3 Knowledge Representation  Issues  Chap.4 Inference in First Order  Logic
Chap.3 Knowledge Representation Issues Chap.4 Inference in First Order Logic
Khushali Kathiriya
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
Khushali Kathiriya
 
learning with complete data.pdf
learning with complete data.pdflearning with complete data.pdf
learning with complete data.pdf
Khushali Kathiriya
 
CV_Chap 6 Motion Representation
CV_Chap 6 Motion RepresentationCV_Chap 6 Motion Representation
CV_Chap 6 Motion Representation
Khushali Kathiriya
 
Cv_Chap 4 Segmentation
Cv_Chap 4 SegmentationCv_Chap 4 Segmentation
Cv_Chap 4 Segmentation
Khushali Kathiriya
 
CV_Chap 3 Features Detection
CV_Chap 3 Features DetectionCV_Chap 3 Features Detection
CV_Chap 3 Features Detection
Khushali Kathiriya
 
CV_2 Fourier_Transformation
CV_2 Fourier_Transformation CV_2 Fourier_Transformation
CV_2 Fourier_Transformation
Khushali Kathiriya
 
CV_2 Filtering_Example
CV_2 Filtering_ExampleCV_2 Filtering_Example
CV_2 Filtering_Example
Khushali Kathiriya
 
CV_2 Image Processing
CV_2 Image ProcessingCV_2 Image Processing
CV_2 Image Processing
Khushali Kathiriya
 
CV_1 Introduction of Computer Vision and its Application
CV_1 Introduction of Computer Vision and its ApplicationCV_1 Introduction of Computer Vision and its Application
CV_1 Introduction of Computer Vision and its Application
Khushali Kathiriya
 
ADA_2_Analysis of Algorithms
ADA_2_Analysis of AlgorithmsADA_2_Analysis of Algorithms
ADA_2_Analysis of Algorithms
Khushali Kathiriya
 
ADA_1 Introduction of Algorithm
ADA_1 Introduction of AlgorithmADA_1 Introduction of Algorithm
ADA_1 Introduction of Algorithm
Khushali Kathiriya
 
AI_ Backtracking in prolog
AI_ Backtracking in prologAI_ Backtracking in prolog
AI_ Backtracking in prolog
Khushali Kathiriya
 
AI_Cuts in prolog
AI_Cuts in prologAI_Cuts in prolog
AI_Cuts in prolog
Khushali Kathiriya
 
AI_Recursive search in prolog
AI_Recursive search in prologAI_Recursive search in prolog
AI_Recursive search in prolog
Khushali Kathiriya
 
AI_List in prolog
AI_List in prologAI_List in prolog
AI_List in prolog
Khushali Kathiriya
 
AI_11 Game playing
AI_11 Game playingAI_11 Game playing
AI_11 Game playing
Khushali Kathiriya
 
AI_ Bays theorem
AI_ Bays theoremAI_ Bays theorem
AI_ Bays theorem
Khushali Kathiriya
 
AI_Bayesian belief network
AI_Bayesian belief networkAI_Bayesian belief network
AI_Bayesian belief network
Khushali Kathiriya
 
AI_11 Understanding
AI_11  UnderstandingAI_11  Understanding
AI_11 Understanding
Khushali Kathiriya
 

More from Khushali Kathiriya (20)

Chap.3 Knowledge Representation Issues Chap.4 Inference in First Order Logic
Chap.3 Knowledge Representation  Issues  Chap.4 Inference in First Order  LogicChap.3 Knowledge Representation  Issues  Chap.4 Inference in First Order  Logic
Chap.3 Knowledge Representation Issues Chap.4 Inference in First Order Logic
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
learning with complete data.pdf
learning with complete data.pdflearning with complete data.pdf
learning with complete data.pdf
 
CV_Chap 6 Motion Representation
CV_Chap 6 Motion RepresentationCV_Chap 6 Motion Representation
CV_Chap 6 Motion Representation
 
Cv_Chap 4 Segmentation
Cv_Chap 4 SegmentationCv_Chap 4 Segmentation
Cv_Chap 4 Segmentation
 
CV_Chap 3 Features Detection
CV_Chap 3 Features DetectionCV_Chap 3 Features Detection
CV_Chap 3 Features Detection
 
CV_2 Fourier_Transformation
CV_2 Fourier_Transformation CV_2 Fourier_Transformation
CV_2 Fourier_Transformation
 
CV_2 Filtering_Example
CV_2 Filtering_ExampleCV_2 Filtering_Example
CV_2 Filtering_Example
 
CV_2 Image Processing
CV_2 Image ProcessingCV_2 Image Processing
CV_2 Image Processing
 
CV_1 Introduction of Computer Vision and its Application
CV_1 Introduction of Computer Vision and its ApplicationCV_1 Introduction of Computer Vision and its Application
CV_1 Introduction of Computer Vision and its Application
 
ADA_2_Analysis of Algorithms
ADA_2_Analysis of AlgorithmsADA_2_Analysis of Algorithms
ADA_2_Analysis of Algorithms
 
ADA_1 Introduction of Algorithm
ADA_1 Introduction of AlgorithmADA_1 Introduction of Algorithm
ADA_1 Introduction of Algorithm
 
AI_ Backtracking in prolog
AI_ Backtracking in prologAI_ Backtracking in prolog
AI_ Backtracking in prolog
 
AI_Cuts in prolog
AI_Cuts in prologAI_Cuts in prolog
AI_Cuts in prolog
 
AI_Recursive search in prolog
AI_Recursive search in prologAI_Recursive search in prolog
AI_Recursive search in prolog
 
AI_List in prolog
AI_List in prologAI_List in prolog
AI_List in prolog
 
AI_11 Game playing
AI_11 Game playingAI_11 Game playing
AI_11 Game playing
 
AI_ Bays theorem
AI_ Bays theoremAI_ Bays theorem
AI_ Bays theorem
 
AI_Bayesian belief network
AI_Bayesian belief networkAI_Bayesian belief network
AI_Bayesian belief network
 
AI_11 Understanding
AI_11  UnderstandingAI_11  Understanding
AI_11 Understanding
 

Recently uploaded

Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 

Recently uploaded (20)

Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 

AI_ 3 & 4 Knowledge Representation issues

  • 1. Artificial Intelligence Chap.3 Knowledge Representation Issues Prepared by: Prof. Khushali B Kathiriya
  • 2. Outline for 8th semester  Representations And Mappings  Approaches To Knowledge Representation Prepared by: Prof. Khushali B Kathiriya 2
  • 3. Artificial Intelligence Chap.3 Logical Agents & First Order Logic Prepared by: Prof. Khushali B Kathiriya
  • 4. Outline for 6th semester  Logical Agents:  Knowledge–based agents  The Wumpus world  Logic  Propositional logic  Propositional theorem proving  Effective propositional model checking  Agents based on propositional logic  First Order Logic:  Representation Revisited  Syntax and Semantics of First Order logic  Using First Order logic Prepared by: Prof. Khushali B Kathiriya 4
  • 5. What is Knowledge?  Knowledge is a general term. Knowledge is a progression that starts with data which is of limited utility.  By organizing or analyzing the data, we understand what the data means and this becomes information.  The interpretation or evaluation of information yield knowledge.  An understanding of the principles embodied within the knowledge is wisdom. Prepared by: Prof. Khushali B Kathiriya 5
  • 6. 6 Prepared by: Prof. Khushali B Kathiriya
  • 7. What is Knowledge representation ?  Humans are best at understanding, reasoning, and interpreting knowledge. Human knows things, which is knowledge and as per their knowledge they perform various actions in the real world. But how machines do all these things comes under knowledge representation and reasoning. Prepared by: Prof. Khushali B Kathiriya 7
  • 8. What is Knowledge representation ? (Cont.)  Hence we can describe Knowledge representation as following: 1. Knowledge representation and reasoning (KR, KRR) is the part of Artificial intelligence which concerned with AI agents thinking and how thinking contributes to intelligent behavior of agents. 2. It is responsible for representing information about the real world so that a computer can understand and can utilize this knowledge to solve the complex real world problems such as diagnosis a medical condition or communicating with humans in natural language. 3. It is also a way which describes how we can represent knowledge in artificial intelligence. Knowledge representation is not just storing data into some database, but it also enables an intelligent machine to learn from that knowledge and experiences so that it can behave intelligently like a human. Prepared by: Prof. Khushali B Kathiriya 8
  • 9. What to represent?  Object: All the facts about objects in our world domain. E.g., Guitars contains strings, trumpets are brass instruments.  Events: Events are the actions which occur in our world.  Performance: It describe behavior which involves knowledge about how to do things.  Meta-knowledge: It is knowledge about what we know.  Facts: Facts are the truths about the real world and what we represent.  Knowledge-Base: The central component of the knowledge-based agents is the knowledge base. It is represented as KB. The Knowledgebase is a group of the Sentences (Here, sentences are used as a technical term and not identical with the English language).  Knowledge: Knowledge is awareness or familiarity gained by experiences of facts, data, and situations. Prepared by: Prof. Khushali B Kathiriya 9
  • 10. Framework of Knowledge Representation Prepared by: Prof. Khushali B Kathiriya 10
  • 11. Artificial Intelligence Knowledge-Based Agent in AI Prepared by: Prof. Khushali B Kathiriya
  • 12. Knowledge-Based Agent in AI  An intelligent agent needs knowledge about the real world for taking decisions and reasoning to act efficiently.  Knowledge-based agents are those agents who have the capability of maintaining an internal state of knowledge, reason over that knowledge, update their knowledge after observations and take actions. These agents can represent the world with some formal representation and act intelligently.  Knowledge-based agents are composed of two main parts: 1. Knowledge-base and 2. Inference system. Prepared by: Prof. Khushali B Kathiriya 12
  • 13. The architecture of knowledge-based agent Prepared by: Prof. Khushali B Kathiriya 13
  • 14. The architecture of knowledge-based agent (Cont.)  The diagram is representing a generalized architecture for a knowledge- based agent. The knowledge-based agent (KBA) take input from the environment by perceiving the environment. The input is taken by the inference engine of the agent and which also communicate with KB to decide as per the knowledge store in KB. The learning element of KBA regularly updates the KB by learning new knowledge. Prepared by: Prof. Khushali B Kathiriya 14
  • 15. Why use knowledge base?  Knowledge base: Knowledge-base is a central component of a knowledge-based agent, it is also known as KB. It is a collection of sentences (here 'sentence' is a technical term and it is not identical to sentence in English). These sentences are expressed in a language which is called a knowledge representation language. The Knowledge-base of KBA stores fact about the world.  Knowledge-base is required for updating knowledge for an agent to learn with experiences and take action as per the knowledge. Prepared by: Prof. Khushali B Kathiriya 15
  • 16. Inference System  Inference means deriving new sentences from old. Inference system allows us to add a new sentence to the knowledge base. A sentence is a proposition about the world. Inference system applies logical rules to the KB to deduce new information.  Inference system generates new facts so that an agent can update the KB. An inference system works mainly in two rules which are given as: 1. Forward chaining 2. Backward chaining Prepared by: Prof. Khushali B Kathiriya 16
  • 17. Artificial Intelligence Techniques of Knowledge Representation Prepared by: Prof. Khushali B Kathiriya
  • 18. Techniques/ Approaches of Knowledge Representation  Knowledge can be represented using the following approaches/techniques: Prepared by: Prof. Khushali B Kathiriya 18
  • 20. 1. Logical Representation  Logical representation is a language with some concrete rules which deals with propositions and has no ambiguity in representation. Logical representation means drawing a conclusion based on various conditions.  This representation lays down some important communication rules. It consists of precisely defined syntax and semantics which supports the sound inference. Each sentence can be translated into logics using syntax and semantics.  Logical representation can be categorized into: 1. Propositional Logic 2. First Order Predicate Logic 3. Higher order Predicate Logic 4. Fuzzy Logic Prepared by: Prof. Khushali B Kathiriya 20
  • 21. 1. Logical Representation (Cont.) 1. Propositional Logics:  All propositions either true/false (1/0).  We can not identify relation between 2 sentences.  For example….. Prepared by: Prof. Khushali B Kathiriya 21 Sentences Truth value Proposition value Sky is blue True True Roses are red True True 2+2=5 False True
  • 22. 1. Logical Representation (Cont.) 2. First Order Predicated Logic:  These are much more expressive and make use of variables, constants, predicates, functions and quantifiers along with the connective explained already in previous section. Prepared by: Prof. Khushali B Kathiriya 22
  • 23. 1. Logical Representation (Cont.) Advantages of logical representation Disadvantages of logical representation Logical representation enables us to do logical reasoning. Logical representations have some restrictions and are challenging to work with. Logical representation is the basis for the programming languages. Logical representation technique may not be very natural, and inference may not be so efficient. Prepared by: Prof. Khushali B Kathiriya 23
  • 24. Artificial Intelligence Semantic net representation Prepared by: Prof. Khushali B Kathiriya
  • 25. 2. Semantic net representation  Semantic networks are alternative of predicate logic for knowledge representation. In Semantic networks, we can represent our knowledge in the form of graphical networks. This network consists of nodes representing objects and arcs which describe the relationship between those objects. Semantic networks can categorize the object in different forms and can also link those objects. Semantic networks are easy to understand and can be easily extended. Prepared by: Prof. Khushali B Kathiriya 25
  • 26. 2. Semantic net representation (Cont.)  Following are some statements which we need to represent in the form of nodes and arcs. 1. Jerry is a cat. 2. Jerry is a mammal 3. Jerry is owned by Priya. 4. Jerry is brown colored. 5. All Mammals are animal. Prepared by: Prof. Khushali B Kathiriya 26
  • 27. 2. Semantic net representation (Cont.)  Drawbacks in Semantic representation: 1. Semantic networks take more computational time at runtime as we need to traverse the complete network tree to answer some questions. It might be possible in the worst case scenario that after traversing the entire tree, we find that the solution does not exist in this network. 2. Semantic networks try to model human-like memory (Which has 1015 neurons and links) to store the information, but in practice, it is not possible to build such a vast semantic network. 3. These types of representations are inadequate as they do not have any equivalent quantifier, e.g., for all, for some, none, etc. 4. Semantic networks do not have any standard definition for the link names. 5. These networks are not intelligent and depend on the creator of the system. Prepared by: Prof. Khushali B Kathiriya 27
  • 28. 2. Semantic net representation (Cont.)  Advantages of Semantic network: 1. Semantic networks are a natural representation of knowledge. 2. Semantic networks convey meaning in a transparent manner. 3. These networks are simple and easily understandable. Prepared by: Prof. Khushali B Kathiriya 28
  • 29. 2. Semantic net representation (Cont.)  Represent following sentences using semantic networks.  Isa(person, mammal)  Instance(Mike-Hall, person)  Team(Mike-Hall, Cardiff) Prepared by: Prof. Khushali B Kathiriya 29
  • 30. 2. Semantic net representation (Cont.) Prepared by: Prof. Khushali B Kathiriya 30
  • 32. 3. Frame Representation  This concept was introduced by Marvin Minsky in 1975. they are mostly used when the task becomes quite complex and needs more structured representation.  More structured the system becomes more would be the requirement of using frames which would prove beneficial. Generally frames are record like structures that consists of a collection of slots or attributes and the corresponding slot values.  Slots can be of any size and type. The slots have names and values called as facts. Facets can have names or numbers too. A simple frame is shown in fig for person ram. Prepared by: Prof. Khushali B Kathiriya 32
  • 33. 3. Frame Representation (Cont.) Prepared by: Prof. Khushali B Kathiriya 33 Ram Brothers Laxman Cat Bharat Grey Color
  • 34. 3. Frame Representation (Cont.) Sr. No. Slot Value 1 Ram - 2 Profession Professor 3 Age 50 4 Wife Sita 5 Children Luv Kush 6 Address 4C gb Road 7 City Banaras 8 State UP 9 Zip 400615 Prepared by: Prof. Khushali B Kathiriya 34
  • 35. 3. Frame Representation (Cont.)  Advantages of frame representation: 1. The frame knowledge representation makes the programming easier by grouping the related data. 2. The frame representation is comparably flexible and used by many applications in AI. 3. It is very easy to add slots for new attribute and relations. 4. It is easy to include default data and to search for missing values. 5. Frame representation is easy to understand and visualize. Prepared by: Prof. Khushali B Kathiriya 35
  • 36. 3. Frame Representation (Cont.)  Disadvantages of frame representation: 1. In frame system inference mechanism is not be easily processed. 2. Inference mechanism cannot be smoothly proceeded by frame representation. 3. Frame representation has a much generalized approach. Prepared by: Prof. Khushali B Kathiriya 36
  • 37. 4. Production Rules  Production rules system consist of (condition, action) pairs which mean, "If condition then action". It has mainly three parts:  The set of production rules  Working Memory  The recognize-act-cycle Prepared by: Prof. Khushali B Kathiriya 37
  • 38. 4. Production Rules (Cont.)  Example:  IF (at bus stop AND bus arrives) THEN action (get into the bus)  IF (on the bus AND paid AND empty seat) THEN action (sit down).  IF (on bus AND unpaid) THEN action (pay charges).  IF (bus arrives at destination) THEN action (get down from the bus). Prepared by: Prof. Khushali B Kathiriya 38
  • 39. 4. Production Rules (Cont.)  Advantages of Production rule: 1. The production rules are expressed in natural language. 2. The production rules are highly modular, so we can easily remove, add or modify an individual rule.  Disadvantages of Production rule: 1. Production rule system does not exhibit any learning capabilities, as it does not store the result of the problem for the future uses. 2. During the execution of the program, many rules may be active hence rule-based production systems are inefficient. Prepared by: Prof. Khushali B Kathiriya 39
  • 40. Artificial Intelligence Issues in Knowledge Representation Prepared by: Prof. Khushali B Kathiriya
  • 41. Issues in Knowledge Representation  Important Attributes:  There can be attributes that occur in many different types of problem with different names.  For example, instance and isa and each is important because each supports property inheritance.  Relationships:  The relationships, such as, inverses, existence; among various attributes of an object need to be represented without any ambiguity.  For example, band(John, NewYork City) Prepared by: Prof. Khushali B Kathiriya 41
  • 42. Issues in Knowledge Representation (Cont.)  Granularity:  This represents at what level should the knowledge be represented and what are primitives. Choosing the granularity of representation primitives are fundamental concepts such as holding, seeing, playing and as English is a very rich language with over half a million words to choose as our primitives in a series of situations.  For example, if Tom feeds a dog then it could become: feeds(tom,dog)  If tom gives the dog a bone like: gives(tom,dog,bone) are these the same? Prepared by: Prof. Khushali B Kathiriya 42
  • 44. Propositional Logic  Propositional logic (PL) is the simplest form of logic where all the statements are made by propositions. A proposition is a declarative statement which is either true or false. It is a technique of knowledge representation in logical and mathematical form.  Example:  It is Sunday. T  The Sun rises from West . F  3+3= 7. F  Some students are intelligent. T/F both Prepared by: Prof. Khushali B Kathiriya 44 PL Semantic Syntax
  • 45. Propositional Logic (Cont.)  Following are some basic facts about propositional logic:  Propositional logic is also called Boolean logic as it works on 0 and 1.  In propositional logic, we use symbolic variables to represent the logic, and we can use any symbol for a representing a proposition, such A, B, C, P, Q, R, etc.  Propositions can be either true or false, but it cannot be both.  Propositional logic consists of an object, relations or function, and logical connectives.  These connectives are also called logical operators. Prepared by: Prof. Khushali B Kathiriya 45 PL Complex Atomic
  • 46. Syntax in Propositional Logic (Cont.)  Rules for conjunction: NEGATIVE operator  A sentence such as ¬ P is called negation of P. A literal can be either Positive literal or negative literal.  Example, P= Today is Sunday.  1 is represent as a true  0 is represent as a false Prepared by: Prof. Khushali B Kathiriya 47 P ¬ P 1 0 0 1
  • 47. Syntax in Propositional Logic (Cont.)  Rules for conjunction: AND operator  A sentence which has ∧ connective such as, P ∧ Q is called a conjunction.  Example: Rohan is intelligent and hardworking.  It can be written as, P= Rohan is intelligent. Q= Rohan is hardworking.  So we can write it as P ∧ Q. Prepared by: Prof. Khushali B Kathiriya 48 P Q P ^ Q 1 1 1 1 0 0 0 1 0 0 0 0
  • 48. Syntax in Propositional Logic (Cont.)  Rules for Disjunction: OR operator  A sentence which has ∨ connective, such as P ∨ Q. is called disjunction, where P and Q are the propositions.  Example: "Ritika is a doctor or Engineer",  It can be written as, P= Ritika is Doctor. Q= Ritika is Engineer,  So we can write it as P ∨ Q. Prepared by: Prof. Khushali B Kathiriya 49 P Q P v Q 1 1 1 1 0 1 0 1 1 0 0 0
  • 49. Syntax in Propositional Logic (Cont.)  Rules for conjunction: CONDITIONAL  A sentence such as P → Q, is called an implication. Implications are also known as if-then rules.  Example: If it is raining, then the street is wet. Let P= It is raining, Q= Street is wet,  so it is represented as P → Q Prepared by: Prof. Khushali B Kathiriya 50 P Q P → Q 1 1 1 1 0 0 0 1 1 0 0 1
  • 50. Syntax in Propositional Logic (Cont.)  Rules for conjunction: BICONDITIONAL  A sentence such as P⇔ Q is a BiConditional sentence,  Example: If I am breathing, then I am alive P= I am breathing Q= I am alive  It can be represented as P ⇔ Q. Prepared by: Prof. Khushali B Kathiriya 51 P Q P ⇔ Q 1 1 1 1 0 0 0 1 0 0 0 1
  • 51. Summarized table Propositional Logic Connectives (Cont.) Prepared by: Prof. Khushali B Kathiriya 52
  • 52. Artificial Intelligence Example of Propositional Logic Prepared by: Prof. Khushali B Kathiriya
  • 53. Properties of Operators  Commutatively  P∧ Q= Q ∧ P, or  P ∨ Q = Q ∨ P.  Associativity  (P ∧ Q) ∧ R= P ∧ (Q ∧ R),  (P ∨ Q) ∨ R= P ∨ (Q ∨ R)  Identity element  P ∧ True = P,  P ∨ True= True. Prepared by: Prof. Khushali B Kathiriya 54  Distributive  P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).  P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).  DE Morgan's Law  ¬ (P ∧ Q) = (¬P) ∨ (¬Q)  ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).  Double-negation elimination  ¬ (¬P) = P.
  • 54. What is Propositional Logic?  A ^ B and B ^ A should have same meaning but in natural language words and sentences may have different meaning  Example, 1. Radha started feeling feverish and Radha went to the doctor. 2. Radha went to doctor and Radha stared feeling feverish.  Here, sentence 1 and sentence 2 have different meaning  In AI propositional logic is a relation between the truth value of one statement to that of the truth table of other statement. Prepared by: Prof. Khushali B Kathiriya 55
  • 55. Example of Propositional Logic 1. ¬(P ^ Q) , P → ¬Q Prepared by: Prof. Khushali B Kathiriya 56 P Q ¬Q (P ^ Q) ¬(P ^ Q) P → ¬Q 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 P Q IF P → Q 1 1 1 1 0 0 0 1 1 0 0 1 P Q IF P ^ Q 1 1 1 1 0 0 0 1 0 0 0 0 P Q IF P v Q 1 1 1 1 0 1 0 1 1 0 0 0
  • 56. Example of Propositional Logic (Cont.) 2. ¬P v ¬Q v R , Q v R, P→R Prepared by: Prof. Khushali B Kathiriya 57 P Q R ¬P ¬Q ¬P v ¬Q v R (Q v R) P → R 0 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 1 1 1 0 0 0 0 1 0 1 1 1 0 0 1 1 1
  • 57. Example of Propositional Logic (Cont.) 3. (P v Q) v ~(P v (Q ^ R))=1 Prepared by: Prof. Khushali B Kathiriya 58 P Q R P v Q Q ^ R P v (Q ^ R) ~(P v (Q ^ R)) (P v Q) v ~(P v (Q ^ R)) 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 0 1 0 0 1 1 0 1 1 1 1 1 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1
  • 58. Example of Propositional Logic (Cont.) 4. ~[{~P v ~(Q ^ R)} v (P ^ R)] Prepared by: Prof. Khushali B Kathiriya 59 I1 I2 I3 P Q R ~ P I1 ~ I1 I2 I3 I2 v I3 ~ (I2 v I3) 0 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 1 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 0 0 0 1 1 0 1 0 1 0 1 0 0 1 1 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 1 0 0 1 1 0
  • 59. Example of Propositional Logic (Cont.) 5. (P→(Q→R)) → ((P→Q) → (P→R)) Prepared by: Prof. Khushali B Kathiriya 60 P Q R Q→R I1 I2 I3 I4 I1→I4 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 I1 I2 I3 I4 P Q IF P → Q 1 1 1 1 0 0 0 1 1 0 0 1
  • 60. Example of Propositional Logic (Cont.)  Try out your self: 1. (P ⇔ (Q→ R)) ⇔ ((P ⇔ Q)→ R) 2. ((P ⇔ Q) ^ (~ Q → R)) ⇔ (~ (P ⇔ R) → Q) Prepared by: Prof. Khushali B Kathiriya 61
  • 61. Limitation of Propositional Logic  We cannot represent relations like ALL, some, or none with propositional logic.  Example:  All the girls are cute.  Some apples are sweet.  Few students are intelligent.  Propositional logic has limited expressive power.  In propositional logic, we cannot describe statements in terms of their properties or logical relationships. Prepared by: Prof. Khushali B Kathiriya 62
  • 62. Artificial Intelligence Inference Rules Prepared by: Prof. Khushali B Kathiriya
  • 63. Inference Rules  Inference:  In artificial intelligence, we need intelligent computers which can create new logic from old logic or by evidence, so generating the conclusions from evidence and facts is termed as Inference.  Inference Rule:  Inference rules are the templates for generating valid arguments. Inference rules are applied to derive proofs in artificial intelligence, and the proof is a sequence of the conclusion that leads to the desired goal.  In inference rules, the implication among all the connectives plays an important role. Prepared by: Prof. Khushali B Kathiriya 64
  • 64. Inference Rules (Cont.) 1. Modus Ponens 2. Modus Tollens 3. Hypothetical Syllogism 4. Disjunctive Syllogism Prepared by: Prof. Khushali B Kathiriya 65
  • 65. Inference Rules (Cont.) 1. Modus Ponens  The Modus Ponens rule is one of the most important rules of inference, and it states that if P and P → Q is true, then we can infer that Q will be true. It can be represented as: 66 Prepared by: Prof. Khushali B Kathiriya
  • 66. Inference Rules (Cont.) 1. Modus Ponens  Example:  Statement-1: "If I am sleepy then I go to bed" ==> P → Q  Statement-2: "I am sleepy" ==> P  Conclusion: "I go to bed." ==> Q  Hence, we can say that, if P→ Q is true and P is true then Q will be true. 67 Prepared by: Prof. Khushali B Kathiriya
  • 67. Inference Rules (Cont.) 2. Modus Tollens  The Modus Tollens rule state that if P→ Q is true and ¬ Q is true, then ¬ P will also true. It can be represented as: Prepared by: Prof. Khushali B Kathiriya 68
  • 68. Inference Rules (Cont.) 2. Modus Tollens  Statement-1: "If I am sleepy then I go to bed" ==> P→ Q  Statement-2: "I do not go to the bed."==> ~Q  Statement-3: Which infers that "I am not sleepy" => ~P Prepared by: Prof. Khushali B Kathiriya 69
  • 69. Inference Rules (Cont.) 3. Hypothetical Syllogism  The Hypothetical Syllogism rule state that if P→R is true whenever P→Q is true, and Q→R is true. It can be represented as the following notation:  Notation is : P → Q, Q → R P → R Prepared by: Prof. Khushali B Kathiriya 70
  • 70. Inference Rules (Cont.) 3. Hypothetical Syllogism  Statement-1: If you have my password, then you can log on to my face book.  Statement-2: If you can log onto my face book account then you can delete my face book account.  Statement-3: If you have my password then you can delete my face book account. 71 Prepared by: Prof. Khushali B Kathiriya
  • 71. Inference Rules (Cont.) 4. Disjunctive Syllogism  The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true, then Q will be true. It can be represented as: Prepared by: Prof. Khushali B Kathiriya 72
  • 72. Inference Rules (Cont.) 4. Disjunctive Syllogism  Statement-1: Today is Sunday or Monday. ==>P∨Q  Statement-2: Today is not Sunday. ==> ¬P  Conclusion: Today is Monday. ==> Q Prepared by: Prof. Khushali B Kathiriya 73
  • 73. Inference Rules (Cont.)  In short inference rule says that new sentence can be create by logically following the set of sentences of knowledge base. Prepared by: Prof. Khushali B Kathiriya 74 Sr. No. Inference Rules Premises (KB) Conclusion 1 Modus Ponens X, X → Y Y 2 Substitution X → Y & Y → Z X = Y 3 Chain Rule X → Y, Y → Z X → Z 4 AND introduction X, Y X ^ Y 5 Transposition X →Y ~X → ~Y
  • 74. Artificial Intelligence Horn Clause Prepared by: Prof. Khushali B Kathiriya
  • 75. Horn Clause  A Horn clause is a clause (a disjunction of literals) with at most one positive literal. ~A1 V ~A2 V ~A3 V . . . . . V ~An V B  Lets take one example,  (A1 ^ A2 ^ A3 ^ . . . . . ^ An) → B  Apply DE Morgan's Law on given equation,  ~(A1 ^ A2 ^ A3 ^ . . . . . ^ An) V B  Apply Distributive Law,  ~A1 V ~A2 V ~A3 V . . . . . V ~An V B Prepared by: Prof. Khushali B Kathiriya 76 Horn clause
  • 76. Properties of Operators  Commutatively  P∧ Q= Q ∧ P, or  P ∨ Q = Q ∨ P.  Associativity  (P ∧ Q) ∧ R= P ∧ (Q ∧ R),  (P ∨ Q) ∨ R= P ∨ (Q ∨ R)  Identity element  P ∧ True = P,  P ∨ True= True. Prepared by: Prof. Khushali B Kathiriya 77  Distributive  P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).  P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).  DE Morgan's Law  ¬ (P ∧ Q) = (¬P) ∨ (¬Q)  ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).  Double-negation elimination  ¬ (¬P) = P.
  • 77. Horn Clause (Cont.) 1. (A ^ B ) → C = (A ^ B) → C Apply DE Morgan's Law = ~ (A ^ B) V C Apply Distributive Law = ~A V ~B V C Prepared by: Prof. Khushali B Kathiriya 78 Horn clause
  • 78. Horn Clause (Cont.) 2. (A V B) → C = (A V B ) → C Apply DE Morgan's Law = ~(A V B ) V C Apply Distributive Law = (~A ^ ~B) V C = (~A V C) ^ (~A V ~B) = (~A V C) , (~B V C) Prepared by: Prof. Khushali B Kathiriya 79
  • 79. Horn Clause (Cont.) 3. ( A ^ ~B ) → C = ( A ^ ~B ) → C Apply DE Morgan's Law = ~(A ^ ~B) V C Apply Distributive Law = (~A V B) V C = ~A V B V C Prepared by: Prof. Khushali B Kathiriya 80 Not Possible
  • 80. Artificial Intelligence Wampus World Prepared by: Prof. Khushali B Kathiriya
  • 81. Wampus World  The Wumpus world is a cave which has 4/4 rooms connected with passageways. So there are total 16 rooms which are connected with each other. We have a knowledge-based agent who will go forward in this world. The cave has a room with a beast which is called Wumpus, who eats anyone who enters the room. The Wumpus can be shot by the agent, but the agent has a single arrow.  In the Wumpus world, there are some Pits rooms which are bottomless, and if agent falls in Pits, then he will be stuck there forever. The exciting thing with this cave is that in one room there is a possibility of finding a heap of gold. So the agent goal is to find the gold and climb out the cave without fallen into Pits or eaten by Wumpus. The agent will get a reward if he comes out with gold, and he will get a penalty if eaten by Wumpus or falls in the pit. Prepared by: Prof. Khushali B Kathiriya 82
  • 82. Wampus World (Cont.)  Following is a sample diagram for representing the Wumpus world. It is showing some rooms with Pits, one room with Wumpus and one agent at (1,1) square location of the world. Prepared by: Prof. Khushali B Kathiriya 83
  • 83. Wampus World (Cont.)  There are also some components which can help the agent to navigate the cave. These components are given as follows: 1. The rooms adjacent to the Wumpus room are smelly, so that it would have some stench. 2. The room adjacent to PITs has a breeze, so if the agent reaches near to PIT, then he will perceive the breeze. 3. There will be glitter in the room if and only if the room has gold. 4. The Wumpus can be killed by the agent if the agent is facing to it, and Wumpus will emit a horrible scream which can be heard anywhere in the cave. Prepared by: Prof. Khushali B Kathiriya 84
  • 84. Wampus World (Cont.)  PEAS description of Wumpus world  To explain the Wumpus world we have given PEAS description as below:  Performance measure  Environment  Actuators  Sensors  The Wumpus world Properties  Exploring the Wumpus world Prepared by: Prof. Khushali B Kathiriya 85
  • 85. Wampus World (Cont.)  Performance measure:  +1000 reward points if the agent comes out of the cave with the gold.  -1000 points penalty for being eaten by the Wumpus or falling into the pit.  -1 for each action, and -10 for using an arrow.  The game ends if either agent dies or came out of the cave. Prepared by: Prof. Khushali B Kathiriya 86
  • 86. Wampus World (Cont.)  Environment:  A 4*4 grid of rooms.  The agent initially in room square [1, 1], facing toward the right.  Location of Wumpus and gold are chosen randomly except the first square [1,1].  Each square of the cave can be a pit with probability 0.2 except the first square. Prepared by: Prof. Khushali B Kathiriya 87
  • 87. Wampus World (Cont.)  Actuators:  Left turn,  Right turn  Move forward  Grab  Release  Shoot Prepared by: Prof. Khushali B Kathiriya 88
  • 88. Wampus World (Cont.)  Sensors:  The agent will perceive the stench if he is in the room adjacent to the Wumpus. (Not diagonally).  The agent will perceive breeze if he is in the room directly adjacent to the Pit.  The agent will perceive the glitter in the room where the gold is present.  The agent will perceive the bump if he walks into a wall.  When the Wumpus is shot, it emits a horrible scream which can be perceived anywhere in the cave.  These percepts can be represented as five element list, in which we will have different indicators for each sensor.  Example if agent perceives stench, breeze, but no glitter, no bump, and no scream then it can be represented as: [Stench, Breeze, None, None, None]. Prepared by: Prof. Khushali B Kathiriya 89
  • 89. Wampus World (Cont.)  The Wumpus world Properties:  Partially observable: The Wumpus world is partially observable because the agent can only perceive the close environment such as an adjacent room.  Deterministic: It is deterministic, as the result and outcome of the world are already known.  Sequential: The order is important, so it is sequential.  Static: It is static as Wumpus and Pits are not moving.  Discrete: The environment is discrete.  One agent: The environment is a single agent as we have one agent only and Wumpus is not considered as an agent. Prepared by: Prof. Khushali B Kathiriya 90
  • 90. Wampus World (Cont.)  Exploring the Wumpus world:  Agent's First step:  Initially, the agent is in the first room or on the square [1,1], and we already know that this room is safe for the agent, so to represent on the below diagram (a) that room is safe we will add symbol OK. Symbol A is used to represent agent, symbol B for the breeze, G for Glitter or gold, V for the visited room, P for pits, W for Wumpus.  At Room [1,1] agent does not feel any breeze or any Stench which means the adjacent squares are also OK. Prepared by: Prof. Khushali B Kathiriya 91
  • 91. Wampus World (Cont.) Prepared by: Prof. Khushali B Kathiriya 92
  • 92. Wampus World (Cont.)  Agent's second Step:  Now agent needs to move forward, so it will either move to [1, 2], or [2,1]. Let's suppose agent moves to the room [2, 1], at this room agent perceives some breeze which means Pit is around this room. The pit can be in [3, 1], or [2,2], so we will add symbol P? to say that, is this Pit room?  Now agent will stop and think and will not make any harmful move. The agent will go back to the [1, 1] room. The room [1,1], and [2,1] are visited by the agent, so we will use symbol V to represent the visited squares. Prepared by: Prof. Khushali B Kathiriya 93
  • 93. Wampus World (Cont.)  Agent's third step:  At the third step, now agent will move to the room [1,2] which is OK. In the room [1,2] agent perceives a stench which means there must be a Wumpus nearby. But Wumpus cannot be in the room [1,1] as by rules of the game, and also not in [2,2] (Agent had not detected any stench when he was at [2,1]). Therefore agent infers that Wumpus is in the room [1,3], and in current state, there is no breeze which means in [2,2] there is no Pit and no Wumpus. So it is safe, and we will mark it OK, and the agent moves further in [2,2]. Prepared by: Prof. Khushali B Kathiriya 94
  • 94. Wampus World (Cont.) Prepared by: Prof. Khushali B Kathiriya 95
  • 95. Wampus World (Cont.)  Agent's fourth step:  At room [2,2], here no stench and no breezes present so let's suppose agent decides to move to [2,3]. At room [2,3] agent perceives glitter, so it should grab the gold and climb out of the cave. Prepared by: Prof. Khushali B Kathiriya 96
  • 96. Artificial Intelligence Chap.3 First Order Predicate Logic Prepared by: Prof. Khushali B Kathiriya
  • 97. First Order Predicate Logic  In the topic of Propositional logic, we have seen that how to represent statements using propositional logic. But unfortunately, in propositional logic, we can only represent the facts, which are either true or false.  PL is not sufficient to represent the complex sentences or natural language statements. The propositional logic has very limited expressive power. Consider the following sentence, which we cannot represent using PL logic.  "Some humans are intelligent“.  "Sachin likes cricket."  To represent the above statements, PL logic is not sufficient, so we required some more powerful logic, such as first-order logic (FOL). Prepared by: Prof. Khushali B Kathiriya 98
  • 98. First Order Predicate Logic (Cont.)  First-order logic is another way of knowledge representation in artificial intelligence. It is an extension to propositional logic.  FOL is sufficiently expressive to represent the natural language statements in a concise way.  First-order logic is also known as Predicate logic or First-order predicate logic. First-order logic is a powerful language that develops information about the objects in a more easy way and can also express the relationship between those objects. Prepared by: Prof. Khushali B Kathiriya 99
  • 99. First Order Predicate Logic (Cont.)  First-order logic (like natural language) does not only assume that the world contains facts like propositional logic but also assumes the following things in the world: 1. Constant term: A, B, people, numbers, colors, wars, theories, squares, pits, Wumpus, etc. 2. Variable term : It can be unary relation such as: red, round, is adjacent, or n-any relation such as: the sister of, brother of, has color, comes between 3. Function: Father of, best friend, third inning of, end of, etc.  As a natural language, first-order logic also has two main parts: 1. Syntax 2. Semantics Prepared by: Prof. Khushali B Kathiriya 100
  • 100. 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, temp3, ......, term n).  Example:  Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).  Chinky is a cat: => cat (Chinky). Prepared by: Prof. Khushali B Kathiriya 101
  • 101. 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.  Example:  "x is an integer." Prepared by: Prof. Khushali B Kathiriya 102
  • 102. Quantifiers in First-Order Logic  A quantifier is a language element which generates quantification, and quantification specifies the quantity of specimen in the universe of discourse.  These are the symbols that permit to determine or identify the range and scope of the variable in the logical expression. There are two types of quantifier: 1. Universal Quantifier, (for all, everyone, everything) 2. Existential quantifier, (for some, at least one). Prepared by: Prof. Khushali B Kathiriya 103
  • 103. Universal Quantifier  Universal quantifier is a symbol of logical representation, which specifies that the statement within its range is true for everything or every instance of a particular thing.  The Universal quantifier is represented by a symbol ∀, which resembles an inverted A.  If x is a variable, then ∀x is read as: • For all x • For each x • For every x. Prepared by: Prof. Khushali B Kathiriya 104
  • 104. Universal Quantifier (Cont.) Prepared by: Prof. Khushali B Kathiriya 105
  • 105. Existential Quantifier  Existential quantifiers are the type of quantifiers, which express that the statement within its scope is true for at least one instance of something.  It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with a predicate variable then it is called as an existential quantifier.  If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as: • There exists a 'x.' • For some 'x.' • For at least one 'x.' Prepared by: Prof. Khushali B Kathiriya 106
  • 106. Existential Quantifier (Cont.) Prepared by: Prof. Khushali B Kathiriya 107
  • 107. Properties of Quantifiers  In Universal quantifier, ∀x∀y is similar to ∀y∀x.  In Existential quantifier, ∃x∃y is similar to ∃y∃x.  ∃x∀y is not similar to ∀y∃x. Prepared by: Prof. Khushali B Kathiriya 108
  • 108. Artificial Intelligence Example of FOL Prepared by: Prof. Khushali B Kathiriya
  • 109. Example of FOL 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). Prepared by: Prof. Khushali B Kathiriya 110
  • 110. Example of FOL 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). Prepared by: Prof. Khushali B Kathiriya 111
  • 111. Example of FOL (Cont.) 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). Prepared by: Prof. Khushali B Kathiriya 112
  • 112. Example of FOL (Cont.) 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)]. Prepared by: Prof. Khushali B Kathiriya 113
  • 113. Example of FOL (Cont.) 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)]. Prepared by: Prof. Khushali B Kathiriya 114
  • 114. Artificial Intelligence Representation Simple Facts in logic Prepared by: Prof. Khushali B Kathiriya
  • 115. Representation Simple Facts in logic 1. All students are smart.  ∀x (Student(x) ⇒ Smart(x)) 2. There exists a student.  ∃x Student(x) 3. There exists a smart student.  ∃x (Student(x) ∧ Smart(x)) Prepared by: Prof. Khushali B Kathiriya 117
  • 116. Representation Simple Facts in logic (Cont.) 4. Every student loves some student.  ∀x (Student(x) ⇒ ∃y (Student(y) ∧ Loves(x,y))) 5. Every student loves some other student.  ∀x (Student(x) ⇒ ∃y (Student(y) ∧¬(x=y) ∧ Loves(x,y))) 6. There is a student who is loved by every other student.  ∃x (Student(x) ∧∀y (Student(y) ∧¬(x=y) ⇒Loves(y,x))) Prepared by: Prof. Khushali B Kathiriya 118
  • 117. Representation Simple Facts in logic (Cont.) 1. Bill is a student.  Student(Bill) 2. Bill takes either Analysis or Geometry (but not both).  Takes(Bill,Analysis) ⇔ ¬Takes(Bill,Geometry) 3. Bill takes Analysis or Geometry (or both).  Takes(Bill,Analysis) ∨ Takes(Bill,Geometry) 4. Bill takes Analysis and Geometry.  Takes(Bill,Analysis) ∧ Takes(Bill,Geometry) 5. Bill does not take Analysis.  ¬Takes(Bill,Analysis) Prepared by: Prof. Khushali B Kathiriya 119
  • 118. Representation Simple Facts in logic (Cont.) 6. No student loves Bill.  ¬∃x (Student(x) ∧ Loves(x,Bill) 7. Bill has at least one sister.  ∃x SisterOf(x,Bill) 8. Bill has no sister.  ¬∃x SisterOf(x,Bill) 9. Bill has at most one sister.  ∀x,y (SisterOf(x,Bill) ∧ SisterOf(y,Bill) ⇒x=y)) 10.Bill has exactly one sister.  ∃x (SisterOf(x,Bill) ∧∀y (SisterOf(y,Bill) ⇒x=y)) 11.Bill has at least two sisters.  ∃x,y (SisterOf(x,Bill) ∧ SisterOf(y,Bill) ∧¬(x=y)) Prepared by: Prof. Khushali B Kathiriya 120
  • 119. Representation Simple Facts in logic (Cont.) 1. Anyone whom Mary loves is a football star. 2. Any student who does not pass does not play. 3. John is a student. 4. Any student who does not study does not pass. 5. Anyone who does not play is not a football star. 6. If John does not study, then Mary does not love John. Prepared by: Prof. Khushali B Kathiriya 121
  • 120. Representation Simple Facts in logic (Cont.) 1. Anyone whom Mary loves is a football star.  ∀ x (LOVES(Mary,x) → STAR(x)) 2. Any student who does not pass does not play.  ∀ x (STUDENT(x) ∧ ¬ PASS(x) → ¬ PLAY(x)) 3. John is a student.  STUDENT(John) 4. Any student who does not study does not pass.  ∀ x (STUDENT(x) ∧ ¬ STUDY(x) → ¬ PASS(x)) 5. Anyone who does not play is not a football star.  ∀ x (¬ PLAY(x) → ¬ STAR(x)) 6. If John does not study, then Mary does not love John.  ¬ STUDY(John) → ¬ LOVES(Mary,John) Prepared by: Prof. Khushali B Kathiriya 122
  • 121. Representation Simple Facts in logic (Cont.) 1. Every child loves Santa. 2. Everyone who loves Santa loves any reindeer. 3. Rudolph is a reindeer, and Rudolph has a red nose. 4. Anything which has a red nose is weird or is a clown. 5. No reindeer is a clown. 6. Scrooge does not love anything which is weird. 7. Scrooge is not a child. Prepared by: Prof. Khushali B Kathiriya 123
  • 122. Representation Simple Facts in logic (Cont.) 1. Every child loves Santa.  ∀ x (CHILD(x) → LOVES(x, Santa)) 2. Everyone who loves Santa loves any reindeer.  ∀ x (LOVES(x, Santa) → ∀ y (REINDEER(y) → LOVES(x, y))) 3. Rudolph is a reindeer, and Rudolph has a red nose.  REINDEER(Rudolph) ∧ REDNOSE(Rudolph) 4. Anything which has a red nose is weird or is a clown.  ∀ x (REDNOSE(x) → WEIRD(x) ∨ CLOWN(x)) Prepared by: Prof. Khushali B Kathiriya 124
  • 123. Representation Simple Facts in logic (Cont.) 5. No reindeer is a clown.  ¬ ∃ x (REINDEER(x) ∧ CLOWN(x)) 6. Scrooge does not love anything which is weird.  ∀ x (WEIRD(x) → ¬ LOVES(Scrooge, x)) 7. Scrooge is not a child.  ¬ CHILD(Scrooge) Prepared by: Prof. Khushali B Kathiriya 125
  • 124. Representation Simple Facts in logic (Cont.) 1. Anyone who buys carrots by the bushel owns either a rabbit or a grocery store. 2. Every dog chases some rabbit. 3. Mary buys carrots by the bushel. 4. Anyone who owns a rabbit hates anything that chases any rabbit. 5. John owns a dog. 6. Someone who hates something owned by another person will not date that person. 7. If Mary does not own a grocery store, she will not date John. Prepared by: Prof. Khushali B Kathiriya 126
  • 125. Representation Simple Facts in logic (Cont.) 1. Anyone who buys carrots by the bushel owns either a rabbit or a grocery store.  ∀ x (BUY(x) → ∃ y (OWNS(x,y) ∧ (RABBIT(y) ∨ GROCERY(y)))) 2. Every dog chases some rabbit.  ∀ x (DOG(x) → ∃ y (RABBIT(y) ∧ CHASE(x,y))) 3. Mary buys carrots by the bushel.  BUY(Mary) 4. Anyone who owns a rabbit hates anything that chases any rabbit.  ∀ x ∀ y (OWNS(x,y) ∧ RABBIT(y) → ∀ z ∀ w (RABBIT(w) ∧ CHASE(z,w) → HATES(x,z))) Prepared by: Prof. Khushali B Kathiriya 127
  • 126. Representation Simple Facts in logic (Cont.) 5. John owns a dog.  ∃ x (DOG(x) ∧ OWNS(John,x)) 6. Someone who hates something owned by another person will not date that person.  ∀ x ∀ y ∀ z (OWNS(y,z) ∧ HATES(x,z) → ¬ DATE(x,y)) 7. (Conclusion) If Mary does not own a grocery store, she will not date John.  (( ¬ ∃ x (GROCERY(x) ∧ OWN(Mary,x))) → ¬ DATE(Mary,John)) Prepared by: Prof. Khushali B Kathiriya 128
  • 127. Artificial Intelligence Chap.4 Inference in First Order Logic Prepared by: Prof. Khushali B Kathiriya
  • 128. Artificial Intelligence Comparison between Propositional Logic and First Order Logic Prepared by: Prof. Khushali B Kathiriya
  • 129. Comparison between Propositional Logic and First Order Logic (Cont.) Propositional Logic (PL) First Order Logic (FOL) PL can not represent small worlds like vacuum cleaner world. FOL can very well represent small world’s problems. PL is a weak knowledge representation language. FOL is a strong way of representing language. PL uses propositions in which the complete sentence is denoted by a symbol. FOL uses predicated which involve constants, variables, functions, relations. PL can not directly represent properties of individual entities or relation between entities. i.e., Hiral is short. FOL can directly represent properties of individual entities or relation between entities. i.e., Hiral is short. Ans is: short (Hiral) Prepared by: Prof. Khushali B Kathiriya 131
  • 130. Comparison between Propositional Logic and First Order Logic Propositional Logic (PL) First Order Logic (FOL) PL can not express specialization, generalization, or patterns, etc. i.e., all rectangle have 4 sides FOL can express specialization, generalization, or patterns, etc. i.e., all rectangle have 4 sides Ans. is: no of size(rectangle,4) Foundation level language Higher level language PL is not sufficiently expressive to represent complex statements. FOL is represent complex statements. In PL meaning of the facts is context- independent unlike natural language. In FOL meaning of the sentences is context dependent like natural language. Declarative in nature Derivative in nature Prepared by: Prof. Khushali B Kathiriya 132
  • 131. Artificial Intelligence Inference in First Order Logic Prepared by: Prof. Khushali B Kathiriya
  • 132. Inference in First Order Logic  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: 1. Forward chaining 2. Backward chaining Prepared by: Prof. Khushali B Kathiriya 134
  • 133. Artificial Intelligence Forward Chaining/ Resolution Prepared by: Prof. Khushali B Kathiriya
  • 134. 1. Forward Chaining  Forward chaining is also known as a forward deduction or forward reasoning method when using an inference engine. Forward chaining is a form of reasoning which start with atomic sentences in the knowledge base and applies inference rules (Modus Ponens) in the forward direction to extract more data until a goal is reached.  The Forward-chaining algorithm starts from known facts, triggers all rules whose premises are satisfied, and add their conclusion to the known facts. This process repeats until the problem is solved.  Forward chaining is called as a data driven inference technique. Prepared by: Prof. Khushali B Kathiriya 136
  • 135. 1. Forward Chaining (Cont.)  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. Prepared by: Prof. Khushali B Kathiriya 137
  • 136. 1. Forward Chaining / Resolution (Cont.)  Example:  If it is raining then, we will take umbrella. Data: It is raining Decision: we will take umbrella  That’s means we already known that it’s raining that’s why it decided to take umbrella. Prepared by: Prof. Khushali B Kathiriya 138 Data Decision
  • 137. 1. Forward Chaining / Resolution (Cont.)  Facts: 1. It is a crime for an American to sell weapons to enemy of America. 2. Country Nono is an enemy of America. 3. Nono has a some missiles. 4. All of the missiles were sold to Nono by colonel west. 5. Missiles are weapons. 6. Colonel west is American.  We have prove that west is a criminal. Prepared by: Prof. Khushali B Kathiriya 139
  • 138. 1. Forward Chaining / Resolution (Cont.)  Facts conversion into FOL: 1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) → Criminal(X) 2. Enemy (Nono, America) 3. Owns ( Nono, X), Missile (X) 4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono) 5. Missile (X) → Weapon (x) 6. American (West) Prepared by: Prof. Khushali B Kathiriya 140
  • 139. 1. Forward Chaining / Resolution (Cont.)  Forward chaining proof:  STEP: 1 Prepared by: Prof. Khushali B Kathiriya 141 American (West) Missiles (X) Owns (Nono, X) Enemy (Nono, America)
  • 140. 1. Forward Chaining / Resolution (Cont.)  Forward chaining proof:  STEP: 2 apply rule number 4 and 5 4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono) 5. Missile (X) → Weapon (x) Prepared by: Prof. Khushali B Kathiriya 142
  • 141. 1. Forward Chaining / Resolution (Cont.) Prepared by: Prof. Khushali B Kathiriya 143 American (West) Missiles (X) Owns (Nono, X) Enemy (Nono, America) Weapon (X) Sell (West, X, Nono) 5 4
  • 142. 1. Forward Chaining / Resolution (Cont.)  Forward chaining proof:  STEP: 3 apply rule number 1 1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) → Criminal(X) Prepared by: Prof. Khushali B Kathiriya 144
  • 143. 1. Forward Chaining / Resolution (Cont.) Prepared by: Prof. Khushali B Kathiriya 145 American (West) Missiles (X) Owns (Nono, X) Enemy (Nono, America) Weapon (X) Sell (West, X, Nono) 5 4 Criminal (West) 1
  • 144. Artificial Intelligence Backward Chaining/ Resolution Prepared by: Prof. Khushali B Kathiriya
  • 145. 2. Backward Chaining/ Resolution  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. Prepared by: Prof. Khushali B Kathiriya 147 Decision Data
  • 146. 2. Backward Chaining/ Resolution (Cont.)  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. Prepared by: Prof. Khushali B Kathiriya 148
  • 147. 2. Backward Chaining/ Resolution (Cont.)  Facts: 1. It is a crime for an American to sell weapons to enemy of America. 2. Country Nono is an enemy of America. 3. Nono has a some missiles. 4. All of the missiles were sold to Nono by colonel west. 5. Missiles are weapons. 6. Colonel west is American.  We have know that west is a criminal. Prepared by: Prof. Khushali B Kathiriya 149
  • 148. 2. Backward Chaining/ Resolution (Cont.)  Facts conversion into FOL: 1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) → Criminal(X) 2. Enemy (Nono, America) 3. Owns ( Nono, X), Missile (X) 4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono) 5. Missile (X) → Weapon (x) 6. American (West) Prepared by: Prof. Khushali B Kathiriya 150
  • 149. 2. Backward Chaining/ Resolution (Cont.)  Backward chaining proof:  STEP: 1 Take conclusion (leaf node) Prepared by: Prof. Khushali B Kathiriya 151 Criminal (West)
  • 150. 2. Backward Chaining/ Resolution (Cont.)  Backward chaining proof:  STEP: 2 Apply 1st rule Prepared by: Prof. Khushali B Kathiriya 152 Criminal (West) American (West) Missiles (X) Sell (West, X, Z) Enemy (Nono, America) 1
  • 151. 2. Backward Chaining/ Resolution (Cont.)  Backward chaining proof:  STEP: 3 Apply rules Prepared by: Prof. Khushali B Kathiriya 153
  • 152. 2. Backward Chaining/ Resolution (Cont.) Prepared by: Prof. Khushali B Kathiriya 154 Criminal (West) American (West) Weapon (X) Sell (West, X, Z) Enemy (Nono, America) 1 Missiles (X) Owns (Nono, X) Missiles (X)
  • 154. Unification Algorithm  Algorithm Unify(L1,L2): 1. If L1 and L2 is a variable or constant then, a. If L1 and L2 are identical return NIL, b. Else if L1 is a variable, then if L1 occurs in L2 then return fail, else return { (L1/L2) } c. Else if L2 is a variable, then if L2 occurs in L1 then return fail, else return { (L2/L1) } d. Else return fail 2. If the initial predicate symbols in L1 and L2 are identical, then return Fail 3. If L1 and L2 have different number of arguments, then fails a. i.e., P(L1,L2) and P(L1,L2,L3) 4. Set SUBST to nil. 5. Loop (apply for all variable/constant) 6. Return SUBST. Prepared by: Prof. Khushali B Kathiriya 156
  • 155. Unification Example  Unification is all about making the expressions look identical. So, for the given expressions to make them look identical we need to do substitution.  (x, y)=(2,3)  So we can say like,  x=2, {2 for X}  y=3 {3 for y}  P(x, F(y)) = P (a, F(g(z))  In our case, P(x, F(y)) and P (a, F(g(z))  x=a (a for x)  y=g(z) (g(z) for y)  [a/x , g(z)/y] Prepared by: Prof. Khushali B Kathiriya 157
  • 156. Unification Example(Cont.)  Food (Peanuts) and Food (x)  So here we can say like this,  Peanuts for X  {X / Peanuts}  Like (Ravi, P) and like (Ravi, Apple)  So here we can say like this,  Apple for P  {P / Apple) Prepared by: Prof. Khushali B Kathiriya 158
  • 158. Resolution  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. Prepared by: Prof. Khushali B Kathiriya 160
  • 159. Conversion from FOL Clausal Normal Form (CNF)  Steps for Resolution : 1. Conversion of facts into FOL. 2. Convert FOL to CNF A. Elimination of implication  Eliminate all ”→” sign  Replace P → Q with ~P V Q B. Distribute negations  Replace ~~P with P  Replace ~(P V Q) with ~P ^ ~Q (pVQ) → R Prepared by: Prof. Khushali B Kathiriya 161
  • 160. Conversion from FOL Clausal Normal Form (CNF) (Cont.) 2. Convert FOL to CNF. (Cont.) C. Eliminate existential quantifiers by replacing with skolem constants or skolem function  ∀X ∃Y ((P1(X,Y) v (P2(X,Y))) ≡ ∀X ((P1(X,F(Y)) v (P2(X,F(Y))) D. Rename variables/ use standard variable to avoid duplicate quantifiers. E. Drop all universal quantifiers.  (P1(X,F(Y)) v (P2(X,F(Y)) Prepared by: Prof. Khushali B Kathiriya 162
  • 161. Conversion from FOL Clausal Normal Form (CNF) (Cont.) 3. Negate the statement which needs to prove (proof by contradiction)  In this statement, we will apply negation to the conclusion statements, which will be written as  ¬ likes(John, Peanuts) 4. Draw Resolution graph  Now in this step, we will solve the problem by resolution tree using substitution. Prepared by: Prof. Khushali B Kathiriya 163
  • 162. Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Facts: 1. It is a crime for an American to sell weapons to enemy of America. 2. Country Nono is an enemy of America. 3. Nono has a some missiles. 4. All of the missiles were sold to Nono by colonel west. 5. Missiles are weapons. 6. Colonel west is American.  Prove: We have know that west is a criminal. Prepared by: Prof. Khushali B Kathiriya 164
  • 163. Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Step 1: Convert English to FOL 1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) → Criminal(X) 2. Enemy (Nono, America) 3. Owns ( Nono, X), Missile (X) 4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono) 5. Missile (X) → Weapon (x) 6. American (West) Prepared by: Prof. Khushali B Kathiriya 165
  • 164. Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Step 2: Remove → sign from the FOL 1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) → Criminal(X) ~(American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America)) V Criminal(X) Apply ~ sign in whole sentence ,  ~American (X) V ~weapon(Y) V ~sells (X,Y,Z) V ~enemy(Z, America) V Criminal(X) 2. Enemy (Nono, America) 3. Owns ( Nono, X), Missile (X) Owns ( Nono, X) Missile (X) Prepared by: Prof. Khushali B Kathiriya 166
  • 165. Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Step 2: Remove ‘→’ sign from the FOL 4. Missile (X) ^ owns (Nono, X) → Sell (West, X, Nono) ~(Missile (X) ^ owns (Nono, X)) V Sell (West, X, Nono) Apply ~ sign in whole sentence , ~Missile (X) V ~owns (Nono, X) V Sell (West, X, Nono) 5. Missile (X) → Weapon (x) ~Missile (X) V Weapon (x) 6. American (West) 7. Criminal (West) Prepared by: Prof. Khushali B Kathiriya 167
  • 166. Artificial Intelligence Example for Conversion from FOL Clausal Normal Form (CNF) Prepared by: Prof. Khushali B Kathiriya
  • 167. Example for Conversion from FOL Clausal Normal Form (CNF)  Step 1: Convert English to FOL Prepared by: Prof. Khushali B Kathiriya 169
  • 168. Example for Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Step 2: Eliminate all implication (→) and rewrite Prepared by: Prof. Khushali B Kathiriya 170
  • 169. Example for Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Step 3: Move negation (¬)inwards and rewrite Prepared by: Prof. Khushali B Kathiriya 171
  • 170. Example for Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Step 4: Rename variables or standardize variables Prepared by: Prof. Khushali B Kathiriya 172
  • 171. Example for Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Step 5: Eliminate existential instantiation quantifier by elimination.  In this step, we will eliminate existential quantifier ∃, and this process is known as Skolemization. But in this example problem since there is no existential quantifier so all the statements will remain same in this step. Prepared by: Prof. Khushali B Kathiriya 173
  • 172. Example for Conversion from FOL Clausal Normal Form (CNF) (Cont.)  Step 6: Drop Universal quantifiers Prepared by: Prof. Khushali B Kathiriya 174
  • 173. 175 Prepared by: Prof. Khushali B Kathiriya ¬ likes(John, Peanuts) ¬ food(x) V likes(John, x) ¬ food(Peanuts) {Peanuts/x} ¬ eats(y, z) V killed(y) V food(z) {Peanuts/z} ¬ eats(y, z) V killed(y) eats (Anil, Peanuts) {Anil/y} killed(Anil) ¬ alive(k) V ¬ killed(k) ¬ alive(Anil) {Anil/k} alive(Anil) { } Step 7: Draw Resolution graph