• 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
          • Database
          • Byte
          • String-option
          • Pos-option
          • Nibble
            • Nibble-list
              • Nibble-list-fix
                • Nibble-list-equiv
                • Nibble-listp
              • Nibble-fix
              • Nibblep-additional-theorems
            • Nat-option
            • Ubyte32-option
            • Byte-list20
            • Byte-list32
            • Byte-list64
            • Pseudo-event-form
            • Natoption/natoptionlist
            • Nati
            • Character-list
            • Nat/natlist
            • Maybe-string
            • Nibble-list
              • Nibble-list-fix
                • Nibble-list-equiv
                • Nibble-listp
              • 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
      • Nibble-list

      Nibble-list-fix

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

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

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

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

      Theorem: nibble-listp-of-nibble-list-fix

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

      Theorem: nibble-list-fix-when-nibble-listp

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

      Function: nibble-list-equiv$inline

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

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

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

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

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

      Theorem: nibble-list-fix-under-nibble-list-equiv

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Theorem: consp-of-nibble-list-fix

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

      Theorem: nibble-list-fix-under-iff

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

      Theorem: nibble-list-fix-of-cons

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

      Theorem: len-of-nibble-list-fix

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

      Theorem: nibble-list-fix-of-append

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

      Theorem: nibble-list-fix-of-repeat

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

      Theorem: list-equiv-refines-nibble-list-equiv

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

      Theorem: nth-of-nibble-list-fix

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

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

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

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

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

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

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

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

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