A fixtype of (unsigned 4-bit) nibbles.
We use fty::defbyte to generate this fixtype, along with the recognizer, fixer, and equivalence. The recognizer is identical to nibblep.
Function:
(defun nibble-equiv$inline (x y) (declare (xargs :guard (and (nibblep x) (nibblep y)))) (equal (nibble-fix x) (nibble-fix y)))
Theorem:
(defthm nibble-equiv-is-an-equivalence (and (booleanp (nibble-equiv x y)) (nibble-equiv x x) (implies (nibble-equiv x y) (nibble-equiv y x)) (implies (and (nibble-equiv x y) (nibble-equiv y z)) (nibble-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm nibble-equiv-implies-equal-nibble-fix-1 (implies (nibble-equiv x x-equiv) (equal (nibble-fix x) (nibble-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm nibble-fix-under-nibble-equiv (nibble-equiv (nibble-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-nibble-fix-1-forward-to-nibble-equiv (implies (equal (nibble-fix x) y) (nibble-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-nibble-fix-2-forward-to-nibble-equiv (implies (equal x (nibble-fix y)) (nibble-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm nibble-equiv-of-nibble-fix-1-forward (implies (nibble-equiv (nibble-fix x) y) (nibble-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm nibble-equiv-of-nibble-fix-2-forward (implies (nibble-equiv x (nibble-fix y)) (nibble-equiv x y)) :rule-classes :forward-chaining)