• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
          • Atc
          • Language
            • Abstract-syntax
              • Tyspecseq
                • Tyspecseqp
                • Tyspecseq-fix
                  • Tyspecseq-case
                  • Tyspecseq-equiv
                  • Tyspecseq-sint
                  • Tyspecseq-kind
                  • Tyspecseq-sshort
                  • Tyspecseq-slong
                  • Tyspecseq-sllong
                  • Tyspecseq-ushort
                  • Tyspecseq-union
                  • Tyspecseq-ulong
                  • Tyspecseq-ullong
                  • Tyspecseq-uint
                  • Tyspecseq-typedef
                  • Tyspecseq-struct
                  • Tyspecseq-ldouble
                  • Tyspecseq-float
                  • Tyspecseq-enum
                  • Tyspecseq-double
                  • Tyspecseq-void
                  • Tyspecseq-uchar
                  • Tyspecseq-schar
                  • Tyspecseq-char
                  • Tyspecseq-bool
                • Expr
                • Binop
                • Fileset
                • Obj-declor
                • Ident
                • Iconst
                • Obj-adeclor
                • Const
                • Fundef
                • Unop
                • File
                • Tag-declon
                • Fun-declor
                • Obj-declon
                • Iconst-length
                • Abstract-syntax-operations
                • Label
                • Struct-declon
                • Initer
                • Ext-declon
                • Fun-adeclor
                • Expr-option
                • Iconst-base
                • Initer-option
                • Iconst-option
                • Tyspecseq-option
                • Stmt-option
                • Scspecseq
                • Param-declon
                • Obj-declon-option
                • File-option
                • Tyname
                • Transunit
                • Fun-declon
                • Transunit-result
                • Param-declon-list
                • Struct-declon-list
                • Expr-list
                • Tyspecseq-list
                • Ident-set
                • Ident-list
                • Ext-declon-list
                • Unop-list
                • Tyname-list
                • Fundef-list
                • Fun-declon-list
                • Binop-list
                • Stmt-fixtypes
                • Expr-fixtypes
              • Integer-ranges
              • Implementation-environments
              • Dynamic-semantics
              • Static-semantics
              • Grammar
              • Integer-formats
              • Types
              • Portable-ascii-identifiers
              • Values
              • Integer-operations
              • Computation-states
              • Object-designators
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Bytes
              • Keywords
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • Transformation-tools
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Tyspecseq

    Tyspecseq-fix

    Fixing function for tyspecseq structures.

    Signature
    (tyspecseq-fix x) → new-x
    Arguments
    x — Guard (tyspecseqp x).
    Returns
    new-x — Type (tyspecseqp new-x).

    Definitions and Theorems

    Function: tyspecseq-fix$inline

    (defun tyspecseq-fix$inline (x)
     (declare (xargs :guard (tyspecseqp x)))
     (let ((__function__ 'tyspecseq-fix))
      (declare (ignorable __function__))
      (mbe
       :logic
       (case (tyspecseq-kind x)
        (:void (cons :void (list)))
        (:char (cons :char (list)))
        (:schar (cons :schar (list)))
        (:uchar (cons :uchar (list)))
        (:sshort (b* ((signed (acl2::bool-fix (std::da-nth 0 (cdr x))))
                      (int (acl2::bool-fix (std::da-nth 1 (cdr x)))))
                   (cons :sshort (list signed int))))
        (:ushort (b* ((int (acl2::bool-fix (std::da-nth 0 (cdr x)))))
                   (cons :ushort (list int))))
        (:sint (b* ((signed (acl2::bool-fix (std::da-nth 0 (cdr x))))
                    (int (acl2::bool-fix (std::da-nth 1 (cdr x)))))
                 (let ((signed (if (not int) t signed))
                       (int (if (not signed) t int)))
                   (cons :sint (list signed int)))))
        (:uint (b* ((int (acl2::bool-fix (std::da-nth 0 (cdr x)))))
                 (cons :uint (list int))))
        (:slong (b* ((signed (acl2::bool-fix (std::da-nth 0 (cdr x))))
                     (int (acl2::bool-fix (std::da-nth 1 (cdr x)))))
                  (cons :slong (list signed int))))
        (:ulong (b* ((int (acl2::bool-fix (std::da-nth 0 (cdr x)))))
                  (cons :ulong (list int))))
        (:sllong (b* ((signed (acl2::bool-fix (std::da-nth 0 (cdr x))))
                      (int (acl2::bool-fix (std::da-nth 1 (cdr x)))))
                   (cons :sllong (list signed int))))
        (:ullong (b* ((int (acl2::bool-fix (std::da-nth 0 (cdr x)))))
                   (cons :ullong (list int))))
        (:bool (cons :bool (list)))
        (:float (b* ((complex (acl2::bool-fix (std::da-nth 0 (cdr x)))))
                  (cons :float (list complex))))
        (:double
             (b* ((complex (acl2::bool-fix (std::da-nth 0 (cdr x)))))
               (cons :double (list complex))))
        (:ldouble
             (b* ((complex (acl2::bool-fix (std::da-nth 0 (cdr x)))))
               (cons :ldouble (list complex))))
        (:struct (b* ((tag (ident-fix (std::da-nth 0 (cdr x)))))
                   (cons :struct (list tag))))
        (:union (b* ((tag (ident-fix (std::da-nth 0 (cdr x)))))
                  (cons :union (list tag))))
        (:enum (b* ((tag (ident-fix (std::da-nth 0 (cdr x)))))
                 (cons :enum (list tag))))
        (:typedef (b* ((name (ident-fix (std::da-nth 0 (cdr x)))))
                    (cons :typedef (list name)))))
       :exec x)))

    Theorem: tyspecseqp-of-tyspecseq-fix

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

    Theorem: tyspecseq-fix-when-tyspecseqp

    (defthm tyspecseq-fix-when-tyspecseqp
      (implies (tyspecseqp x)
               (equal (tyspecseq-fix x) x)))

    Function: tyspecseq-equiv$inline

    (defun tyspecseq-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (tyspecseqp acl2::x)
                                  (tyspecseqp acl2::y))))
      (equal (tyspecseq-fix acl2::x)
             (tyspecseq-fix acl2::y)))

    Theorem: tyspecseq-equiv-is-an-equivalence

    (defthm tyspecseq-equiv-is-an-equivalence
      (and (booleanp (tyspecseq-equiv x y))
           (tyspecseq-equiv x x)
           (implies (tyspecseq-equiv x y)
                    (tyspecseq-equiv y x))
           (implies (and (tyspecseq-equiv x y)
                         (tyspecseq-equiv y z))
                    (tyspecseq-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: tyspecseq-equiv-implies-equal-tyspecseq-fix-1

    (defthm tyspecseq-equiv-implies-equal-tyspecseq-fix-1
      (implies (tyspecseq-equiv acl2::x x-equiv)
               (equal (tyspecseq-fix acl2::x)
                      (tyspecseq-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: tyspecseq-fix-under-tyspecseq-equiv

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

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

    (defthm equal-of-tyspecseq-fix-1-forward-to-tyspecseq-equiv
      (implies (equal (tyspecseq-fix acl2::x) acl2::y)
               (tyspecseq-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-tyspecseq-fix-2-forward-to-tyspecseq-equiv

    (defthm equal-of-tyspecseq-fix-2-forward-to-tyspecseq-equiv
      (implies (equal acl2::x (tyspecseq-fix acl2::y))
               (tyspecseq-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: tyspecseq-equiv-of-tyspecseq-fix-1-forward

    (defthm tyspecseq-equiv-of-tyspecseq-fix-1-forward
      (implies (tyspecseq-equiv (tyspecseq-fix acl2::x)
                                acl2::y)
               (tyspecseq-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: tyspecseq-equiv-of-tyspecseq-fix-2-forward

    (defthm tyspecseq-equiv-of-tyspecseq-fix-2-forward
      (implies (tyspecseq-equiv acl2::x (tyspecseq-fix acl2::y))
               (tyspecseq-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: tyspecseq-kind$inline-of-tyspecseq-fix-x

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

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

    (defthm tyspecseq-kind$inline-tyspecseq-equiv-congruence-on-x
      (implies (tyspecseq-equiv x x-equiv)
               (equal (tyspecseq-kind$inline x)
                      (tyspecseq-kind$inline x-equiv)))
      :rule-classes :congruence)