anchor.diff:                             (visit (car (funcall mover i-q (aref token-old i-z))))))))
                 (visit (car (fa-start fa)))))))
       ;; Build sorted FA
  -    (%make-fa :states (if preserve-states
  -                          (map 'vector (lambda (i) (aref (fa-states fa) i)) state-indices)
  -                          state-indices)
  -              :tokens (map 'vector (lambda (i) (aref (fa-tokens fa) i)) token-indices)
  -              :start (sort (map 'list
  -                                (lambda (i) (aref state-old i))
  -                                (fa-start fa))
  -                           #'<)
  -              :accept (sort (map 'list
  -                                 (lambda (i) (aref state-old i))
  -                                 (fa-accept fa))
  -                            #'<)
  -              :edges (sort (map 'list (lambda (e)
  -                                        (list (aref state-old (first e))
  -                                              (aref token-old (second e))
  -                                              (aref state-old (third e))))
  -                                (fa-edges fa))
  -                           #'symbol-list-compare))))
  +    (fa-renumber fa :state-map state-old :token-map token-old)))
   
   
   (defun dfa-equal (a b)
     "Check equivalence up to state names of DFAs"
  +  (assert (dfap a))
  +  (assert (dfap b))
     (equalp (dfa-sort a) (dfa-sort b)))
   
   (defun fa-mover (fa)
  
positive.code:                               (position-if (lambda (q) (find (car q-next) q))
                                             p))
                          edges)))
        (make-fa edges
                 (fa-subset-indices (fa-start dfa) p)
                 (fa-subset-indices (fa-accept dfa) p)))))
  
  
  ;; (defun nfa-e-close (n e-lookup)
  
negative.code:                name))
             (helper (s)
               (format s "~&digraph {~%")
               ;; state labels
               (format s "~:{~&  ~A[label=\"~A\"];~}"
                       (loop for i below (length (fa-states fa))
                            collect (list i (state-label i))))
               ;; start state
               (when (fa-start fa)
                 (format s "~&  start[shape=none];")
                 (format s "~{~&  start -> ~A;~}"
                         (map 'list #'identity
                              (alexandria:ensure-list (fa-start fa)))))
               ;; accept state
               (format s "~{~&  ~A [ shape=doublecircle ];~}"
                       (map 'list #'identity
                            (alexandria:ensure-list (fa-accept fa))))
               (map 'nil (lambda (x)
                           (format s "~&  ~A -> ~A [label=\"~A\"];~%"
                                   (first x) (third x)
                                   (token-label (second x))))
                    (fa-edges fa))
               (format s "~&}~%"))
  