Part I Forward Chaining RULE PREMISES TREE --------------------------------------------------------------- R1 Asset ?x low Asset (?x) bob low Salary ?x low | salary (?x) bob low Succeeds WM <--WM U {credit bob bad} --------------------------------------------------------------- R2 Asset ?x low asset (?x)bob low Salary ?x high | salary (?x)bob high Fails against WM --------------------------------------------------------------- R3 Asset ?x high asset (?x)sue high Succeeds WM <--WM U {credit sue good} --------------------------------------------------------------- R4 / \ / \ / \ Asset ?x ?y asset (?x)bob (?y)low asset (?x)sue (?y)high | | married (?x)bob (?z)mary married (?x)sue (?z)bill succeeds succeeds WM <--WM U {asset mary low} WM U{asset bill high} Working memory now is: salary bob low asset bob low married bob mary parent bob bill asset sue high married sue bill credit bob bad credit sue good asset mary low asset bill high Second pass --------------------------------------------------------------- R1 / \ / \ / \ Asset ?x low asset (?x)bob low asset (?x)mary low | | salary (?x)bob low salary (?x)mary low (credit bob bad already in WM) Fails against WM --------------------------------------------------------------- R2 / \ / \ / \ Asset ?x low asset (?x)bob low asset (?x)mary low Salary ?x high | | salary (?x)bob high salary (?x)mary high Fails against WM (again) fails against WM --------------------------------------------------------------- R3 / \ / \ / \ Asset ?x ?y asset (?x)sue high asset (?x)bill high Success Success (credit sue good already in WM) WM <--WM U {credit bill good} --------------------------------------------------------------- R4 / | | \ / | | \ / | | \ asset bob low asset sue high asset mary low asset bill high | | | | married bob mary married sue bill married mary ?z married bill ?z succeeds succeeds succeeds fails againt WM fails against WM {asset mary low {asset bill high already in WM} already in WM} Working memory now is: salary bob low asset bob low married bob mary parent bob bill asset sue high married sue bill credit bob bad credit sue good asset mary low asset bill high credit bill good Third Pass No changes Final working memory is: salary bob low asset bob low married bob mary parent bob bill asset sue high married sue bill credit bob bad credit sue good asset mary low asset bill high credit bill good Backward Chaining G1: credit bob good / \ --------------------------------------------------------------------------- R2 Asset ? low asset (?x)bob low | (succeeds) | salary ?x low salary (?x)bob low | Fails against WM and rules | | --------------------------------------------------------------------------- R3 | Asset ?x high asset (?x)bob high | ---------------------------------------------------------------------------- R4 asset (?x)sue (?y)high | married (?x)sue (?z)bob Fails against WM and rules G2: credit mary bad | --------------------------------------------------------------------------- R1 | Asset ?x low asset (?x)mary low Salary ?x low | | -------------------------------------------------------------------------- R4 | Asset ?x ?y asset (?x)bob (?y)low Married ?x ?z(mary) married (?x)bob (?z)mary Success WM <--WM U {asset mary low} | -------------------------------------------------------------------------- (go back to continue with R1) R1 | salary (?x)mary low Failes agains WM and Rules --------------------------------------------------------------------------