Fixing function for literal structures.
Function:
(defun literal-fix$inline (x) (declare (xargs :guard (literalp x))) (let ((__function__ 'literal-fix)) (declare (ignorable __function__)) (mbe :logic (case (literal-kind x) (:integer (b* ((get (integer-literal-fix (std::da-nth 0 (cdr x))))) (cons :integer (list get)))) (:fpoint (b* ((get (floating-point-literal-fix (std::da-nth 0 (cdr x))))) (cons :fpoint (list get)))) (:char (b* ((get (char-literal-fix (std::da-nth 0 (cdr x))))) (cons :char (list get)))) (:string (b* ((get (string-literal-fix (std::da-nth 0 (cdr x))))) (cons :string (list get)))) (:boolean (b* ((get (acl2::bool-fix (std::da-nth 0 (cdr x))))) (cons :boolean (list get)))) (:null (cons :null (list)))) :exec x)))
Theorem:
(defthm literalp-of-literal-fix (b* ((new-x (literal-fix$inline x))) (literalp new-x)) :rule-classes :rewrite)
Theorem:
(defthm literal-fix-when-literalp (implies (literalp x) (equal (literal-fix x) x)))
Function:
(defun literal-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (literalp acl2::x) (literalp acl2::y)))) (equal (literal-fix acl2::x) (literal-fix acl2::y)))
Theorem:
(defthm literal-equiv-is-an-equivalence (and (booleanp (literal-equiv x y)) (literal-equiv x x) (implies (literal-equiv x y) (literal-equiv y x)) (implies (and (literal-equiv x y) (literal-equiv y z)) (literal-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm literal-equiv-implies-equal-literal-fix-1 (implies (literal-equiv acl2::x x-equiv) (equal (literal-fix acl2::x) (literal-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm literal-fix-under-literal-equiv (literal-equiv (literal-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-literal-fix-1-forward-to-literal-equiv (implies (equal (literal-fix acl2::x) acl2::y) (literal-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-literal-fix-2-forward-to-literal-equiv (implies (equal acl2::x (literal-fix acl2::y)) (literal-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm literal-equiv-of-literal-fix-1-forward (implies (literal-equiv (literal-fix acl2::x) acl2::y) (literal-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm literal-equiv-of-literal-fix-2-forward (implies (literal-equiv acl2::x (literal-fix acl2::y)) (literal-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm literal-kind$inline-of-literal-fix-x (equal (literal-kind$inline (literal-fix x)) (literal-kind$inline x)))
Theorem:
(defthm literal-kind$inline-literal-equiv-congruence-on-x (implies (literal-equiv x x-equiv) (equal (literal-kind$inline x) (literal-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-literal-fix (consp (literal-fix x)) :rule-classes :type-prescription)