0% found this document useful (0 votes)
35 views40 pages

Knowledge Reasoning & Inference in AI

Sss
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views40 pages

Knowledge Reasoning & Inference in AI

Sss
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

UNIT-III

KNOWLEDGE REASONING AND


INFERENCE
• Knowledge based Agent,
• The Wumpus World Problem,
• Logic: Propositional Logic,
• First-Order Logic Knowledge and Reasoning: Inference in First-

Order Logic: Propositional vs First Order inference.


• First-Order Logic: Syntax and Semantics of First order Logic,
• Using First Order Logic,
• Unification and Lifting,
• Forward Chaining.
• Planning: The planning problem
• formulation,
• The Language of Planning Problems,
• Examples: Air Cargo Transport,
• Spare Tyres
knowledge based agents
• A knowledge-based agent (KBA) in AI is an intelligent agent
that uses a structured knowledge base and an inference
engine to make decisions and solve problems.
• Essentially, it's an AI system that relies on a repository of
facts, rules, and relationships (the knowledge base) and a
mechanism to reason with that information (the inference
engine) to perform tasks.
Key Components:
Knowledge Base (KB):
• A structured collection of facts, rules, and relationships about the
world.
• This could include things like "All humans are mortal," "Socrates
is a human," and "If it's raining, then the ground is wet".

Inference Engine:
• The reasoning component that uses the knowledge base to derive
new information, solve problems, and make decisions.
• It uses logical rules to deduce consequences, identify potential
conflicts, or predict future states.
How it works:

• The agent perceives its environment and stores relevant


information in the knowledge base.
• The inference engine uses the knowledge base and
logical rules to draw conclusions.
• The agent can then use these conclusions to make
decisions or take actions.

Example:
• Imagine a medical diagnosis system.
• It might have a knowledge base containing information
about diseases, symptoms, and treatments.
• When a patient's symptoms are entered, the inference
engine can use the knowledge base to diagnose the
Advantages of KBAs:
Explicit Knowledge Representation:
• The knowledge is represented in a structured way, making it easier
to understand, modify, and extend.
Reasoning Capabilities:
• KBAs can perform complex reasoning tasks, such as deduction,
induction, and abduction.
• Deduction (drawing conclusions from established facts) and
induction (generalizing from specific instances).
• Abduction is crucial for AI systems to understand their environment,
diagnose problems, and make predictions.

Adaptability:
• By updating the knowledge base, KBAs can adapt to new situations
and learn from experience.
Examples of KBAs:

Expert Systems:
• Systems that mimic the decision-making abilities of a
human expert in a specific domain.

Virtual Assistants:
• Systems like Siri or Alexa, which can understand and
respond to natural language queries.

Robotics:
• KBAs can be used to control robots in complex
environments, enabling them to navigate, plan actions,
and interact with objects.
THE WUMPUS WORLD:

• The wumpus world is a cave consisting of rooms(4/4)


connected by passage ways.
• Lurking somewhere in the cave is the terrible wumpus, a
beast that eats anyone who enters its room.
• The wumpus can be shot by an agent, but the agent has only
one arrow.
• Some rooms contain bottomless pits that will trap anyone
who wanders into these rooms (except for the wumpus, which
is too big to fall in).
• The only mitigating feature of this bleak environment is the
possibility of finding a heap of gold.
The PEAS description for Wumpus world are given by
Performance measure:
• +1000 for climbing out of the cave with the gold,
• –1000 for falling into a pit or being eaten by the wumpus,
• –1 for each action taken and
• –10 for using up the arrow.
• The game ends either when the agent dies or when the agent
climbs out of the cave.
Environment: A 4×4 grid of rooms.
• The agent always starts in the square labelled [1,1], facing to
the right.
• The locations of the gold and the wumpus are chosen
randomly.
Actuators:

• The agent can move Forward, TurnLeft by 90◦, or TurnRight


by 90◦.
• The agent dies a miserable death if it enters a square containing
a pit or a live wumpus.
• If an agent tries to move forward and bumps into a wall, then
the agent does not move.
• The action Grab can be used to pick up the gold if it is in the
same square as the agent.
• The action Shoot can be used to fire an arrow in a straight line
in the direction the agent is facing.
• Finally, the action Climb can be used to climb out of the cave,
but only from square [1,1].
Sensors: The agent has five sensors, each
of which gives a single bit of information: –
• In the square containing the wumpus
and in the directly (not diagonally)
adjacent squares, the agent will perceive
a Stench.
• In the squares directly adjacent to a pit,
the agent will perceive a Breeze.
• In the square where the gold is, the
agent will perceive a Glitter.
• When an agent walks into a wall, it will
perceive a Bump.
• When the wumpus is killed, it emits a
woeful Scream that can be perceived
A Typical Wumpus world. The Agent is in the bottom left
corner, facing right
PROPOSITIONAL LOGIC: A VERY
SIMPLE LOGIC
• Propositional logic is used for solving complex problems using
simple statements.
• These statements can either be true or false but cannot be both
at same time.
• These propositions form knowledge representation, reasoning
and decision-making in AI systems.
• Propositional logic is a fundamental form of logic in Artificial
Intelligence (AI) that deals with simple statements, called
propositions, which can only be true or false.
• It's a basic system for representing knowledge and reasoning,
forming the foundation for more complex logical systems.
Understanding Propositional Logic in Artificial
Intelligence

