Recognizer for function structures.
(functionp x) → *
Function:
(defun functionp (x) (declare (xargs :guard t)) (let ((__function__ 'functionp)) (declare (ignorable __function__)) (and (consp x) (eq (car x) :function) (mbe :logic (and (alistp (cdr x)) (equal (strip-cars (cdr x)) '(name inputs instrs outputs finalize))) :exec (fty::alist-with-carsp (cdr x) '(name inputs instrs outputs finalize))) (b* ((name (cdr (std::da-nth 0 (cdr x)))) (inputs (cdr (std::da-nth 1 (cdr x)))) (instrs (cdr (std::da-nth 2 (cdr x)))) (outputs (cdr (std::da-nth 3 (cdr x)))) (finalize (cdr (std::da-nth 4 (cdr x))))) (and (identifierp name) (function-input-listp inputs) (instruction-listp instrs) (function-output-listp outputs) (finalizationp finalize))))))
Theorem:
(defthm consp-when-functionp (implies (functionp x) (consp x)) :rule-classes :compound-recognizer)