SlideShare a Scribd company logo
1 of 21
Download to read offline
Artificial Intelligence Knowledge & Reasoning
Logic.
Reading: Sections 7.1, 7.3, 7.4 & 7.5 of Textbook R&N
Representation Language of Artificial
Intelligence.
By Bal Krishna Subedi 1
Artificial Intelligence Knowledge & Reasoning
Knowledge bases
Knowledge base = set of sentences in a formal language
Allows an agent to reason about the world, deduce hidden properties and
determine appropriate actions.
Example:
KB = {Mike comes to the party;
If Cathy comes to the party then Becky comes;
If Cathy doesn't come then Mike won't come to the party}
Agent should be able to deduce that Becky comes to the party.
By Bal Krishna Subedi 2
Artificial Intelligence Knowledge & Reasoning
Logic in general
Logics are formal languages for representing information such that
conclusions can be drawn
Components of logic:
Syntax defines how we can make sentences in the language.
Semantics defines how the sentences reflect meaning in the real world.
i.e define truth of sentence in real world
Inference Procedures specify how we can derive new sentences from our
existing sentences.
E.g., the language of arithmetic
x + 2 ≥ y is a sentence; x2 + y > is not a sentence.
x + 2 ≥ y is true iff the number x + 2 is no less than the number y
x + 2 ≥ y is true in a world where x = 7, y = 1.
x + 2 ≥ y is false in a world where x = 0, y = 6.
By Bal Krishna Subedi 3
Artificial Intelligence Knowledge & Reasoning
Types of logic
Logics are characterized by what they commit to as “primitives”
Ontological commitment: what exists -- facts? objects? time? beliefs?
Epistemological commitment: what states of knowledge?
We will look at propositional logic, first-order logic (also known as
predicate logic) and probability theory.
By Bal Krishna Subedi 4
Artificial Intelligence Knowledge & Reasoning
Propositional logic: Syntax
Propositional logic is the simplest logic --illustrates
basic ideas
• Symbols:
– Logical constants: True, False
– Propositional symbols: P, Q, R, ...
– Connectives: ^ (and), ∨ (or), ¬ (not), ⇒ (implies), ⇔
(equivalent)
– Parentheses: ( )
• Sentences
– constructed from atomic sentences and connectives.
By Bal Krishna Subedi 5
Artificial Intelligence Knowledge & Reasoning
Propositional logic: Syntax
Formal Grammar of Propositional Logic (in BNF form):
Sentence → AtomicSentence | ComplexSentence
AtomicSentence → True | False | P | Q | ...
ComplexSentence → (Sentence )
| Sentence Connective Sentence
| ¬ Sentence
Connective → ∧ | ∨ | ⇒ | ⇔
ambiguities are resolved through precedence ¬ ∧ ∨ ⇒ ⇔ or parentheses
By Bal Krishna Subedi 6
Artificial Intelligence Knowledge & Reasoning
Propositional logic: Syntax
The proposition symbols P, Q, R etc are sentences
If P is a sentence, ¬P is a sentence
If P and Q is a sentence, P ^ Q is a sentence
If P and Q is a sentence, P ∨ Q is a sentence
If P and Q is a sentence, P ⇒ Q is a sentence
If P and Q is a sentence, P ⇔ Q is a sentence
By Bal Krishna Subedi 7
Artificial Intelligence Knowledge & Reasoning
Propositional logic: Semantics
Each propositional statement is a fact which can be true or false.
Example:
P means “It is hot"
Q means “It is sunny"
R means “It is raining"
The user defines what the propositional symbols mean.
A model of the world species true/false for each propositional symbol.
E.g. P Q R the world
True True False It is sunny and hot but it is not raining
False False True It is raining and it is not sunny nor hot
By Bal Krishna Subedi 8
Artificial Intelligence Knowledge & Reasoning
Propositional logic: Semantics
Rules for evaluating truth:
¬ P is true iff P is false
P ^ Q is true iff P is true and Q is true
P ∨ Q is true iff P is true or Q is true
P ⇒ Q is true iff P is false or Q is true
i.e., is false iff P is true and Q is false
P ⇔ Q is true iff P ⇒ Q is true and Q ⇒ P is true
We can define the meaning of the logical connectives explicitly
with a truth table:
By Bal Krishna Subedi 9
Artificial Intelligence Knowledge & Reasoning
Semantics of Implication ⇒
What does P ⇒ Q mean?
If P is true, then I am claiming that Q is true. If P is
false then I make no claim.
Also known as if-then rules
Example:
if it rains then I will get wet R ⇒ W
Important: P ⇒ Q is equivalent to : ¬ P ∨ Q
By Bal Krishna Subedi 10
Representing Knowledge in
Propositional Logic
Artificial Intelligence Knowledge & Reasoning
Example:
KB = {Mike comes to the party;
If Cathy comes to the party then Becky comes;
If Cathy doesn't come then Mike won't come to the party}
Let
M represent Mike comes to the party.
C represent Cathy comes to the party.
B represent Becky comes to the party.
KB = {M, C ⇒ B, ¬C ⇒ ¬M}
By Bal Krishna Subedi 11
Artificial Intelligence Knowledge & Reasoning
Models and Entailment
In propositional logic models can be thought of as a truth
assignment to the literals that make the sentence true,
e.g. what are the models of a sentence C ⇒ B?
We say m is a model of a sentence α if α is true in m
M(α) is the set of all models of α
Then KB╞ α if and only if M(KB) is subset of M(α)
By Bal Krishna Subedi 12
Artificial Intelligence Knowledge & Reasoning
Inference
Inference – derive a conclusion from facts or premises
Inference rules allow the construction of new sentences
from existing sentences
An inference procedure generates new sentences on the
basis of inference rules.
That is, the procedure will answer any question whose
answer follows from what is known by the KB
By Bal Krishna Subedi 13
Artificial Intelligence Knowledge & Reasoning
Inference: Example
KB = {Mike comes to the party;
If Cathy comes to the party then Becky comes;
If Cathy doesn't come then Mike won't come to the party}
Let
M represent Mike comes to the party.
C represent Cathy comes to the party.
B represent Becky comes to the party.
Conclusion: Becky comes to the party.
Propositional Logic Representation
Premises: M, C ⇒ B, ¬C ⇒ ¬M
Conclusion: Therefore B.
By Bal Krishna Subedi 14
Artificial Intelligence Knowledge & Reasoning
Inference rules for propositional logic
Modus Ponens:
from an implication and its premise one
can infer the conclusion.
if α ⇒ β, α are given, then sentence β
can be inferred.
and-elimination
– from a conjunction, any of the conjuncts can
be inferred.
and-introduction
– from a list of sentences, one can infer their
conjunction
or-introduction
– from a sentence, one can infer its disjunction
with anything else
α ⇒ β, α
β
α1 ∧ α2 ∧... ∧ αn
αi
α1, α2, … , αn
α1 ∧ α2 ∧... ∧ αn
By Bal Krishna Subedi 15
αi
α1 ∨ α2 ∨... ∨ αn
Artificial Intelligence Knowledge & Reasoning
Inference rules for propositional logic
Resolution:
A complete inference mechanism for propositional logic
Intuition: cannot be both true and false, therefore one of the
other disjuncts must be true in one of the premises.
unit resolution
• if one of the disjuncts in a disjunction is false, then the
other one must be true
resolution
• β cannot be true and false, so one of the other disjuncts
must be true
• can also be restated as “implication is transitive”
α ∨ β, ¬ β
α
α ∨ β, ¬ β ∨ γ
α ∨ γ
¬ α ⇒ β, β ⇒ γ
¬ α ⇒ γ
By Bal Krishna Subedi 16
Artificial Intelligence Knowledge & Reasoning
Normal forms
The resolution rule use syntactic operations on sentences, often
expressed in standardized forms.
By Bal Krishna Subedi 17
Artificial Intelligence Knowledge & Reasoning
Converting Sentences to CNF
By Bal Krishna Subedi 18
Artificial Intelligence Knowledge & Reasoning
Example
KB = {Mike comes to the party;
If Cathy comes to the party then Becky comes;
If Cathy doesn't come then Mike won't come to the party}
Let
M represent Mike comes to the party.
C represent Cathy comes to the party.
B represent Becky comes to the party.
Propositional Logic Representation
KB = {M, C ⇒ B, ¬C ⇒ ¬M}
Convert to CNF:
1. M
2. ¬C ∨ B
3. C ∨ ¬M
By Bal Krishna Subedi 19
Artificial Intelligence Knowledge & Reasoning
Example
Use resolution to combine 3 and 2.
Add result to the KB
4. ¬ M ∨ B
Use unit resolution to combine 1 and 4.
Conclusion: Therefore, Becky comes to the party
By Bal Krishna Subedi 20
Artificial Intelligence Knowledge & Reasoning
Limitations of Propositional Logic
Propositional logic is extremely simple, hence it has limited
expressive power and thus it is difficult to represent statements
concerning objects and relations.
Example: How do we use propositional logic to represent
{All people are mortal}
To do so we would need to have a separate proposition for each
person living on Earth claiming that she or he is mortal.
{Mortal-Pete, Mortal-Jessica, Mortal-John, and so on}
This results in a huge number of propositions and thus causes
problems with inference.
We will look at a more expressive logic: predicate or first-order logic.
It allows us to reason about objects, their properties and their
relations.
By Bal Krishna Subedi 21

