Memra

Inference & production-system drills

◈ 5 cards

Build a forward-chaining derivation (Q8), a DFS inference tree (Q6), and contrast data- vs goal-driven control (Q2).

Three exam tasks, one engine

A production system is rules + working memory + a recognize–act cycle. The same rule base can be run in two directions, and the exam tests both plus the contrast between them.

Q2 — data-driven vs goal-driven

Data-driven (forward chaining)Goal-driven (backward chaining)
Start fromthe known factsthe goal to prove
Match rules by theirpremises (conditions)conclusions (actions)
Each stepfires a rule, adds its conclusion to working memoryturns a rule's premises into subgoals
Stops whenno new fact can be derived (fixpoint)the goal traces back to known facts
Best whenfew facts, many possible conclusions; "what follows from this data?"a specific goal, the data set is large; "is this goal provable?"

Rule of thumb: choose the direction with the smaller branching factor — work from whichever end has fewer choices.

Q8 — forward chaining to a fixpoint

Using the cat/dog/mouse KB from L10.1 with facts , repeatedly fire any rule whose premises are all known, add the conclusion, and loop until a full pass derives nothing new (the fixpoint):

  1. dog absent + cat not sleeping ⇒ derive cat_absent.
  2. dog absent + cat absent ⇒ derive mouse_present.
  3. Next pass adds nothing new ⇒ fixpoint, stop.

Every rule firing is one application of modus ponens; forward chaining is just modus ponens run to exhaustion.

Q6 — the DFS inference tree

Backward chaining proves a goal depth-first over the rules. The exam's playground KB:

Facts: , . Prove playground_empty, numbering rules in trial order:

  • Goal playground_empty. Rule 1 concludes it ⇒ try rule 1; its premises are not facts and unprovablefail, backtrack.
  • Rule 5 also concludes playground_empty ⇒ try rule 5; subgoal kids_not_outside.
  • Rule 2 concludes kids_not_outside ⇒ its premise playing_videogame is a fact ⇒ succeed.
  • kids_not_outside proved ⇒ playground_empty proved via rules [5, 2].

The and/or structure: each rule conclusion is an OR-choice (rule 1 or rule 5 could establish the goal); each rule's premises are AND-subgoals (all must hold). DFS tries OR-children left to right, backtracking on failure.

rule 1rule 5playground_emptygoalraining ∧ temp_coldnot facts → backtrackrule 2kids_not_outsideplaying_videogamefact — succeed
This shape is what Q6 is graded on — the <em>trial</em> sequence, not just the proof. Rule 1 is tried first and dies (neither raining nor temp_cold is a fact or provable), DFS backtracks to rule 5, and rule 2 lands on the fact: proved via rules [5, 2]. Each rule concluding the goal is an OR-choice; each rule’s premises are AND-subgoals.
NORMAL ~/memra/learn/comp-456/inference-production-system-drills utf-8 LF