• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Abnf
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Pfcs
        • Soft
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • C
          • Atc
          • Language
            • Abstract-syntax
            • Integer-ranges
            • Dynamic-semantics
            • Static-semantics
            • Integer-formats
            • Types
              • Type
                • Typep
                • Type-case
                • Type-fix
                  • Type-count
                  • Type-equiv
                  • Type-kind
                  • Type-array
                  • Type-struct
                  • Type-pointer
                  • Type-sint
                  • Type-uchar
                  • Type-void
                  • Type-ushort
                  • Type-ulong
                  • Type-ullong
                  • Type-uint
                  • Type-sshort
                  • Type-slong
                  • Type-sllong
                  • Type-schar
                  • Type-char
                • Type-name-list-to-type-list
                • Tyname-to-type
                • Member-type-list->name-list
                • Type-completep
                • Member-type
                • Member-type-add-first
                • Member-type-add-last
                • Init-type
                • Type-option
                • Member-type-lookup
                • Tyspecseq-to-type
                • Member-type-list-option
                • Type-promoted-arithmeticp
                • Type-list-result
                • Member-type-list-result
                • Integer-type-bits-nulfun
                • Init-type-result
                • Type-result
                • Type-nonchar-integerp
                • Type-nonchar-integer-listp
                • Type-arithmetic-listp
                • Type-integer-listp
                • Integer-type-xdoc-string
                • Integer-type-minbits
                • Type-unsigned-integerp
                • Type-signed-integerp
                • Type-integerp
                • Type-arithmeticp
                • Integer-type-bits
                • Type-scalarp
                • Type-realp
                • Type-list
                • *nonchar-integer-types*
                • Member-type-list
                • Type-set
                • Type-option-set
                • Symbol-type-alist
                • Type-option-list
              • Portable-ascii-identifiers
              • Values
              • Integer-operations
              • Computation-states
              • Object-designators
              • Implementation-environments
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Grammar
              • Bytes
              • Keywords
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • Pack
          • Syntheto
          • File-io-light
          • Number-theory
          • Cryptography
          • Lists-light
          • Json
          • Axe
          • Builtins
          • Solidity
          • Std-extensions
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Type

    Type-fix

    Fixing function for type structures.

    Signature
    (type-fix x) → new-x
    Arguments
    x — Guard (typep x).
    Returns
    new-x — Type (typep new-x).

    Definitions and Theorems

    Function: type-fix$inline

    (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: typep-of-type-fix

    (defthm typep-of-type-fix
      (b* ((new-x (type-fix$inline x)))
        (typep new-x))
      :rule-classes :rewrite)

    Theorem: type-fix-when-typep

    (defthm type-fix-when-typep
      (implies (typep x)
               (equal (type-fix x) x)))

    Function: type-equiv$inline

    (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: type-equiv-is-an-equivalence

    (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: type-equiv-implies-equal-type-fix-1

    (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: type-fix-under-type-equiv

    (defthm type-fix-under-type-equiv
      (type-equiv (type-fix acl2::x) acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-type-fix-1-forward-to-type-equiv

    (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: equal-of-type-fix-2-forward-to-type-equiv

    (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: type-equiv-of-type-fix-1-forward

    (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: type-equiv-of-type-fix-2-forward

    (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: type-kind$inline-of-type-fix-x

    (defthm type-kind$inline-of-type-fix-x
      (equal (type-kind$inline (type-fix x))
             (type-kind$inline x)))

    Theorem: type-kind$inline-type-equiv-congruence-on-x

    (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: consp-of-type-fix

    (defthm consp-of-type-fix
      (consp (type-fix x))
      :rule-classes :type-prescription)