Put a formula into a context.
(atc-contextualize formula context fn? fn-guard? compst-var? limit-var? limit-bound? preamblep wrld) → formula1
We go through the context elements, generating code for them and ending with the term given as input.
We also add, around the resulting term from the process described above, additional premises:
If
If
If
If
Function:
(defun atc-contextualize-aux (formula premises skip-cs) (declare (xargs :guard (and (atc-premise-listp premises) (booleanp skip-cs)))) (let ((__function__ 'atc-contextualize-aux)) (declare (ignorable __function__)) (b* (((when (endp premises)) formula) (premise (car premises))) (atc-premise-case premise :compustate (if skip-cs (atc-contextualize-aux formula (cdr premises) skip-cs) (cons 'let (cons (cons (cons premise.var (cons premise.term 'nil)) 'nil) (cons (atc-contextualize-aux formula (cdr premises) skip-cs) 'nil)))) :cvalue (cons 'let (cons (cons (cons premise.var (cons premise.term 'nil)) 'nil) (cons (atc-contextualize-aux formula (cdr premises) skip-cs) 'nil))) :cvalues (cons 'mv-let (cons premise.vars (cons premise.term (cons (atc-contextualize-aux formula (cdr premises) skip-cs) 'nil)))) :test (cons 'implies (cons (cons 'test* (cons premise.term 'nil)) (cons (atc-contextualize-aux formula (cdr premises) skip-cs) 'nil)))))))
Function:
(defun atc-contextualize (formula context fn? fn-guard? compst-var? limit-var? limit-bound? preamblep wrld) (declare (xargs :guard (and (atc-contextp context) (symbolp fn?) (symbolp fn-guard?) (symbolp compst-var?) (symbolp limit-var?) (pseudo-termp limit-bound?) (booleanp preamblep) (plist-worldp wrld)))) (let ((__function__ 'atc-contextualize)) (declare (ignorable __function__)) (b* ((skip-cs (not compst-var?)) (formula (atc-contextualize-aux formula (atc-context->premises context) skip-cs)) (hyps (append (and compst-var? (cons (cons 'compustatep (cons compst-var? 'nil)) 'nil)) (and preamblep (atc-context->preamble context)) (and fn-guard? (cons (cons fn-guard? (formals+ fn? wrld)) 'nil)) (and limit-var? (cons (cons 'integerp (cons limit-var? 'nil)) (cons (cons '>= (cons limit-var? (cons limit-bound? 'nil))) 'nil))))) ((when (and (not fn-guard?) fn?)) (raise "Internal error: FN-GUARD? is NIL but FN? is ~x0." fn?)) ((when (and (not limit-var?) limit-bound?)) (raise "Internal error: LIMIT-VAR? is NIL but LIMIT-BOUND? is ~x0." limit-bound?)) (formula (cons 'implies (cons (cons 'and hyps) (cons formula 'nil))))) formula)))