SlideShare a Scribd company logo
1 of 47
Knowledge representationKnowledge representation
using Predicate logicusing Predicate logic
Dr.V.Manjula ,
Prof/CSE,
VEL TECH HIGH TECH Dr. RANGARAJAN Dr. SAKUNTHALA
ENGINEERING COLLEGE.
LogicLogic
2
Formal Language and their ontological and epistemological commitments
3
Review of PropositionalReview of Propositional
LogicLogic
Let P: Today is Sunday
Q: We have guests
P ∧ Q : Today is Sunday and We have guests
P ∨ Q : Today is Sunday or We have guests
¬P : Today is not Sunday.
P → Q : if today is Sunday then we have guests.
P ↔ Q : Today is Sunday if and only if we have guests.
Propositional variables
Propositional constants: T, F
Logical connectives
4
SemanticsSemantics
Propositions and expressions have
truth values: can be true or false.
The truth value of an expression is
determined by truth tables, e.g.:
P Q P v Q
T T T
T F T
F T T
F F F
5
Propositional Proof TheoryPropositional Proof Theory
Propositional proof theory: A set of axioms
(logical identities) and inference rules used to
manipulate expressions and to obtain true
expressions out of other true expressions.
Inference rules: give a mechanical procedure to
obtain true expressions out of other true
expressions.
Modus ponens: P, P → Q |= Q
6
Knowledge representationKnowledge representation
using predicate logicusing predicate logic
Some books are interesting.
∃ x (book(x) Λ interesting(x))
Anybody that has a friend is not lonely
(If someone has a friend, they are not lonely)
∀x (∃ y friend(x,y)  ~lonely(x))
7
Predicate LogicPredicate Logic
Represents properties and relations by
using predicates with arguments.
likes(mary,apples) ∧ ¬likes(mary,grapes)
Quantifiers: indicate the scope of the predicate
Universal quantifier:
∀ X likes ( mary , X) Mary likes everything
Existential quantifier
∃ X likes ( mary , X)
there is something which Mary likes.
8
Proof Theory for Predicate LogicProof Theory for Predicate Logic
Based on the resolution procedure.
Unification: matching predicates with variables
to atomic sentences (matching variables to
constants.)
Example: Is Socrates mortal?
∀ X (human(X)  mortal(X))
human(socrates)
human(plato)
alien(spock)
Inferencing in Predicate LogicInferencing in Predicate Logic
 Forward chainingForward chaining
 Given P,Given P, , to infer Q, to infer Q
 P, matchP, match L.H.SL.H.S ofof
 Assert Q fromAssert Q from R.H.SR.H.S
 Backward chainingBackward chaining
 Q, MatchQ, Match R.H.SR.H.S ofof
 assert Passert P
 Check if P existsCheck if P exists
 Resolution – RefutationResolution – Refutation
 Negate goalNegate goal
 Convert all pieces of knowledge into clausal form (disjunction ofConvert all pieces of knowledge into clausal form (disjunction of
literals)literals)
 See if contradiction indicated by null clause can be derivedSee if contradiction indicated by null clause can be derived
QP →
QP →
10
ResolutionResolution
A ∨ B, ¬B ∨ C |= A ∨ C
compare with: B, ¬B ∨ C |= C
(B →C = ¬B ∨ C)
If B is true, then C must be true, if B is false
than A must be true.
This means that WHENEVER the conjunction
(A ∨ B) ∧ (¬B ∨ C) is true, A ∨ C is also true.
11
How resolution worksHow resolution works
¬P1 v P2 ¬P2
¬P1 P1 v P3 v P4
P3 v P4 This is the conclusion
Eliminate opposite literals and rewrite two
expressions as one
12
Proof by refutationProof by refutation
P4 v ¬P6 P6
P4 ¬P4
Add the negation of the
statement to be proved
contradiction
Resolution in First-Order LogicResolution in First-Order Logic
13
Basic steps for proving a conclusion S given premises
Premise1, …, Premisen
(all expressed in FOL):
1. Convert all sentences to CNF
2. Negate conclusion S & convert result to CNF
3. Add negated conclusion S to the premise clauses
4. Repeat until contradiction or no progress is made:
a. Select 2 clauses (call them parent clauses)
b. Resolve them together, performing all required
unifications
c. If resolvent is the empty clause, a contradiction
has been found (i.e., S follows from the premises)
d. If not, add resolvent to the premises
If we succeed in Step 4, we have proved the conclusion
March 14, 2006
AI: Chapter 9: Inference in
First-Order Logic14
UnificationUnification
 UnificationUnification: The process of finding all legal: The process of finding all legal