More Related Content

What's hot

Unit I discrete mathematics lecture notes
Unit I  discrete mathematics lecture notesUnit I  discrete mathematics lecture notes
Unit I discrete mathematics lecture notesGIRIM8
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representationRushdi Shams
 
Ai lecture 09(unit03)
Ai lecture  09(unit03)Ai lecture  09(unit03)
Ai lecture 09(unit03)vikas dhakane
 
Propositional logic
Propositional logicPropositional logic
Propositional logicMamta Pandey
 
Jarrar.lecture notes.aai.2011s.ch7.p logic
Jarrar.lecture notes.aai.2011s.ch7.p logicJarrar.lecture notes.aai.2011s.ch7.p logic
Jarrar.lecture notes.aai.2011s.ch7.p logicPalGov
 
AI_ 8 Weak Slot and Filler Structure
AI_ 8 Weak Slot and Filler  StructureAI_ 8 Weak Slot and Filler  Structure
AI_ 8 Weak Slot and Filler StructureKhushali Kathiriya
 
Artificial intelligence and first order logic
Artificial intelligence and first order logicArtificial intelligence and first order logic
Artificial intelligence and first order logicparsa rafiq
 
First order predicate logic(fopl)
First order predicate logic(fopl)First order predicate logic(fopl)
First order predicate logic(fopl)surbhi jha
 
