• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Zcash
      • Des
      • X86isa
        • Program-execution
          • Dynamic-instrumentation
          • Initialize-x86-state
          • Binary-file-load-fn
          • Read-channel-into-memory
          • Setting-up-page-tables
          • Read-channel-into-byte-list
            • Init-zero-page
            • Linux-load
            • Read-file-into-memory
            • Read-file-into-byte-list
            • Init-sys-view
            • Load-elf-sections
            • Chars-to-c-str
            • String-to-c-str
            • Pack-u64
            • Pack-u32
            • Concrete-simulation-examples
            • Gdt-entry
          • Sdm-instruction-set-summary
          • Tlb
          • Running-linux
          • Introduction
          • Asmtest
          • X86isa-build-instructions
          • Publications
          • Contributors
          • Machine
          • Implemented-opcodes
          • To-do
          • Proof-utilities
          • Peripherals
          • Model-validation
          • Modelcalls
          • Concrete-simulation-examples
          • Utils
          • Debugging-code-proofs
        • Sha-2
        • Yul
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Axe
        • Poseidon
        • Where-do-i-place-my-book
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Program-execution

    Read-channel-into-byte-list

    Signature
    (read-channel-into-byte-list channel acc state) 
      → 
    (mv bytes state)
    Arguments
    channel — Guard (symbolp channel).
    Returns
    bytes — Type (byte-listp bytes), given (and (state-p1 state) (symbolp channel) (open-input-channel-p channel :byte state) (byte-listp acc)) .
    state — Type (state-p1 state), given (and (state-p1 state) (symbolp channel) (open-input-channel-p1 channel :byte state)) .

    Definitions and Theorems

    Function: read-channel-into-byte-list

    (defun read-channel-into-byte-list (channel acc state)
      (declare (xargs :stobjs (state)))
      (declare (xargs :guard (symbolp channel)))
      (declare (xargs :guard (open-input-channel-p channel
                                                   :byte state)))
      (let ((__function__ 'read-channel-into-byte-list))
        (declare (ignorable __function__))
        (b* (((mv current-byte state)
              (read-byte$ channel state)))
          (if (not current-byte)
              (mv acc state)
            (read-channel-into-byte-list channel (cons current-byte acc)
                                         state)))))

    Theorem: byte-listp-of-read-channel-into-byte-list.bytes

    (defthm byte-listp-of-read-channel-into-byte-list.bytes
      (implies (and (state-p1 state)
                    (symbolp channel)
                    (open-input-channel-p channel
                                          :byte state)
                    (byte-listp acc))
               (b* (((mv ?bytes acl2::?state)
                     (read-channel-into-byte-list channel acc state)))
                 (byte-listp bytes)))
      :rule-classes :rewrite)

    Theorem: state-p1-of-read-channel-into-byte-list.state

    (defthm state-p1-of-read-channel-into-byte-list.state
      (implies (and (state-p1 state)
                    (symbolp channel)
                    (open-input-channel-p1 channel
                                           :byte state))
               (b* (((mv ?bytes acl2::?state)
                     (read-channel-into-byte-list channel acc state)))
                 (state-p1 state)))
      :rule-classes :rewrite)

    Theorem: read-channel-into-byte-list-leaves-channel-open

    (defthm read-channel-into-byte-list-leaves-channel-open
     (implies
      (open-input-channel-p1 channel
                             :byte state)
      (open-input-channel-p1
       channel
       :byte (mv-nth 1
                     (read-channel-into-byte-list channel acc state)))))