substitutions that make logical expressions looksubstitutions that make logical expressions look
identicalidentical
 This is a recursive algorithmThis is a recursive algorithm
March 14, 2006
AI: Chapter 9: Inference in
First-Order Logic15
UnificationUnification
 We can get the inference immediately if we canWe can get the inference immediately if we can
find a substitutionfind a substitution θθ such that King(x) andsuch that King(x) and
Greedy(x) match King(John) and Greedy(y)Greedy(x) match King(John) and Greedy(y)
 θθ = {x/John, y/John} works= {x/John, y/John} works
 Unify(Unify(αα,,ββ) =) = θθ ifif αα θθ == ββ θθ
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Resolution ExamplesResolution Examples
30
31
Resolution ExamplesResolution Examples
32
33
Predicate CalculusPredicate Calculus
 Introduction through an exampleIntroduction through an example (Zohar Manna, 1974):(Zohar Manna, 1974):
 Problem: A, B and C belong to the Himalayan club. EveryProblem: A, B and C belong to the Himalayan club. Every
member in the club is either a mountain climber or a skier ormember in the club is either a mountain climber or a skier or
both. A likes whatever B dislikes and dislikes whatever Bboth. A likes whatever B dislikes and dislikes whatever B
likes. A likes rain and snow. No mountain climber likes rain.likes. A likes rain and snow. No mountain climber likes rain.
Every skier likes snow.Every skier likes snow. Is there a member who is a mountain climberIs there a member who is a mountain climber
and not a skier?and not a skier?
 Given knowledge has:Given knowledge has:
 FactsFacts
 RulesRules
Predicate Calculus: ExamplePredicate Calculus: Example
contd.contd.
 LetLet mcmc denote mountain climber anddenote mountain climber and sksk denotes skier. Knowledgedenotes skier. Knowledge
representation in the given problem is as follows:representation in the given problem is as follows:
1.1. member(A)member(A)
2.2. member(B)member(B)
3.3. member(C)member(C)
4.4. ∀∀x[member(x) → (mc(x) sk(x))]∨x[member(x) → (mc(x) sk(x))]∨
5.5. ∀∀x[mc(x) → ~like(x,rain)]x[mc(x) → ~like(x,rain)]
6.6. ∀∀x[sk(x) → like(x, snow)]x[sk(x) → like(x, snow)]
7.7. ∀∀x[like(B, x) → ~like(A, x)]x[like(B, x) → ~like(A, x)]
8.8. ∀∀x[~like(B, x) → like(A, x)]x[~like(B, x) → like(A, x)]
9.9. like(A, rain)like(A, rain)
10.10. like(A, snow)like(A, snow)
11.11. Question: x[member(x) mc(x) ~sk(x)]∃ ∧ ∧Question: x[member(x) mc(x) ~sk(x)]∃ ∧ ∧
 We have to infer the 11We have to infer the 11thth
expression from the given 10.expression from the given 10.
 Done through Resolution Refutation.Done through Resolution Refutation.
1.1. PP
2.2. converted toconverted to
3.3.
Draw the resolution tree (actually an invertedDraw the resolution tree (actually an inverted
tree). Every node is a clausal form andtree). Every node is a clausal form and
branches are intermediate inference steps.branches are intermediate inference steps.
QP → QP ∨~
Q~
Q~
QP ∨~
P~ P
TerminologyTerminology
 Pair of clauses beingPair of clauses being resolvedresolved is called theis called the
ResolventsResolvents. The resulting clause is called the. The resulting clause is called the
ResoluteResolute..
 Choosing the correct pair of resolvents is aChoosing the correct pair of resolvents is a