Propositional logic works with statements called propositions


that can be true or false.
• These propositions represent facts or conditions about a
situation.
• We use symbols to represent the propositions and logical
operations to connect those propositions.
• It help us understand how different facts are related to each
other in complex statements or problem.
• Proposition operators like conjunction (∧), disjunction (∨),
negation (¬), implication( →) and bi conditional (↔) helps
combine various proposition to represent logical relations.
Core Concepts:
Propositions:
• These are declarative sentences that can be either true or false,
but not both simultaneously.
• Examples include "The sky is blue" or "It is raining".

Logical Connectives:
• Operators like AND (∧), OR (∨), NOT (¬), IMPLIES (→), and
BICONDITIONAL (↔) are used to combine propositions into more
complex statements.
Truth Values:
• Each proposition has a truth value, either true (T) or false (F).

Truth Tables:
• These are used to determine the truth value of compound
propositions based on the truth values of their components.
Example of Propositions Logic
• P: "The sky is blue." (This statement can be either true or false.)
• Q: "It is raining right now." (This can also be true or false.)
• R: "The ground is wet." (This is either true or false.)
• These can be combined using logical operations to create more
complex statements. For example:
• P ∧ Q: "The sky is blue AND it is raining." (This is true only if
both P and Q are true.)
• P ∨ Q: "The sky is blue OR it is raining." (This is true if at least
one of P or Q is true.)
• ¬P: "It is NOT true that the sky is blue." (This is true if P is false
means the sky is not blue.)
First-Order Logic Knowledge and Reasoning
• First-order logic (FOL) inference is a process of deriving new,
logically sound conclusions from a set of given FOL statements
(premises).
• This involves using inference rules and techniques to
manipulate the FOL structure (which includes variables,
constants, predicates, functions, and quantifiers) to reach new,
valid inferences.
• FOL inference is crucial for knowledge representation,
reasoning, and automated theorem proving in AI systems.
Knowledge Representation:
• FOL allows us to represent facts, rules, and relationships within
a specific domain using constants, predicates, functions, and
Inference in first-order logic (FOL)

• Inference in first-order logic (FOL) is the process of deriving


new, logical consequences from a set of given premises
using the rules of inference and the structure of FOL.
• This involves manipulating sentences with variables,
constants, predicates, and quantifiers to construct valid
arguments and prove theorems.

• Key techniques include substitution, unification, and rules


like Modus Ponens, Universal Instantiation, and

Existential Generalization.
• Inference Rules:
• These are established patterns of logical reasoning that allow us
to derive new sentences from existing ones.
• Examples include :
• Modus Ponens: If P and (P implies Q) are true, then Q is true.
• Universal Elimination: If a statement is true for all instances
(universal quantification), it's true for any specific instance.
• Existential Introduction: If a statement is true for a specific
instance, then there exists an instance for which that statement
is true.
• Universal Introduction: If a statement can be shown to be true
for an arbitrary instance, it can be generalized to all instances.
How Inference Works in FOL:
• Knowledge Base: A set of FOL statements representing
facts and rules about a domain.
• Query: A question posed to the knowledge base.

• Inference: Applying inference rules and techniques to the


knowledge base to try to prove the query or derive new
facts that can help answer the query.
• Proof: If the inference process successfully derives the
query or a statement implying the query, then the query is
considered proven.
Importance of FOL Inference:

• FOL inference is a foundational aspect of logical reasoning and is


crucial for building intelligent systems. It enables:
Knowledge Representation and Reasoning:
• FOL allows us to represent complex knowledge and reason about it
in a formal and systematic way.

Automated Theorem Proving:


• FOL inference forms the basis for automated reasoning systems
that can prove theorems and solve logical problems.

Natural Language Processing:


• FOL can be used to represent the meaning of natural language
sentences and to reason about them.
Expert Systems:
• FOL can be used to represent the knowledge of experts in a
specific domain and to build systems that can make decisions
based on that knowledge.
Propositional vs First Order
inference
• Propositional logic and first-order logic (FOL) are both
formal systems used in AI for knowledge representation and
reasoning, but they differ in their expressive power and
complexity.
• Propositional logic deals with simple declarative statements
(propositions) that are either true or false, while FOL
extends this by allowing quantification over objects and
relations, making it more powerful for representing complex
knowledge.
First-Order Logic: Syntax and Semantics
of First order Logic

• First-order logic (FOL) in AI provides a way to represent


