;;; -*- Mode: LISP; -*- ;;;; Basic rules for JSAINT. ;;;; Last edited 1/29/93, by KDF ;;; Copyright (c) 1991-1993, Kenneth D. Forbus, Northwestern ;;; University, and Johan de Kleer, Xerox Corporation. ;;; All Rights reserved. ;;; See the file legal.txt for a paragraph stating scope of permission ;;; and disclaimer of warranty. The above copyright notice and that ;;; paragraph must be included in any separate copy of this file. (in-package :cl-user) ;;; Expand pointers (rule ((:in (and-subgoals ?parent ?children) :var ?def)) (dolist (child ?children) (rlet ((?child (:eval child))) (rassert! (parent-of ?child ?parent :and) (:def-of-and ?def)) (rule ((:in (failed ?child) :var ?delinquent)) (rassert! (failed ?parent) (:and-failure ?def ?delinquent))))) (assert! `(solved ,?parent) `(:and-success ,?def ,@ (mapcar #'(lambda (child) `(solved ,child)) ?children)))) (rule ((:in (or-subgoals ?parent ?children) :var ?def :test ?children)) (dolist (child ?children) (rlet ((?child (:eval child))) (rassert! (parent-of ?child ?parent :or) (:def-of-or ?def)) (rule ((:in (solved ?child) :var ?winner)) (rassert! (solved ?parent) (:or-success ?winner ?def))))) (assert! `(failed ,?parent) `(:or-failure ,?def ,@ (mapcar #'(lambda (child) `(failed ,child)) ?children)))) (rule ((:in (parent-of ?child ?parent ?type) :var ?lineage)) (rassert! (relevant ?child) (:still-working-on (open ?parent) ?lineage))) (rule ((:in (solution-of ?problem ?answer) :var ?found)) (rassert! (solved ?problem) (:found-answer ?found))) (rule ((:in (or-subgoals (integrate ?expr) nil) :var ?no-ideas)) (rassert! (failed (integrate ?expr)) (:no-methods ?no-ideas))) (rule ((:in (solved ?problem))) ;; can only happen once (retract! `(open ,?problem) :expand-agenda-item t)) (rule ((:in (failed ?problem))) (retract! `(open ,?problem) :expand-agenda-item t))