matter of search.matter of search.
Club example revisitedClub example revisited
1. member(A)
2. member(B)
3. member(C)
4.
– Can be written as
–
5.
–
6.
–
7.
–
))]()(()([ xskxmcxmemberx ∨→∀
))]()(()([ xskxmcxmember ∨→
)()()(~ xskxmcxmember ∨∨
)],()([ snowxlkxskx →∀
),()(~ snowxlkxsk ∨
)],(~)([ rainxlkxmcx →∀
),(~)(~ rainxlkxmc ∨
)],(~),([ xBlkxAlkx →∀
),(~),(~ xBlkxAlk ∨
8.8.
–
9.9.
10.10.
11.11.
– Negate–Negate–
)],(),([~ xBlkxAlkx →∀
),(),( xBlkxAlk ∨
),( rainAlk
),( snowAlk
)](~)()([ xskxmcxmemberx ∧∧∃
)]()(~)([~ xskxmcxmemberx ∨∨∀
 Now standardize the variables apart whichNow standardize the variables apart which
results in the followingresults in the following
1. member(A)
2. member(B)
3. member(C)
4.
5.
6.
7.
8.
9.
10.
11.
)()()(~ 111 xskxmcxmember ∨∨
),()(~ 22 snowxlkxsk ∨
),(~)(~ 33 rainxlkxmc ∨
),(~),(~ 44 xBlkxAlk ∨
),(),( 55 xBlkxAlk ∨
),( rainAlk
),( snowAlk
)]()(~)([~ 666 xskxmcxmemberx ∨∨∀
),(~),(~ 44 xBlkxAlk ∨ ),( snowAlk
),(~ snowBlk ),()(~ 22 snowxlkxsk ∨
)()()(~ 111 xskxmcxmember ∨∨)(~ Bsk
)()(~ BmcBmember ∨ )(Bmember
)(Bmc)]()(~)([~ 666 xskxmcxmemberx ∨∨∀
)()(~ BskBmember ∨ )(~ Bsk
)(~ Bmember )(Bmember
7
10
12 5
13 4
14 2
11
15
16 13
17 2
42
Prolog exampleProlog example
Predicate logic representation is used only on paper.
Computational implementation: logic
programming languages
In Logic and in Prolog:
∀ X ∀ Y (father(X,Y) v mother(X,Y)  parent(X,Y))
∀ X ∀ Y( (∃ Z(parent(Z,X) ∧ parent(Z,Y)) 
siblings(X,Y))
parent(X,Y):- father(X,Y).
parent(X,Y):- mother(X,Y).
siblings(X,Y):- parent(Z,X),parent(Z,Y).
Example -2Example -2
43
Converting Statements into Predicate Logic Formulae (WFFs):
1.All employees earning Rs 500000 or more per year pay taxes.
2.Some employees are sick today.
3.No employees earns more than the president.
Let
• E(x) : for x is an employee
• P(x) : for x is a President
• i(x) : for the income of x (lower case – denotes function not
predicate)
• GE(u,v) for u is greater than or equal to v
• S(x) for x is sick today
• T(x) for x pays taxes
Then : Formulae in FOPL are :
1 : x ((E(x)∀ ∧ GE(i(x), 500000)) ⇒T(x))
2 : x(E(y)∃ ⇒ S(x))
3 : x y((E(x)∀ ∀ ∧ P(y)) ⇒ ~GE(i(x), i(y)))
Example -3Example -3
44
i. John likes all kinds of food.
ii. Apples are food.
iii.Chicken is food.
iv.Anything anyone eats and isn’t killed by is
food.
v. Bill eats peanuts, and is still alive.
vi.Sue eats everything that Bill eats.
Prove that “John likes peanuts”
45
John likes all kinds of
food
∀x food (x) ⇒ eats(John, x)
Apples are food. food(apples)
Chicken is food. food(chicken)
Anything anyone eats and
isn’t killed by is food.
∀x,y eats(x,y) ∧ ¬killed(x)
⇒ food(y)
Bill eats peanuts, and is
still alive.
eats(Bill,Peanuts) ∧
¬killed(Bill)
Sue eats everything that
Bill eats.
∀x eats (Bill,x) ⇒
eats(Sue,x)
Another way of writingAnother way of writing
46
(a) Well Formed Formulas
1.  x Food(x) → Likes(John, x)∀
2. Food(Apples)
3. Food(Chicken)
4.  x y Eats(y, x)   ¬KilledBy(y, x) → Food(x)∀ ∃ ∧
5. Eats(Bill, Peanuts)   ¬KilledBy(Bill, Peanuts)∧
6.  x Eats(Bill, x) → Eats(Sue, x)∀
(b) Convert the formulas of part (a) into clause form.
1. ¬Food(x)   Likes(John, x)∨
2. Food(Apples)
3. Food(Chicken)
4. ¬Eats(y, x)   KilledBy(y, x)   Food(x)∨ ∨
5. Eats(Bill, Peanuts)
6. ¬KilledBy(Bill, Peanuts)
7. ¬Eats(Bill, x)   Eats(Sue, x)∨
ResolutionResolution
47
(d) Use resolution to prove that John likes
peanuts.
8. ¬Likes(John, Peanuts) negated conclusion
9. ¬Food(Peanuts) 1 and 8
10. ¬Eats(y, Peanuts)   KilledBy(y, Peanuts) 4 and 9∨
11. KilledBy(Bill, Peanuts) 5 and 10
12.   6 and 11⊥
(e) Use resolution to answer the question, “What
food does Sue eat?”
13. ¬Eats(Sue, x) negated query
14. ¬Eats(Bill, x) 7 and 13
15.   5 and 14, unifying Peanuts/x⊥

More Related Content

What's hot

AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemMohammad Imam Hossain
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic Junya Tanaka
 
Adversarial search
Adversarial searchAdversarial search
Adversarial searchNilu Desai
 
weak slot and filler structure
weak slot and filler structureweak slot and filler structure
weak slot and filler structureAmey Kerkar
 
Uncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial IntelligenceUncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial IntelligenceExperfy
 
Dempster Shafer Theory AI CSE 8th Sem
Dempster Shafer Theory AI CSE 8th SemDempster Shafer Theory AI CSE 8th Sem
Dempster Shafer Theory AI CSE 8th SemDigiGurukul
 
Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2DigiGurukul
 
4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines constructionSampath Kumar S
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introductionwahab khan
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)SHUBHAM KUMAR GUPTA
 

What's hot (20)

AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction Problem
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic
 
Problem Solving
Problem Solving Problem Solving
Problem Solving
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Uncertainty in AI
Uncertainty in AIUncertainty in AI
Uncertainty in AI
 
weak slot and filler structure
weak slot and filler structureweak slot and filler structure
weak slot and filler structure
 
Chapter 4 (final)
Chapter 4 (final)Chapter 4 (final)
Chapter 4 (final)
 
Uncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial IntelligenceUncertain Knowledge and Reasoning in Artificial Intelligence
Uncertain Knowledge and Reasoning in Artificial Intelligence
 
Dempster Shafer Theory AI CSE 8th Sem
Dempster Shafer Theory AI CSE 8th SemDempster Shafer Theory AI CSE 8th Sem
Dempster Shafer Theory AI CSE 8th Sem
 
Backtracking
Backtracking  Backtracking
Backtracking
 
Unit 1 chapter 1 Design and Analysis of Algorithms
Unit 1   chapter 1 Design and Analysis of AlgorithmsUnit 1   chapter 1 Design and Analysis of Algorithms
Unit 1 chapter 1 Design and Analysis of Algorithms
 
Predicate logic
 Predicate logic Predicate logic
Predicate logic
 
Np complete
Np completeNp complete
Np complete
 
Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2
 
AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)
 
4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines construction
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
 
AI: Planning and AI
AI: Planning and AIAI: Planning and AI
AI: Planning and AI
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 

Similar to L03 ai - knowledge representation using logic

Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
Unit III  Knowledge Representation in AI   K.Sundar,AP/CSE,VECUnit III  Knowledge Representation in AI   K.Sundar,AP/CSE,VEC
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VECsundarKanagaraj1
 
CPSC 125 Ch 1 sec 2
CPSC 125 Ch 1 sec 2CPSC 125 Ch 1 sec 2
CPSC 125 Ch 1 sec 2David Wood
 
Predicate calculus
Predicate calculusPredicate calculus
Predicate calculusRajendran
 
Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceasimnawaz54
 
Jarrar.lecture notes.aai.2011s.ch9.fol.inference
Jarrar.lecture notes.aai.2011s.ch9.fol.inferenceJarrar.lecture notes.aai.2011s.ch9.fol.inference
Jarrar.lecture notes.aai.2011s.ch9.fol.inferencePalGov
 
Jarrar.lecture notes.aai.2011s.ch9.fol.inference
Jarrar.lecture notes.aai.2011s.ch9.fol.inferenceJarrar.lecture notes.aai.2011s.ch9.fol.inference
Jarrar.lecture notes.aai.2011s.ch9.fol.inferencePalGov
 
1606751772-ds-lecture-6.ppt
1606751772-ds-lecture-6.ppt1606751772-ds-lecture-6.ppt
1606751772-ds-lecture-6.pptTejasAditya2
 
Discreate structure presentation introduction
Discreate structure presentation introductionDiscreate structure presentation introduction
Discreate structure presentation introductionyashirraza123
 
Exchanging More than Complete Data
Exchanging More than Complete DataExchanging More than Complete Data
Exchanging More than Complete Datanet2-project
 
Chapter 01 - p2.pdf
Chapter 01 - p2.pdfChapter 01 - p2.pdf
Chapter 01 - p2.pdfsmarwaneid
 
Algorithmic foundations.docx
Algorithmic foundations.docxAlgorithmic foundations.docx
Algorithmic foundations.docxedwin orege
 
Boolean Programs and Quantified Propositional Proof System -
Boolean Programs and Quantified Propositional Proof System - Boolean Programs and Quantified Propositional Proof System -
Boolean Programs and Quantified Propositional Proof System - Michael Soltys
 

Similar to L03 ai - knowledge representation using logic (20)

chapter9.ppt
chapter9.pptchapter9.ppt
chapter9.ppt
 
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
Unit III  Knowledge Representation in AI   K.Sundar,AP/CSE,VECUnit III  Knowledge Representation in AI   K.Sundar,AP/CSE,VEC
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
 
CPSC 125 Ch 1 sec 2
CPSC 125 Ch 1 sec 2CPSC 125 Ch 1 sec 2
CPSC 125 Ch 1 sec 2
 
Predicate calculus
Predicate calculusPredicate calculus
Predicate calculus
 
Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inference
 
Predicates
PredicatesPredicates
Predicates
 
Jarrar.lecture notes.aai.2011s.ch9.fol.inference
Jarrar.lecture notes.aai.2011s.ch9.fol.inferenceJarrar.lecture notes.aai.2011s.ch9.fol.inference
Jarrar.lecture notes.aai.2011s.ch9.fol.inference
 
Jarrar.lecture notes.aai.2011s.ch9.fol.inference
Jarrar.lecture notes.aai.2011s.ch9.fol.inferenceJarrar.lecture notes.aai.2011s.ch9.fol.inference
Jarrar.lecture notes.aai.2011s.ch9.fol.inference
 
09
0909
09
 
1606751772-ds-lecture-6.ppt
1606751772-ds-lecture-6.ppt1606751772-ds-lecture-6.ppt
1606751772-ds-lecture-6.ppt
 
Discreate structure presentation introduction
Discreate structure presentation introductionDiscreate structure presentation introduction
Discreate structure presentation introduction
 
Chap05
Chap05Chap05
Chap05
 
Exchanging More than Complete Data
Exchanging More than Complete DataExchanging More than Complete Data
Exchanging More than Complete Data
 
Dscrete structure
Dscrete  structureDscrete  structure
Dscrete structure
 
Chapter 01 - p2.pdf
Chapter 01 - p2.pdfChapter 01 - p2.pdf
Chapter 01 - p2.pdf
 
DISMATH_Part1
DISMATH_Part1DISMATH_Part1
DISMATH_Part1
 
Algorithmic foundations.docx
Algorithmic foundations.docxAlgorithmic foundations.docx
Algorithmic foundations.docx
 
L2.pdf
L2.pdfL2.pdf
L2.pdf
 
Boolean Programs and Quantified Propositional Proof System -
Boolean Programs and Quantified Propositional Proof System - Boolean Programs and Quantified Propositional Proof System -
Boolean Programs and Quantified Propositional Proof System -
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
 

Recently uploaded

Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 

Recently uploaded (20)

Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 

L03 ai - knowledge representation using logic

  • 1. Knowledge representationKnowledge representation using Predicate logicusing Predicate logic Dr.V.Manjula , Prof/CSE, VEL TECH HIGH TECH Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE.
  • 2. LogicLogic 2 Formal Language and their ontological and epistemological commitments
  • 3. 3 Review of PropositionalReview of Propositional LogicLogic Let P: Today is Sunday Q: We have guests P ∧ Q : Today is Sunday and We have guests P ∨ Q : Today is Sunday or We have guests ¬P : Today is not Sunday. P → Q : if today is Sunday then we have guests. P ↔ Q : Today is Sunday if and only if we have guests. Propositional variables Propositional constants: T, F Logical connectives
  • 4. 4 SemanticsSemantics Propositions and expressions have truth values: can be true or false. The truth value of an expression is determined by truth tables, e.g.: P Q P v Q T T T T F T F T T F F F
  • 5. 5 Propositional Proof TheoryPropositional Proof Theory Propositional proof theory: A set of axioms (logical identities) and inference rules used to manipulate expressions and to obtain true expressions out of other true expressions. Inference rules: give a mechanical procedure to obtain true expressions out of other true expressions. Modus ponens: P, P → Q |= Q
  • 6. 6 Knowledge representationKnowledge representation using predicate logicusing predicate logic Some books are interesting. ∃ x (book(x) Λ interesting(x)) Anybody that has a friend is not lonely (If someone has a friend, they are not lonely) ∀x (∃ y friend(x,y)  ~lonely(x))
  • 7. 7 Predicate LogicPredicate Logic Represents properties and relations by using predicates with arguments. likes(mary,apples) ∧ ¬likes(mary,grapes) Quantifiers: indicate the scope of the predicate Universal quantifier: ∀ X likes ( mary , X) Mary likes everything Existential quantifier ∃ X likes ( mary , X) there is something which Mary likes.
  • 8. 8 Proof Theory for Predicate LogicProof Theory for Predicate Logic Based on the resolution procedure. Unification: matching predicates with variables to atomic sentences (matching variables to constants.) Example: Is Socrates mortal? ∀ X (human(X)  mortal(X)) human(socrates) human(plato) alien(spock)
  • 9. Inferencing in Predicate LogicInferencing in Predicate Logic  Forward chainingForward chaining  Given P,Given P, , to infer Q, to infer Q  P, matchP, match L.H.SL.H.S ofof  Assert Q fromAssert Q from R.H.SR.H.S  Backward chainingBackward chaining  Q, MatchQ, Match R.H.SR.H.S ofof  assert Passert P  Check if P existsCheck if P exists  Resolution – RefutationResolution – Refutation  Negate goalNegate goal  Convert all pieces of knowledge into clausal form (disjunction ofConvert all pieces of knowledge into clausal form (disjunction of literals)literals)  See if contradiction indicated by null clause can be derivedSee if contradiction indicated by null clause can be derived QP → QP →
  • 10. 10 ResolutionResolution A ∨ B, ¬B ∨ C |= A ∨ C compare with: B, ¬B ∨ C |= C (B →C = ¬B ∨ C) If B is true, then C must be true, if B is false than A must be true. This means that WHENEVER the conjunction (A ∨ B) ∧ (¬B ∨ C) is true, A ∨ C is also true.
  • 11. 11 How resolution worksHow resolution works ¬P1 v P2 ¬P2 ¬P1 P1 v P3 v P4 P3 v P4 This is the conclusion Eliminate opposite literals and rewrite two expressions as one
  • 12. 12 Proof by refutationProof by refutation P4 v ¬P6 P6 P4 ¬P4 Add the negation of the statement to be proved contradiction
  • 13. Resolution in First-Order LogicResolution in First-Order Logic 13 Basic steps for proving a conclusion S given premises Premise1, …, Premisen (all expressed in FOL): 1. Convert all sentences to CNF 2. Negate conclusion S & convert result to CNF 3. Add negated conclusion S to the premise clauses 4. Repeat until contradiction or no progress is made: a. Select 2 clauses (call them parent clauses) b. Resolve them together, performing all required unifications c. If resolvent is the empty clause, a contradiction has been found (i.e., S follows from the premises) d. If not, add resolvent to the premises If we succeed in Step 4, we have proved the conclusion
  • 14. March 14, 2006 AI: Chapter 9: Inference in First-Order Logic14 UnificationUnification  UnificationUnification: The process of finding all legal: The process of finding all legal substitutions that make logical expressions looksubstitutions that make logical expressions look identicalidentical  This is a recursive algorithmThis is a recursive algorithm
  • 15. March 14, 2006 AI: Chapter 9: Inference in First-Order Logic15 UnificationUnification  We can get the inference immediately if we canWe can get the inference immediately if we can find a substitutionfind a substitution θθ such that King(x) andsuch that King(x) and Greedy(x) match King(John) and Greedy(y)Greedy(x) match King(John) and Greedy(y)  θθ = {x/John, y/John} works= {x/John, y/John} works  Unify(Unify(αα,,ββ) =) = θθ ifif αα θθ == ββ θθ
  • 16. 16
  • 17. 17
  • 18. 18
  • 19. 19
  • 20. 20
  • 21. 21
  • 22. 22
  • 23. 23
  • 24. 24
  • 25. 25
  • 26. 26
  • 27. 27
  • 28. 28
  • 29. 29
  • 31. 31
  • 33. 33
  • 34. Predicate CalculusPredicate Calculus  Introduction through an exampleIntroduction through an example (Zohar Manna, 1974):(Zohar Manna, 1974):  Problem: A, B and C belong to the Himalayan club. EveryProblem: A, B and C belong to the Himalayan club. Every member in the club is either a mountain climber or a skier ormember in the club is either a mountain climber or a skier or both. A likes whatever B dislikes and dislikes whatever Bboth. A likes whatever B dislikes and dislikes whatever B likes. A likes rain and snow. No mountain climber likes rain.likes. A likes rain and snow. No mountain climber likes rain. Every skier likes snow.Every skier likes snow. Is there a member who is a mountain climberIs there a member who is a mountain climber and not a skier?and not a skier?  Given knowledge has:Given knowledge has:  FactsFacts  RulesRules
  • 35. Predicate Calculus: ExamplePredicate Calculus: Example contd.contd.  LetLet mcmc denote mountain climber anddenote mountain climber and sksk denotes skier. Knowledgedenotes skier. Knowledge representation in the given problem is as follows:representation in the given problem is as follows: 1.1. member(A)member(A) 2.2. member(B)member(B) 3.3. member(C)member(C) 4.4. ∀∀x[member(x) → (mc(x) sk(x))]∨x[member(x) → (mc(x) sk(x))]∨ 5.5. ∀∀x[mc(x) → ~like(x,rain)]x[mc(x) → ~like(x,rain)] 6.6. ∀∀x[sk(x) → like(x, snow)]x[sk(x) → like(x, snow)] 7.7. ∀∀x[like(B, x) → ~like(A, x)]x[like(B, x) → ~like(A, x)] 8.8. ∀∀x[~like(B, x) → like(A, x)]x[~like(B, x) → like(A, x)] 9.9. like(A, rain)like(A, rain) 10.10. like(A, snow)like(A, snow) 11.11. Question: x[member(x) mc(x) ~sk(x)]∃ ∧ ∧Question: x[member(x) mc(x) ~sk(x)]∃ ∧ ∧  We have to infer the 11We have to infer the 11thth expression from the given 10.expression from the given 10.  Done through Resolution Refutation.Done through Resolution Refutation.
  • 36. 1.1. PP 2.2. converted toconverted to 3.3. Draw the resolution tree (actually an invertedDraw the resolution tree (actually an inverted tree). Every node is a clausal form andtree). Every node is a clausal form and branches are intermediate inference steps.branches are intermediate inference steps. QP → QP ∨~ Q~ Q~ QP ∨~ P~ P
  • 37. TerminologyTerminology  Pair of clauses beingPair of clauses being resolvedresolved is called theis called the ResolventsResolvents. The resulting clause is called the. The resulting clause is called the ResoluteResolute..  Choosing the correct pair of resolvents is aChoosing the correct pair of resolvents is a matter of search.matter of search.
  • 38. Club example revisitedClub example revisited 1. member(A) 2. member(B) 3. member(C) 4. – Can be written as – 5. – 6. – 7. – ))]()(()([ xskxmcxmemberx ∨→∀ ))]()(()([ xskxmcxmember ∨→ )()()(~ xskxmcxmember ∨∨ )],()([ snowxlkxskx →∀ ),()(~ snowxlkxsk ∨ )],(~)([ rainxlkxmcx →∀ ),(~)(~ rainxlkxmc ∨ )],(~),([ xBlkxAlkx →∀ ),(~),(~ xBlkxAlk ∨
  • 39. 8.8. – 9.9. 10.10. 11.11. – Negate–Negate– )],(),([~ xBlkxAlkx →∀ ),(),( xBlkxAlk ∨ ),( rainAlk ),( snowAlk )](~)()([ xskxmcxmemberx ∧∧∃ )]()(~)([~ xskxmcxmemberx ∨∨∀
  • 40.  Now standardize the variables apart whichNow standardize the variables apart which results in the followingresults in the following 1. member(A) 2. member(B) 3. member(C) 4. 5. 6. 7. 8. 9. 10. 11. )()()(~ 111 xskxmcxmember ∨∨ ),()(~ 22 snowxlkxsk ∨ ),(~)(~ 33 rainxlkxmc ∨ ),(~),(~ 44 xBlkxAlk ∨ ),(),( 55 xBlkxAlk ∨ ),( rainAlk ),( snowAlk )]()(~)([~ 666 xskxmcxmemberx ∨∨∀
  • 41. ),(~),(~ 44 xBlkxAlk ∨ ),( snowAlk ),(~ snowBlk ),()(~ 22 snowxlkxsk ∨ )()()(~ 111 xskxmcxmember ∨∨)(~ Bsk )()(~ BmcBmember ∨ )(Bmember )(Bmc)]()(~)([~ 666 xskxmcxmemberx ∨∨∀ )()(~ BskBmember ∨ )(~ Bsk )(~ Bmember )(Bmember 7 10 12 5 13 4 14 2 11 15 16 13 17 2
  • 42. 42 Prolog exampleProlog example Predicate logic representation is used only on paper. Computational implementation: logic programming languages In Logic and in Prolog: ∀ X ∀ Y (father(X,Y) v mother(X,Y)  parent(X,Y)) ∀ X ∀ Y( (∃ Z(parent(Z,X) ∧ parent(Z,Y))  siblings(X,Y)) parent(X,Y):- father(X,Y). parent(X,Y):- mother(X,Y). siblings(X,Y):- parent(Z,X),parent(Z,Y).
  • 43. Example -2Example -2 43 Converting Statements into Predicate Logic Formulae (WFFs): 1.All employees earning Rs 500000 or more per year pay taxes. 2.Some employees are sick today. 3.No employees earns more than the president. Let • E(x) : for x is an employee • P(x) : for x is a President • i(x) : for the income of x (lower case – denotes function not predicate) • GE(u,v) for u is greater than or equal to v • S(x) for x is sick today • T(x) for x pays taxes Then : Formulae in FOPL are : 1 : x ((E(x)∀ ∧ GE(i(x), 500000)) ⇒T(x)) 2 : x(E(y)∃ ⇒ S(x)) 3 : x y((E(x)∀ ∀ ∧ P(y)) ⇒ ~GE(i(x), i(y)))
  • 44. Example -3Example -3 44 i. John likes all kinds of food. ii. Apples are food. iii.Chicken is food. iv.Anything anyone eats and isn’t killed by is food. v. Bill eats peanuts, and is still alive. vi.Sue eats everything that Bill eats. Prove that “John likes peanuts”
  • 45. 45 John likes all kinds of food ∀x food (x) ⇒ eats(John, x) Apples are food. food(apples) Chicken is food. food(chicken) Anything anyone eats and isn’t killed by is food. ∀x,y eats(x,y) ∧ ¬killed(x) ⇒ food(y) Bill eats peanuts, and is still alive. eats(Bill,Peanuts) ∧ ¬killed(Bill) Sue eats everything that Bill eats. ∀x eats (Bill,x) ⇒ eats(Sue,x)
  • 46. Another way of writingAnother way of writing 46 (a) Well Formed Formulas 1.  x Food(x) → Likes(John, x)∀ 2. Food(Apples) 3. Food(Chicken) 4.  x y Eats(y, x)   ¬KilledBy(y, x) → Food(x)∀ ∃ ∧ 5. Eats(Bill, Peanuts)   ¬KilledBy(Bill, Peanuts)∧ 6.  x Eats(Bill, x) → Eats(Sue, x)∀ (b) Convert the formulas of part (a) into clause form. 1. ¬Food(x)   Likes(John, x)∨ 2. Food(Apples) 3. Food(Chicken) 4. ¬Eats(y, x)   KilledBy(y, x)   Food(x)∨ ∨ 5. Eats(Bill, Peanuts) 6. ¬KilledBy(Bill, Peanuts) 7. ¬Eats(Bill, x)   Eats(Sue, x)∨
  • 47. ResolutionResolution 47 (d) Use resolution to prove that John likes peanuts. 8. ¬Likes(John, Peanuts) negated conclusion 9. ¬Food(Peanuts) 1 and 8 10. ¬Eats(y, Peanuts)   KilledBy(y, Peanuts) 4 and 9∨ 11. KilledBy(Bill, Peanuts) 5 and 10 12.   6 and 11⊥ (e) Use resolution to answer the question, “What food does Sue eat?” 13. ¬Eats(Sue, x) negated query 14. ¬Eats(Bill, x) 7 and 13 15.   5 and 14, unifying Peanuts/x⊥