Check if a term is a (translated) call of
an
(check-nary-lambda-call term n) → (mv yes/no formals body args)
This is like check-lambda-call but it additionally requires the lambda expression to have a specified arity. It is accompanied by theorems saying that the lengths of the formal and argument lists equal the specified arity.
See also check-unary-lambda-call.
Function:
(defun check-nary-lambda-call (term n) (declare (xargs :guard (and (pseudo-termp term) (natp n)))) (let ((__function__ 'check-nary-lambda-call)) (declare (ignorable __function__)) (b* (((mv yes/no formals body args) (check-lambda-call term)) ((unless yes/no) (mv nil nil nil nil)) ((unless (equal (len formals) n)) (mv nil nil nil nil))) (mv t formals body args))))
Theorem:
(defthm booleanp-of-check-nary-lambda-call.yes/no (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm symbol-listp-of-check-nary-lambda-call.formals (implies (and (pseudo-termp term) (natp n)) (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (symbol-listp formals))) :rule-classes :rewrite)
Theorem:
(defthm pseudo-termp-of-check-nary-lambda-call.body (implies (and (pseudo-termp term) (natp n)) (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (pseudo-termp body))) :rule-classes :rewrite)
Theorem:
(defthm pseudo-term-listp-of-check-nary-lambda-call.args (implies (and (pseudo-termp term) (natp n)) (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (pseudo-term-listp args))) :rule-classes :rewrite)
Theorem:
(defthm true-listp-of-check-nary-lambda-call.formals (implies (and (pseudo-termp term) (natp n)) (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (true-listp formals))) :rule-classes :type-prescription)
Theorem:
(defthm true-listp-of-check-nary-lambda-call.args (implies (and (pseudo-termp term) (natp n)) (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (true-listp args))) :rule-classes :type-prescription)
Theorem:
(defthm len-of-check-nary-lambda-call.formals (implies (and (pseudo-termp term) (natp n)) (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (implies yes/no (equal (len formals) n)))))
Theorem:
(defthm len-of-check-nary-lambda-call.args (implies (and (pseudo-termp term) (natp n)) (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (implies yes/no (equal (len args) n)))))
Theorem:
(defthm acl2-count-of-check-nary-lambda-call.body (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (implies yes/no (< (acl2-count body) (acl2-count term)))) :rule-classes :linear)
Theorem:
(defthm acl2-count-of-check-nary-lambda-call.args (b* (((mv ?yes/no ?formals ?body ?args) (check-nary-lambda-call term n))) (implies yes/no (< (acl2-count args) (acl2-count term)))) :rule-classes :linear)