• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
          • Defbyte
          • Defresult
          • Fold
          • Specific-types
          • Defsubtype
          • Defset
          • Defflatsum
          • Deflist-of-len
          • Pos-list
          • Defomap
          • Defbytelist
          • Defbyte-standard-instances
          • Deffixtype-alias
          • Defbytelist-standard-instances
          • Defunit
          • Byte-list
            • Byte-listp
            • Byte-list-fix
              • Byte-list20
              • Byte-list32
              • Byte-list64
              • Byte-list-equiv
            • Database
            • Byte
              • Byte-list
                • Byte-listp
                • Byte-list-fix
                  • Byte-list20
                  • Byte-list32
                  • Byte-list64
                  • Byte-list-equiv
                • Byte-fix
                • Bytep-additional-theorems
              • String-option
              • Pos-option
              • Nibble
              • Nat-option
              • Ubyte32-option
              • Byte-list20
              • Byte-list32
              • Byte-list64
              • Pseudo-event-form
              • Natoption/natoptionlist
              • Nati
              • Character-list
              • Nat/natlist
              • Maybe-string
              • Nibble-list
              • Natoption/natoptionlist-result
              • Nat/natlist-result
              • Nat-option-list-result
              • Set
              • String-result
              • String-list-result
              • Nat-result
              • Nat-option-result
              • Nat-list-result
              • Maybe-string-result
              • Integer-result
              • Character-result
              • Character-list-result
              • Boolean-result
              • Map
              • Dependencies
              • Bag
              • Pos-set
              • Hex-digit-char-list
              • Dec-digit-char-list
              • Pseudo-event-form-list
              • Nat-option-list
              • Character-any-map
              • Any-nat-map
              • Symbol-set
              • String-set
              • Nat-set
              • Character-set
              • Oct-digit-char-list
              • Bin-digit-char-list
              • Bit-list
            • Isar
            • Kestrel-utilities
            • Set
            • C
            • Soft
            • Bv
            • Imp-language
            • Ethereum
            • Event-macros
            • Java
            • Riscv
            • Bitcoin
            • Zcash
            • Yul
            • ACL2-programming-language
            • Prime-fields
            • Json
            • Syntheto
            • File-io-light
            • Cryptography
            • Number-theory
            • Axe
            • Lists-light
            • Builtins
            • Solidity
            • Helpers
            • Htclient
            • Typed-lists-light
            • Arithmetic-light
          • X86isa
          • Axe
          • Execloader
        • Math
        • Testing-utilities
      • Byte-list

      Byte-list-fix

      (byte-list-fix x) is a usual fty list fixing function.

      Signature
      (byte-list-fix x) → fty::newx
      Arguments
      x — Guard (byte-listp x).
      Returns
      fty::newx — Type (byte-listp fty::newx).

      In the logic, we apply byte-fix to each member of the x. In the execution, none of that is actually necessary and this is just an inlined identity function.

      Definitions and Theorems

      Function: byte-list-fix$inline

      (defun byte-list-fix$inline (x)
        (declare (xargs :guard (byte-listp x)))
        (let ((__function__ 'byte-list-fix))
          (declare (ignorable __function__))
          (mbe :logic
               (if (atom x)
                   nil
                 (cons (byte-fix (car x))
                       (byte-list-fix (cdr x))))
               :exec x)))

      Theorem: byte-listp-of-byte-list-fix

      (defthm byte-listp-of-byte-list-fix
        (b* ((fty::newx (byte-list-fix$inline x)))
          (byte-listp fty::newx))
        :rule-classes :rewrite)

      Theorem: byte-list-fix-when-byte-listp

      (defthm byte-list-fix-when-byte-listp
        (implies (byte-listp x)
                 (equal (byte-list-fix x) x)))

      Function: byte-list-equiv$inline

      (defun byte-list-equiv$inline (x y)
        (declare (xargs :guard (and (byte-listp x) (byte-listp y))))
        (equal (byte-list-fix x)
               (byte-list-fix y)))

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

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

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

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

      Theorem: byte-list-fix-under-byte-list-equiv

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

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

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

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

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

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

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

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

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

      Theorem: car-of-byte-list-fix-x-under-byte-equiv

      (defthm car-of-byte-list-fix-x-under-byte-equiv
        (byte-equiv (car (byte-list-fix x))
                    (car x)))

      Theorem: car-byte-list-equiv-congruence-on-x-under-byte-equiv

      (defthm car-byte-list-equiv-congruence-on-x-under-byte-equiv
        (implies (byte-list-equiv x x-equiv)
                 (byte-equiv (car x) (car x-equiv)))
        :rule-classes :congruence)

      Theorem: cdr-of-byte-list-fix-x-under-byte-list-equiv

      (defthm cdr-of-byte-list-fix-x-under-byte-list-equiv
        (byte-list-equiv (cdr (byte-list-fix x))
                         (cdr x)))

      Theorem: cdr-byte-list-equiv-congruence-on-x-under-byte-list-equiv

      (defthm cdr-byte-list-equiv-congruence-on-x-under-byte-list-equiv
        (implies (byte-list-equiv x x-equiv)
                 (byte-list-equiv (cdr x) (cdr x-equiv)))
        :rule-classes :congruence)

      Theorem: cons-of-byte-fix-x-under-byte-list-equiv

      (defthm cons-of-byte-fix-x-under-byte-list-equiv
        (byte-list-equiv (cons (byte-fix x) y)
                         (cons x y)))

      Theorem: cons-byte-equiv-congruence-on-x-under-byte-list-equiv

      (defthm cons-byte-equiv-congruence-on-x-under-byte-list-equiv
        (implies (byte-equiv x x-equiv)
                 (byte-list-equiv (cons x y)
                                  (cons x-equiv y)))
        :rule-classes :congruence)

      Theorem: cons-of-byte-list-fix-y-under-byte-list-equiv

      (defthm cons-of-byte-list-fix-y-under-byte-list-equiv
        (byte-list-equiv (cons x (byte-list-fix y))
                         (cons x y)))

      Theorem: cons-byte-list-equiv-congruence-on-y-under-byte-list-equiv

      (defthm cons-byte-list-equiv-congruence-on-y-under-byte-list-equiv
        (implies (byte-list-equiv y y-equiv)
                 (byte-list-equiv (cons x y)
                                  (cons x y-equiv)))
        :rule-classes :congruence)

      Theorem: consp-of-byte-list-fix

      (defthm consp-of-byte-list-fix
        (equal (consp (byte-list-fix x))
               (consp x)))

      Theorem: byte-list-fix-under-iff

      (defthm byte-list-fix-under-iff
        (iff (byte-list-fix x) (consp x)))

      Theorem: byte-list-fix-of-cons

      (defthm byte-list-fix-of-cons
        (equal (byte-list-fix (cons a x))
               (cons (byte-fix a) (byte-list-fix x))))

      Theorem: len-of-byte-list-fix

      (defthm len-of-byte-list-fix
        (equal (len (byte-list-fix x)) (len x)))

      Theorem: byte-list-fix-of-append

      (defthm byte-list-fix-of-append
        (equal (byte-list-fix (append std::a std::b))
               (append (byte-list-fix std::a)
                       (byte-list-fix std::b))))

      Theorem: byte-list-fix-of-repeat

      (defthm byte-list-fix-of-repeat
        (equal (byte-list-fix (repeat n x))
               (repeat n (byte-fix x))))

      Theorem: list-equiv-refines-byte-list-equiv

      (defthm list-equiv-refines-byte-list-equiv
        (implies (list-equiv x y)
                 (byte-list-equiv x y))
        :rule-classes :refinement)

      Theorem: nth-of-byte-list-fix

      (defthm nth-of-byte-list-fix
        (equal (nth n (byte-list-fix x))
               (if (< (nfix n) (len x))
                   (byte-fix (nth n x))
                 nil)))

      Theorem: byte-list-equiv-implies-byte-list-equiv-append-1

      (defthm byte-list-equiv-implies-byte-list-equiv-append-1
        (implies (byte-list-equiv x fty::x-equiv)
                 (byte-list-equiv (append x y)
                                  (append fty::x-equiv y)))
        :rule-classes (:congruence))

      Theorem: byte-list-equiv-implies-byte-list-equiv-append-2

      (defthm byte-list-equiv-implies-byte-list-equiv-append-2
        (implies (byte-list-equiv y fty::y-equiv)
                 (byte-list-equiv (append x y)
                                  (append x fty::y-equiv)))
        :rule-classes (:congruence))

      Theorem: byte-list-equiv-implies-byte-list-equiv-nthcdr-2

      (defthm byte-list-equiv-implies-byte-list-equiv-nthcdr-2
        (implies (byte-list-equiv l l-equiv)
                 (byte-list-equiv (nthcdr n l)
                                  (nthcdr n l-equiv)))
        :rule-classes (:congruence))

      Theorem: byte-list-equiv-implies-byte-list-equiv-take-2

      (defthm byte-list-equiv-implies-byte-list-equiv-take-2
        (implies (byte-list-equiv l l-equiv)
                 (byte-list-equiv (take n l)
                                  (take n l-equiv)))
        :rule-classes (:congruence))