SlideShare a Scribd company logo
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

Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence
Yasir Khan
 
Artificial Intelligence: Natural Language Processing
Artificial Intelligence: Natural Language ProcessingArtificial Intelligence: Natural Language Processing
Artificial Intelligence: Natural Language Processing
Frank Cunha
 
First order logic
First order logicFirst order logic
First order logic
Rushdi Shams
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic
Junya Tanaka
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
vikas dhakane
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & Reasoning
Sajid Marwat
 
Artificial Intelligence - Reasoning in Uncertain Situations
Artificial Intelligence - Reasoning in Uncertain SituationsArtificial Intelligence - Reasoning in Uncertain Situations
Artificial Intelligence - Reasoning in Uncertain Situations
Laguna State Polytechnic University
 
Genetic algorithm ppt
Genetic algorithm pptGenetic algorithm ppt
Genetic algorithm ppt
Mayank Jain
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
SHUBHAM KUMAR GUPTA
 
Propositional Logic and Pridicate logic
Propositional Logic and Pridicate logicPropositional Logic and Pridicate logic
Propositional Logic and Pridicate logic
Roorkee College of Engineering, Roorkee
 
Fuzzy Set Theory
Fuzzy Set TheoryFuzzy Set Theory
Fuzzy Set Theory
AMIT KUMAR
 
Probabilistic Reasoning
Probabilistic ReasoningProbabilistic Reasoning
Probabilistic Reasoning
Junya Tanaka
 
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
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
Animesh Chaturvedi
 
Bayesian networks
Bayesian networksBayesian networks
Bayesian networks
Orochi Krizalid
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
Rajendran
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
Amey Kerkar
 
knowledge representation using rules
knowledge representation using rulesknowledge representation using rules
knowledge representation using rules
Harini Balamurugan
 
Feedforward neural network
Feedforward neural networkFeedforward neural network
Feedforward neural network
Sopheaktra YONG
 
Bayesian Networks - A Brief Introduction
Bayesian Networks - A Brief IntroductionBayesian Networks - A Brief Introduction
Bayesian Networks - A Brief Introduction
Adnan Masood
 

What's hot (20)

Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence Knowledge Representation in Artificial intelligence
Knowledge Representation in Artificial intelligence
 
Artificial Intelligence: Natural Language Processing
Artificial Intelligence: Natural Language ProcessingArtificial Intelligence: Natural Language Processing
Artificial Intelligence: Natural Language Processing
 
First order logic
First order logicFirst order logic
First order logic
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & Reasoning
 
Artificial Intelligence - Reasoning in Uncertain Situations
Artificial Intelligence - Reasoning in Uncertain SituationsArtificial Intelligence - Reasoning in Uncertain Situations
Artificial Intelligence - Reasoning in Uncertain Situations
 
Genetic algorithm ppt
Genetic algorithm pptGenetic algorithm ppt
Genetic algorithm ppt
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 
Propositional Logic and Pridicate logic
Propositional Logic and Pridicate logicPropositional Logic and Pridicate logic
Propositional Logic and Pridicate logic
 
Fuzzy Set Theory
Fuzzy Set TheoryFuzzy Set Theory
Fuzzy Set Theory
 
Probabilistic Reasoning
Probabilistic ReasoningProbabilistic Reasoning
Probabilistic Reasoning
 
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...
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
 
Bayesian networks
Bayesian networksBayesian networks
Bayesian networks
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
 
knowledge representation using rules
knowledge representation using rulesknowledge representation using rules
knowledge representation using rules
 
Feedforward neural network
Feedforward neural networkFeedforward neural network
Feedforward neural network
 
Bayesian Networks - A Brief Introduction
Bayesian Networks - A Brief IntroductionBayesian Networks - A Brief Introduction
Bayesian Networks - A Brief Introduction
 

Similar to Knnowledge representation and logic lec 11 to lec 15

Knowledge base artificial intelligence.pdf
Knowledge base  artificial intelligence.pdfKnowledge base  artificial intelligence.pdf
Knowledge base artificial intelligence.pdf
jannatulferdous20101
 
AI Lesson 11
AI Lesson 11AI Lesson 11
AI Lesson 11
Assistant Professor
 
Logic (1)
Logic (1)Logic (1)
Logic (1)
Nikki Atillo
 
Unit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfUnit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdf
HrideshSapkota2
 
