• 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
        • 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-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-to-mnemonic

    Turn an entropy value into a mnemonic.

    Signature
    (bip39-entropy-to-mnemonic entropy) → mnemonic
    Arguments
    entropy — Guard (bip39-entropyp entropy).
    Returns
    mnemonic — Type (stringp mnemonic).

    This is the composition of the three functions that map entropy to word indexes, word indexes to words, and words to mnemonic.

    Since the maximum numer of words is 24, given the bound on the mnemonic as 9 times the number of words, we show that the the length of the mnemonic has an upper bound equal to the product of 9 and 24.

    Definitions and Theorems

    Function: bip39-entropy-to-mnemonic

    (defun bip39-entropy-to-mnemonic (entropy)
      (declare (xargs :guard (bip39-entropyp entropy)))
      (b* ((indexes (bip39-entropy-to-word-indexes entropy))
           (words (bip39-word-indexes-to-words indexes))
           (mnemonic (bip39-words-to-mnemonic words)))
        mnemonic))

    Theorem: stringp-of-bip39-entropy-to-mnemonic

    (defthm stringp-of-bip39-entropy-to-mnemonic
      (b* ((mnemonic (bip39-entropy-to-mnemonic entropy)))
        (stringp mnemonic))
      :rule-classes :rewrite)

    Theorem: bip39-entropy-to-mnemonic-upper-bound

    (defthm bip39-entropy-to-mnemonic-upper-bound
      (<= (length (bip39-entropy-to-mnemonic entropy))
          (* 9 24))
      :rule-classes :linear)

    Theorem: bip39-entropy-to-mnemonic-of-bip39-entropy-fix-entropy

    (defthm bip39-entropy-to-mnemonic-of-bip39-entropy-fix-entropy
      (equal (bip39-entropy-to-mnemonic (bip39-entropy-fix entropy))
             (bip39-entropy-to-mnemonic entropy)))

    Theorem: bip39-entropy-to-mnemonic-bip39-entropy-equiv-congruence-on-entropy

    (defthm
     bip39-entropy-to-mnemonic-bip39-entropy-equiv-congruence-on-entropy
     (implies (bip39-entropy-equiv entropy entropy-equiv)
              (equal (bip39-entropy-to-mnemonic entropy)
                     (bip39-entropy-to-mnemonic entropy-equiv)))
     :rule-classes :congruence)