• 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
        • Bv
        • Imp-language
        • Event-macros
        • Java
          • Atj
            • Atj-implementation
              • Atj-types
              • Atj-java-primitive-array-model
                • Atj-def-java-primitive-array-model
                • Short-array
                • Long-array
                • Int-array
                • Char-array
                • Byte-array
                  • Byte-array-fix
                    • Byte-array-equiv
                    • Make-byte-array
                    • Byte-array->components
                    • Byte-arrayp
                    • Change-byte-array
                  • Boolean-array
                  • Float-array
                  • Double-array
                  • Byte-array-to-sbyte8-list
                  • Short-array-to-sbyte16-list
                  • Long-array-to-sbyte64-list
                  • Int-array-to-sbyte32-list
                  • Char-array-to-ubyte16-list
                  • Boolean-array-to-boolean-list
                  • Double-array-write
                  • Boolean-array-write
                  • Short-array-write
                  • Short-array-from-sbyte16-list
                  • Long-array-write
                  • Int-array-write
                  • Float-array-write
                  • Char-array-write
                  • Char-array-from-ubyte16-list
                  • Byte-array-write
                  • Byte-array-from-sbyte8-list
                  • Boolean-array-from-boolean-list
                  • Long-array-from-sbyte64-list
                  • Int-array-from-sbyte32-list
                  • Short-array-new-init
                  • Double-array-index-in-range-p
                  • Byte-array-new-init
                  • Boolean-array-new-init
                  • Boolean-array-index-in-range-p
                  • Short-array-new-len
                  • Short-array-index-in-range-p
                  • Long-array-new-len
                  • Long-array-new-init
                  • Long-array-index-in-range-p
                  • Int-array-new-init
                  • Int-array-index-in-range-p
                  • Float-array-new-len
                  • Float-array-index-in-range-p
                  • Double-array-new-len
                  • Char-array-new-len
                  • Char-array-new-init
                  • Char-array-index-in-range-p
                  • Byte-array-new-len
                  • Byte-array-index-in-range-p
                  • Boolean-array-new-len
                  • Short-array-read
                  • Long-array-read
                  • Int-array-new-len
                  • Float-array-read
                  • Float-array-new-init
                  • Double-array-read
                  • Double-array-new-init
                  • Char-array-read
                  • Byte-array-read
                  • Boolean-array-read
                  • Int-array-read
                  • Short-array-length
                  • Float-array-length
                  • Double-array-length
                  • Boolean-array-length
                  • Long-array-length
                  • Int-array-length
                  • Char-array-length
                  • Byte-array-length
                • Atj-java-abstract-syntax
                • Atj-input-processing
                • Atj-java-pretty-printer
                • Atj-code-generation
                • Atj-java-primitives
                • Atj-java-primitive-arrays
                • Atj-type-macros
                • Atj-java-syntax-operations
                • Atj-fn
                • Atj-library-extensions
                • Atj-java-input-types
                • Atj-test-structures
                • Aij-notions
                • Atj-macro-definition
              • Atj-tutorial
            • Aij
            • Language
          • 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
    • Byte-array

    Byte-array-fix

    Fixing function for byte-array structures.

    Signature
    (byte-array-fix x) → new-x
    Arguments
    x — Guard (byte-arrayp x).
    Returns
    new-x — Type (byte-arrayp new-x).

    Definitions and Theorems

    Function: byte-array-fix$inline

    (defun byte-array-fix$inline (x)
     (declare (xargs :guard (byte-arrayp x)))
     (let ((__function__ 'byte-array-fix))
      (declare (ignorable __function__))
      (mbe
        :logic
        (b* ((components (byte-value-list-fix (std::da-nth 0 (cdr x)))))
          (let ((components (if (< (len components) (expt 2 31))
                                components
                              nil)))
            (cons :byte-array (list components))))
        :exec x)))

    Theorem: byte-arrayp-of-byte-array-fix

    (defthm byte-arrayp-of-byte-array-fix
      (b* ((new-x (byte-array-fix$inline x)))
        (byte-arrayp new-x))
      :rule-classes :rewrite)

    Theorem: byte-array-fix-when-byte-arrayp

    (defthm byte-array-fix-when-byte-arrayp
      (implies (byte-arrayp x)
               (equal (byte-array-fix x) x)))

    Function: byte-array-equiv$inline

    (defun byte-array-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (byte-arrayp acl2::x)
                                  (byte-arrayp acl2::y))))
      (equal (byte-array-fix acl2::x)
             (byte-array-fix acl2::y)))

    Theorem: byte-array-equiv-is-an-equivalence

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

    Theorem: byte-array-equiv-implies-equal-byte-array-fix-1

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

    Theorem: byte-array-fix-under-byte-array-equiv

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

    Theorem: equal-of-byte-array-fix-1-forward-to-byte-array-equiv

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

    Theorem: equal-of-byte-array-fix-2-forward-to-byte-array-equiv

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

    Theorem: byte-array-equiv-of-byte-array-fix-1-forward

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

    Theorem: byte-array-equiv-of-byte-array-fix-2-forward

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