• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • 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
        • Axe
        • Execloader
      • 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)))))