anchor.diff:  	(let* ((v (psr-var-maior-grau p))
   	       (d (psr-variavel-dominio p v)))
   
  -;	  (when DEBUG (format t "Escolhi a variavel:~a cujo dominio e:~a~%" v (psr-variavel-dominio p v)))
   	  (dolist (valor d)
   	    (multiple-value-bind (consistente testes) (psr-atribuicao-consistente-p p v valor)
   	      (incf testes-total testes)
  -;	      (when DEBUG (format t "Fiz ~a testes de consistencia. O total vai em:~a~%" testes testes-total))
   	      (when consistente
  -;		(when DEBUG (format t "Atribuindo o valor:~a a variavel:~a~%" valor v))
   		(psr-adiciona-atribuicao! p v valor)
  -
  -;		(when DEBUG
  -;		  (format DEBUG "Depois da atribuicao~%")
  -;		  (desenha-fill-a-pix (psr->fill-a-pix p LC LC)))
   
   		(multiple-value-bind (recurs-consistente recurs-testes) (procura-retrocesso-grau p)
   		  (incf testes-total recurs-testes)
  -;		  (when DEBUG
  -;		    (format t "Somando os ~a desta iteracao com os ~a que vem de tras fica:~a~%" testes recurs-testes testes-total))
  +
   		  (when (not (null recurs-consistente))
   		    (return-from procura-retrocesso-grau (values p testes-total))))
   
  -		(psr-remove-atribuicao! p v)
  -;		(when DEBUG
  -;		  (print "Removendo a atribuicao:")
  -;		  (desenha-fill-a-pix (psr->fill-a-pix p LC LC)))
  -		)))
  +		(psr-remove-atribuicao! p v))))
   	  (return-from procura-retrocesso-grau (values nil testes-total))))))
   
   
  
