• 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
          • Bech32
          • Bip39
            • *bip39-english-words*
            • Bip39-mnemonic-to-seed
            • Bip39-entropy-to-word-indexes
            • Bip39-entropy
              • Bip39-entropyp
              • Bip39-entropy-fix
            • Bip39-word-indexes-to-words
            • Bip39-words-to-mnemonic
            • Bip39-entropy-to-seed
            • Bip39-entropy-to-mnemonic
            • Bip39-english-words-bound-p
            • Bip39-entropy-size-p
          • 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
  • Bip39

Bip39-entropy

Entropy values.

The entropy is a sequence of bits whose size is one of the allowed ones (see bip39-entropy-size-p).

We introduce a fixtype for the possible values of the entropy.

Definitions and Theorems

Function: bip39-entropyp

(defun bip39-entropyp (x)
  (declare (xargs :guard t))
  (and (bit-listp x)
       (bip39-entropy-size-p (len x))
       t))

Theorem: booleanp-of-bip39-entropyp

(defthm booleanp-of-bip39-entropyp
  (b* ((yes/no (bip39-entropyp x)))
    (booleanp yes/no))
  :rule-classes :rewrite)

Function: bip39-entropy-fix

(defun bip39-entropy-fix (x)
  (declare (xargs :guard (bip39-entropyp x)))
  (mbe :logic (if (bip39-entropyp x) x (repeat 128 0))
       :exec x))

Theorem: bip39-entropyp-of-bip39-entropy-fix

(defthm bip39-entropyp-of-bip39-entropy-fix
  (b* ((fixed-x (bip39-entropy-fix x)))
    (bip39-entropyp fixed-x))
  :rule-classes :rewrite)

Theorem: bip39-entropy-fix-when-bip39-entropyp

(defthm bip39-entropy-fix-when-bip39-entropyp
  (implies (bip39-entropyp x)
           (equal (bip39-entropy-fix x) x)))

Function: bip39-entropy-equiv$inline

(defun bip39-entropy-equiv$inline (acl2::x acl2::y)
  (declare (xargs :guard (and (bip39-entropyp acl2::x)
                              (bip39-entropyp acl2::y))))
  (equal (bip39-entropy-fix acl2::x)
         (bip39-entropy-fix acl2::y)))

Theorem: bip39-entropy-equiv-is-an-equivalence

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

Theorem: bip39-entropy-equiv-implies-equal-bip39-entropy-fix-1

(defthm bip39-entropy-equiv-implies-equal-bip39-entropy-fix-1
  (implies (bip39-entropy-equiv acl2::x x-equiv)
           (equal (bip39-entropy-fix acl2::x)
                  (bip39-entropy-fix x-equiv)))
  :rule-classes (:congruence))

Theorem: bip39-entropy-fix-under-bip39-entropy-equiv

(defthm bip39-entropy-fix-under-bip39-entropy-equiv
  (bip39-entropy-equiv (bip39-entropy-fix acl2::x)
                       acl2::x)
  :rule-classes (:rewrite :rewrite-quoted-constant))

Theorem: equal-of-bip39-entropy-fix-1-forward-to-bip39-entropy-equiv

(defthm equal-of-bip39-entropy-fix-1-forward-to-bip39-entropy-equiv
  (implies (equal (bip39-entropy-fix acl2::x)
                  acl2::y)
           (bip39-entropy-equiv acl2::x acl2::y))
  :rule-classes :forward-chaining)

Theorem: equal-of-bip39-entropy-fix-2-forward-to-bip39-entropy-equiv

(defthm equal-of-bip39-entropy-fix-2-forward-to-bip39-entropy-equiv
  (implies (equal acl2::x (bip39-entropy-fix acl2::y))
           (bip39-entropy-equiv acl2::x acl2::y))
  :rule-classes :forward-chaining)

Theorem: bip39-entropy-equiv-of-bip39-entropy-fix-1-forward

(defthm bip39-entropy-equiv-of-bip39-entropy-fix-1-forward
  (implies (bip39-entropy-equiv (bip39-entropy-fix acl2::x)
                                acl2::y)
           (bip39-entropy-equiv acl2::x acl2::y))
  :rule-classes :forward-chaining)

Theorem: bip39-entropy-equiv-of-bip39-entropy-fix-2-forward

(defthm bip39-entropy-equiv-of-bip39-entropy-fix-2-forward
  (implies (bip39-entropy-equiv acl2::x (bip39-entropy-fix acl2::y))
           (bip39-entropy-equiv acl2::x acl2::y))
  :rule-classes :forward-chaining)

Subtopics

Bip39-entropyp
Recognizer for bip39-entropy.
Bip39-entropy-fix
Fixer for bip39-entropy.