Check if
(is-elf-content-p contents state) → (mv is-elf-file header state)
Function:
(defun is-elf-content-p (contents state) (declare (xargs :stobjs (state))) (declare (xargs :guard (byte-listp contents))) (let ((__function__ 'is-elf-content-p)) (declare (ignorable __function__)) (b* (((unless (<= 64 (len contents))) (prog2$ (raise "Error reading ELF contents!") (mv nil (make-elf-header) state))) (bytes contents) (file-header (take 64 bytes)) ((elf-header header) (read-elf-header file-header)) (magic (merge-bytes header.magic)) (class header.class) ((when (or (not (equal magic *elfmag*)) (not (member class '(1 2))))) (prog2$ (raise "Error: Invalid ELF header! ~% Header: ~x0 ~%" header) (mv nil (make-elf-header) state)))) (mv t header state))))
Theorem:
(defthm booleanp-of-is-elf-content-p.is-elf-file (b* (((mv ?is-elf-file acl2::?header acl2::?state) (is-elf-content-p contents state))) (booleanp is-elf-file)) :rule-classes :type-prescription)
Theorem:
(defthm elf-header-p-of-is-elf-content-p.header (b* (((mv ?is-elf-file acl2::?header acl2::?state) (is-elf-content-p contents state))) (elf-header-p header)) :rule-classes :rewrite)