Check if a term may represent a write of an integer by pointer.
(atc-check-integer-write val) → (mv erp yes/no fn arg type)
A write of an integer by pointer is represented by a let of the form
(let ((<var> (<type>-write <int>))) ...)
where
This ACL2 function takes as argument the value term of the let,
i.e.
Function:
(defun atc-check-integer-write (val) (declare (xargs :guard (pseudo-termp val))) (let ((__function__ 'atc-check-integer-write)) (declare (ignorable __function__)) (b* (((reterr) nil nil nil (irr-type)) ((acl2::fun (no)) (retok nil nil nil (irr-type))) ((mv okp fn args) (fty-check-fn-call val)) ((unless okp) (no)) ((mv okp fixtype write) (atc-check-symbol-2part fn)) (type (fixtype-to-integer-type fixtype)) ((unless (and okp (eq write 'write) type)) (no)) ((unless (equal (symbol-package-name fn) "C")) (reterr (msg "Invalid function ~x0 encountered: ~ it has the form of a write of an integer by pointer, ~ but it is not in the \"C\" package." fn))) ((unless (list-lenp 1 args)) (reterr (raise "Internal error: ~x0 not applied to 1 argument." fn))) (arg (first args))) (retok t fn arg type))))
Theorem:
(defthm booleanp-of-atc-check-integer-write.yes/no (b* (((mv acl2::?erp ?yes/no ?fn ?arg ?type) (atc-check-integer-write val))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm symbolp-of-atc-check-integer-write.fn (b* (((mv acl2::?erp ?yes/no ?fn ?arg ?type) (atc-check-integer-write val))) (symbolp fn)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-termp-of-atc-check-integer-write.arg (b* (((mv acl2::?erp ?yes/no ?fn ?arg ?type) (atc-check-integer-write val))) (pseudo-termp arg)) :rule-classes :rewrite)
Theorem:
(defthm typep-of-atc-check-integer-write.type (b* (((mv acl2::?erp ?yes/no ?fn ?arg ?type) (atc-check-integer-write val))) (typep type)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-term-count-of-atc-check-integer-write (b* (((mv acl2::?erp ?yes/no ?fn ?arg ?type) (atc-check-integer-write val))) (implies yes/no (< (pseudo-term-count arg) (pseudo-term-count val)))) :rule-classes :linear)
Theorem:
(defthm type-nonchar-integerp-of-atc-check-integer-write (b* (((mv acl2::?erp ?yes/no ?fn ?arg ?type) (atc-check-integer-write val))) (implies yes/no (type-nonchar-integerp type))))