; KNOWN checks if exp is known to be true in *STATE* of CURRENT-NODE.
; returns a list of binding lists, as do other meta-functions, or t

(defun known (node exp)
    (let ((old-state *STATE*) result)
	 (setq *STATE* (node-state node))
	 (setq result (descend-match exp '((nil nil)) 'all))
	 (cond ((equal result '(((nil nil))))
	        (setq result t)))
	 (setq *STATE* old-state)
	 result))



;  just used internally by learning system, taking advantage of
; the fact that on-goal-stack doesn't look in the alt.

(defun high-on-goal-stack (n g)
    (on-goal-stack n g))

(defun on-goal-stack (n super)
    (cond ((is-variable n) 
           (error "ON-GOAL-STACK: node cannot be a variable"))
	  ((is-variable super)
	   (mapcar #'(lambda (g) (list (list super g)))
		   (node-goal-stack n)))
	  ((listp super)
	   (mapcan #'(lambda (g) (let ((val (lst-match super g)))
				      (cond (val (list val))
					    (t nil))))
		   (node-goal-stack n)))))
 
