Non-optimized conversion from sexprs into faigs.
This is a straightforward, non-optimizing conversion where we just
use the
Function:
(defun 4v-sexpr-to-faig-plain (x onoff) (declare (xargs :guard t)) (b* (((when (atom x)) (if x (let ((look (hons-get x onoff))) (if (consp (cdr look)) (cdr look) (faig-x))) (faig-x))) (fn (car x))) (mbe :logic (4v-sexpr-to-faig-apply fn (4v-sexpr-to-faig-plain-list (cdr x) onoff)) :exec (b* (((when (eq fn (4vt))) (faig-t)) ((when (eq fn (4vf))) (faig-f)) ((when (eq fn (4vz))) (faig-z)) ((when (eq fn (4vx))) (faig-x)) (args (4v-sexpr-to-faig-plain-list (cdr x) onoff)) (arg1 (4v-first args)) (arg2 (4v-second args)) (arg3 (4v-third args))) (case fn (not (f-aig-not arg1)) (and (f-aig-and arg1 arg2)) (xor (f-aig-xor arg1 arg2)) (iff (f-aig-iff arg1 arg2)) (or (f-aig-or arg1 arg2)) (ite* (f-aig-ite* arg1 arg2 arg3)) (zif (f-aig-zif arg1 arg2 arg3)) (buf (f-aig-unfloat arg1)) (xdet (f-aig-xdet arg1)) (res (f-aig-res arg1 arg2)) (tristate (t-aig-tristate arg1 arg2)) (ite (f-aig-ite arg1 arg2 arg3)) (pullup (f-aig-pullup arg1)) (id (faig-fix arg1)) (otherwise (faig-x)))))))
Function:
(defun 4v-sexpr-to-faig-plain-list (x onoff) (declare (xargs :guard t)) (if (atom x) nil (cons (4v-sexpr-to-faig-plain (car x) onoff) (4v-sexpr-to-faig-plain-list (cdr x) onoff))))
Function:
(defun 4v-sexpr-to-faig-plain-memoize-condition (x onoff) (declare (ignorable x onoff) (xargs :guard 't)) (and (consp x) (consp (cdr x))))
Theorem:
(defthm consp-4v-sexpr-to-faig-plain (consp (4v-sexpr-to-faig-plain x al)) :rule-classes :type-prescription)
Theorem:
(defthm alistp-4v-sexpr-to-faig-plain-list (alistp (4v-sexpr-to-faig-plain-list x al)))
Theorem:
(defthm faig-eval-4v-sexpr-to-faig-plain (let ((4v-env (faig-const-alist->4v-alist (faig-eval-alist onoff env)))) (equal (faig-eval (4v-sexpr-to-faig-plain x onoff) env) (4v->faig-const (4v-sexpr-eval x 4v-env)))))
Theorem:
(defthm faig-eval-4v-sexpr-to-faig-plain-list (let ((4v-env (faig-const-alist->4v-alist (faig-eval-alist onoff env)))) (equal (faig-eval-list (4v-sexpr-to-faig-plain-list x onoff) env) (4v-list->faig-const-list (4v-sexpr-eval-list x 4v-env)))))