*)
Definition octet_lt (a b c d e f g h : Z) (p1 p2 : Qpositive)
(a' b' c' d' e' f' g' h' : Z) (p1' p2' : Qpositive) : Prop :=
bin_lt p1 p1' \/
p1 = p1' /\
(a + b + c + d + e + f + g + h < a' + b' + c' + d' + e' + f' + g' + h')%Z.
Definition octointegral_lt (a b c d e f g h a' b' c' d' e' f' g' h' : Z) :=
(a + b + c + d + e + f + g + h < a' + b' + c' + d' + e' + f' + g' + h')%Z.
Definition octointegral_eq (a b c d e f g h a' b' c' d' e' f' g' h' : Z) :=
a = a' /\
b = b' /\ c = c' /\ d = d' /\ e = e' /\ f = f' /\ g = g' /\ h = h'.
Record Z8 : Set :=
{z8crr :> Z * Z * (Z * Z) * (Z * Z * (Z * Z));
z8prf :
(0 <= fst (fst (fst z8crr)))%Z /\
(0 <= snd (fst (fst z8crr)))%Z /\
(0 <= fst (snd (fst z8crr)))%Z /\
(0 <= snd (snd (fst z8crr)))%Z /\
(0 <= fst (fst (snd z8crr)))%Z /\
(0 <= snd (fst (snd z8crr)))%Z /\
(0 <= fst (snd (snd z8crr)))%Z /\ (0 <= snd (snd (snd z8crr)))%Z}.
Definition Z8_lt : Z8 -> Z8 -> Prop.
intros x y.
case (z8crr x).
intros W1 W2.
case (z8crr y).
intros W3 W4.
case W1.
intros V1 V2.
case W2.
intros V3 V4.
case W3.
intros U1 U2.
case W4.
intros U3 U4.
case V1.
intros a b.
case V2.
intros c d.
case V3.
intros e f.
case V4.
intros g h.
case U1.
intros a' b'.
case U2.
intros c' d'.
case U3.
intros e' f'.
case U4.
intros g' h'.
exact (octointegral_lt a b c d e f g h a' b' c' d' e' f' g' h').
Defined.
Definition Z8_eq : Z8 -> Z8 -> Prop.
intros x y.
case (z8crr x).
intros W1 W2.
case (z8crr y).
intros W3 W4.
case W1.
intros V1 V2.
case W2.
intros V3 V4.
case W3.
intros U1 U2.
case W4.
intros U3 U4.
case V1.
intros a b.
case V2.
intros c d.
case V3.
intros e f.
case V4.
intros g h.
case U1.
intros a' b'.
case U2.
intros c' d'.
case U3.
intros e' f'.
case U4.
intros g' h'.
exact (octointegral_eq a b c d e f g h a' b' c' d' e' f' g' h').
Defined.

Lemma Z8_eq_is_transitive :
forall x y z : Z8, Z8_eq x y -> Z8_eq y z -> Z8_eq x z.