• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
          • Defbyte
          • Defresult
          • Fold
          • Defsubtype
          • Specific-types
          • Defset
          • Defflatsum
          • Deflist-of-len
          • Pos-list
          • Defbytelist
          • Defomap
          • Defbyte-standard-instances
          • Deffixtype-alias
          • Defbytelist-standard-instances
            • Ubyte8-list
            • Ubyte4-list
            • Ubyte32-list
              • Ubyte32-list-fix
                • Ubyte32-list-equiv
                • Ubyte32-listp
              • Ubyte256-list
              • Ubyte128-list
              • Ubyte64-list
              • Ubyte3-list
              • Ubyte2-list
              • Ubyte16-list
              • Ubyte11-list
              • Ubyte1-list
              • Sbyte8-list
              • Sbyte64-list
              • Sbyte4-list
              • Sbyte32-list
              • Sbyte3-list
              • Sbyte256-list
              • Sbyte2-list
              • Sbyte16-list
              • Sbyte128-list
              • Sbyte1-list
              • Defubytelist
              • Defsbytelist
            • Defunit
            • Byte-list
            • Database
            • Byte
            • Pos-option
            • Nibble
            • Nat-option
            • String-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
            • Bag
            • Pos-set
            • Hex-digit-char-list
            • Dec-digit-char-list
            • Pseudo-event-form-list
            • Nat-option-list
            • Symbol-set
            • String-set
            • Nat-set
            • Oct-digit-char-list
            • Bin-digit-char-list
            • Bit-list
          • Isar
          • Kestrel-utilities
          • Set
          • Soft
          • C
          • 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
    • Ubyte32-list

    Ubyte32-list-fix

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

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

    In the logic, we apply ubyte32-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: ubyte32-list-fix$inline

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

    Theorem: ubyte32-listp-of-ubyte32-list-fix

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

    Theorem: ubyte32-list-fix-when-ubyte32-listp

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

    Function: ubyte32-list-equiv$inline

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

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

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

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

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

    Theorem: ubyte32-list-fix-under-ubyte32-list-equiv

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Theorem: consp-of-ubyte32-list-fix

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

    Theorem: ubyte32-list-fix-under-iff

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

    Theorem: ubyte32-list-fix-of-cons

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

    Theorem: len-of-ubyte32-list-fix

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

    Theorem: ubyte32-list-fix-of-append

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

    Theorem: ubyte32-list-fix-of-repeat

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

    Theorem: list-equiv-refines-ubyte32-list-equiv

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

    Theorem: nth-of-ubyte32-list-fix

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

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

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

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

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

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

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

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

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