• 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
        • Bitcoin
          • Bip32
            • Bip32-wallet-structure
            • Bip32-key-trees
              • Bip32-extend-tree
              • Bip32-valid-depths-p
              • Bip32-key-tree
              • Bip32-path-set-closedp
              • Bip32-valid-keys-p
              • Bip32-index-tree
                • Bip32-index-treep
                • Bip32-index-tree-fix
              • Bip32-path-in-tree-p
              • Bip32-ckd*
              • Bip32-get-pub-key-at-path
              • Bip32-get-priv-key-at-path
              • Bip32-ckd-priv*
              • Bip32-ckd-pub*
              • Bip32-path
              • Bip32-key-tree-priv-p
              • Bip32-path-set
            • Bip32-key-serialization
            • Bip32-key-derivation
            • Bip32-executable-attachments
            • Bip32-extended-keys
            • Bip32-master-key-generation
          • Bech32
          • Bip39
          • Bip44
          • Base58
          • Bip43
          • Bytes
          • Base58check
          • Cryptography
          • Bip-350
          • Bip-173
        • 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
  • Bip32-key-trees

Bip32-index-tree

Index trees underlying key trees.

As defined later, a key tree includes a tree of indices, represented as a closed non-empty set of paths.

Extending a path of an index tree results in a index tree, because the extension preserves non-emptiness and prefix closure.

Definitions and Theorems

Function: bip32-index-treep

(defun bip32-index-treep (x)
  (declare (xargs :guard t))
  (and (bip32-path-setp x)
       (not (emptyp x))
       (bip32-path-set-closedp x)))

Theorem: booleanp-of-bip32-index-treep

(defthm booleanp-of-bip32-index-treep
  (b* ((yes/no (bip32-index-treep x)))
    (booleanp yes/no))
  :rule-classes :rewrite)

Theorem: bip32-path-setp-when-bip32-index-treep

(defthm bip32-path-setp-when-bip32-index-treep
  (implies (bip32-index-treep x)
           (bip32-path-setp x))
  :rule-classes (:rewrite :forward-chaining))

Theorem: bip32-index-treep-of-singleton-empty-path

(defthm bip32-index-treep-of-singleton-empty-path
  (bip32-index-treep '(nil)))

Function: bip32-index-tree-fix

(defun bip32-index-tree-fix (x)
  (declare (xargs :guard (bip32-index-treep x)))
  (mbe :logic (if (bip32-index-treep x) x (list nil))
       :exec x))

Theorem: bip32-index-treep-of-bip32-index-tree-fix

(defthm bip32-index-treep-of-bip32-index-tree-fix
  (b* ((fixed-x (bip32-index-tree-fix x)))
    (bip32-index-treep fixed-x))
  :rule-classes :rewrite)

Theorem: bip32-index-tree-fix-when-bip32-index-treep

(defthm bip32-index-tree-fix-when-bip32-index-treep
  (implies (bip32-index-treep x)
           (equal (bip32-index-tree-fix x) x)))

Function: bip32-index-tree-equiv$inline

(defun bip32-index-tree-equiv$inline (acl2::x acl2::y)
  (declare (xargs :guard (and (bip32-index-treep acl2::x)
                              (bip32-index-treep acl2::y))))
  (equal (bip32-index-tree-fix acl2::x)
         (bip32-index-tree-fix acl2::y)))

Theorem: bip32-index-tree-equiv-is-an-equivalence

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

Theorem: bip32-index-tree-equiv-implies-equal-bip32-index-tree-fix-1

(defthm bip32-index-tree-equiv-implies-equal-bip32-index-tree-fix-1
  (implies (bip32-index-tree-equiv acl2::x x-equiv)
           (equal (bip32-index-tree-fix acl2::x)
                  (bip32-index-tree-fix x-equiv)))
  :rule-classes (:congruence))

Theorem: bip32-index-tree-fix-under-bip32-index-tree-equiv

(defthm bip32-index-tree-fix-under-bip32-index-tree-equiv
  (bip32-index-tree-equiv (bip32-index-tree-fix acl2::x)
                          acl2::x)
  :rule-classes (:rewrite :rewrite-quoted-constant))

Theorem: equal-of-bip32-index-tree-fix-1-forward-to-bip32-index-tree-equiv

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

Theorem: equal-of-bip32-index-tree-fix-2-forward-to-bip32-index-tree-equiv

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

Theorem: bip32-index-tree-equiv-of-bip32-index-tree-fix-1-forward

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

Theorem: bip32-index-tree-equiv-of-bip32-index-tree-fix-2-forward

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

Theorem: bip32-index-treep-of-insert-of-rcons

(defthm bip32-index-treep-of-insert-of-rcons
  (implies (and (bip32-index-treep paths)
                (in path paths)
                (ubyte32p index))
           (bip32-index-treep (insert (rcons index path) paths))))

Subtopics

Bip32-index-treep
Recognizer for bip32-index-tree.
Bip32-index-tree-fix
Fixer for bip32-index-tree.