• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
        • C
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
        • Java
        • Riscv
        • Bitcoin
        • Zcash
          • Jubjub
          • Verify-zcash-r1cs
          • Lift-zcash-r1cs
          • Pedersen-hash
          • Zcash-gadgets
          • Bit/byte/integer-conversions
            • Leos2ip
            • Lebs2osp
              • Lebs2ip
              • Leos2bsp
              • I2lebsp
              • I2bebsp
            • Constants
            • Blake2-hash
            • Randomness-beacon
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Bit/byte/integer-conversions

    Lebs2osp

    The function \mathsf{LEBS2OSP} in [ZPS:5.1].

    Signature
    (lebs2osp bits) → bytes
    Arguments
    bits — Guard (bit-listp bits).
    Returns
    bytes — Type (byte-listp bytes).

    The \ell argumnent can be determined from the other argument: it is the length of the other argument. Thus, in our formalization we just have one argument.

    Definitions and Theorems

    Function: lebs2osp

    (defun lebs2osp (bits)
      (declare (xargs :guard (bit-listp bits)))
      (let ((__function__ 'lebs2osp))
        (declare (ignorable __function__))
        (b* ((l (len bits))
             (padlen (- (* 8 (ceiling l 8)) l))
             (padded (append bits (repeat padlen 0))))
          (acl2::bits=>lebytes padded))))

    Theorem: byte-listp-of-lebs2osp

    (defthm byte-listp-of-lebs2osp
      (b* ((bytes (lebs2osp bits)))
        (byte-listp bytes))
      :rule-classes :rewrite)

    Theorem: len-of-lebs2osp

    (defthm len-of-lebs2osp
      (b* ((?bytes (lebs2osp bits)))
        (equal (len bytes)
               (ceiling (len bits) 8))))