Check if a term may be a let statement term.
(atc-check-let term) → (mv yes/no var val body wrapper?)
The forms of these terms are described in the user documentation.
Here we recognize and decompose statement terms that are lets.
In translated form,
We also return the declar or assign wrapper,
if present;
Function:
(defun atc-check-let (term) (declare (xargs :guard (pseudo-termp term))) (let ((__function__ 'atc-check-let)) (declare (ignorable __function__)) (b* (((acl2::fun (no)) (mv nil nil nil nil nil)) ((mv okp formals body actuals) (fty-check-lambda-call term)) ((when (not okp)) (no)) ((mv formals actuals) (fty-remove-equal-formals-actuals formals actuals)) ((unless (and (list-lenp 1 formals) (list-lenp 1 actuals))) (no)) (var (first formals)) (possibly-wrapped-val (first actuals)) ((unless (pseudo-term-case possibly-wrapped-val :fncall)) (mv t var possibly-wrapped-val body nil)) ((pseudo-term-fncall possibly-wrapped-val) possibly-wrapped-val) ((unless (member-eq possibly-wrapped-val.fn '(declar assign))) (mv t var possibly-wrapped-val body nil)) ((unless (list-lenp 1 possibly-wrapped-val.args)) (no))) (mv t var (first possibly-wrapped-val.args) body possibly-wrapped-val.fn))))
Theorem:
(defthm booleanp-of-atc-check-let.yes/no (b* (((mv ?yes/no ?var ?val ?body ?wrapper?) (atc-check-let term))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm symbolp-of-atc-check-let.var (b* (((mv ?yes/no ?var ?val ?body ?wrapper?) (atc-check-let term))) (symbolp var)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-termp-of-atc-check-let.val (b* (((mv ?yes/no ?var ?val ?body ?wrapper?) (atc-check-let term))) (pseudo-termp val)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-termp-of-atc-check-let.body (b* (((mv ?yes/no ?var ?val ?body ?wrapper?) (atc-check-let term))) (pseudo-termp body)) :rule-classes :rewrite)
Theorem:
(defthm symbolp-of-atc-check-let.wrapper? (b* (((mv ?yes/no ?var ?val ?body ?wrapper?) (atc-check-let term))) (symbolp wrapper?)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-term-count-of-atc-check-let-val (b* (((mv ?yes/no ?var ?val ?body ?wrapper?) (atc-check-let term))) (implies yes/no (< (pseudo-term-count val) (pseudo-term-count term)))) :rule-classes :linear)
Theorem:
(defthm pseudo-term-count-of-atc-check-let-body (b* (((mv ?yes/no ?var ?val ?body ?wrapper?) (atc-check-let term))) (implies yes/no (< (pseudo-term-count body) (pseudo-term-count term)))) :rule-classes :linear)
Theorem:
(defthm pseudo-term-count-of-atc-check-let (b* (((mv ?yes/no ?var ?val ?body ?wrapper?) (atc-check-let term))) (implies yes/no (< (+ (pseudo-term-count val) (pseudo-term-count body)) (pseudo-term-count term)))) :rule-classes :linear)