• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
        • Fmt
        • Msg
        • Cw
        • Set-evisc-tuple
        • Set-iprint
        • Print-control
        • Read-file-into-string
        • Std/io
          • Open-channel-lemmas
          • Std/io/read-char$
          • Std/io/read-object
          • Std/io/open-output-channel
          • Unsound-read
          • Read-string
          • Read-bytes$
          • File-measure
          • Read-bytes$-n
          • Std/io/read-byte$
          • Std/io/open-input-channel
          • Read-file-lines-no-newlines
          • Print-compressed
          • Nthcdr-bytes
          • Read-file-lines
          • Std/io/close-output-channel
          • Read-file-characters
          • Read-file-bytes
          • Print-legibly
          • Std/io/close-input-channel
          • Read-file-objects
            • Read-object-all
            • Logical-story-of-io
            • Take-bytes
            • Std/io/peek-char$
            • Read-file-characters-rev
            • Read-file-as-string
            • Std/io/write-byte$
            • Std/io/set-serialize-character
            • Std/io/print-object$
            • Std/io/princ$
            • Std/io/read-file-into-string
            • *file-types*
          • Msgp
          • Printing-to-strings
          • Evisc-tuple
          • Output-controls
          • Observation
          • *standard-co*
          • Ppr-special-syms
          • Standard-oi
          • Standard-co
          • Without-evisc
          • Serialize
          • Output-to-file
          • Fmt-to-comment-window
          • Princ$
          • Character-encoding
          • Open-output-channel!
          • Cw-print-base-radix
          • Set-print-case
          • Set-print-base
          • Print-object$
          • Extend-pathname
          • Print-object$+
          • Fmx-cw
          • Set-print-radix
          • Set-fmt-hard-right-margin
          • File-write-date$
          • Proofs-co
          • Set-print-base-radix
          • Print-base-p
          • *standard-oi*
          • Wof
          • File-length$
          • Fms!-lst
          • Delete-file$
          • *standard-ci*
          • Write-list
          • Trace-co
          • Fmt!
          • Fms
          • Cw!
          • Fmt-to-comment-window!
          • Fms!
          • Eviscerate-hide-terms
          • Fmt1!
          • Fmt-to-comment-window!+
          • Read-file-into-byte-array-stobj
          • Fmt1
          • Fmt-to-comment-window+
          • Cw-print-base-radix!
          • Read-file-into-character-array-stobj
          • Fmx
          • Cw!+
          • Read-objects-from-book
          • Newline
          • Cw+
          • Probe-file
          • Write-objects-to-file!
          • Write-objects-to-file
          • Read-objects-from-file
          • Read-object-from-file
          • Read-file-into-byte-list
          • Set-fmt-soft-right-margin
          • Read-file-into-character-list
          • Io-utilities
        • Defttag
        • Sys-call
        • Save-exec
        • Quicklisp
        • Std/io
          • Open-channel-lemmas
          • Std/io/read-char$
          • Std/io/read-object
          • Std/io/open-output-channel
          • Unsound-read
          • Read-string
          • Read-bytes$
          • File-measure
          • Read-bytes$-n
          • Std/io/read-byte$
          • Std/io/open-input-channel
          • Read-file-lines-no-newlines
          • Print-compressed
          • Nthcdr-bytes
          • Read-file-lines
          • Std/io/close-output-channel
          • Read-file-characters
          • Read-file-bytes
          • Print-legibly
          • Std/io/close-input-channel
          • Read-file-objects
            • Read-object-all
            • Logical-story-of-io
            • Take-bytes
            • Std/io/peek-char$
            • Read-file-characters-rev
            • Read-file-as-string
            • Std/io/write-byte$
            • Std/io/set-serialize-character
            • Std/io/print-object$
            • Std/io/princ$
            • Std/io/read-file-into-string
            • *file-types*
          • Oslib
          • Bridge
          • Clex
          • Tshell
          • Unsound-eval
          • Hacker
          • ACL2s-interface
          • Startup-banner
          • Command-line
        • Hardware-verification
        • Software-verification
        • Math
        • Testing-utilities
      • Read-file-objects

      Read-object-all

      (read-object-all channel state) reads all remaining objects from a file.

      This is the main loop inside read-file-objects. It reads everything in the file, but doesn't handle opening or closing the file.

      Definitions and Theorems

      Function: tr-read-object-all

      (defun tr-read-object-all (channel state acc)
       (declare (xargs :guard (and (state-p state)
                                   (symbolp channel)
                                   (open-input-channel-p channel
                                                         :object state))))
       (b* (((unless (mbt (state-p state)))
             (mv acc state))
            ((mv eofp obj state)
             (read-object channel state))
            ((when eofp) (mv acc state)))
         (tr-read-object-all channel state (cons obj acc))))

      Function: read-object-all

      (defun read-object-all (channel state)
       (declare (xargs :guard (and (state-p state)
                                   (symbolp channel)
                                   (open-input-channel-p channel
                                                         :object state))))
       (mbe :logic
            (b* (((unless (state-p state))
                  (mv nil state))
                 ((mv eofp obj state)
                  (read-object channel state))
                 ((when eofp) (mv nil state))
                 ((mv rest state)
                  (read-object-all channel state)))
              (mv (cons obj rest) state))
            :exec
            (b* (((mv acc state)
                  (tr-read-object-all channel state nil)))
              (mv (reverse acc) state))))

      Theorem: tr-read-object-all-removal

      (defthm tr-read-object-all-removal
        (equal (tr-read-object-all channel state nil)
               (mv (rev (mv-nth 0 (read-object-all channel state)))
                   (mv-nth 1 (read-object-all channel state)))))

      Theorem: true-listp-of-read-object-all

      (defthm true-listp-of-read-object-all
        (true-listp (mv-nth 0 (read-object-all channel state)))
        :rule-classes :type-prescription)

      Theorem: state-p1-of-read-object-all

      (defthm state-p1-of-read-object-all
        (implies (and (force (state-p1 state))
                      (force (symbolp channel))
                      (force (open-input-channel-p1 channel
                                                    :object state)))
                 (state-p1 (mv-nth 1 (read-object-all channel state)))))

      Theorem: open-input-channel-p1-of-read-object-all

      (defthm open-input-channel-p1-of-read-object-all
       (implies (and (force (state-p1 state))
                     (force (symbolp channel))
                     (force (open-input-channel-p1 channel
                                                   :object state)))
                (open-input-channel-p1
                     channel
                     :object (mv-nth 1 (read-object-all channel state)))))