Mit203 analysis and design of algorithms
Mit203  analysis and design of algorithmsMit203  analysis and design of algorithms
Mit203 analysis and design of algorithmssmumbahelp
 
Syntax and semantics of propositional logic
Syntax and semantics of propositional logicSyntax and semantics of propositional logic
Syntax and semantics of propositional logicJanet Stemwedel
 
Dm 10.12.2020
Dm 10.12.2020Dm 10.12.2020
Dm 10.12.2020snmeens
 
Mca4040 analysis and design of algorithm
Mca4040  analysis and design of algorithmMca4040  analysis and design of algorithm
Mca4040 analysis and design of algorithmsmumbahelp
 
Constructive Hybrid Logics
Constructive Hybrid LogicsConstructive Hybrid Logics
Constructive Hybrid LogicsValeria de Paiva
 
Ai lecture 11(unit03)
Ai lecture  11(unit03)Ai lecture  11(unit03)
Ai lecture 11(unit03)vikas dhakane
 
20150629 ``The Meaninglessness of Algebraic Semantics''
20150629 ``The Meaninglessness of Algebraic Semantics''20150629 ``The Meaninglessness of Algebraic Semantics''
20150629 ``The Meaninglessness of Algebraic Semantics''HANADASatoru
 
Lec 13. Introduction to Pointers
Lec 13. Introduction to PointersLec 13. Introduction to Pointers
Lec 13. Introduction to PointersRushdi Shams
 

What's hot (17)

