• 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
      • Riscv
      • Taspi
      • Bitcoin
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • 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
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • ACL2
      • Macro-libraries
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • 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))))