• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
        • Bip32
        • Bech32
          • Bech32-split-address
          • Bech32-hrp-expand
          • Valid-bech32-or-bech32m
          • Bech32-polymod-aux
            • Bech32-or-bech32m-verify-checksum
            • Bech32m-verify-checksum
            • Valid-bech32m
            • Valid-bech32
            • Bech32-verify-checksum
            • Bech32-collect-low-5-bits
            • Bech32-collect-high-3-bits
            • Bech32-polymod
            • Bech32-chars-to-octets
            • Hrp-valid-p
            • Mixed-case-stringp
            • Hrp-valid-string-length-p
            • Hrp-valid-char-code-p
            • *bech32-char-vals*
            • Bech32-index-of-last-1
            • *bech32m-const*
          • Bip39
          • Bip44
          • Base58
          • Bip43
          • Bytes
          • Base58check
          • Cryptography
          • Bip-350
          • Bip-173
        • Riscv
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Bech32

    Bech32-polymod-aux

    Signature
    (bech32-polymod-aux values chk) → checksum
    Arguments
    values — Guard (unsigned-byte-listp 8 values).
    chk — Guard (unsigned-byte-p 48 chk).
    Returns
    checksum — Type (unsigned-byte-p 48 checksum).

    Definitions and Theorems

    Function: bech32-polymod-aux

    (defun bech32-polymod-aux (values chk)
      (declare (xargs :guard (and (unsigned-byte-listp 8 values)
                                  (unsigned-byte-p 48 chk))))
      (let ((__function__ 'bech32-polymod-aux))
        (declare (ignorable __function__))
        (if (not (mbt (unsigned-byte-p 48 chk)))
            0
          (if (endp values)
              chk
            (b* ((v (first values))
                 (b (bvshr 48 chk 25))
                 (chk (bvxor 48 (bvshl 48 (bvand 48 chk 33554431) 5)
                             v))
                 (chk (bvxor 48 chk
                             (if (oddp (bvshr 48 b 0))
                                 (nth 0 *bech32-gen*)
                               0)))
                 (chk (bvxor 48 chk
                             (if (oddp (bvshr 48 b 1))
                                 (nth 1 *bech32-gen*)
                               0)))
                 (chk (bvxor 48 chk
                             (if (oddp (bvshr 48 b 2))
                                 (nth 2 *bech32-gen*)
                               0)))
                 (chk (bvxor 48 chk
                             (if (oddp (bvshr 48 b 3))
                                 (nth 3 *bech32-gen*)
                               0)))
                 (chk (bvxor 48 chk
                             (if (oddp (bvshr 48 b 4))
                                 (nth 4 *bech32-gen*)
                               0))))
              (bech32-polymod-aux (rest values)
                                  chk))))))

    Theorem: return-type-of-bech32-polymod-aux

    (defthm return-type-of-bech32-polymod-aux
      (b* ((checksum (bech32-polymod-aux values chk)))
        (unsigned-byte-p 48 checksum))
      :rule-classes :rewrite)