A faster alternative to serialize-read, which is unsound in general, but may be fine in many common cases.
The
As its name suggests,
(include-book "std/io/unsound-read" :dir :system :ttags (:unsound-read))
General form:
(unsound-read filename [:hons-mode {:always, :never, :smart}] [:verbose {t, nil}]) --> obj
The arguments are as in serialize-read.
The logical problem with
(equal (unsound-read-fn filename hons-mode verbosep) (unsound-read-fn filename hons-mode verbosep))
But we can easily violate this property by modifying the file system between
calls of
(local (encapsulate () ;; Write NIL to test.sao (make-event (let ((state (serialize-write "test.sao" nil))) (value '(value-triple :invisible)))) ;; Prove that test.sao contains NIL. (defthm lemma-1 (equal (unsound-read "test.sao") nil) :rule-classes nil) ;; Write T to test.sao (make-event (let ((state (serialize-write "test.sao" t))) (value '(value-triple :invisible)))) ;; Prove that test.sao contains T. (defthm lemma-2 (equal (unsound-read "test.sao") t) :rule-classes nil) ;; Arrive at our contradiction. (defthm qed nil :rule-classes nil :hints(("Goal" :use ((:instance lemma-1) (:instance lemma-2)) :in-theory (disable (unsound-read-fn)))))))
If you want to safely use
A common scenario is that you have some book,
; (depends-on "foo.sao") (defconst *contents* (unsound-read "foo.sao"))
May, at least for users of