positive.code:     (return-from psr-forward-checking (values inferencias testes-totais))))
  
  
  ;(defun psr-arcos-vizinhos-nao-atribuidos (p v)
  ;  ""
  ;  (let ((lista-arcos (list))) ; lista vs vector?
  ;    (dolist (v-na (psr-variaveis-nao-atribuidas p))
  ;      (when (not (equal v v-na))
  ;	(when (some #'(lambda (r) (find r (psr-variavel-restricoes p v-na)))
  ;		    (psr-variavel-restricoes p v))
  ;	  (push (cons v-na v) lista-arcos))))
  ;    (nreverse lista-arcos)))
  
  
  (defun psr-arcos-vizinhos-nao-atribuidos2 (p v)
    ""
    (let ((lista-arcos (list))
  	(envolvidas (remove-duplicates (reduce #'append (psr-variavel-restricoes p v) ; TODO: rever
  					       :key 'restricao-variaveis)
  				       :test 'equal)))
  ;    (format t "A variavel ~a tem estas restricoes:~a~%" v (psr-variavel-restricoes p v))
  ;    (format t "PAVNA: v:~a~%restricoes:~a~%envolvidas:~a~%" v (psr-variavel-restricoes p v) envolvidas)
  ;    (format t "PAVNA: var-natribuidas:~a~%" (psr-variaveis-nao-atribuidas p))
      (dolist (v-na (psr-variaveis-nao-atribuidas p))
        (when (not (equal v v-na))
  	(when (find v-na envolvidas :test 'equal)
  	  (push (cons v-na v) lista-arcos))))
  
      (nreverse lista-arcos)))
  
  
  ;; (defun psr-revise (p x y inferencias)
  ;;   ""
  ;;   (let* ((testes-total 0)
  ;; 	 (revised nil)
  ;; 	 (dominio-x (gethash x inferencias (psr-variavel-dominio p x)))
  ;; 	 (novo-dominio-x dominio-x)
  ;; 	 (dominio-y (if (psr-variavel-atribuida-p p y)
  ;; 			(psr-variavel-dominio p y)
  ;; 			(gethash y inferencias (psr-variavel-dominio p y)))))
  
  ;;     (dolist (valor-x dominio-x)
  ;;       (when (dolist (valor-y dominio-y t)
  ;; 	      (multiple-value-bind (consistente testes)
  ;; 		  (psr-atribuicoes-consistentes-arco-p p x valor-x y valor-y)
  ;; 		(incf testes-total testes)
  ;; 		(when consistente (return nil))))
  ;; 	(setf revised t)
  ;; 	(setf novo-dominio-x (remove valor-x novo-dominio-x))))
  
  ;;     (when revised
  ;;       (setf (gethash x inferencias) novo-dominio-x)) ; TODO: sobrepor?
  
  ;;     (values revised testes-total)))
  
  
  (defun psr-revise2 (p x y inferencias)
  
negative.code:       (when (= (aref (fapix-hv f) ipix) 1)
  	(setf d (reverse d))))
  
      (dolist (cor d)
        (fapix-adiciona-atribuicao! f ipix cor)
        (setf (fapix-natribuidos f) (remove ipix (fapix-natribuidos f)))
        (setf (aref (fapix-dominio-len f) (length d))
  	    (remove ipix (aref (fapix-dominio-len f) (length d))))
  
        (let ((inferencias (fapix-forward-checking f ipix)))
  	(when inferencias
  	  (let ((backup (make-hash-table :test 'eql)))
  	    (maphash #'(lambda (iipix id)
  			 (setf (gethash iipix backup) (fapix-pix-dominio f iipix))
  			 (fapix-altera-dominio! f iipix id))
  		     inferencias)
  
  	    (multiple-value-bind (resultado) (procura-retrocesso-fc-mrv-fapix f)
  	      (when resultado
  		(return-from procura-retrocesso-fc-mrv-fapix (values resultado 0))))
  
  	    (maphash #'(lambda (bipix bd)
  			 (fapix-altera-dominio! f bipix bd))
  		     backup)))
  
  	(fapix-remove-atribuicao! f ipix)
  	(push ipix (fapix-natribuidos f))
  	(push ipix (aref (fapix-dominio-len f) (length d))))))
  
    (return-from procura-retrocesso-fc-mrv-fapix (values nil 0)))
  
  (defun procura-retrocesso-mac-mrv-fapix (f)
    ""
    (when (fapix-completo-p f)
      (return-from procura-retrocesso-mac-mrv-fapix (values f 0)))
  
    (let* ((ipix (fapix-mrv f))
  	 (d (fapix-pix-dominio f ipix)))
  
      (when (= (length d) 2)
        (when (= (aref (fapix-hv f) ipix) 1)
  	(setf d (reverse d))))
  
      (dolist (cor d)
        (fapix-adiciona-atribuicao! f ipix cor)
        (setf (fapix-natribuidos f) (remove ipix (fapix-natribuidos f)))
  
        (setf (aref (fapix-dominio-len f) (length d))
  	    (remove ipix (aref (fapix-dominio-len f) (length d))))
  
        (let ((inferencias (fapix-mac f ipix)))
  
  	(when inferencias
  	  (let ((backup (make-hash-table :test 'eql)))
  	    (maphash #'(lambda (iipix id)
  			 (setf (gethash iipix backup) (fapix-pix-dominio f iipix))
  			 (fapix-altera-dominio! f iipix id))
  		     inferencias)
  
  	    (multiple-value-bind (resultado) (procura-retrocesso-mac-mrv-fapix f)
  	      (when resultado
  		(return-from procura-retrocesso-mac-mrv-fapix (values resultado 0))))
  
  	    (maphash #'(lambda (bipix bd)
  			 (fapix-altera-dominio! f bipix bd))
  		     backup)))
  
  	(fapix-remove-atribuicao! f ipix)
  	(push ipix (fapix-natribuidos f))
  	(push ipix (aref (fapix-dominio-len f) (length d))))))
  
      (return-from procura-retrocesso-mac-mrv-fapix (values nil 0)))
  
  