Unit I discrete mathematics lecture notes
Unit I  discrete mathematics lecture notesUnit I  discrete mathematics lecture notes
Unit I discrete mathematics lecture notes
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
 
Ai lecture 09(unit03)
Ai lecture  09(unit03)Ai lecture  09(unit03)
Ai lecture 09(unit03)
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Jarrar.lecture notes.aai.2011s.ch7.p logic
Jarrar.lecture notes.aai.2011s.ch7.p logicJarrar.lecture notes.aai.2011s.ch7.p logic
Jarrar.lecture notes.aai.2011s.ch7.p logic
 
AI_ 8 Weak Slot and Filler Structure
AI_ 8 Weak Slot and Filler  StructureAI_ 8 Weak Slot and Filler  Structure
AI_ 8 Weak Slot and Filler Structure
 
Artificial intelligence and first order logic
Artificial intelligence and first order logicArtificial intelligence and first order logic
Artificial intelligence and first order logic
 
AI_11 Understanding
AI_11  UnderstandingAI_11  Understanding
AI_11 Understanding
 
First order predicate logic(fopl)
First order predicate logic(fopl)First order predicate logic(fopl)
First order predicate logic(fopl)
 
Mit203 analysis and design of algorithms
Mit203  analysis and design of algorithmsMit203  analysis and design of algorithms
Mit203 analysis and design of algorithms
 
Syntax and semantics of propositional logic
Syntax and semantics of propositional logicSyntax and semantics of propositional logic
Syntax and semantics of propositional logic
 
Dm 10.12.2020
Dm 10.12.2020Dm 10.12.2020
Dm 10.12.2020
 
Mca4040 analysis and design of algorithm
Mca4040  analysis and design of algorithmMca4040  analysis and design of algorithm
Mca4040 analysis and design of algorithm
 
Constructive Hybrid Logics
Constructive Hybrid LogicsConstructive Hybrid Logics
Constructive Hybrid Logics
 
Ai lecture 11(unit03)
Ai lecture  11(unit03)Ai lecture  11(unit03)
Ai lecture 11(unit03)
 
20150629 ``The Meaninglessness of Algebraic Semantics''
20150629 ``The Meaninglessness of Algebraic Semantics''20150629 ``The Meaninglessness of Algebraic Semantics''
20150629 ``The Meaninglessness of Algebraic Semantics''
 
Lec 13. Introduction to Pointers
Lec 13. Introduction to PointersLec 13. Introduction to Pointers
Lec 13. Introduction to Pointers
 

Similar to Logic 1

Similar to Logic 1 (20)

Artificial intelligent Lec 5-logic
Artificial intelligent Lec 5-logicArtificial intelligent Lec 5-logic
Artificial intelligent Lec 5-logic
 
Knowledge base artificial intelligence.pdf
Knowledge base  artificial intelligence.pdfKnowledge base  artificial intelligence.pdf
Knowledge base artificial intelligence.pdf
 
Logic 2
Logic 2Logic 2
Logic 2
 
Chapter1p1
Chapter1p1Chapter1p1
Chapter1p1
 
Drinkfromme.pptx
Drinkfromme.pptxDrinkfromme.pptx
Drinkfromme.pptx
 
Logic.pdf
Logic.pdfLogic.pdf
Logic.pdf
 
Knowledege Representation.pptx
Knowledege Representation.pptxKnowledege Representation.pptx
Knowledege Representation.pptx
 
Prpositional2
Prpositional2Prpositional2
Prpositional2
 
AI Lecture 6 (logical agents)
AI Lecture 6 (logical agents)AI Lecture 6 (logical agents)
AI Lecture 6 (logical agents)
 
Logic in Computer Science Unit 2 (1).pptx
Logic in Computer Science Unit 2 (1).pptxLogic in Computer Science Unit 2 (1).pptx
Logic in Computer Science Unit 2 (1).pptx
 
Chapter1p1.pdf
Chapter1p1.pdfChapter1p1.pdf
Chapter1p1.pdf
 
Chapter 01 - p1.pdf
Chapter 01 - p1.pdfChapter 01 - p1.pdf
Chapter 01 - p1.pdf
 
