Fixing function for vl-value structures.
(vl-value-fix x) → new-x
Function:
(defun vl-value-fix$inline (x) (declare (xargs :guard (vl-value-p x))) (let ((__function__ 'vl-value-fix)) (declare (ignorable __function__)) (mbe :logic (common-lisp::case (vl-value-kind x) (:vl-constint (b* ((origwidth (pos-fix (std::prod-car (std::prod-car (cdr x))))) (value (nfix (std::prod-cdr (std::prod-car (cdr x))))) (origsign (vl-exprsign-fix (std::prod-car (std::prod-cdr (cdr x))))) (wasunsized (acl2::bool-fix (std::prod-cdr (std::prod-cdr (cdr x)))))) (let ((value (acl2::loghead (pos-fix origwidth) value))) (hons :vl-constint (std::prod-hons (std::prod-hons origwidth value) (std::prod-hons origsign wasunsized)))))) (:vl-weirdint (b* ((bits (vl-bitlist-fix (std::prod-car (cdr x)))) (origsign (vl-exprsign-fix (std::prod-car (std::prod-cdr (cdr x))))) (wasunsized (acl2::bool-fix (std::prod-cdr (std::prod-cdr (cdr x)))))) (let ((bits (vl-bitlist-nonempty-fix bits))) (hons :vl-weirdint (std::prod-hons bits (std::prod-hons origsign wasunsized)))))) (:vl-extint (b* ((value (vl-bit-fix (cdr x)))) (hons :vl-extint value))) (:vl-real (b* ((value (str-fix (cdr x)))) (cons :vl-real value))) (:vl-time (b* ((quantity (str-fix (std::prod-car (cdr x)))) (units (vl-timeunit-fix (std::prod-cdr (cdr x))))) (hons :vl-time (std::prod-hons quantity units)))) (:vl-string (b* ((value (str-fix (cdr x)))) (cons :vl-string value)))) :exec x)))
Theorem:
(defthm vl-value-p-of-vl-value-fix (b* ((new-x (vl-value-fix$inline x))) (vl-value-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm vl-value-fix-when-vl-value-p (implies (vl-value-p x) (equal (vl-value-fix x) x)))
Function:
(defun vl-value-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (vl-value-p acl2::x) (vl-value-p acl2::y)))) (equal (vl-value-fix acl2::x) (vl-value-fix acl2::y)))
Theorem:
(defthm vl-value-equiv-is-an-equivalence (and (booleanp (vl-value-equiv x y)) (vl-value-equiv x x) (implies (vl-value-equiv x y) (vl-value-equiv y x)) (implies (and (vl-value-equiv x y) (vl-value-equiv y z)) (vl-value-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm vl-value-equiv-implies-equal-vl-value-fix-1 (implies (vl-value-equiv acl2::x x-equiv) (equal (vl-value-fix acl2::x) (vl-value-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm vl-value-fix-under-vl-value-equiv (vl-value-equiv (vl-value-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-vl-value-fix-1-forward-to-vl-value-equiv (implies (equal (vl-value-fix acl2::x) acl2::y) (vl-value-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-vl-value-fix-2-forward-to-vl-value-equiv (implies (equal acl2::x (vl-value-fix acl2::y)) (vl-value-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm vl-value-equiv-of-vl-value-fix-1-forward (implies (vl-value-equiv (vl-value-fix acl2::x) acl2::y) (vl-value-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm vl-value-equiv-of-vl-value-fix-2-forward (implies (vl-value-equiv acl2::x (vl-value-fix acl2::y)) (vl-value-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm vl-value-kind$inline-of-vl-value-fix-x (equal (vl-value-kind$inline (vl-value-fix x)) (vl-value-kind$inline x)))
Theorem:
(defthm vl-value-kind$inline-vl-value-equiv-congruence-on-x (implies (vl-value-equiv x x-equiv) (equal (vl-value-kind$inline x) (vl-value-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-vl-value-fix (consp (vl-value-fix x)) :rule-classes :type-prescription)