• 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-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-path-sfix
                  • Bip32-path-setp
                  • Bip32-path-set-equiv
              • 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-path-set

    Bip32-path-sfix

    (bip32-path-sfix x) is a usual ACL2::fty set fixing function.

    Signature
    (bip32-path-sfix x) → *
    Arguments
    x — Guard (bip32-path-setp x).

    In the logic, we apply ubyte32-list-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: bip32-path-sfix

    (defun bip32-path-sfix (x)
      (declare (xargs :guard (bip32-path-setp x)))
      (mbe :logic (if (bip32-path-setp x) x nil)
           :exec x))

    Theorem: bip32-path-setp-of-bip32-path-sfix

    (defthm bip32-path-setp-of-bip32-path-sfix
      (bip32-path-setp (bip32-path-sfix x)))

    Theorem: bip32-path-sfix-when-bip32-path-setp

    (defthm bip32-path-sfix-when-bip32-path-setp
      (implies (bip32-path-setp x)
               (equal (bip32-path-sfix x) x)))

    Theorem: emptyp-bip32-path-sfix

    (defthm emptyp-bip32-path-sfix
      (implies (or (emptyp x)
                   (not (bip32-path-setp x)))
               (emptyp (bip32-path-sfix x))))

    Theorem: emptyp-of-bip32-path-sfix

    (defthm emptyp-of-bip32-path-sfix
      (equal (emptyp (bip32-path-sfix x))
             (or (not (bip32-path-setp x))
                 (emptyp x))))

    Function: bip32-path-set-equiv$inline

    (defun bip32-path-set-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (bip32-path-setp acl2::x)
                                  (bip32-path-setp acl2::y))))
      (equal (bip32-path-sfix acl2::x)
             (bip32-path-sfix acl2::y)))

    Theorem: bip32-path-set-equiv-is-an-equivalence

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

    Theorem: bip32-path-set-equiv-implies-equal-bip32-path-sfix-1

    (defthm bip32-path-set-equiv-implies-equal-bip32-path-sfix-1
      (implies (bip32-path-set-equiv acl2::x x-equiv)
               (equal (bip32-path-sfix acl2::x)
                      (bip32-path-sfix x-equiv)))
      :rule-classes (:congruence))

    Theorem: bip32-path-sfix-under-bip32-path-set-equiv

    (defthm bip32-path-sfix-under-bip32-path-set-equiv
      (bip32-path-set-equiv (bip32-path-sfix acl2::x)
                            acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-bip32-path-sfix-1-forward-to-bip32-path-set-equiv

    (defthm equal-of-bip32-path-sfix-1-forward-to-bip32-path-set-equiv
      (implies (equal (bip32-path-sfix acl2::x)
                      acl2::y)
               (bip32-path-set-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-bip32-path-sfix-2-forward-to-bip32-path-set-equiv

    (defthm equal-of-bip32-path-sfix-2-forward-to-bip32-path-set-equiv
      (implies (equal acl2::x (bip32-path-sfix acl2::y))
               (bip32-path-set-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: bip32-path-set-equiv-of-bip32-path-sfix-1-forward

    (defthm bip32-path-set-equiv-of-bip32-path-sfix-1-forward
      (implies (bip32-path-set-equiv (bip32-path-sfix acl2::x)
                                     acl2::y)
               (bip32-path-set-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: bip32-path-set-equiv-of-bip32-path-sfix-2-forward

    (defthm bip32-path-set-equiv-of-bip32-path-sfix-2-forward
      (implies (bip32-path-set-equiv acl2::x (bip32-path-sfix acl2::y))
               (bip32-path-set-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)