• 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-file-into-byte-list

    Signature
    (read-file-into-byte-list filename state) 
      → 
    (mv file-contents state)
    Arguments
    filename — Guard (stringp filename).
    Returns
    file-contents — Type (byte-listp file-contents), given (and (stringp filename) (state-p1 state)).
    state — Type (state-p1 state), given (and (stringp filename) (state-p1 state)).

    Definitions and Theorems

    Function: read-file-into-byte-list

    (defun read-file-into-byte-list (filename state)
      (declare (xargs :stobjs (state)))
      (declare (xargs :guard (stringp filename)))
      (let ((__function__ 'read-file-into-byte-list))
        (declare (ignorable __function__))
        (b* (((mv channel state)
              (open-input-channel filename
                                  :byte state))
             ((when (not channel)) (mv nil state))
             ((mv file-contents state)
              (read-channel-into-byte-list channel nil state))
             (state (close-input-channel channel state)))
          (mv (reverse file-contents) state))))

    Theorem: byte-listp-of-read-file-into-byte-list.file-contents

    (defthm byte-listp-of-read-file-into-byte-list.file-contents
      (implies (and (stringp filename)
                    (state-p1 state))
               (b* (((mv ?file-contents acl2::?state)
                     (read-file-into-byte-list filename state)))
                 (byte-listp file-contents)))
      :rule-classes :rewrite)

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

    (defthm state-p1-of-read-file-into-byte-list.state
      (implies (and (stringp filename)
                    (state-p1 state))
               (b* (((mv ?file-contents acl2::?state)
                     (read-file-into-byte-list filename state)))
                 (state-p1 state)))
      :rule-classes :rewrite)