Check if an equality or inequality expression is well-formed.
(check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) → result
The two types must have a supremum type, which is the one where the (in)equality is checked. Otherwise, the expression is not type-correct. The expression returns a boolean.
Function:
(defun check-eq/ne-expression (arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (declare (xargs :guard (and (expressionp arg1) (expressionp arg2) (typep arg1-type) (typep arg2-type) (proof-obligation-listp arg1-obligs) (proof-obligation-listp arg2-obligs) (keywordp err-keyword) (expressionp expr) (contextp ctxt)))) (declare (ignorable expr)) (let ((__function__ 'check-eq/ne-expression)) (declare (ignorable __function__)) (b* ((supremum (supremum-type arg1-type arg2-type (context->tops ctxt)))) (if supremum (make-type-result-ok :types (list (type-boolean)) :obligations (append arg1-obligs arg2-obligs)) (type-result-err (list err-keyword (expression-fix arg1) (expression-fix arg2) (type-fix arg1-type) (type-fix arg2-type)))))))
Theorem:
(defthm type-resultp-of-check-eq/ne-expression (b* ((result (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt))) (type-resultp result)) :rule-classes :rewrite)
Theorem:
(defthm check-eq/ne-expression-of-expression-fix-arg1 (equal (check-eq/ne-expression (expression-fix arg1) arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt)))
Theorem:
(defthm check-eq/ne-expression-expression-equiv-congruence-on-arg1 (implies (expression-equiv arg1 arg1-equiv) (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1-equiv arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-eq/ne-expression-of-expression-fix-arg2 (equal (check-eq/ne-expression arg1 (expression-fix arg2) arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt)))
Theorem:
(defthm check-eq/ne-expression-expression-equiv-congruence-on-arg2 (implies (expression-equiv arg2 arg2-equiv) (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2-equiv arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-eq/ne-expression-of-type-fix-arg1-type (equal (check-eq/ne-expression arg1 arg2 (type-fix arg1-type) arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt)))
Theorem:
(defthm check-eq/ne-expression-type-equiv-congruence-on-arg1-type (implies (type-equiv arg1-type arg1-type-equiv) (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type-equiv arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-eq/ne-expression-of-type-fix-arg2-type (equal (check-eq/ne-expression arg1 arg2 arg1-type (type-fix arg2-type) arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt)))
Theorem:
(defthm check-eq/ne-expression-type-equiv-congruence-on-arg2-type (implies (type-equiv arg2-type arg2-type-equiv) (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type-equiv arg1-obligs arg2-obligs err-keyword expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-eq/ne-expression-of-proof-obligation-list-fix-arg1-obligs (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type (proof-obligation-list-fix arg1-obligs) arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt)))
Theorem:
(defthm check-eq/ne-expression-proof-obligation-list-equiv-congruence-on-arg1-obligs (implies (proof-obligation-list-equiv arg1-obligs arg1-obligs-equiv) (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs-equiv arg2-obligs err-keyword expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-eq/ne-expression-of-proof-obligation-list-fix-arg2-obligs (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs (proof-obligation-list-fix arg2-obligs) err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt)))
Theorem:
(defthm check-eq/ne-expression-proof-obligation-list-equiv-congruence-on-arg2-obligs (implies (proof-obligation-list-equiv arg2-obligs arg2-obligs-equiv) (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs-equiv err-keyword expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-eq/ne-expression-of-expression-fix-expr (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword (expression-fix expr) ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt)))
Theorem:
(defthm check-eq/ne-expression-expression-equiv-congruence-on-expr (implies (expression-equiv expr expr-equiv) (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr-equiv ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-eq/ne-expression-of-context-fix-ctxt (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr (context-fix ctxt)) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt)))
Theorem:
(defthm check-eq/ne-expression-context-equiv-congruence-on-ctxt (implies (context-equiv ctxt ctxt-equiv) (equal (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt) (check-eq/ne-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs err-keyword expr ctxt-equiv))) :rule-classes :congruence)