Introduction to mathematical analysis
Introduction to mathematical analysisIntroduction to mathematical analysis
Introduction to mathematical analysis
AnoojaI
 
predicateLogic.ppt
predicateLogic.pptpredicateLogic.ppt
predicateLogic.ppt
MUZAMILALI48
 
Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4
DigiGurukul
 
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.pptx
ethiouniverse
 
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
Abhinav Gupta
 
AI-Unit4.ppt
AI-Unit4.pptAI-Unit4.ppt
AI-Unit4.ppt
ssuserd0df33
 
PNP.pptx
PNP.pptxPNP.pptx
PNP.pptx
RishuRaj953240
 
PNP.pptx
PNP.pptxPNP.pptx
Logic
LogicLogic
Logic
Yasir Khan
 
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
Hafizul Mukhlis
 
CSE680-17NP-Complete.pptx
CSE680-17NP-Complete.pptxCSE680-17NP-Complete.pptx
CSE680-17NP-Complete.pptx
AjayPratap828815
 
- 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
MehdiHassan67
 
AppTheories_L3
AppTheories_L3AppTheories_L3
AppTheories_L3
Manu Muñoz H
 
AI NOTES ppt 4.pdf
AI NOTES ppt 4.pdfAI NOTES ppt 4.pdf
AI NOTES ppt 4.pdf
ARMANVERMA7
 
l4.pptx
l4.pptxl4.pptx

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

Knowledge base artificial intelligence.pdf
Knowledge base  artificial intelligence.pdfKnowledge base  artificial intelligence.pdf
Knowledge base artificial intelligence.pdf
 
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
 
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
 
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
 
AI NOTES ppt 4.pdf
AI NOTES ppt 4.pdfAI NOTES ppt 4.pdf
AI NOTES ppt 4.pdf
 
l4.pptx
l4.pptxl4.pptx
l4.pptx
 

More from Subash Chandra Pakhrin

Prismoid
PrismoidPrismoid
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
Subash Chandra Pakhrin
 
COVID 19
COVID 19 COVID 19
Lstm covid 19 prediction
Lstm covid 19 predictionLstm covid 19 prediction
Lstm covid 19 prediction
Subash Chandra Pakhrin
 
Rnn & Lstm
Rnn & LstmRnn & 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
Subash Chandra Pakhrin
 
Cnn april 8 2020
Cnn april 8 2020Cnn april 8 2020
Cnn april 8 2020
Subash Chandra Pakhrin
 
Deep Learning or Convolutional Neural Network
Deep Learning or Convolutional Neural Network Deep Learning or Convolutional Neural Network
Deep Learning or Convolutional Neural Network
Subash Chandra Pakhrin
 
Ncit 1st ai lab
Ncit 1st ai labNcit 1st ai lab
Ncit 1st ai lab
Subash Chandra Pakhrin
 
Ai lab
Ai labAi lab
Constraint satisfaction problem
Constraint satisfaction problem Constraint satisfaction problem
Constraint satisfaction problem
Subash Chandra Pakhrin
 
Analysis
AnalysisAnalysis
Planning
PlanningPlanning
Intelligent agents (bsc csit) lec 2
Intelligent agents (bsc csit) lec 2Intelligent agents (bsc csit) lec 2
Intelligent agents (bsc csit) lec 2
Subash Chandra Pakhrin
 
Final slide4 (bsc csit) chapter 4
Final slide4 (bsc csit) chapter 4Final slide4 (bsc csit) chapter 4
Final slide4 (bsc csit) chapter 4
Subash Chandra Pakhrin
 
Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5Final slide (bsc csit) chapter 5
Final slide (bsc csit) chapter 5
Subash Chandra Pakhrin
 
Lec 6 bsc csit
Lec 6 bsc csitLec 6 bsc csit
Lec 6 bsc csit
Subash Chandra Pakhrin
 
Two player games
Two player gamesTwo player games
Two player games
Subash Chandra Pakhrin
 
Final slide (bsc csit) chapter 2
Final slide (bsc csit) chapter 2Final slide (bsc csit) chapter 2
Final slide (bsc csit) chapter 2
Subash Chandra Pakhrin
 
Final slide (bsc csit) chapter 3
Final slide (bsc csit) chapter 3Final slide (bsc csit) chapter 3
Final slide (bsc csit) chapter 3
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

writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
christianmathematics
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 

Recently uploaded (20)

writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 

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 ?