Performance note. In the execution, this is just an inlined call of eql.
Function:
(defun maybe-nat-equiv$inline (x y) (declare (xargs :guard (and (maybe-natp x) (maybe-natp y)))) (eql (maybe-natp-fix x) (maybe-natp-fix y)))
Theorem:
(defthm maybe-nat-equiv-is-an-equivalence (and (booleanp (maybe-nat-equiv x y)) (maybe-nat-equiv x x) (implies (maybe-nat-equiv x y) (maybe-nat-equiv y x)) (implies (and (maybe-nat-equiv x y) (maybe-nat-equiv y z)) (maybe-nat-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm maybe-nat-equiv-implies-equal-maybe-natp-fix-1 (implies (maybe-nat-equiv x x-equiv) (equal (maybe-natp-fix x) (maybe-natp-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm maybe-natp-fix-under-maybe-nat-equiv (maybe-nat-equiv (maybe-natp-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))