Unit 3 (Part2)
Unit 3 (Part2)
PART2
Knowledge and Reasoning:
• Knowledge representation issues,
• predicate logic-Resolution, Unification,
• Representation knowledge using Rules-Inference in First – order logic
forward and backward reasoning.
Knowledge and Reasoning
• Knowledge refers to the information that an AI system has about the
world (or) Knowledge is the basic element for a human brain to know
and understand the things logically.
• This information can be obtained through various means, such as
sensors, databases, or human input.
• The knowledge can be in different forms, such as rules, facts, or
heuristics.
• The more knowledge an AI system has, the better it can understand
and reason about the world.
• Reasoning, on the other hand, is the process by which an AI system
uses its knowledge to draw conclusions or make decisions.
Knowledge and Reasoning (cont..)
• There are different types of reasoning, such as deductive reasoning,
inductive reasoning, and abductive reasoning.
• In deductive reasoning, an AI system applies logical rules to reach a
conclusion based on given premises.
• In inductive reasoning, an AI system derives general principles from
specific observations.
• In abductive reasoning, an AI system infers the best explanation for a
given observation.
Example:
• To illustrate how knowledge and reasoning work in AI, imagine an AI
system that helps diagnose medical conditions.
• The system would need to have a large amount of medical knowledge,
such as symptoms, treatments, and risk factors.
• It would then use deductive reasoning to match a patient's symptoms
with known medical conditions and come up with a diagnosis.
• The system may also use inductive reasoning to learn from past cases
and improve its accuracy over time.
What is Logic?
• Logic is the key behind any knowledge. It allows a person to filter the
necessary information from the bulk and draw a conclusion.
• In AI, the representation of knowledge is done via logics. There are
three main components of logic, which are as follows:
• Syntax: It is the sequence of a specific language which should be
followed in order to form a sentence. Syntax is the representation of a
language. Every language has its own syntax.
For example, ax2+bx+c is a well-formed syntax of a quadratic
equation.
What is Logic? (Cont..)
• Semantics: Semantics defines the sense of the sentence which relates
to the real world.
• For example, Indian people celebrate Diwali every year. This
sentence represents the true fact about the country and its people
who are Indians. Therefore, the sentence is syntactically as well as
semantically correct.
• Logical Inference: Inference means to infer or draw some
conclusions about some fact or a problem. Logical inference is
thinking all the possible reasons which could lead to a proper result.
Inference algorithms are used to perform logical inference.
Knowledge Representation
Knowledge-Based Agent: 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.
EXAMPLE: You can access the internet from campus only if you are cse students or
you are not freshman
P -> (Q V ¬ R)
Limitations of Propositional logic:
Existential quantifier:
Ex: Some boys are intelligent.
∃x: boys(x) ∧ intelligent(x)
• It will be read as: There are some x where x is a boy who is intelligent.
Note:
• The main connective for universal quantifier ∀ is implication →.
• The main connective for existential quantifier ∃ is and ∧.
Some Examples of FOL using quantifier:
i) All birds fly.
• In this question the predicate is "fly(bird)."
• And since there are all birds who fly so it will be represented as
follows.
∀ x bird(x) → fly(x).
ii) Every man respects his parent.
• In this question, the predicate is "respect(x, y)," where x=man, and
y= parent.
4) Finally, using distributive law on the sentences, and form the CNF as:
(A1 V B1) ^ (A2 V B2) ^ …. ^ (An V Bn).
Note: CNF can also be described as AND of ORS
Example:
Let us say:
{Bird(F(x)) V Loves(G(x), x)} and {¬Loves(a, b) V ¬Kills(a, b)}
(P V Q)
2. (P -> P) -> R
= ~(~P V P) V R
= (P ^ ~P) V R
= (P V R) ^ (~P V R)
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
Proof by truth table:
4. Disjunctive Syllogism:
• The Disjunctive syllogism rule state that if P ∨Q is true, and ¬P is true,
then Q will be true. It can be represented as:
Example:
Statement-1: Today is Sunday or Monday. ==>P∨Q
Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
Proof by truth-table:
5. Addition:
• The Addition rule is one the common inference rule, and it states that
If P is true, then P∨Q will be true.
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)
Proof by Truth-Table:
6. Simplification:
• The simplification rule state that if P∧ Q is true, then Q or P will also
be true. It can be represented as:
• Proof by Truth-Table:
7. Resolution:
• The Resolution rule state that if P∨Q and ¬ P∧R is true, then Q ∨R
will also be true. It can be represented as
Proof by Truth-Table:
Forward and Backward Reasoning
• Backward and forward chaining stem from the inference engine
component.
• This is a component in which logical rules are applied to the
knowledge base to get new information or make a decision.
• The backward and forward chaining techniques are used by the
inference engine as strategies for proposing solutions or deducing
information in the expert system.
Forward reasoning:
• Forward chaining is a method of reasoning in artificial intelligence in
which inference rules are applied to existing data to extract additional
data until an endpoint (goal) is achieved.
• In this type of chaining, the inference engine starts by evaluating
existing facts, derivations, and conditions before deducing new
information. An endpoint (goal) is achieved through the manipulation
of knowledge that exists in the knowledge base.
Properties of forward chaining
• The process uses a down-up approach (bottom to top).
• It starts from an initial state and uses facts to make a conclusion.
• This approach is data-driven.
• It’s employed in expert systems and production rule system.
Example:
A
A->B
B
A is the starting point. A->B represents a fact. This fact is used to
achieve a decision B.
A practical example will go as follows;
• Tom is running (A)
• If a person is running, he will sweat (A->B)
• Therefore, Tom is sweating. (B)
Backward chaining:
• Backward chaining is a concept in artificial intelligence that involves
backtracking from the endpoint or goal to steps that led to the
endpoint. This type of chaining starts from the goal and moves
backward to comprehend the steps that were taken to attain this goal.
• The backtracking process can also enable a person establish logical
steps that can be used to find other important solutions.
• Backward chaining can be used in debugging, diagnostics, and
prescription applications.
Properties of backward chaining
• The process uses an up-down approach (top to bottom).
• It’s a goal-driven method of reasoning.
• The endpoint (goal) is subdivided into sub-goals to prove the truth of
facts.
• A backward chaining algorithm is employed in inference engines, game
theories, and complex database systems.
• The modus ponens inference rule is used as the basis for the backward
chaining process. This rule states that if both the conditional statement
(p->q) and the antecedent (p) are true, then we can infer the subsequent
(q).
Example of backward chaining:
• The information provided in the previous example (forward chaining) can
be used to provide a simple explanation of backward chaining. Backward
chaining can be explained in the following sequence.
B
A->B
A
• B is the goal or endpoint, that is used as the starting point for backward
tracking. A is the initial state. A->B is a fact that must be asserted to
arrive at the endpoint B.
A practical example of backward chaining will go as follows:
• Tom is sweating (B).
• If a person is running, he will sweat (A->B).
• Tom is running (A).