Check if a coimplication expression is well-formed.
(check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) → result
The operands must be booleans, and the result is a boolean.
Function:
(defun check-iff-expression (arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs 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) (expressionp expr) (contextp ctxt)))) (declare (ignorable expr)) (let ((__function__ 'check-iff-expression)) (declare (ignorable __function__)) (b* (((mv okp obligs) (match-type arg1 arg1-type (type-boolean) ctxt)) ((unless okp) (type-result-err (list :type-mismatch-iff (expression-fix arg1) (expression-fix arg2) (type-fix arg1-type) (type-fix arg2-type) (type-boolean)))) ((acl2::run-when (consp obligs)) (raise "Internal error: obligations ~x0 for the boolean type." obligs)) ((mv okp obligs) (match-type arg2 arg2-type (type-boolean) ctxt)) ((unless okp) (type-result-err (list :type-mismatch-iff (expression-fix arg1) (expression-fix arg2) (type-fix arg1-type) (type-fix arg2-type) (type-boolean)))) ((acl2::run-when (consp obligs)) (raise "Internal error: obligations ~x0 for the boolean type." obligs))) (make-type-result-ok :types (list (type-boolean)) :obligations (append arg1-obligs arg2-obligs)))))
Theorem:
(defthm type-resultp-of-check-iff-expression (b* ((result (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt))) (type-resultp result)) :rule-classes :rewrite)
Theorem:
(defthm check-iff-expression-of-expression-fix-arg1 (equal (check-iff-expression (expression-fix arg1) arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt)))
Theorem:
(defthm check-iff-expression-expression-equiv-congruence-on-arg1 (implies (expression-equiv arg1 arg1-equiv) (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1-equiv arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-iff-expression-of-expression-fix-arg2 (equal (check-iff-expression arg1 (expression-fix arg2) arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt)))
Theorem:
(defthm check-iff-expression-expression-equiv-congruence-on-arg2 (implies (expression-equiv arg2 arg2-equiv) (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2-equiv arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-iff-expression-of-type-fix-arg1-type (equal (check-iff-expression arg1 arg2 (type-fix arg1-type) arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt)))
Theorem:
(defthm check-iff-expression-type-equiv-congruence-on-arg1-type (implies (type-equiv arg1-type arg1-type-equiv) (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type-equiv arg2-type arg1-obligs arg2-obligs expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-iff-expression-of-type-fix-arg2-type (equal (check-iff-expression arg1 arg2 arg1-type (type-fix arg2-type) arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt)))
Theorem:
(defthm check-iff-expression-type-equiv-congruence-on-arg2-type (implies (type-equiv arg2-type arg2-type-equiv) (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type-equiv arg1-obligs arg2-obligs expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-iff-expression-of-proof-obligation-list-fix-arg1-obligs (equal (check-iff-expression arg1 arg2 arg1-type arg2-type (proof-obligation-list-fix arg1-obligs) arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt)))
Theorem:
(defthm check-iff-expression-proof-obligation-list-equiv-congruence-on-arg1-obligs (implies (proof-obligation-list-equiv arg1-obligs arg1-obligs-equiv) (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs-equiv arg2-obligs expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-iff-expression-of-proof-obligation-list-fix-arg2-obligs (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs (proof-obligation-list-fix arg2-obligs) expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt)))
Theorem:
(defthm check-iff-expression-proof-obligation-list-equiv-congruence-on-arg2-obligs (implies (proof-obligation-list-equiv arg2-obligs arg2-obligs-equiv) (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs-equiv expr ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-iff-expression-of-expression-fix-expr (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs (expression-fix expr) ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt)))
Theorem:
(defthm check-iff-expression-expression-equiv-congruence-on-expr (implies (expression-equiv expr expr-equiv) (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr-equiv ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-iff-expression-of-context-fix-ctxt (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr (context-fix ctxt)) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt)))
Theorem:
(defthm check-iff-expression-context-equiv-congruence-on-ctxt (implies (context-equiv ctxt ctxt-equiv) (equal (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt) (check-iff-expression arg1 arg2 arg1-type arg2-type arg1-obligs arg2-obligs expr ctxt-equiv))) :rule-classes :congruence)