knowledge and reason about it.
• Its syntax defines the structure of logical expressions,
while semantics assigns meaning to these expressions.
• syntax (the rules for forming logical expressions) and
semantics (the meaning of those expressions).
• This ensures that logical reasoning is sound and consistent.
• Essentially, syntax is about how we write things down, and
semantics is about what those things mean in a specific
context.
Syntax of First-Order Logic
• FOL uses symbols to represent objects, properties, and
relationships.
• These symbols include:
• Constants: Represent specific objects (e.g., "John", "3").
• Variables: Represent any object (e.g., "x", "y").
• Predicates: Represent properties or relationships (e.g., "Loves(x,
y)", "is_a_cat(x)").
• Functions: Map objects to other objects (e.g., "father_of(x)").
• Logical Connectives: Connective symbols like "and" (∧), "or"
(∨), "not" (¬), "implies" (→), and "if and only if" (↔).
• Quantifiers: "For all" (∀) and "there exists" (∃).
• Terms in FOL represent objects. They can be constants,
variables, or constructed using function symbols and other
terms.
• Atomic formulas are the most basic statements in FOL,
formed by applying a predicate to a set of terms.
• Formulas are constructed from atomic formulas using logical
connectives and quantifiers.
Semantics of First-Order Logic
• Semantics define the meaning of FOL expressions within a specific
domain.
• For example, consider the predicate "Loves(x, y)".
• In a specific interpretation, "Loves" might be interpreted as a
relationship between people, where x and y are specific people.
• The formula "Loves(John, Mary)" would be true if, in that
interpretation, John indeed loves Mary.
• Key Concepts in Semantics:
• Domain of Discourse: The set of objects that are being talked
about.
• Interpretation Function: Maps symbols to elements and
relationships within the domain.
• Truth: A formula is considered true under an interpretation if it
corresponds to a true statement about the domain.
Example:

Let's say we have the following:


•Domain: {John, Mary, Cat, Dog}
•Constants: John, Mary
•Predicates: Loves(x, y), is_a_cat(x), is_a_dog(x)
We can define an interpretation where:
•Loves(John, Mary) is true.
•is_a_cat(Cat) is true.
•is_a_dog(Dog) is true.
With these definitions, the formula
∀x(is_a_cat(x)→ Loves(John, x)) is false because
John doesn't love all cats, even though he loves Mary.
Using first order logic in AI
• First-order logic (FOL) is a powerful tool in AI for knowledge
representation and reasoning.
• It extends propositional logic by introducing objects,
relations, and functions, allowing for more expressive and
nuanced representations of information.
• This makes FOL suitable for building systems that can
understand and reason about the world in a way that is
similar to human reasoning.
Unification and Lifting

• In AI, unification and lifting are techniques used in


automated reasoning and logic programming, particularly
within the context of first-order logic (FOL).
• Unification finds substitutions to make logical expressions
identical, while lifting transforms first-order representations
into higher-order ones.
Unification:

Definition:
• Unification is the process of finding a substitution (a set of
variable replacements) that makes two logical expressions
equal.
Purpose:
• It's crucial for matching patterns, resolving logical statements,
and enabling inference in AI systems.
Example:
• If you have "Likes(John, X)" and "Likes(Y, Mary)", unification
would find the substitution {Y/John, X/Mary} to make them
identical.
Applications:
• Unification is fundamental in Prolog programming, theorem
proving, and natural language processing.
Lifting:

Definition:
• Lifting is a process of transforming a first-order logical
representation into a higher-order one.
Purpose:
• It allows for reasoning about the structure of logical
expressions, not just their content, by introducing variables
or placeholders for certain elements.
Example:
• Instead of reasoning about specific individuals, lifting allows
reasoning about properties or relationships that apply to all
individuals.
Applications:
• Lifting is used to generalize logical rules and enable more
abstract reasoning in AI systems.
Relationship between Unification and Lifting:

• Unification is often used as a subroutine within the lifting


process.
• Lifting can introduce new variables that need to be unified
with other terms or expressions.
• Together, unification and lifting enable more powerful and
flexible reasoning in AI.

In essence, unification is about making things equal,


while lifting is about making things more general.
Forward Chaining

• Forward chaining is a reasoning technique in artificial


intelligence where an inference engine starts with known
facts and applies rules to derive new facts until a desired
conclusion is reached or no more rules can be applied.
• It's a data-driven approach, moving from initial facts to a
goal or conclusion.
How it works:

1. Start with known facts:


• The process begins with a set of initial facts or data that are
already known or given.

2. Apply inference rules:


• Inference rules, which are logical statements that relate
facts, are applied to these facts.
• If the premises of a rule are satisfied by the current facts,
the rule is "fired" and its conclusion is added as a new fact.
3. Repeat and expand:
• This process of applying rules and adding new facts
continues until a desired conclusion is reached or no more
rules can be applied.
• 4. Example:
• Imagine an expert system for diagnosing car problems.
• If you tell the system that the car won't start and the
battery is new, it might use a rule like "If the car won't start
and the battery is new, then check the starter motor."
• The system would then add "check the starter motor" as a
new fact and continue applying rules based on that new
fact.
Key characteristics:
•Data-driven: Forward chaining focuses on deriving new
information from existing data.
•Bottom-up approach: It starts with basic facts and builds
up to a conclusion.
•Breadth-first search: It often explores multiple rules
simultaneously.
•Can be inefficient: It might explore irrelevant rules that
don't contribute to the final goal.
Forward chaining is preferred when there is a large
amount of data available, and the goal is not well-
defined.

You might also like