Fixing function for type structures.
Function:
(defun type-fix$inline (x) (declare (xargs :guard (typep x))) (let ((__function__ 'type-fix)) (declare (ignorable __function__)) (mbe :logic (case (type-kind x) (:void (cons :void (list))) (:char (cons :char (list))) (:schar (cons :schar (list))) (:uchar (cons :uchar (list))) (:sshort (cons :sshort (list))) (:ushort (cons :ushort (list))) (:sint (cons :sint (list))) (:uint (cons :uint (list))) (:slong (cons :slong (list))) (:ulong (cons :ulong (list))) (:sllong (cons :sllong (list))) (:ullong (cons :ullong (list))) (:struct (b* ((tag (ident-fix (std::da-nth 0 (cdr x))))) (cons :struct (list tag)))) (:pointer (b* ((to (type-fix (std::da-nth 0 (cdr x))))) (cons :pointer (list to)))) (:array (b* ((of (type-fix (std::da-nth 0 (cdr x)))) (size (acl2::pos-option-fix (std::da-nth 1 (cdr x))))) (cons :array (list of size))))) :exec x)))
Theorem:
(defthm typep-of-type-fix (b* ((new-x (type-fix$inline x))) (typep new-x)) :rule-classes :rewrite)
Theorem:
(defthm type-fix-when-typep (implies (typep x) (equal (type-fix x) x)))
Function:
(defun type-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (typep acl2::x) (typep acl2::y)))) (equal (type-fix acl2::x) (type-fix acl2::y)))
Theorem:
(defthm type-equiv-is-an-equivalence (and (booleanp (type-equiv x y)) (type-equiv x x) (implies (type-equiv x y) (type-equiv y x)) (implies (and (type-equiv x y) (type-equiv y z)) (type-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm type-equiv-implies-equal-type-fix-1 (implies (type-equiv acl2::x x-equiv) (equal (type-fix acl2::x) (type-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm type-fix-under-type-equiv (type-equiv (type-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-type-fix-1-forward-to-type-equiv (implies (equal (type-fix acl2::x) acl2::y) (type-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-type-fix-2-forward-to-type-equiv (implies (equal acl2::x (type-fix acl2::y)) (type-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm type-equiv-of-type-fix-1-forward (implies (type-equiv (type-fix acl2::x) acl2::y) (type-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm type-equiv-of-type-fix-2-forward (implies (type-equiv acl2::x (type-fix acl2::y)) (type-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm type-kind$inline-of-type-fix-x (equal (type-kind$inline (type-fix x)) (type-kind$inline x)))
Theorem:
(defthm type-kind$inline-type-equiv-congruence-on-x (implies (type-equiv x x-equiv) (equal (type-kind$inline x) (type-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-type-fix (consp (type-fix x)) :rule-classes :type-prescription)