Topic 5 Logical Agents Types Details.ppt
Topic 5 Logical Agents Types Details.pptTopic 5 Logical Agents Types Details.ppt
Topic 5 Logical Agents Types Details.ppt
 
Lecture 1 Propositional logic
Lecture 1   Propositional logicLecture 1   Propositional logic
Lecture 1 Propositional logic
 
Relative Charity
Relative CharityRelative Charity
Relative Charity
 
Knowledge based agents
Knowledge based agentsKnowledge based agents
Knowledge based agents
 
Notes discrete math
Notes discrete mathNotes discrete math
Notes discrete math
 
Relevance theory part 1
Relevance theory part 1Relevance theory part 1
Relevance theory part 1
 
Mathematical Logic - Part 1
Mathematical Logic - Part 1Mathematical Logic - Part 1
Mathematical Logic - Part 1
 
DM(1).pptx
DM(1).pptxDM(1).pptx
DM(1).pptx
 

More from Tribhuvan University (20)

Lecture 7 se
Lecture 7 seLecture 7 se
Lecture 7 se
 
Lecture 6 se
Lecture 6 seLecture 6 se
Lecture 6 se
 
Lecture 5 se
Lecture 5 seLecture 5 se
Lecture 5 se
 
Lecture 3 se
Lecture 3 seLecture 3 se
Lecture 3 se
 
Lecture 1 se
Lecture 1 seLecture 1 se
Lecture 1 se
 
Lecture 2 se
Lecture 2 seLecture 2 se
Lecture 2 se
 
Lecture 5 m&ca
Lecture 5 m&caLecture 5 m&ca
Lecture 5 m&ca
 
Lecture 4 m&ca
Lecture 4 m&caLecture 4 m&ca
Lecture 4 m&ca
 
Lecture 3 m&ca
Lecture 3 m&caLecture 3 m&ca
Lecture 3 m&ca
 
Lecture 2 m&ca
Lecture 2 m&caLecture 2 m&ca
Lecture 2 m&ca
 
Lecture 1 m&ca
Lecture 1 m&caLecture 1 m&ca
Lecture 1 m&ca
 
Neural network (csc372) lecture 2
Neural network (csc372) lecture 2Neural network (csc372) lecture 2
Neural network (csc372) lecture 2
 
Neural network (csc372) lecture 1
Neural network (csc372) lecture 1Neural network (csc372) lecture 1
Neural network (csc372) lecture 1
 
Ai unit-2
Ai unit-2Ai unit-2
Ai unit-2
 
Ai unit-3
Ai unit-3Ai unit-3
Ai unit-3
 
Ai unit-4
Ai unit-4Ai unit-4
Ai unit-4
 
Unit 4(nlp _neural_network)
Unit 4(nlp _neural_network)Unit 4(nlp _neural_network)
Unit 4(nlp _neural_network)
 
Ai unit-6
Ai unit-6Ai unit-6
Ai unit-6
 
Ai unit-1
Ai unit-1Ai unit-1
Ai unit-1
 
Knowldge reprsentations
Knowldge reprsentationsKnowldge reprsentations
Knowldge reprsentations
 

