anchor.diff:            (push v step-ops))))
       step-ops))
   
  -(defun smt-plan-encode (state-vars ground-actions
  -                        initial-state
  -                        goal
  -                        steps)
  -  (let ((smt-statements nil))
  -    (labels ((stmt (x) (push x smt-statements)))
  -      ;; Per-step function
  -      (map nil #'stmt (smt-plan-step-fun state-vars ground-actions))
  -
  -      ;; initial state
  -      (stmt (smt-comment "Initial State"))
  -      (map nil #'stmt (smt-plan-step-vars state-vars 0))
  -      (stmt (smt-assert (rewrite-exp initial-state 0)))
  -
  -      ;; Steps
  -      (dotimes (i steps)
  -        (map nil #'stmt (smt-plan-step-stmts state-vars ground-actions i)))
  -
  -      ;; goal state
  -      (stmt (smt-comment "Goal State"))
  -      (stmt (smt-assert (rewrite-exp goal steps))))
  -
  -    (values (reverse smt-statements)
  -            (smt-plan-step-ops ground-actions steps))))
  +
   
   (defun smt-plan-parse (assignments)
     (let ((plan))
  
positive.code:               `(|get-value| ,step-ops))))
  
  
  (defun smt-plan-context ( &key
                              operators facts
                              state-vars
                              ground-actions
                              initial-true
                              initial-false
                              initial-state
                              goal
                              smt)
    "Fork an SMT solver and initialize with base plan definitions."
    (let* ((operators (when operators
                        (load-operators operators)))
           (facts (when facts (load-facts facts)))
           (type-map (compute-type-map (pddl-operators-types operators)
                                       (pddl-facts-objects facts)))
           (state-vars (or state-vars
                           (create-state-variables (pddl-operators-predicates operators)
                                                   type-map)))
           (ground-actions (or ground-actions
                                 (smt-ground-actions (pddl-operators-actions operators)
                                                        type-map)))
           (initial-true (unless initial-state (or initial-true (pddl-facts-init facts))))
           (initial-false (unless initial-state (or initial-false
                                                    (set-difference  state-vars initial-true :test #'equal))))
           (initial-state (or initial-state
                              `(and ,@initial-true
                                    ,@(loop for v in initial-false collect `(not ,v)))))
  
           (goal (or goal (pddl-facts-goal facts)))
           (n-op (length ground-actions))
           (n-var (length state-vars)))
      (format t "~&ground actions: ~D" n-op)
  
negative.code:            ((not x) x)
             ((t &rest rest) (declare (ignore rest))
              exp)))))
  
  (defstruct ground-domain
    variables
    operators
    axioms
    start
    goal)
  
  (defun ground-domain (operators facts
                        &key
                          goal)
    (let* ((operators (load-operators operators))
           (facts (load-facts facts))
           (type-map (compute-type-map (pddl-operators-types operators)
                                       (pddl-facts-objects facts)))
           (ground-variables (create-state-variables (pddl-operators-predicates operators)
                                                     type-map))
           (ground-operators (smt-ground-actions (pddl-operators-actions operators)
                                                 type-map))
           (initial-true (pddl-facts-init facts))
           (initial-false (set-difference  ground-variables initial-true :test #'equal)))
      (make-ground-domain :variables ground-variables
                          :operators ground-operators
                          :axioms nil
                          :start  `(and ,@initial-true
                                        ,@(loop for v in initial-false collect `(not ,v)))
                          :goal (or goal (pddl-facts-goal facts)))))
  
  (defun smt-frame-axioms-exp (state-vars ground-actions i j)
    ;(print ground-operators)
  