SlideShare a Scribd company logo
1 of 138
Knowledge Representation and Logic
Objective
This lecture will enable you to
• Represent simple facts in the language of
propositional logic
• Interpret a propositional logic statement
• Compute the meaning of a compound
proposition
Knowledge Representation
• Knowledge is a theoretical or practical
understanding of a subject or a domain.
Knowledge is also the sum of what is currently
known.
• Knowledge is “the sum of what is known: the
body of truth, information, and principles
acquired by mankind.” Or, "Knowledge is what I
know, Information is what we know."
• There are many other definitions such as:
Definition of Knowledge
• Knowledge is "information combined with experience,
context, interpretation, and reflection. It is a high-value
form of information that is ready to apply to decisions
and actions." (T. Davenport et al., 1998)
• Knowledge is “human expertise stored in a person’s
mind, gained through experience, and interaction with
the person’s environment." (Sunasee and Sewery,
2002)
• Knowledge is “information evaluated and organized by
the human mind so that it can be used purposefully,
e.g., conclusions or explanations." (Rousa, 2002)
Knowledge Representation
• Knowledge consists of information that has
been:
– interpreted,
– categorised,
– applied, experienced and revised.
• In general, knowledge is more than just data,
it consist of: facts, ideas, beliefs, heuristics,
associations, rules, abstractions, relationships,
customs.
Research literature classifies
knowledge as
Classification-based
Knowledge
Ability to classify information
Decision-oriented
Knowledge
Choosing the best option
Descriptive
knowledge
State of some world (heuristic)
Procedural knowledge How to do something
Reasoning knowledge
What conclusion is valid in what
situation?
Assimilative
What its impact is?
Knowledge Representation
• Knowledge representation (KR) is the study of how
knowledge about the world can be represented and
what kinds of reasoning can be done with that
knowledge. Knowledge Representation is the method
used to encode knowledge in Intelligent Systems.
• Since knowledge is used to achieve intelligent behavior,
the fundamental goal of knowledge representation is
to represent knowledge in a manner as to facilitate
inferencing (i.e. drawing conclusions) from knowledge.
A successful representation of some knowledge must,
then, be in a form that is understandable by humans,
and must cause the system using the knowledge to
behave as if it knows it.
• Some issues that arise in knowledge
representation from an AI perspective are:
– How do people represent knowledge?
– What is the nature of knowledge and how do we
represent it?
– Should a representation scheme deal with a particular
domain or should it be general purpose?
– How expressive is a representation scheme or formal
language?
– Should the scheme be declarative or procedural ?
Two entities in Knowledge
Representation
Properties for Knowledge
Representation Systems
• Representational Adequacy
– the ability to represent the required knowledge;
• Inferential Adequacy
– the ability to manipulate the knowledge represented to produce
new knowledge corresponding to that inferred from the
original;
• Inferential Efficiency
– the ability to direct the inferential mechanisms into the most
productive directions by storing appropriate guides;
•
• Acquisitional Efficiency
– the ability to acquire new knowledge using automatic methods
wherever possible rather than reliance on human intervention.
Knowledge and Intelligence
• Does knowledge have any role in
demonstrating intelligent behavior ?
How can we represent knowledge in a
machine ?
• We need a language to represent domain
knowledge
• There must be a method to use this
knowledge
• Inference Mechanism
• Syntax and Semantics of a language
– Laughs (Suman) == ??
– Likes ( Sunita, Shanta) == ??
Logic is a Formal language
• Propositional Logic
– Serena is Intelligent Propositional
– Serena is hardworking
– If Serena is Intelligent and Serena is hardworking
Then Serena scores high marks
Elements of Propositional Logic
• Anil is Intelligent
• Anil is hardworking
• Objects and Relations or Functions
Anil Intelligent
hardworking
Intelligent (Anil) == Anil is intelligent
Hardworking (Anil) == Anil is hardworking
Propositions
Also Intelligent-Anil can be a proposition
A Propositions (statement) can be True or False
Towards the Syntax
• Let P stand for intelligent (Anil)
• Let Q stand for Hardworking (Anil)
• What does P Λ Q ( P and Q) mean ?
• What does P V Q ( P or Q) mean ?
• P Λ Q, P V Q are compound propositions
Syntactic Elements of Propositional
Logic
• Vocabulary
– A set of propositional symbols (P , Q, R etc.) each
of which can be True or False
– Set of logical operators
Λ (AND), V(OR), ¬ (NOT), (IMPLIES)
Often parenthesis () is used for grouping
– There are two special symbols
TRUE (T) and FALSE(F) – these are logical
constants
How to form propositional sentences ?
• Each symbol ( a proposition or a constant) is a
sentence
• If P is a sentence and Q is a sentence
• Then
– (P) is a sentence
– P Λ Q is a sentence
– P V Q is a sentence
– ¬P is a sentence
– P Q is a sentence
– Nothing else is a sentence
Sentences are also
called well formed
formulae (wff)
Example wffs
• P
• True
• P Λ Q
• (P V Q) R
• (P Λ Q) V R S
• ¬ (P V Q)
• ¬ (P V Q) R Λ S
Implies
• P Q
• If P is true then Q is true
• If it rains then the roads are wet
• What about –
• If the roads are wet then it rains ????
Equivalence
• P Q
• Example ?
• If two sides of a triangle are equal then two
base angles of the triangle are equal.
• Can be represented as two sentences
• P Q and Q P
What does a wff mean -- Semantics
• Interpretation in a world
• When we interpret a sentence in a world we
assign meaning to it and it evaluates to either
True or False
P The child can write Nursery
Class II
F
T
The child can speak
T
T
P Suman is intelligent
Q Serena is Diligent
Class II
Class III
T
T
F
F
So how do we get the meaning ?
• Remember: Sentences can be compound
propositions
• Interpret each atomic proposition in the same
world
• Assign Truth values to each interpretation
• Compute the truth value of the compound
proposition
Example
• P: likes (Suman, Shanta)
• Q: knows (Subash, Shraddha)
• World: Suman and Shanta are friends and Subash
and Shraddha are known to each other
• P = T, Q = T
• P Λ Q = T
• P Λ (¬ Q) = F
Validity of a sentence
• If a propositional sentence is true under all
possible interpretation, it is VALID
• Tautology
– P V ¬ P is always true
Quiz
Express the following English Statements in the
language of propositional logic:
1. It rains in July
2. The book is not costly
3. If it rains today and one does not carry
umbrella he will be drenched
Quiz
• If P is true and Q is true, then are the
following true or false ?
1. P Q
2. (¬ P V Q) Q
3. (¬ P V Q) P
4. P V ¬ P T
Inferences in Propositional Logic
Quiz Answer
It rains in July
Rains (July)
¬ Rains (November) etc.
If it rains today and one does not carry umbrella
he will be drenched
• Rains (Today) Λ ¬ Carry (Umbrella) Get_Drenched
• Rains (Today) Λ ¬ Carry (Umbrella, Tom) Get_Drenched (Tom)
Objective
• In this lecture you will learn to:
• Infer the truth value of a proposition
• Reason towards new facts, given a set of
propositions
• Prove a proposition given a set of
propositional facts
Procedure to derive Truth Value
Truth Table
P Q P Λ Q
F F F
F T F
T F F
T T T
P Q P V Q
F F F
F T T
T F T
T T T
P Q P Q
F F T
F T T
T F F
T T T
¬PVQ P Λ Q
P Q ¬P ¬PVQ P Λ Q
F F T T F F
F T T T F F
T F F F F T
T T F T T T
De Morgan’s Theorem
¬(P Λ Q) =¬P V ¬Q
¬(P V Q) =¬P Λ ¬Q
P Q P V Q ¬(P V Q) ¬P ¬Q ¬P Λ ¬Q
F F F T T T T
F T T F T F F
T F T F F T F
T T T F F F F
Retry the Earlier Quiz
• If P is true and Q is true, then are the
following true or false ?
1. P Q P Q P Q
F F T
F T T
T F F
T T T
Retry the Earlier Quiz
3. (¬ P V Q) P: S is the entire statement
P ¬ P Q S
T F T T
Reasoning
P: It is the month of July
Q: It rains
R: P Q
If it is the month of July then it rains
It is the month of July
Conclude: It rains
Modus Ponens
• One of the inference rule
P Q
P
Q
Is Modus Ponens Correct Inference
Rule ??
P Q can be written as ¬ P V Q conjoined
with P we can write
P Λ ¬ P V Q = (P Λ ¬ P) V Q
= F V Q
= Q
Modus Ponens
• Thus irrespective of meaning Modus Ponens
allows us to infer the truth of Q
• Modus Ponens is an inference rule that allows
us to deduce the truth of a consequent
depending on the truth of the antecedents
Inference rule can be mechanically applied
Other rules
If P and Q then P
If P then P or Q
If Not(Not(P)) then P
Chain Rule:
If P then Q If Q then R
Leads to If P then R
Satisfiability
• Remember: An interpretation is a mapping to a
world
• A sentence is SATISFIABLE by an interpretation
If
Under that interpretation the sentence evaluates to
TRUE
If No interpretation makes all the sentences in the
set to be TRUE
Then the set of sentences is UNSATISFIABLE or
INCONSISTENT
Entailment
Interpretation that satisfies the larger world set of sentences S and same interpretation makes the
candidate sentence TRUE then we can say the S logically entails the candidate sentence.
• If a sentence s1 has a value True for all
interpretations that make all sentences a set
of sentence S then
S |- s1
S1 logically follows from S
S1 is a logical consequence of S
S logically entails s1
Clause: A Special Form
• Literal – A single proposition or its negation
P, ¬ P
• A clause is a disjunction of literals
P V Q V ¬ R
Converting a compound proposition to
the clausal form
• Consider the sentence (wff)
¬ (A B) V ( C A)
1. Eliminate implication sign
¬ (¬ A V B) V (¬ C V A)
2. Eliminate double negation and replace scope
of “not” signs (De - Morgans Law)
(A Λ ¬ B) V (¬ C V A)
Converting a compound proposition to
the clausal form
3. Convert to conjunctive normal form by using
distributive and associative laws
(A Λ ¬ B) V (¬ C V A)
(A V ¬ C V A) Λ (¬ B V ¬ C V A)
(A V ¬ C) Λ (¬ B V ¬ C V A)
4. Get the set of clauses
Set of clauses
(A V ¬ C)
(¬ B V ¬ C V A)
Resolution – A technique of Inference
• A sound inference mechanism
Principle:
Suppose x is a literal and s1 and s2 are two sets of
propositional sentences represented in clausal form
If we have (x V s1) Λ (¬x V s2)
Then we get S1 V S2
Here S1 V S2 is the resolvent,
x is resolved upon
An Example
• If a triangle is equilateral then it is isosceles
• If a triangle is isosceles then two sides AB and
AC are equal
• If AB and AC are equal then angle B and angle
C are equal
• ABS is an equilateral triangle
• Angle B is equal to angle C – Prove
Proving by Resolution
• If a triangle is equilateral then it is isosceles
Equilateral (ABC) Isosceles (ABC)
• If a triangle is isosceles then two sides AB and AC
are equal
Isosceles (ABC) Equal (AB, AC)
• If AB and AC are equal then angle B and angle C
are equal
Equal (AB, AC) Equal (B, C)
• ABC is an equilateral triangle
Equilateral (ABC)
Proving by Resolution
• Clausal Form
1. Equilateral (ABC) Isosceles (ABC)
¬ Equilateral (ABC) V Isosceles (ABC)
2. Isosceles (ABC) Equal (AB, AC)
¬Isosceles (ABC) V Equal (AB, AC)
3. Equal (AB, AC) Equal (B, C)
¬Equal (AB, AC) V Equal (B, C)
4. Equilateral (ABC)
Proof by refutation
• To prove
Angle B is equal to Angle C
Equal (B,C)
Let us disprove
Not Equal (B,C)
¬ Equal (B,C)
Let us try to disprove this
¬ Equilateral
(ABC) V
Isosceles (ABC)
¬Isosceles (ABC)
V Equal (AB,
AC)
¬Equal (AB, AC)
V Equal (B, C)
Equilateral
(ABC)
¬ Equal (B,C)
¬Equal (AB, AC) V Equal (B, C)
¬Equal (AB, AC)
¬Isosceles (ABC)
V Equal (AB, AC)
¬Isosceles (ABC)
¬ Equilateral (ABC)
V Isosceles (ABC)
¬ Equilateral (ABC)
Equilateral (ABC) Null Clause
Procedure for Resolution
• Convert given propositions into clausal form
• Convert the negation of the sentence to be
proved into clausal form
• Combine the clauses into a set
• Iteratively apply resolution to the set and add the
resolvent to the set
• Continue until no further resolvents can be
obtained or a null clause is obtained
Quiz
• Consider the following sentences
1. Mammals drink milk
2. Man is mortal
3. Man is a mammal
4. Tom is a man
5. Prove Tom drink(s) milk
6. Prove Tom is mortal
Quiz
1. Represent all the sentences in clausal form
2. Prove (5) and (6) using modus ponens
3. Prove (5) and (6) using resolution
First Order Logic
or Predicate Logic
Quiz Answers
1. Mammals drink milk
2. Man is mortal
3. Man is a mammal
4. Tom is a man
1. Prove Tom drink(s) milk
2. Prove Tom is mortal
• Applying modus ponens on R and S we get
mammal(Tom) ……… 5
• Applying modus ponens on 5 and 1 we get
drink(Tom, Milk)
• Applying modus ponens on R and S we get
mammal(Tom) ……… 5
• Applying modus ponens on 5 and 1 we get
drink(Tom, Milk)
Proof by Resolution
P: mammal (Tom)  drink (Tom, Milk)
¬ mammal (Tom) V drink (Tom, Milk)
Q: man (Tom)  mortal (Tom)
¬ man (Tom) V mortal (Tom)
R: man(Tom) mammal (Tom)
¬man(Tom) V mammal (Tom)
S: man(Tom)
Goal: drink(Tom, Milk)
To disprove: ¬ drink(Tom, Milk)
P: ¬ mammal (Tom)
V drink (Tom, Milk)
Q:¬ man (Tom) V
mortal (Tom)
R: ¬man(Tom) V
mammal (Tom)
S: man(Tom)
¬ drink(Tom, Milk)
¬ mammal (Tom)
V drink (Tom, Milk)
¬ mammal (Tom)
¬man(Tom) V
mammal (Tom)
¬man(Tom)
man(Tom)
Null Clause
Objective
This lecture will enable you to
• Formulate more types of sentences in logic
• Write correct predicate logic formulae
Limitation of Propositional Logic
• Consider the following argument
– All dogs are faithful
– Tommy is a dog
– Therefore, Tommy is faithful
• How to represent and infer this in
propositional logic?
Limitation of Propositional Logic
p : all dogs are faithful
q: Tommy is a dog
But P Λ q === >Tommy is faithful ??
No! we cannot infer this in Propositional Logic
More Scenarios
• Tom is a hardworking student
Hardworking(Tom)
• Tom is an intelligent student
Intelligent(Tom)
• If Tom is hardworking and Tom is intelligent
Then Tom scores high marks
• Hardworking(Tom) Λ Intelligent (Tom) 
Scores_High_Marks(Tom)
What about John and Jill ?
If we could write instead
All students who are hardworking and intelligent
scores high marks !!!
For all x such that x is a student and x is intelligent
and x is hardworking then x scores high marks
The Problem of Infinite Model
• In general, propositional logic can deal with
only a finite, number of propositions.
• If there are only three dogs Tommy, Jimmy,
and Laika, Then
T: Tommy is faithful
J: Jimmy is faithful
L: Laika is faithful
All dogs are faithful T Λ J Λ L
• What if there are infinite number of dogs ?
First-Order Logic / Predicate Logic
• First – order logic or predicate logic is a
generalization of propositional logic that
allows us to express and infer arguments in
infinite modes like
– All men are mortal
– Some birds cannot fly
– At least one planet has life on it
Syntax of FOL
• The syntax of first-order logic can be defined
in terms of
–Terms
–Predicate
–Quantifiers
Term
• A term denotes some object other than True
or False
Tommy is a dog
Tommy = Term
All men are mortal
Men = Term
Terms: Constant & Variable
• A constant of type W is a name that denotes a
particular object in a set W
– Example: 5, Tommy etc.
• A variable of type W is a name that can
denote any element in the set W
– Example: x ∈ N denotes a natural number
d denotes the name of a dog
Terms: Functions
• A functional term of arity n takes n objects of
type W 1 to W n as inputs and returns an
object of type W.
f(W 1, W2, …, W n )
plus(3,4) = 7
Functional term Constant term
Functions: Example
• Let plus be a function that takes two
arguments of type Natural Number and
returns a Natural number
• Valid functional terms:
plus (2, 3) plus(5, plus(7,3))
plus(plus(100,plus(1,6)),plus(3,3))
• Invalid functional terms:
plus(0, -1) plus(1.2, 3.1)
Functions with Variable arguments
plus( x, y)
prod( x, y, z)
Predicates
• Predicates are like functions except that their
return type is true or false.
• Example:
– gt ( x , y ) is true iff x > y
– Here gt is a predicate symbol that takes two
arguments of type natural number
– gt (3, 4 ) is a valid predicate but gt (3, -4) is not
Types of Predicates
• A predicate with no variable is a proposition
– Tommy is a dog
• A predicate with one variable is called a
property
– dog(x) is true iff x is a dog.
– mortal(y) is true iff y is mortal.
Formulation of Predicates
• Let P( x , y , …) and Q( x , y , …) are two
predicates.
• Then so are
P V Q
P Λ Q
¬ P
P  Q
Predicate Examples
• If x is a man then x is mortal
man (x)  mortal (x)
¬ man (x) V mortal (x)
• If n is a natural number, then n is either even
or odd.
natural (n)  even (n) V odd (n)
Quantifiers
• There are two basic quantifiers in FOL
– ∀ “For all” – Universal quantifier
– ∃ “There exists” – Existential quantifier
Universal quantifier
• ∀x P(x) : P(x) is true for any element that I
choose from the set
• This predicate will be true if it satisfy all value
of x satisfy P(x)
Existential quantifier
• ∃x Q(x) there should be at least one element
in the set for which Q(x) is true
Existential quantifier
• ∃x holiday (x)
• This predicate will be true if it satisfy at least
one x
• Days of week {Saturday, Sunday, Monday,
Tuesday, Wednesday, Thursday, Friday}
Universal Quantifiers
• All dogs are faithful
– faithful(x) : x is faithful
– dog(x): x is a dog
– ∀x (dog (x)  faithful (x))
• All birds cannot fly
– fly(x): x can fly
– bird(x): x is a bird
– ¬ (∀x(bird (x)  fly (x)))
Quiz problem Revisited
Existential Quantifiers
• At least one planet has life on it
– Planet(x): x is a planet
– haslife(x): x has life on it
– ∃x (planet (x) Λ haslife(x))
Existential Quantifiers
• All birds cannot fly There exists a bird that
cannot fly
• Fly (x): x can fly
• Bird (x): x is a bird
• ∃x (Bird (x) Λ ¬ fly (x))
Duality of Quantifiers
All men are mortal
No man is immortal
There exist birds that can fly.
It is not the case that all birds cannot fly.
Sentences
• A predicate is a sentence
• If sen, ¬ sen are sentences and x a variable,
then
• (sen), ¬sen, ∃x sen, ∀x sen, sen Λ ¬ sen , sen V
¬ sen, sen  ¬ sen are sentences
• Nothing else is a sentence
Quiz / Exercises
• Some dogs bark
• All dogs have four legs
• All barking dogs are irritating
• No dugs purr
• Father are male parents with children
• Students are people who are enrolled in
courses
Examples of Sentences
Birthday ( x , y ) – x celebrates birthday on date y
∀ y ∃ x Birthday ( x , y ) –
For all dates, there exists a person who
celebrates his/her Birthday on that date.
That is - “everyday someone celebrates
his/her birthday”
Examples
Brother ( x , y ) – x is y’s brother
Loves ( x , y ) – x loves y
∀ x ∀ y Brother ( x , y)  Loves ( x , y)
Everyone loves (all of) his/her brothers.
Let m(x) represent mother of x then
“everyone loves his/her mother” is
∀ x Loves (x, m(x))
Examples
• Any number is the successor of its
predecessor
• succ (x), pred (x)
• Equal ( x , y )
∀ x equal ( x , succ (pred (x))
Alternative Representation
• The previous example can be represented
succinctly as
• ∀ x (succ (pred (x) = x))
• Not Allowed in predicates
FOL with Equality
• In FOL with equality, we are allowed to use
the equality sign (=) between two functions.
• This is just for representational ease.
• We modify the definition of sentence to
include equality as
term = term is also a sentence
Quiz Revisited
• Some dogs bark
• ∃ x (dog(x) Λ bark(x))
• All dogs have four legs
• ∀ x (dog(x)  have_four_legs(x))
• ∀ x (dog(x)  legs(x,4))
• No dugs purr
• ¬ ∃ x (dog(x) Λ purr(x))
• Father are male parents with children
• ∀ x (father(x)  male(x) Λ has_childern(x))
Inference Rule
• Universal Elimination
∀ x Likes(x, flower)
Substituting x by Shirin gives
Likes(Shirin , flower)
The substitution should be done by a constant
term
Inference Rule
• Existential Elimination (Skolemization)
∃ x Likes(x, flower)
Likes(Person, flower)
As long as person is not in the knowledge base
• Existential introduction
Likes (shahid, flower)
Can be written as
∃ x Likes(x, flower)
Reasoning in FOL
• Consider the following problem:
If a perfect square is divisible by a prime p,
then it is also divisible by square of p. Every
perfect square is divisible by some prime.
36 is a perfect square.
Does there exist a prime q such that square of
q divided 36?
Representation in FOL
• If a perfect square is divisible by a prime p,
then it is also divisible by square of p.
∀ x ,y ( perfect_sq(x) Λ prime(y) Λ divides(x, y)
 divides (x, square(y))
• Every perfect square is divisible by some
prime.
∀ x ∃ y (perfect_sq(x) Λ prime(y) Λ divides(x,
y)
Representation in FOL
• 36 is a perfect square.
perfect_sq(36)
• Does there exist a prime q such that the
square of q divides 35 ?
∃ y (prime(y) Λ divides(36, square(y))
The knowledge base
1. ∀ x ,y ( perfect_sq(x) Λ prime(y) Λ divides(x,
y)  divides (x, square(y))
2. ∀ x ∃ y (perfect_sq(x) Λ prime(y) Λ divides(x,
y)
3. perfect_sq(36)
Inference
• From 2 and Universal Elimination
(4) ∃ y (perfect_sq(36) Λ prime (y) Λ
divides(36, y))
• From 4 and Existential Elimination
(5) perfect_sq(36) Λ prime (P) Λ divides(36, P)
• From (1) and (5)
(6) divides (36, square(P))
Inference
• From (5) and (6)
(7) prime (P) Λ divides(36, square(P))
• From (7) and Existential Introduction
∃ y prime (y) Λ divides(36, square(y))
Horn Sentences
• Atomic sentence
perfect_sq(36)
• Implication with a conjunction of atomic
sentences on the left and a single atom on the
right
∀ x ,y ( perfect_sq(x) Λ prime(y) Λ divides(x, y)
 divides (x, square(y))
• No existential Quantifier
Conversion to Horn Sentences
• Existential Quantifiers can be removed using
Existential Elimination (Skolemization)
– If the existential quantifier is outside any universal
quantifier, a Skolem constant is introduced. E.g. ∃
y prime (y) can be written as prime(P), where P is
a Skolem constant
– Otherwise a Skolem function is introduced. E.g.
– ∀ x ∃ y ( prime(y) Λ divides(x, y) ∀ x
prime(PD(x)) Λ divides(x, PD(x)), where PD(x) is a
Skolem function
Conversion to Horn Sentences
• And- Elimination
• Prime(P) Λ divides( x , P) can be written as two
clauses
Prime(P)
divides ( x , P )
Substitution
• It replaces variables with constants.
• SUBST({x/49, y/7}, Divides( x, y)) = Divides (49;
7)
Unification
• It is the process of finding a substitution that
makes two atomic sentences identical.
• UNIFY(Prime(7), Prime(x)) = {x/7}
Resolution in FOPL
An Example
• If a triangle is equilateral then it is isosceles
• If a triangle is isosceles then two sides AB and
AC are equal
• If AB and AC are equal then angle B and angle
C are equal
• ABS is an equilateral triangle
• Angle B is equal to angle C – Prove
Proving by Resolution
• If a triangle is equilateral then it is isosceles
Equilateral (ABC) Isosceles (ABC)
• If a triangle is isosceles then two sides AB and AC
are equal
Isosceles (ABC) Equal (AB, AC)
• If AB and AC are equal then angle B and angle C
are equal
Equal (AB, AC) Equal (B, C)
• ABC is an equilateral triangle
Equilateral (ABC)
Proving by Resolution
• Clausal Form
1. Equilateral (ABC) Isosceles (ABC)
¬ Equilateral (ABC) V Isosceles (ABC)
2. Isosceles (ABC) Equal (AB, AC)
¬Isosceles (ABC) V Equal (AB, AC)
3. Equal (AB, AC) Equal (B, C)
¬Equal (AB, AC) V Equal (B, C)
4. Equilateral (ABC)
Proof by refutation
• To prove
Angle B is equal to Angle C
Equal (B,C)
Let us disprove
Not Equal (B,C)
¬ Equal (B,C)
Let us try to disprove this
¬ Equal (B,C)
¬Equal (AB, AC) V Equal (B, C)
¬Equal (AB, AC)
¬Isosceles (ABC)
V Equal (AB, AC)
¬Isosceles (ABC)
¬ Equilateral (ABC)
V Isosceles (ABC)
¬ Equilateral (ABC)
Equilateral (ABC) Null Clause
¬ Equilateral
(ABC) V Isosceles
(ABC)
¬Isosceles (ABC)
V Equal (AB, AC)
¬Equal (AB, AC) V
Equal (B, C)
Equilateral (ABC)
Procedure for Resolution
• Convert given propositions into clausal form
• Convert the negation of the sentence to be proved into
clausal form
• Combine the clauses into a set
• Iteratively apply resolution to the set and add the resolvent
to the set
• Continue until no further resolvents can be obtained or a
null clause is obtained
A Few Statements
• All people who are graduating are happy.
• All happy people smile.
• Someone is graduating.
• Is someone smiling?
(Conclusion)
Solving the problem
• We intend to code the problem in predicate
calculus.
• Use resolution refutation to solve problem
• Solving = whether the conclusion can be
answered from the given set of sentences.
Selecting the Predicates
• Graduating(x): x is graduating
• Happy(x): x is happy
• Smiling(x): x is smiling
Encoding sentences in Predicate Logic
• All people who are graduating are happy
– ∀ x [graduating(x)  happy(x)]
• All happy people smile
– ∀ x[happy(x) smiling(x)]
• Someone is graduating
– ∃ x graduating(x)
• Is someone smiling
– ∃ x smiling(x)
Predicates
1.∀ x [graduating(x)  happy(x)]
2. ∀ x[happy(x) smiling(x)]
3. ∃ x graduating(x)
4. ¬ ∃ x smiling(x)
(Negating the conclusion)
Converting to Clausal Form
• Step 1: Eliminate 
1. ∀ x ¬graduating(x) V happy(x)
2. ∀ x ¬ happy(x) V smiling(x)
3. ∃ x graduating(x)
4. ¬ ∃ x smiling(x)
Converting to Canonical / Normal
Form
• Step 2: Reduce the scope of negation
1. ∀ x ¬graduating(x) V happy(x)
2. ∀ x ¬ happy(x) V smiling(x)
3. ∃ x graduating(x)
4. ∀ x ¬ smiling(x)
Converting to Canonical / Normal
Form
• Step 3: Standardize variables apart
1. ∀ x ¬graduating(x) V happy(x)
2. ∀ y ¬ happy(y) V smiling(y)
3. ∃ z graduating(z)
4. ∀w ¬ smiling(w)
Converting to Canonical / Normal
Form
• Step 4: Move all quantifiers to the left
1. ∀ x ¬graduating(x) V happy(x)
2. ∀ y ¬ happy(y) V smiling(y)
3. ∃ z graduating(z)
4. ∀w ¬ smiling(w)
Converting to Canonical / Normal
Form
• Step 5: Eliminate ∃ (Skolemization)
1. ∀ x ¬graduating(x) V happy(x)
2. ∀ y ¬ happy(y) V smiling(y)
3. graduating(name1)
(name1 is the Skolemization constant)
4. ∀w ¬ smiling(w)
Converting to Canonical / Normal
Form
• Step 6:Drop all ∀
1. ¬graduating(x) V happy(x)
2. ¬ happy(y) V smiling(y)
3. graduating(name1)
(name1 is the Skolemization constant)
4. ¬ smiling(w)
Canonical Form
• Canonical form is the conjunct of disjunction
only
Converting to Canonical Form
• Step 7: Convert to conjunct of disjunction
form
• Step 8: Make each conjunct a separate clause.
• Step 9: Standardize variables apart again.
• These steps do not change the set of clauses
any further (in the present problem)
Resolution
Quiz
• Solve the problem with resolution
If a perfect square is divisible by a prime p,
then it is also divisible by square of p. Every
perfect square is divisible by some prime.
36 is a perfect square.
Does there exist a prime q such that square of
q divided 36?
Answer Extraction
Find the Package Example (Nilsson)
• We know that
• All packages in room 27 are smaller than those
in room 28
• Package A is either in room 27 or in room 28
• Package B is in room 27
• Package B is not smaller than Package A
• Where is Package A ?

More Related Content

What's hot

I.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AII.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AIvikas dhakane
 
Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2DigiGurukul
 
Artificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge AcquisitionArtificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge AcquisitionThe Integral Worm
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gamemanika kumari
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.Alamgir Hossain
 
Unit4: Knowledge Representation
Unit4: Knowledge RepresentationUnit4: Knowledge Representation
Unit4: Knowledge RepresentationTekendra Nath Yogi
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languagesSOMNATHMORE2
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesOmprakash Chauhan
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithmMani Kanth
 
Planning in AI(Partial order planning)
Planning in AI(Partial order planning)Planning in AI(Partial order planning)
Planning in AI(Partial order planning)Vicky Tyagi
 
First order predicate logic (fopl)
First order predicate logic (fopl)First order predicate logic (fopl)
First order predicate logic (fopl)chauhankapil
 
weak slot and filler structure
weak slot and filler structureweak slot and filler structure
weak slot and filler structureAmey Kerkar
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded searchHema Kashyap
 

What's hot (20)

I.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AII.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AI
 
Predicate logic
 Predicate logic Predicate logic
Predicate logic
 
Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2
 
Artificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge AcquisitionArtificial Intelligence: Knowledge Acquisition
Artificial Intelligence: Knowledge Acquisition
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe game
 
Expert system
Expert systemExpert system
Expert system
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.
 
Unit4: Knowledge Representation
Unit4: Knowledge RepresentationUnit4: Knowledge Representation
Unit4: Knowledge Representation
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - Notes
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
 
Planning in AI(Partial order planning)
Planning in AI(Partial order planning)Planning in AI(Partial order planning)
Planning in AI(Partial order planning)
 
Backtracking
Backtracking  Backtracking
Backtracking
 
First order predicate logic (fopl)
First order predicate logic (fopl)First order predicate logic (fopl)
First order predicate logic (fopl)
 
weak slot and filler structure
weak slot and filler structureweak slot and filler structure
weak slot and filler structure
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded search
 
Iterative deepening search
Iterative deepening searchIterative deepening search
Iterative deepening search
 
predicate logic example
predicate logic examplepredicate logic example
predicate logic example
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 

Similar to Knnowledge representation and logic lec 11 to lec 15

Unit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfUnit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfHrideshSapkota2
 
Introduction to mathematical analysis
Introduction to mathematical analysisIntroduction to mathematical analysis
Introduction to mathematical analysisAnoojaI
 
predicateLogic.ppt
predicateLogic.pptpredicateLogic.ppt
predicateLogic.pptMUZAMILALI48
 
Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4DigiGurukul
 
Adnan: Introduction to Natural Language Processing
Adnan: Introduction to Natural Language Processing Adnan: Introduction to Natural Language Processing
Adnan: Introduction to Natural Language Processing Mustafa Jarrar
 
CS Artificial Intelligence chapter 4.pptx
CS Artificial Intelligence chapter 4.pptxCS Artificial Intelligence chapter 4.pptx
CS Artificial Intelligence chapter 4.pptxethiouniverse
 
Analyzing Arguments during a Debate using Natural Language Processing in Python
Analyzing Arguments during a Debate using Natural Language Processing in PythonAnalyzing Arguments during a Debate using Natural Language Processing in Python
Analyzing Arguments during a Debate using Natural Language Processing in PythonAbhinav Gupta
 
Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence Yasir Khan
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & ReasoningSajid Marwat
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)SHUBHAM KUMAR GUPTA
 
Week 6 7c - language in procedures & method
Week 6 7c - language in procedures & methodWeek 6 7c - language in procedures & method
Week 6 7c - language in procedures & methodHafizul Mukhlis
 
- Logic - Module 1B - Logic and Propositions course lactur .pdf
- Logic - Module 1B - Logic and Propositions course lactur .pdf- Logic - Module 1B - Logic and Propositions course lactur .pdf
- Logic - Module 1B - Logic and Propositions course lactur .pdfMehdiHassan67
 

Similar to Knnowledge representation and logic lec 11 to lec 15 (20)

AI Lesson 11
AI Lesson 11AI Lesson 11
AI Lesson 11
 
Logic (1)
Logic (1)Logic (1)
Logic (1)
 
Unit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfUnit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdf
 
Introduction to mathematical analysis
Introduction to mathematical analysisIntroduction to mathematical analysis
Introduction to mathematical analysis
 
predicateLogic.ppt
predicateLogic.pptpredicateLogic.ppt
predicateLogic.ppt
 
Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4
 
Adnan: Introduction to Natural Language Processing
Adnan: Introduction to Natural Language Processing Adnan: Introduction to Natural Language Processing
Adnan: Introduction to Natural Language Processing
 
CS Artificial Intelligence chapter 4.pptx
CS Artificial Intelligence chapter 4.pptxCS Artificial Intelligence chapter 4.pptx
CS Artificial Intelligence chapter 4.pptx
 
Analyzing Arguments during a Debate using Natural Language Processing in Python
Analyzing Arguments during a Debate using Natural Language Processing in PythonAnalyzing Arguments during a Debate using Natural Language Processing in Python
Analyzing Arguments during a Debate using Natural Language Processing in Python
 
Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & Reasoning
 
AI-Unit4.ppt
AI-Unit4.pptAI-Unit4.ppt
AI-Unit4.ppt
 
PNP.pptx
PNP.pptxPNP.pptx
PNP.pptx
 
PNP.pptx
PNP.pptxPNP.pptx
PNP.pptx
 
Logic
LogicLogic
Logic
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 
Week 6 7c - language in procedures & method
Week 6 7c - language in procedures & methodWeek 6 7c - language in procedures & method
Week 6 7c - language in procedures & method
 
CSE680-17NP-Complete.pptx
CSE680-17NP-Complete.pptxCSE680-17NP-Complete.pptx
CSE680-17NP-Complete.pptx
 
- Logic - Module 1B - Logic and Propositions course lactur .pdf
- Logic - Module 1B - Logic and Propositions course lactur .pdf- Logic - Module 1B - Logic and Propositions course lactur .pdf
- Logic - Module 1B - Logic and Propositions course lactur .pdf
 
AppTheories_L3
AppTheories_L3AppTheories_L3
AppTheories_L3
 

More from Subash Chandra Pakhrin

More from Subash Chandra Pakhrin (20)

Prismoid
PrismoidPrismoid
Prismoid
 
Torsion Angles, ASA Used for prediction of Non - Enzymatic PTM
Torsion Angles, ASA Used for prediction of Non - Enzymatic PTMTorsion Angles, ASA Used for prediction of Non - Enzymatic PTM
Torsion Angles, ASA Used for prediction of Non - Enzymatic PTM
 
COVID 19
COVID 19 COVID 19
COVID 19
 
Lstm covid 19 prediction
Lstm covid 19 predictionLstm covid 19 prediction
Lstm covid 19 prediction
 
Rnn & Lstm
Rnn & LstmRnn & Lstm
Rnn & Lstm
 
Characterization and identification of lysine succinylation sites based
Characterization and identification of lysine succinylation sites basedCharacterization and identification of lysine succinylation sites based
Characterization and identification of lysine succinylation sites based
 
Cnn april 8 2020
Cnn april 8 2020Cnn april 8 2020
Cnn april 8 2020
 
Deep Learning or Convolutional Neural Network
Deep Learning or Convolutional Neural Network Deep Learning or Convolutional Neural Network
Deep Learning or Convolutional Neural Network
 
Ncit 1st ai lab
Ncit 1st ai labNcit 1st ai lab
Ncit 1st ai lab
 
Ai lab
Ai labAi lab
Ai lab
 
Constraint satisfaction problem
Constraint satisfaction problem Constraint satisfaction problem
Constraint satisfaction problem
 
Analysis
AnalysisAnalysis
Analysis
 
Planning
PlanningPlanning
Planning
 
Intelligent agents (bsc csit) lec 2
Intelligent agents (bsc csit) lec 2Intelligent agents (bsc csit) lec 2
Intelligent agents (bsc csit) lec 2
 
Final slide4 (bsc csit) chapter 4
Final slide4 (bsc csit) chapter 4Final slide4 (bsc csit) chapter 4
Final slide4 (bsc csit) chapter 4
 
Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5
 
Lec 6 bsc csit
Lec 6 bsc csitLec 6 bsc csit
Lec 6 bsc csit
 
Two player games
Two player gamesTwo player games
Two player games
 
Final slide (bsc csit) chapter 2
Final slide (bsc csit) chapter 2Final slide (bsc csit) chapter 2
Final slide (bsc csit) chapter 2
 
Final slide (bsc csit) chapter 3
Final slide (bsc csit) chapter 3Final slide (bsc csit) chapter 3
Final slide (bsc csit) chapter 3
 

Recently uploaded

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 

Knnowledge representation and logic lec 11 to lec 15

  • 2. Objective This lecture will enable you to • Represent simple facts in the language of propositional logic • Interpret a propositional logic statement • Compute the meaning of a compound proposition
  • 3. Knowledge Representation • Knowledge is a theoretical or practical understanding of a subject or a domain. Knowledge is also the sum of what is currently known. • Knowledge is “the sum of what is known: the body of truth, information, and principles acquired by mankind.” Or, "Knowledge is what I know, Information is what we know." • There are many other definitions such as:
  • 4. Definition of Knowledge • Knowledge is "information combined with experience, context, interpretation, and reflection. It is a high-value form of information that is ready to apply to decisions and actions." (T. Davenport et al., 1998) • Knowledge is “human expertise stored in a person’s mind, gained through experience, and interaction with the person’s environment." (Sunasee and Sewery, 2002) • Knowledge is “information evaluated and organized by the human mind so that it can be used purposefully, e.g., conclusions or explanations." (Rousa, 2002)
  • 5. Knowledge Representation • Knowledge consists of information that has been: – interpreted, – categorised, – applied, experienced and revised. • In general, knowledge is more than just data, it consist of: facts, ideas, beliefs, heuristics, associations, rules, abstractions, relationships, customs.
  • 6. Research literature classifies knowledge as Classification-based Knowledge Ability to classify information Decision-oriented Knowledge Choosing the best option Descriptive knowledge State of some world (heuristic) Procedural knowledge How to do something Reasoning knowledge What conclusion is valid in what situation? Assimilative What its impact is?
  • 7. Knowledge Representation • Knowledge representation (KR) is the study of how knowledge about the world can be represented and what kinds of reasoning can be done with that knowledge. Knowledge Representation is the method used to encode knowledge in Intelligent Systems. • Since knowledge is used to achieve intelligent behavior, the fundamental goal of knowledge representation is to represent knowledge in a manner as to facilitate inferencing (i.e. drawing conclusions) from knowledge. A successful representation of some knowledge must, then, be in a form that is understandable by humans, and must cause the system using the knowledge to behave as if it knows it.
  • 8. • Some issues that arise in knowledge representation from an AI perspective are: – How do people represent knowledge? – What is the nature of knowledge and how do we represent it? – Should a representation scheme deal with a particular domain or should it be general purpose? – How expressive is a representation scheme or formal language? – Should the scheme be declarative or procedural ?
  • 9. Two entities in Knowledge Representation
  • 10. Properties for Knowledge Representation Systems • Representational Adequacy – the ability to represent the required knowledge; • Inferential Adequacy – the ability to manipulate the knowledge represented to produce new knowledge corresponding to that inferred from the original; • Inferential Efficiency – the ability to direct the inferential mechanisms into the most productive directions by storing appropriate guides; • • Acquisitional Efficiency – the ability to acquire new knowledge using automatic methods wherever possible rather than reliance on human intervention.
  • 11. Knowledge and Intelligence • Does knowledge have any role in demonstrating intelligent behavior ?
  • 12. How can we represent knowledge in a machine ? • We need a language to represent domain knowledge • There must be a method to use this knowledge • Inference Mechanism • Syntax and Semantics of a language – Laughs (Suman) == ?? – Likes ( Sunita, Shanta) == ??
  • 13. Logic is a Formal language • Propositional Logic – Serena is Intelligent Propositional – Serena is hardworking – If Serena is Intelligent and Serena is hardworking Then Serena scores high marks
  • 14. Elements of Propositional Logic • Anil is Intelligent • Anil is hardworking • Objects and Relations or Functions Anil Intelligent hardworking
  • 15. Intelligent (Anil) == Anil is intelligent Hardworking (Anil) == Anil is hardworking Propositions Also Intelligent-Anil can be a proposition A Propositions (statement) can be True or False
  • 16. Towards the Syntax • Let P stand for intelligent (Anil) • Let Q stand for Hardworking (Anil) • What does P Λ Q ( P and Q) mean ? • What does P V Q ( P or Q) mean ? • P Λ Q, P V Q are compound propositions
  • 17. Syntactic Elements of Propositional Logic • Vocabulary – A set of propositional symbols (P , Q, R etc.) each of which can be True or False – Set of logical operators Λ (AND), V(OR), ¬ (NOT), (IMPLIES) Often parenthesis () is used for grouping – There are two special symbols TRUE (T) and FALSE(F) – these are logical constants
  • 18. How to form propositional sentences ? • Each symbol ( a proposition or a constant) is a sentence • If P is a sentence and Q is a sentence • Then – (P) is a sentence – P Λ Q is a sentence – P V Q is a sentence – ¬P is a sentence – P Q is a sentence – Nothing else is a sentence Sentences are also called well formed formulae (wff)
  • 19. Example wffs • P • True • P Λ Q • (P V Q) R • (P Λ Q) V R S • ¬ (P V Q) • ¬ (P V Q) R Λ S
  • 20. Implies • P Q • If P is true then Q is true • If it rains then the roads are wet • What about – • If the roads are wet then it rains ????
  • 21. Equivalence • P Q • Example ? • If two sides of a triangle are equal then two base angles of the triangle are equal. • Can be represented as two sentences • P Q and Q P
  • 22. What does a wff mean -- Semantics • Interpretation in a world • When we interpret a sentence in a world we assign meaning to it and it evaluates to either True or False
  • 23. P The child can write Nursery Class II F T The child can speak T T
  • 24. P Suman is intelligent Q Serena is Diligent Class II Class III T T F F
  • 25. So how do we get the meaning ? • Remember: Sentences can be compound propositions • Interpret each atomic proposition in the same world • Assign Truth values to each interpretation • Compute the truth value of the compound proposition
  • 26. Example • P: likes (Suman, Shanta) • Q: knows (Subash, Shraddha) • World: Suman and Shanta are friends and Subash and Shraddha are known to each other • P = T, Q = T • P Λ Q = T • P Λ (¬ Q) = F
  • 27. Validity of a sentence • If a propositional sentence is true under all possible interpretation, it is VALID • Tautology – P V ¬ P is always true
  • 28. Quiz Express the following English Statements in the language of propositional logic: 1. It rains in July 2. The book is not costly 3. If it rains today and one does not carry umbrella he will be drenched
  • 29. Quiz • If P is true and Q is true, then are the following true or false ? 1. P Q 2. (¬ P V Q) Q 3. (¬ P V Q) P 4. P V ¬ P T
  • 31. Quiz Answer It rains in July Rains (July) ¬ Rains (November) etc. If it rains today and one does not carry umbrella he will be drenched • Rains (Today) Λ ¬ Carry (Umbrella) Get_Drenched • Rains (Today) Λ ¬ Carry (Umbrella, Tom) Get_Drenched (Tom)
  • 32. Objective • In this lecture you will learn to: • Infer the truth value of a proposition • Reason towards new facts, given a set of propositions • Prove a proposition given a set of propositional facts
  • 33. Procedure to derive Truth Value Truth Table P Q P Λ Q F F F F T F T F F T T T P Q P V Q F F F F T T T F T T T T P Q P Q F F T F T T T F F T T T
  • 34. ¬PVQ P Λ Q P Q ¬P ¬PVQ P Λ Q F F T T F F F T T T F F T F F F F T T T F T T T
  • 35. De Morgan’s Theorem ¬(P Λ Q) =¬P V ¬Q ¬(P V Q) =¬P Λ ¬Q P Q P V Q ¬(P V Q) ¬P ¬Q ¬P Λ ¬Q F F F T T T T F T T F T F F T F T F F T F T T T F F F F
  • 36. Retry the Earlier Quiz • If P is true and Q is true, then are the following true or false ? 1. P Q P Q P Q F F T F T T T F F T T T
  • 37. Retry the Earlier Quiz 3. (¬ P V Q) P: S is the entire statement P ¬ P Q S T F T T
  • 38. Reasoning P: It is the month of July Q: It rains R: P Q If it is the month of July then it rains It is the month of July Conclude: It rains
  • 39. Modus Ponens • One of the inference rule P Q P Q
  • 40. Is Modus Ponens Correct Inference Rule ?? P Q can be written as ¬ P V Q conjoined with P we can write P Λ ¬ P V Q = (P Λ ¬ P) V Q = F V Q = Q
  • 41. Modus Ponens • Thus irrespective of meaning Modus Ponens allows us to infer the truth of Q • Modus Ponens is an inference rule that allows us to deduce the truth of a consequent depending on the truth of the antecedents
  • 42. Inference rule can be mechanically applied Other rules If P and Q then P If P then P or Q If Not(Not(P)) then P Chain Rule: If P then Q If Q then R Leads to If P then R
  • 43. Satisfiability • Remember: An interpretation is a mapping to a world • A sentence is SATISFIABLE by an interpretation If Under that interpretation the sentence evaluates to TRUE If No interpretation makes all the sentences in the set to be TRUE Then the set of sentences is UNSATISFIABLE or INCONSISTENT
  • 44. Entailment Interpretation that satisfies the larger world set of sentences S and same interpretation makes the candidate sentence TRUE then we can say the S logically entails the candidate sentence.
  • 45. • If a sentence s1 has a value True for all interpretations that make all sentences a set of sentence S then S |- s1 S1 logically follows from S S1 is a logical consequence of S S logically entails s1
  • 46.
  • 47. Clause: A Special Form • Literal – A single proposition or its negation P, ¬ P • A clause is a disjunction of literals P V Q V ¬ R
  • 48. Converting a compound proposition to the clausal form • Consider the sentence (wff) ¬ (A B) V ( C A) 1. Eliminate implication sign ¬ (¬ A V B) V (¬ C V A) 2. Eliminate double negation and replace scope of “not” signs (De - Morgans Law) (A Λ ¬ B) V (¬ C V A)
  • 49. Converting a compound proposition to the clausal form 3. Convert to conjunctive normal form by using distributive and associative laws (A Λ ¬ B) V (¬ C V A) (A V ¬ C V A) Λ (¬ B V ¬ C V A) (A V ¬ C) Λ (¬ B V ¬ C V A) 4. Get the set of clauses Set of clauses (A V ¬ C) (¬ B V ¬ C V A)
  • 50. Resolution – A technique of Inference • A sound inference mechanism Principle: Suppose x is a literal and s1 and s2 are two sets of propositional sentences represented in clausal form If we have (x V s1) Λ (¬x V s2) Then we get S1 V S2 Here S1 V S2 is the resolvent, x is resolved upon
  • 51. An Example • If a triangle is equilateral then it is isosceles • If a triangle is isosceles then two sides AB and AC are equal • If AB and AC are equal then angle B and angle C are equal • ABS is an equilateral triangle • Angle B is equal to angle C – Prove
  • 52. Proving by Resolution • If a triangle is equilateral then it is isosceles Equilateral (ABC) Isosceles (ABC) • If a triangle is isosceles then two sides AB and AC are equal Isosceles (ABC) Equal (AB, AC) • If AB and AC are equal then angle B and angle C are equal Equal (AB, AC) Equal (B, C) • ABC is an equilateral triangle Equilateral (ABC)
  • 53. Proving by Resolution • Clausal Form 1. Equilateral (ABC) Isosceles (ABC) ¬ Equilateral (ABC) V Isosceles (ABC) 2. Isosceles (ABC) Equal (AB, AC) ¬Isosceles (ABC) V Equal (AB, AC) 3. Equal (AB, AC) Equal (B, C) ¬Equal (AB, AC) V Equal (B, C) 4. Equilateral (ABC)
  • 54. Proof by refutation • To prove Angle B is equal to Angle C Equal (B,C) Let us disprove Not Equal (B,C) ¬ Equal (B,C) Let us try to disprove this
  • 55. ¬ Equilateral (ABC) V Isosceles (ABC) ¬Isosceles (ABC) V Equal (AB, AC) ¬Equal (AB, AC) V Equal (B, C) Equilateral (ABC) ¬ Equal (B,C) ¬Equal (AB, AC) V Equal (B, C) ¬Equal (AB, AC) ¬Isosceles (ABC) V Equal (AB, AC) ¬Isosceles (ABC) ¬ Equilateral (ABC) V Isosceles (ABC) ¬ Equilateral (ABC) Equilateral (ABC) Null Clause
  • 56. Procedure for Resolution • Convert given propositions into clausal form • Convert the negation of the sentence to be proved into clausal form • Combine the clauses into a set • Iteratively apply resolution to the set and add the resolvent to the set • Continue until no further resolvents can be obtained or a null clause is obtained
  • 57. Quiz • Consider the following sentences 1. Mammals drink milk 2. Man is mortal 3. Man is a mammal 4. Tom is a man 5. Prove Tom drink(s) milk 6. Prove Tom is mortal
  • 58. Quiz 1. Represent all the sentences in clausal form 2. Prove (5) and (6) using modus ponens 3. Prove (5) and (6) using resolution
  • 59. First Order Logic or Predicate Logic
  • 60. Quiz Answers 1. Mammals drink milk 2. Man is mortal 3. Man is a mammal 4. Tom is a man 1. Prove Tom drink(s) milk 2. Prove Tom is mortal
  • 61.
  • 62. • Applying modus ponens on R and S we get mammal(Tom) ……… 5 • Applying modus ponens on 5 and 1 we get drink(Tom, Milk)
  • 63. • Applying modus ponens on R and S we get mammal(Tom) ……… 5 • Applying modus ponens on 5 and 1 we get drink(Tom, Milk)
  • 64. Proof by Resolution P: mammal (Tom)  drink (Tom, Milk) ¬ mammal (Tom) V drink (Tom, Milk) Q: man (Tom)  mortal (Tom) ¬ man (Tom) V mortal (Tom) R: man(Tom) mammal (Tom) ¬man(Tom) V mammal (Tom) S: man(Tom) Goal: drink(Tom, Milk) To disprove: ¬ drink(Tom, Milk)
  • 65. P: ¬ mammal (Tom) V drink (Tom, Milk) Q:¬ man (Tom) V mortal (Tom) R: ¬man(Tom) V mammal (Tom) S: man(Tom) ¬ drink(Tom, Milk) ¬ mammal (Tom) V drink (Tom, Milk) ¬ mammal (Tom) ¬man(Tom) V mammal (Tom) ¬man(Tom) man(Tom) Null Clause
  • 66. Objective This lecture will enable you to • Formulate more types of sentences in logic • Write correct predicate logic formulae
  • 67. Limitation of Propositional Logic • Consider the following argument – All dogs are faithful – Tommy is a dog – Therefore, Tommy is faithful • How to represent and infer this in propositional logic?
  • 68. Limitation of Propositional Logic p : all dogs are faithful q: Tommy is a dog But P Λ q === >Tommy is faithful ?? No! we cannot infer this in Propositional Logic
  • 69. More Scenarios • Tom is a hardworking student Hardworking(Tom) • Tom is an intelligent student Intelligent(Tom) • If Tom is hardworking and Tom is intelligent Then Tom scores high marks • Hardworking(Tom) Λ Intelligent (Tom)  Scores_High_Marks(Tom)
  • 70. What about John and Jill ? If we could write instead All students who are hardworking and intelligent scores high marks !!! For all x such that x is a student and x is intelligent and x is hardworking then x scores high marks
  • 71. The Problem of Infinite Model • In general, propositional logic can deal with only a finite, number of propositions. • If there are only three dogs Tommy, Jimmy, and Laika, Then T: Tommy is faithful J: Jimmy is faithful L: Laika is faithful All dogs are faithful T Λ J Λ L • What if there are infinite number of dogs ?
  • 72. First-Order Logic / Predicate Logic • First – order logic or predicate logic is a generalization of propositional logic that allows us to express and infer arguments in infinite modes like – All men are mortal – Some birds cannot fly – At least one planet has life on it
  • 73. Syntax of FOL • The syntax of first-order logic can be defined in terms of –Terms –Predicate –Quantifiers
  • 74. Term • A term denotes some object other than True or False Tommy is a dog Tommy = Term All men are mortal Men = Term
  • 75. Terms: Constant & Variable • A constant of type W is a name that denotes a particular object in a set W – Example: 5, Tommy etc. • A variable of type W is a name that can denote any element in the set W – Example: x ∈ N denotes a natural number d denotes the name of a dog
  • 76. Terms: Functions • A functional term of arity n takes n objects of type W 1 to W n as inputs and returns an object of type W. f(W 1, W2, …, W n ) plus(3,4) = 7 Functional term Constant term
  • 77. Functions: Example • Let plus be a function that takes two arguments of type Natural Number and returns a Natural number • Valid functional terms: plus (2, 3) plus(5, plus(7,3)) plus(plus(100,plus(1,6)),plus(3,3)) • Invalid functional terms: plus(0, -1) plus(1.2, 3.1)
  • 78. Functions with Variable arguments plus( x, y) prod( x, y, z)
  • 79. Predicates • Predicates are like functions except that their return type is true or false. • Example: – gt ( x , y ) is true iff x > y – Here gt is a predicate symbol that takes two arguments of type natural number – gt (3, 4 ) is a valid predicate but gt (3, -4) is not
  • 80. Types of Predicates • A predicate with no variable is a proposition – Tommy is a dog • A predicate with one variable is called a property – dog(x) is true iff x is a dog. – mortal(y) is true iff y is mortal.
  • 81. Formulation of Predicates • Let P( x , y , …) and Q( x , y , …) are two predicates. • Then so are P V Q P Λ Q ¬ P P  Q
  • 82. Predicate Examples • If x is a man then x is mortal man (x)  mortal (x) ¬ man (x) V mortal (x) • If n is a natural number, then n is either even or odd. natural (n)  even (n) V odd (n)
  • 83. Quantifiers • There are two basic quantifiers in FOL – ∀ “For all” – Universal quantifier – ∃ “There exists” – Existential quantifier
  • 84. Universal quantifier • ∀x P(x) : P(x) is true for any element that I choose from the set • This predicate will be true if it satisfy all value of x satisfy P(x)
  • 85. Existential quantifier • ∃x Q(x) there should be at least one element in the set for which Q(x) is true
  • 86. Existential quantifier • ∃x holiday (x) • This predicate will be true if it satisfy at least one x • Days of week {Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday}
  • 87. Universal Quantifiers • All dogs are faithful – faithful(x) : x is faithful – dog(x): x is a dog – ∀x (dog (x)  faithful (x)) • All birds cannot fly – fly(x): x can fly – bird(x): x is a bird – ¬ (∀x(bird (x)  fly (x)))
  • 89. Existential Quantifiers • At least one planet has life on it – Planet(x): x is a planet – haslife(x): x has life on it – ∃x (planet (x) Λ haslife(x))
  • 90. Existential Quantifiers • All birds cannot fly There exists a bird that cannot fly • Fly (x): x can fly • Bird (x): x is a bird • ∃x (Bird (x) Λ ¬ fly (x))
  • 91. Duality of Quantifiers All men are mortal No man is immortal There exist birds that can fly. It is not the case that all birds cannot fly.
  • 92. Sentences • A predicate is a sentence • If sen, ¬ sen are sentences and x a variable, then • (sen), ¬sen, ∃x sen, ∀x sen, sen Λ ¬ sen , sen V ¬ sen, sen  ¬ sen are sentences • Nothing else is a sentence
  • 93. Quiz / Exercises • Some dogs bark • All dogs have four legs • All barking dogs are irritating • No dugs purr • Father are male parents with children • Students are people who are enrolled in courses
  • 94. Examples of Sentences Birthday ( x , y ) – x celebrates birthday on date y ∀ y ∃ x Birthday ( x , y ) – For all dates, there exists a person who celebrates his/her Birthday on that date. That is - “everyday someone celebrates his/her birthday”
  • 95. Examples Brother ( x , y ) – x is y’s brother Loves ( x , y ) – x loves y ∀ x ∀ y Brother ( x , y)  Loves ( x , y) Everyone loves (all of) his/her brothers. Let m(x) represent mother of x then “everyone loves his/her mother” is ∀ x Loves (x, m(x))
  • 96. Examples • Any number is the successor of its predecessor • succ (x), pred (x) • Equal ( x , y ) ∀ x equal ( x , succ (pred (x))
  • 97. Alternative Representation • The previous example can be represented succinctly as • ∀ x (succ (pred (x) = x)) • Not Allowed in predicates
  • 98. FOL with Equality • In FOL with equality, we are allowed to use the equality sign (=) between two functions. • This is just for representational ease. • We modify the definition of sentence to include equality as term = term is also a sentence
  • 99. Quiz Revisited • Some dogs bark • ∃ x (dog(x) Λ bark(x)) • All dogs have four legs • ∀ x (dog(x)  have_four_legs(x)) • ∀ x (dog(x)  legs(x,4)) • No dugs purr • ¬ ∃ x (dog(x) Λ purr(x))
  • 100. • Father are male parents with children • ∀ x (father(x)  male(x) Λ has_childern(x))
  • 101. Inference Rule • Universal Elimination ∀ x Likes(x, flower) Substituting x by Shirin gives Likes(Shirin , flower) The substitution should be done by a constant term
  • 102. Inference Rule • Existential Elimination (Skolemization) ∃ x Likes(x, flower) Likes(Person, flower) As long as person is not in the knowledge base • Existential introduction Likes (shahid, flower) Can be written as ∃ x Likes(x, flower)
  • 103. Reasoning in FOL • Consider the following problem: If a perfect square is divisible by a prime p, then it is also divisible by square of p. Every perfect square is divisible by some prime. 36 is a perfect square. Does there exist a prime q such that square of q divided 36?
  • 104. Representation in FOL • If a perfect square is divisible by a prime p, then it is also divisible by square of p. ∀ x ,y ( perfect_sq(x) Λ prime(y) Λ divides(x, y)  divides (x, square(y)) • Every perfect square is divisible by some prime. ∀ x ∃ y (perfect_sq(x) Λ prime(y) Λ divides(x, y)
  • 105. Representation in FOL • 36 is a perfect square. perfect_sq(36) • Does there exist a prime q such that the square of q divides 35 ? ∃ y (prime(y) Λ divides(36, square(y))
  • 106. The knowledge base 1. ∀ x ,y ( perfect_sq(x) Λ prime(y) Λ divides(x, y)  divides (x, square(y)) 2. ∀ x ∃ y (perfect_sq(x) Λ prime(y) Λ divides(x, y) 3. perfect_sq(36)
  • 107. Inference • From 2 and Universal Elimination (4) ∃ y (perfect_sq(36) Λ prime (y) Λ divides(36, y)) • From 4 and Existential Elimination (5) perfect_sq(36) Λ prime (P) Λ divides(36, P) • From (1) and (5) (6) divides (36, square(P))
  • 108. Inference • From (5) and (6) (7) prime (P) Λ divides(36, square(P)) • From (7) and Existential Introduction ∃ y prime (y) Λ divides(36, square(y))
  • 109. Horn Sentences • Atomic sentence perfect_sq(36) • Implication with a conjunction of atomic sentences on the left and a single atom on the right ∀ x ,y ( perfect_sq(x) Λ prime(y) Λ divides(x, y)  divides (x, square(y)) • No existential Quantifier
  • 110. Conversion to Horn Sentences • Existential Quantifiers can be removed using Existential Elimination (Skolemization) – If the existential quantifier is outside any universal quantifier, a Skolem constant is introduced. E.g. ∃ y prime (y) can be written as prime(P), where P is a Skolem constant – Otherwise a Skolem function is introduced. E.g. – ∀ x ∃ y ( prime(y) Λ divides(x, y) ∀ x prime(PD(x)) Λ divides(x, PD(x)), where PD(x) is a Skolem function
  • 111. Conversion to Horn Sentences • And- Elimination • Prime(P) Λ divides( x , P) can be written as two clauses Prime(P) divides ( x , P )
  • 112. Substitution • It replaces variables with constants. • SUBST({x/49, y/7}, Divides( x, y)) = Divides (49; 7)
  • 113. Unification • It is the process of finding a substitution that makes two atomic sentences identical. • UNIFY(Prime(7), Prime(x)) = {x/7}
  • 115.
  • 116. An Example • If a triangle is equilateral then it is isosceles • If a triangle is isosceles then two sides AB and AC are equal • If AB and AC are equal then angle B and angle C are equal • ABS is an equilateral triangle • Angle B is equal to angle C – Prove
  • 117. Proving by Resolution • If a triangle is equilateral then it is isosceles Equilateral (ABC) Isosceles (ABC) • If a triangle is isosceles then two sides AB and AC are equal Isosceles (ABC) Equal (AB, AC) • If AB and AC are equal then angle B and angle C are equal Equal (AB, AC) Equal (B, C) • ABC is an equilateral triangle Equilateral (ABC)
  • 118. Proving by Resolution • Clausal Form 1. Equilateral (ABC) Isosceles (ABC) ¬ Equilateral (ABC) V Isosceles (ABC) 2. Isosceles (ABC) Equal (AB, AC) ¬Isosceles (ABC) V Equal (AB, AC) 3. Equal (AB, AC) Equal (B, C) ¬Equal (AB, AC) V Equal (B, C) 4. Equilateral (ABC)
  • 119. Proof by refutation • To prove Angle B is equal to Angle C Equal (B,C) Let us disprove Not Equal (B,C) ¬ Equal (B,C) Let us try to disprove this
  • 120. ¬ Equal (B,C) ¬Equal (AB, AC) V Equal (B, C) ¬Equal (AB, AC) ¬Isosceles (ABC) V Equal (AB, AC) ¬Isosceles (ABC) ¬ Equilateral (ABC) V Isosceles (ABC) ¬ Equilateral (ABC) Equilateral (ABC) Null Clause ¬ Equilateral (ABC) V Isosceles (ABC) ¬Isosceles (ABC) V Equal (AB, AC) ¬Equal (AB, AC) V Equal (B, C) Equilateral (ABC)
  • 121. Procedure for Resolution • Convert given propositions into clausal form • Convert the negation of the sentence to be proved into clausal form • Combine the clauses into a set • Iteratively apply resolution to the set and add the resolvent to the set • Continue until no further resolvents can be obtained or a null clause is obtained
  • 122. A Few Statements • All people who are graduating are happy. • All happy people smile. • Someone is graduating. • Is someone smiling? (Conclusion)
  • 123. Solving the problem • We intend to code the problem in predicate calculus. • Use resolution refutation to solve problem • Solving = whether the conclusion can be answered from the given set of sentences.
  • 124. Selecting the Predicates • Graduating(x): x is graduating • Happy(x): x is happy • Smiling(x): x is smiling
  • 125. Encoding sentences in Predicate Logic • All people who are graduating are happy – ∀ x [graduating(x)  happy(x)] • All happy people smile – ∀ x[happy(x) smiling(x)] • Someone is graduating – ∃ x graduating(x) • Is someone smiling – ∃ x smiling(x)
  • 126. Predicates 1.∀ x [graduating(x)  happy(x)] 2. ∀ x[happy(x) smiling(x)] 3. ∃ x graduating(x) 4. ¬ ∃ x smiling(x) (Negating the conclusion)
  • 127. Converting to Clausal Form • Step 1: Eliminate  1. ∀ x ¬graduating(x) V happy(x) 2. ∀ x ¬ happy(x) V smiling(x) 3. ∃ x graduating(x) 4. ¬ ∃ x smiling(x)
  • 128. Converting to Canonical / Normal Form • Step 2: Reduce the scope of negation 1. ∀ x ¬graduating(x) V happy(x) 2. ∀ x ¬ happy(x) V smiling(x) 3. ∃ x graduating(x) 4. ∀ x ¬ smiling(x)
  • 129. Converting to Canonical / Normal Form • Step 3: Standardize variables apart 1. ∀ x ¬graduating(x) V happy(x) 2. ∀ y ¬ happy(y) V smiling(y) 3. ∃ z graduating(z) 4. ∀w ¬ smiling(w)
  • 130. Converting to Canonical / Normal Form • Step 4: Move all quantifiers to the left 1. ∀ x ¬graduating(x) V happy(x) 2. ∀ y ¬ happy(y) V smiling(y) 3. ∃ z graduating(z) 4. ∀w ¬ smiling(w)
  • 131. Converting to Canonical / Normal Form • Step 5: Eliminate ∃ (Skolemization) 1. ∀ x ¬graduating(x) V happy(x) 2. ∀ y ¬ happy(y) V smiling(y) 3. graduating(name1) (name1 is the Skolemization constant) 4. ∀w ¬ smiling(w)
  • 132. Converting to Canonical / Normal Form • Step 6:Drop all ∀ 1. ¬graduating(x) V happy(x) 2. ¬ happy(y) V smiling(y) 3. graduating(name1) (name1 is the Skolemization constant) 4. ¬ smiling(w)
  • 133. Canonical Form • Canonical form is the conjunct of disjunction only
  • 134. Converting to Canonical Form • Step 7: Convert to conjunct of disjunction form • Step 8: Make each conjunct a separate clause. • Step 9: Standardize variables apart again. • These steps do not change the set of clauses any further (in the present problem)
  • 136. Quiz • Solve the problem with resolution If a perfect square is divisible by a prime p, then it is also divisible by square of p. Every perfect square is divisible by some prime. 36 is a perfect square. Does there exist a prime q such that square of q divided 36?
  • 138. Find the Package Example (Nilsson) • We know that • All packages in room 27 are smaller than those in room 28 • Package A is either in room 27 or in room 28 • Package B is in room 27 • Package B is not smaller than Package A • Where is Package A ?