Check if a term may represent a C loop.
(atc-check-loop-call term var-term-alist prec-fns) → (mv yes/no fn args in-types affect loop limit)
We check whether this is a call of
a function that has been previously processed
(i.e. it is in the
The limit retrieved from the function table refers to the formal parameters. We must instantiate it to the actual parameters in order to obtain an appropriate limit for the call, but we also need to substitute all the bindings in order to obtain the real arguments of the call from the point of view of the top level of where this call term occurs.
Function:
(defun atc-check-loop-call (term var-term-alist prec-fns) (declare (xargs :guard (and (pseudo-termp term) (symbol-pseudoterm-alistp var-term-alist) (atc-symbol-fninfo-alistp prec-fns)))) (let ((__function__ 'atc-check-loop-call)) (declare (ignorable __function__)) (b* (((acl2::fun (no)) (mv nil nil nil nil nil (irr-stmt) nil)) ((unless (pseudo-term-case term :fncall)) (no)) ((pseudo-term-fncall term) term) (fn+info (assoc-eq term.fn (atc-symbol-fninfo-alist-fix prec-fns))) ((unless (consp fn+info)) (no)) (info (cdr fn+info)) (loop (atc-fn-info->loop? info)) ((unless (stmtp loop)) (no)) (in-types (atc-fn-info->in-types info)) (affect (atc-fn-info->affect info)) (limit (atc-fn-info->limit info)) (limit (fty-fsublis-var var-term-alist limit))) (mv t term.fn term.args in-types affect loop limit))))
Theorem:
(defthm booleanp-of-atc-check-loop-call.yes/no (b* (((mv ?yes/no ?fn acl2::?args ?in-types ?affect common-lisp::?loop ?limit) (atc-check-loop-call term var-term-alist prec-fns))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm symbolp-of-atc-check-loop-call.fn (b* (((mv ?yes/no ?fn acl2::?args ?in-types ?affect common-lisp::?loop ?limit) (atc-check-loop-call term var-term-alist prec-fns))) (symbolp fn)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-term-listp-of-atc-check-loop-call.args (b* (((mv ?yes/no ?fn acl2::?args ?in-types ?affect common-lisp::?loop ?limit) (atc-check-loop-call term var-term-alist prec-fns))) (pseudo-term-listp args)) :rule-classes :rewrite)
Theorem:
(defthm type-listp-of-atc-check-loop-call.in-types (b* (((mv ?yes/no ?fn acl2::?args ?in-types ?affect common-lisp::?loop ?limit) (atc-check-loop-call term var-term-alist prec-fns))) (type-listp in-types)) :rule-classes :rewrite)
Theorem:
(defthm symbol-listp-of-atc-check-loop-call.affect (b* (((mv ?yes/no ?fn acl2::?args ?in-types ?affect common-lisp::?loop ?limit) (atc-check-loop-call term var-term-alist prec-fns))) (symbol-listp affect)) :rule-classes :rewrite)
Theorem:
(defthm stmtp-of-atc-check-loop-call.loop (b* (((mv ?yes/no ?fn acl2::?args ?in-types ?affect common-lisp::?loop ?limit) (atc-check-loop-call term var-term-alist prec-fns))) (stmtp loop)) :rule-classes :rewrite)
Theorem:
(defthm pseudo-termp-of-atc-check-loop-call.limit (b* (((mv ?yes/no ?fn acl2::?args ?in-types ?affect common-lisp::?loop ?limit) (atc-check-loop-call term var-term-alist prec-fns))) (pseudo-termp limit)) :rule-classes :rewrite)