anchor.diff:         do (push q1 (aref move q0 z)))
       (lambda (i-state i-token) (aref move i-state i-token))))
   
  +(defun fa-inv-mover (fa)
  +  (let ((move (make-array (list (length (fa-states fa)) (length (fa-tokens fa)))
  +                          :initial-element nil)))
  +    (loop for (q0 z q1) in (fa-edges fa)
  +       do (push q0 (aref move q1 z)))
  +    (lambda (i-state i-token) (aref move i-state i-token))))
   
   (defun fa-dot (fa &optional output )
     "Graphviz output of dfa.
  
positive.code:        (with-output-to-string (s)
           (helper s))))))
  
  
  
  ;;; Regex
  
negative.code:                   when (intersection q (fa-accept nfa))
                    collect i)))))
  
  ;; Brzozowski's Algorithm
  (defun dfa-minimize-brzozowski (dfa)
    (nfa->dfa (fa-reverse (nfa->dfa (fa-reverse dfa)))))
  
  ;; Hopcroft's Algorithm
  (defun dfa-minimize-hopcroft (dfa)
    (let ((p (list (fa-accept dfa)
                   (set-difference (map 'list #'identity (fa-states dfa))
                                   (fa-accept dfa))))
          (q (list (fa-accept dfa)))
          (imover (fa-inv-mover dfa))
          (mover (fa-mover dfa)))
      (loop while q
         for a = (pop q)
         do (loop for c below (length (fa-tokens dfa))
               for x = (reduce (lambda (x i-q)
                                 (union x (funcall imover i-q c)))
                               a :initial-value nil)
               when x
               do
                 (setq p (mapcan (lambda (y)
                                   (if (and (intersection y x)
                                            (cdr y))
                                       (let ((i (intersection y x))
                                             (j (set-difference y x)))
                                         ;; i is smaller
                                         (when (< (length j) (length i))
                                           (psetq i j
                                                  j i))
                                         (assert (and j i))
                                         (when (find y q :test #'equal)
                                             (remove y q :test #'equal)
                                             (push j q))
                                         (push i q)
                                         (list i j))
                                       (list y)))
                                 p))))
  
      (let ((edges))
        (loop for ds in p
           for i-q from 0
           do (loop
                 for i-z from 0 below (length (fa-tokens dfa))
                 for q-next = (funcall mover (car ds) i-z)
                 when q-next
                 do (push (list i-q
                                (aref (fa-tokens dfa) i-z)
                                (position-if (lambda (q) (find (car q-next) q))
                                             p))
                          edges)))
        (make-fa edges
                 (loop ; start
                    for q in p
                    for i from 0
                    when (intersection q (fa-start dfa))
                    collect i)
                 (loop ; accept
                    for q in p
                    for i from 0
                    when (intersection q (fa-accept dfa))
                    collect i)))))
  
  
  ;; (defun nfa-e-close (n e-lookup)
  