Unit-3 AI Propositional Logic
Unit-3 AI Propositional Logic
Unit-3 AI Propositional Logic
Propositional Logic
Propositional Theorem Proving
Contents:
• Propositional Logic:
– Knowledge-Based Agents,
– The Wumpus World,
– Logic,
– Propositional Logic
• Propositional Theorem Proving:
– Inference and proofs,
– Proof by resolution, Horn clauses and definite clauses,
– Forward and backward chaining,
– Effective Propositional Model Checking,
– Agents Based on Propositional Logic.
Knowledge-Based Agent
• An intelligent agent needs
– knowledge about the real world for taking decisions and
– reasoning to act efficiently.
• Knowledge-based agents are those agents who have
the capability of
– maintaining an internal state of knowledge,
– reason over that knowledge,
– update their knowledge after observations and
– take actions.
These agents can represent the world with some formal
representation and act intelligently.
• Knowledge-based agents are composed of 2 main parts:
– Knowledge-base(Domain Specific) and
– Inference system(Domain Independent Algorithm)
A knowledge-based agent(KBA) must able to do the
following:
• Knowledge Level
• Logical Level
• Implementation Level
1. Knowledge Level
• The knowledge level is the highest level of abstraction in a
knowledge-based agent.
• It describes what the agent knows and how it uses it to
perform tasks.
• The knowledge level, concerns the representation and
organization of knowledge rather than the implementation
details.
2. Logical Level
• The logical level is the intermediate level of abstraction in a
knowledge-based agent.
• It describes how the knowledge is represented and
manipulated by the inference engine.
• The logical story concerns the formal logic used to represent
knowledge and make inferences.
3. Implementation Level
• The implementation level is the lowest level of
abstraction in a knowledge-based agent.
• It describes how the knowledge and inference
engine is implemented using a programming
language.
• The implementation level is concerned with the
details of the programming language and the
algorithms used to implement the knowledge
and inference engine.
Approaches to Designing a Knowledge-Based Agent
Declarative Approach
Procedural Approach
Declarative Approach
• The declarative approach to designing a
knowledge-based agent focuses on
representing knowledge in a declarative
form, such as rules or facts.
• The knowledge is represented independently
of the algorithms used to manipulate it.
Procedural Approach
• The procedural approach to designing a
knowledge-based agent focuses on
representing knowledge in a procedural form,
such as a sequence of instructions.
• The knowledge is represented in terms of the
algorithms used to manipulate it.
• The inference engine uses these algorithms to
make inferences from the knowledge.
Knowledge Representation
• Humans are best at understanding, reasoning,
and interpreting knowledge.
• Human knows things, which is knowledge and
as per their knowledge they perform various
actions in the real world.
• But how machines do all these things comes
under knowledge representation and
reasoning.
• Knowledge representation provides a
framework for
– representing, organizing, and manipulating
knowledge
that can be used
– to solve complex problems,
– make decisions, and
– learn from data.
• For example, when you see a hot tea cup, a
signal immediately comes from your brain
cautioning you against picking it up.
What to Represent:
Following are the kind of knowledge which needs to be
represented in AI systems:
• Object: All the facts about objects in our world domain.
E.g., Guitars contains strings, trumpets are brass
instruments.
• Facts: Facts are the truths about the real world and what
we represent.
• Events: Events are the actions which occur in our world.
• Performance: It describe behavior which involves
knowledge about how to do things.
• Meta-knowledge: It is knowledge about what we know.
Knowledge-Base: The central component of the
knowledge-based agents is the knowledge base.
• Knowledge: Knowledge is awareness or familiarity
gained by experiences of facts, data, and situations.
• Following are the types of knowledge in artificial
intelligence:
Types of
knowledge
1. Declarative Knowledge:
• Declarative knowledge is to know about
something.
• In the above diagram, we have represented the different type of knowledge in the form
of nodes and arcs.
• Each object is connected with another object by some relation.
3. Frame Representation
• A frame is a record like structure which consists of a
collection of attributes and its values to describe an
entity in the world.
• It consists of a collection of slots and slot values.
• These slots may be of any type and sizes.
• Slots have names and values which are called
facets.
Facets: The various aspects of a slot is known
as Facets.
A frame is also known as slot-filter knowledge
representation in artificial intelligence.
Slots Filters
Let's take an example of a frame for a book
Title Artificial Intelligence
Genre Computer Science
Author Peter Norvig
Edition Third Edition
Year 1996
Page 1152
Example 2:
Let's suppose we are taking an entity, Peter. Peter is an engineer as a profession, and his age
is 25, he lives in city London, and the country is England. So following is the frame
representation for this:
Slots Filter
Name Peter
Profession Doctor
Age 25
Marital status Single
Weight 78
4. Production Rules
• Production rules system consist of (condition,
action) pairs which mean,
– "If condition then action".
d) 5 is a prime number.
2. Predicate Logic :
Predicates are properties, additional information
to better express the subject of the sentence.
A quantified predicate is a proposition , that is,
when you assign values to a predicate with
variables it can be made a proposition.
Difference between Propositional Logic and Predicate Logic
Example:
Precedence Operators
First Precedence Parenthesis- ()
Second Precedence Negation- ~
Third Precedence Conjunction(AND) - ^
Fourth Precedence Disjunction(OR) - v
Fifth Precedence Implication - ->
Six Precedence Biconditional -
Note:
For better understanding use parenthesis to make sure of the correct
interpretations.
Such as ¬R∨ Q, It can be interpreted as (¬R) ∨ Q
Logical equivalence:
• Logical equivalence is one of the features of propositional logic.
P → Q is equivalent to ¬ Q → ¬ P,
and
Q→ P is equivalent to ¬ P → ¬ Q.
Types of Inference rules
1. Modus Ponens:
• The Modus Ponens rule states that if P and P → Q is true, then we can
infer that Q will be true.
• It can be represented as:
Example:
Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
Statement-2: "I am sleepy" ==> P
Conclusion: "I go to bed." ==> Q.
Hence, we can say that, if P→ Q is true and P is true then Q will be true.
Example:
Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
Statement-2: "I do not go to the bed."==> ~Q
Statement-3: Which infers that "I am not sleepy" => ~P
Example:
Statement-1: If you have my home key then you can unlock my home. P→Q
Statement-2: If you can unlock my home then you can take my money. Q→R
Conclusion: If you have my home key then you can take my money. P→R
Example:
Statement-1: Today is Sunday or Monday. ==>P∨Q
Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
Example:
Statement: I have a vanilla ice-cream. ==> P
Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-cream. ==> (P∨Q)