5 Reasoning And Inference

Artificial Intelligence ยท Unit 5

Reasoning and Inference

Exam-focused notes for Reasoning and Inference (Artificial Intelligence, BIT252): what the TU syllabus asks and how it has actually been tested, with 3 solved past questions from this unit.

Reasoning and Inference in short

Reasoning is how an agent derives new facts from what it knows. This chapter covers inference rules, chaining, resolution, constraint satisfaction, and decision making in games.

Reasoning and Inference: notes

Rules of inference

A rule of inference is a pattern that lets us derive a valid conclusion from given premises. Main rules:

RuleFormExample
Modus ponens$P,\ P \rightarrow Q \ \therefore\ Q$It rains. If it rains the road is wet. So the road is wet.
Modus tollens$\neg Q,\ P \rightarrow Q \ \therefore\ \neg P$The road is dry. So it did not rain.
Hypothetical syllogism$P \rightarrow Q,\ Q \rightarrow R \ \therefore\ P \rightarrow R$Chain of two rules
Disjunctive syllogism$P \vee Q,\ \neg P \ \therefore\ Q$Either A or B; not A; so B
Conjunction$P,\ Q \ \therefore\ P \wedge Q$Join two true facts
Simplification$P \wedge Q \ \therefore\ P$Take one part
Universal instantiation$\forall x\ P(x) \ \therefore\ P(c)$All dogs bark, so Rex barks
Resolution$P \vee Q,\ \neg P \vee R \ \therefore\ Q \vee R$Used in automatic proof

A rule is sound if it only derives true conclusions from true premises. A set of rules is complete if it can derive every true conclusion.

Forward chaining

Forward chaining is data-driven. It starts from known facts. It fires any rule whose conditions are all true and adds its conclusion as a new fact. It repeats until the goal is found or no rule can fire.

Example. Rules: R1: $A \wedge B \rightarrow C$. R2: $C \rightarrow D$. R3: $D \wedge E \rightarrow G$. Facts: $A, B, E$. Goal: $G$.

  • R1 fires because A and B are known. Add C.
  • R2 fires because C is known. Add D.
  • R3 fires because D and E are known. Add G. The goal is reached.

Forward chaining is good when there are many facts and the goal is not known in advance, such as monitoring and planning.

What this unit covers

  • Rules of inference
  • Forward chaining
  • Backward chaining
  • Resolution method
  • Constraint satisfaction problems
  • Game theory and minimax algorithm

Backward chaining

2080 ยท 5 marks

Distinguish between backward chaining and forward chaining with an example. [5]

Show solved answer

Backward Chaining vs Forward Chaining

Forward Chaining (Data-Driven Reasoning)

Forward chaining starts from known facts and applies inference rules to derive new facts, moving forward toward the goal.

  • It is a bottom-up approach
  • Begins with available data/facts
  • Fires rules whose conditions are satisfied
  • Continues until the goal is reached or no more rules can fire
  • Used when: all data is available and we want to derive conclusions

Backward Chaining (Goal-Driven Reasoning)

Backward chaining starts from the goal and works backward to find the facts that support it.

  • It is a top-down approach
  • Begins with the goal to be proved
  • Breaks the goal into sub-goals
  • Continues until all sub-goals are satisfied by known facts
  • Used when: the goal is clear and we want to verify it

Key Differences

FeatureForward ChainingBackward Chaining
DirectionFacts โ†’ GoalGoal โ†’ Facts
ApproachBottom-upTop-down
Driven byDataGoal
Starting pointKnown factsHypothesis/Goal
UsageWhen facts are givenWhen goal is specific
May deriveIrrelevant conclusionsOnly goal-relevant facts
Example systemCLIPSProlog

Example

Given Rules and Facts:

  • Fact 1: It is raining
  • Fact 2: I have an umbrella
  • Rule 1: If it is raining AND I have an umbrella โ†’ I will not get wet
  • Rule 2: If I will not get wet โ†’ I will go outside
  • Goal: Will I go outside?

Forward Chaining Solution:

Start with known facts: {raining, have umbrella}

Step 1: Rule 1 fires (raining + have umbrella)
        โ†’ Derive: "will not get wet"

Step 2: Rule 2 fires (will not get wet)
        โ†’ Derive: "will go outside"

Goal REACHED: Yes, I will go outside.

Backward Chaining Solution:

Start with Goal: "Will I go outside?"

Step 1: To prove "go outside", need Rule 2
        โ†’ Sub-goal: Prove "will not get wet"

Step 2: To prove "will not get wet", need Rule 1
        โ†’ Sub-goals: Prove "raining" AND "have umbrella"

Step 3: Check facts:
        "raining" โ†’ TRUE (known fact)
        "have umbrella" โ†’ TRUE (known fact)

Goal PROVED: Yes, I will go outside.

Summary

Forward chaining is suitable when we have a set of facts and want to derive all possible conclusions. Backward chaining is suitable when we have a specific goal and want to verify whether it can be supported by existing facts. Both are fundamental inference strategies used in expert systems and AI rule-based reasoning.

Open this answer on its own page โ†’

Rules of inference

0 ยท 5 marks

All living things are either animal or plant. All animals who can bark are dogs. Puppy is living thing and it is not a plant. Using rules of inference show that Puppy can bark. [5]

Let us define the predicates: - $A(x)$: x is an animal - $P(x)$: x is a plant - $B(x)$: x can bark - $D(x)$: x is a dog - $L(x)$: x is a living thing Premise 1: All living things are either animal or plant. $$\forall x ; [L(x) \Rightarrow A(x) \lor P(x)]$$ Premise 2: All animals who can bark are...

Open this answer on its own page โ†’

Game theory and minimax algorithm

0 ยท 5 marks

What does alpha and beta refer in min max algorithm? Write the script for a shopping at department store? [5]

Alpha (ฮฑ): - Alpha represents the best (maximum) value that the Maximizer player is assured of along the current path. - It is the lower bound on the score that the MAX player can achieve. - Initial value: ฮฑ = -โˆž - Alpha value increases as the MAX player finds better moves. Beta (ฮฒ): - Beta repre...

Open this answer on its own page โ†’