Recently uploaded

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Recently uploaded (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Logic 1

  • 1. Artificial Intelligence Knowledge & Reasoning Logic. Reading: Sections 7.1, 7.3, 7.4 & 7.5 of Textbook R&N Representation Language of Artificial Intelligence. By Bal Krishna Subedi 1
  • 2. Artificial Intelligence Knowledge & Reasoning Knowledge bases Knowledge base = set of sentences in a formal language Allows an agent to reason about the world, deduce hidden properties and determine appropriate actions. Example: KB = {Mike comes to the party; If Cathy comes to the party then Becky comes; If Cathy doesn't come then Mike won't come to the party} Agent should be able to deduce that Becky comes to the party. By Bal Krishna Subedi 2
  • 3. Artificial Intelligence Knowledge & Reasoning Logic in general Logics are formal languages for representing information such that conclusions can be drawn Components of logic: Syntax defines how we can make sentences in the language. Semantics defines how the sentences reflect meaning in the real world. i.e define truth of sentence in real world Inference Procedures specify how we can derive new sentences from our existing sentences. E.g., the language of arithmetic x + 2 ≥ y is a sentence; x2 + y > is not a sentence. x + 2 ≥ y is true iff the number x + 2 is no less than the number y x + 2 ≥ y is true in a world where x = 7, y = 1. x + 2 ≥ y is false in a world where x = 0, y = 6. By Bal Krishna Subedi 3
  • 4. Artificial Intelligence Knowledge & Reasoning Types of logic Logics are characterized by what they commit to as “primitives” Ontological commitment: what exists -- facts? objects? time? beliefs? Epistemological commitment: what states of knowledge? We will look at propositional logic, first-order logic (also known as predicate logic) and probability theory. By Bal Krishna Subedi 4
  • 5. Artificial Intelligence Knowledge & Reasoning Propositional logic: Syntax Propositional logic is the simplest logic --illustrates basic ideas • Symbols: – Logical constants: True, False – Propositional symbols: P, Q, R, ... – Connectives: ^ (and), ∨ (or), ¬ (not), ⇒ (implies), ⇔ (equivalent) – Parentheses: ( ) • Sentences – constructed from atomic sentences and connectives. By Bal Krishna Subedi 5
  • 6. Artificial Intelligence Knowledge & Reasoning Propositional logic: Syntax Formal Grammar of Propositional Logic (in BNF form): Sentence → AtomicSentence | ComplexSentence AtomicSentence → True | False | P | Q | ... ComplexSentence → (Sentence ) | Sentence Connective Sentence | ¬ Sentence Connective → ∧ | ∨ | ⇒ | ⇔ ambiguities are resolved through precedence ¬ ∧ ∨ ⇒ ⇔ or parentheses By Bal Krishna Subedi 6
  • 7. Artificial Intelligence Knowledge & Reasoning Propositional logic: Syntax The proposition symbols P, Q, R etc are sentences If P is a sentence, ¬P is a sentence If P and Q is a sentence, P ^ Q is a sentence If P and Q is a sentence, P ∨ Q is a sentence If P and Q is a sentence, P ⇒ Q is a sentence If P and Q is a sentence, P ⇔ Q is a sentence By Bal Krishna Subedi 7
  • 8. Artificial Intelligence Knowledge & Reasoning Propositional logic: Semantics Each propositional statement is a fact which can be true or false. Example: P means “It is hot" Q means “It is sunny" R means “It is raining" The user defines what the propositional symbols mean. A model of the world species true/false for each propositional symbol. E.g. P Q R the world True True False It is sunny and hot but it is not raining False False True It is raining and it is not sunny nor hot By Bal Krishna Subedi 8
  • 9. Artificial Intelligence Knowledge & Reasoning Propositional logic: Semantics Rules for evaluating truth: ¬ P is true iff P is false P ^ Q is true iff P is true and Q is true P ∨ Q is true iff P is true or Q is true P ⇒ Q is true iff P is false or Q is true i.e., is false iff P is true and Q is false P ⇔ Q is true iff P ⇒ Q is true and Q ⇒ P is true We can define the meaning of the logical connectives explicitly with a truth table: By Bal Krishna Subedi 9
  • 10. Artificial Intelligence Knowledge & Reasoning Semantics of Implication ⇒ What does P ⇒ Q mean? If P is true, then I am claiming that Q is true. If P is false then I make no claim. Also known as if-then rules Example: if it rains then I will get wet R ⇒ W Important: P ⇒ Q is equivalent to : ¬ P ∨ Q By Bal Krishna Subedi 10
  • 11. Representing Knowledge in Propositional Logic Artificial Intelligence Knowledge & Reasoning Example: KB = {Mike comes to the party; If Cathy comes to the party then Becky comes; If Cathy doesn't come then Mike won't come to the party} Let M represent Mike comes to the party. C represent Cathy comes to the party. B represent Becky comes to the party. KB = {M, C ⇒ B, ¬C ⇒ ¬M} By Bal Krishna Subedi 11
  • 12. Artificial Intelligence Knowledge & Reasoning Models and Entailment In propositional logic models can be thought of as a truth assignment to the literals that make the sentence true, e.g. what are the models of a sentence C ⇒ B? We say m is a model of a sentence α if α is true in m M(α) is the set of all models of α Then KB╞ α if and only if M(KB) is subset of M(α) By Bal Krishna Subedi 12
  • 13. Artificial Intelligence Knowledge & Reasoning Inference Inference – derive a conclusion from facts or premises Inference rules allow the construction of new sentences from existing sentences An inference procedure generates new sentences on the basis of inference rules. That is, the procedure will answer any question whose answer follows from what is known by the KB By Bal Krishna Subedi 13
  • 14. Artificial Intelligence Knowledge & Reasoning Inference: Example KB = {Mike comes to the party; If Cathy comes to the party then Becky comes; If Cathy doesn't come then Mike won't come to the party} Let M represent Mike comes to the party. C represent Cathy comes to the party. B represent Becky comes to the party. Conclusion: Becky comes to the party. Propositional Logic Representation Premises: M, C ⇒ B, ¬C ⇒ ¬M Conclusion: Therefore B. By Bal Krishna Subedi 14
  • 15. Artificial Intelligence Knowledge & Reasoning Inference rules for propositional logic Modus Ponens: from an implication and its premise one can infer the conclusion. if α ⇒ β, α are given, then sentence β can be inferred. and-elimination – from a conjunction, any of the conjuncts can be inferred. and-introduction – from a list of sentences, one can infer their conjunction or-introduction – from a sentence, one can infer its disjunction with anything else α ⇒ β, α β α1 ∧ α2 ∧... ∧ αn αi α1, α2, … , αn α1 ∧ α2 ∧... ∧ αn By Bal Krishna Subedi 15 αi α1 ∨ α2 ∨... ∨ αn
  • 16. Artificial Intelligence Knowledge & Reasoning Inference rules for propositional logic Resolution: A complete inference mechanism for propositional logic Intuition: cannot be both true and false, therefore one of the other disjuncts must be true in one of the premises. unit resolution • if one of the disjuncts in a disjunction is false, then the other one must be true resolution • β cannot be true and false, so one of the other disjuncts must be true • can also be restated as “implication is transitive” α ∨ β, ¬ β α α ∨ β, ¬ β ∨ γ α ∨ γ ¬ α ⇒ β, β ⇒ γ ¬ α ⇒ γ By Bal Krishna Subedi 16
  • 17. Artificial Intelligence Knowledge & Reasoning Normal forms The resolution rule use syntactic operations on sentences, often expressed in standardized forms. By Bal Krishna Subedi 17
  • 18. Artificial Intelligence Knowledge & Reasoning Converting Sentences to CNF By Bal Krishna Subedi 18
  • 19. Artificial Intelligence Knowledge & Reasoning Example KB = {Mike comes to the party; If Cathy comes to the party then Becky comes; If Cathy doesn't come then Mike won't come to the party} Let M represent Mike comes to the party. C represent Cathy comes to the party. B represent Becky comes to the party. Propositional Logic Representation KB = {M, C ⇒ B, ¬C ⇒ ¬M} Convert to CNF: 1. M 2. ¬C ∨ B 3. C ∨ ¬M By Bal Krishna Subedi 19
  • 20. Artificial Intelligence Knowledge & Reasoning Example Use resolution to combine 3 and 2. Add result to the KB 4. ¬ M ∨ B Use unit resolution to combine 1 and 4. Conclusion: Therefore, Becky comes to the party By Bal Krishna Subedi 20
  • 21. Artificial Intelligence Knowledge & Reasoning Limitations of Propositional Logic Propositional logic is extremely simple, hence it has limited expressive power and thus it is difficult to represent statements concerning objects and relations. Example: How do we use propositional logic to represent {All people are mortal} To do so we would need to have a separate proposition for each person living on Earth claiming that she or he is mortal. {Mortal-Pete, Mortal-Jessica, Mortal-John, and so on} This results in a huge number of propositions and thus causes problems with inference. We will look at a more expressive logic: predicate or first-order logic. It allows us to reason about objects, their properties and their relations. By Bal Krishna Subedi 21