Update the |AIGNET|::|LEVEL| field of a gatesimp bit structure.
(!gatesimp->level level x) → new-x
Function:
(defun !gatesimp->level (level x) (declare (xargs :guard (and (gatesimp-level-p level) (gatesimp-p x)))) (mbe :logic (b* ((level (mbe :logic (gatesimp-level-fix level) :exec level)) (x (gatesimp-fix x))) (part-install level x :width 3 :low 1)) :exec (the (unsigned-byte 6) (logior (the (unsigned-byte 6) (logand (the (unsigned-byte 6) x) (the (signed-byte 5) -15))) (the (unsigned-byte 4) (ash (the (unsigned-byte 3) level) 1))))))
Theorem:
(defthm gatesimp-p-of-!gatesimp->level (b* ((new-x (!gatesimp->level level x))) (gatesimp-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm !gatesimp->level-of-gatesimp-level-fix-level (equal (!gatesimp->level (gatesimp-level-fix level) x) (!gatesimp->level level x)))
Theorem:
(defthm !gatesimp->level-gatesimp-level-equiv-congruence-on-level (implies (gatesimp-level-equiv level level-equiv) (equal (!gatesimp->level level x) (!gatesimp->level level-equiv x))) :rule-classes :congruence)
Theorem:
(defthm !gatesimp->level-of-gatesimp-fix-x (equal (!gatesimp->level level (gatesimp-fix x)) (!gatesimp->level level x)))
Theorem:
(defthm !gatesimp->level-gatesimp-equiv-congruence-on-x (implies (gatesimp-equiv x x-equiv) (equal (!gatesimp->level level x) (!gatesimp->level level x-equiv))) :rule-classes :congruence)
Theorem:
(defthm !gatesimp->level-is-gatesimp (equal (!gatesimp->level level x) (change-gatesimp x :level level)))
Theorem:
(defthm gatesimp->level-of-!gatesimp->level (b* ((?new-x (!gatesimp->level level x))) (equal (gatesimp->level new-x) (gatesimp-level-fix level))))
Theorem:
(defthm !gatesimp->level-equiv-under-mask (b* ((?new-x (!gatesimp->level level x))) (gatesimp-equiv-under-mask new-x x -15)))