*)
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.

(* Specifications: *)
Lemma Z8_lt_is_irreflexive : forall x : Z8, ~ Z8_lt x x.
Lemma Z8_lt_is_transitive :
forall x y z : Z8, Z8_lt x y -> Z8_lt y z -> Z8_lt x z.
Lemma Z8_lt_is_order : is_order Z8 Z8_lt.
Lemma Z8_eq_is_reflexive : forall x : Z8, Z8_eq x x.
Lemma Z8_eq_is_symmetric : forall x y : Z8, Z8_eq x y -> Z8_eq y x.
Lemma Z8_eq_is_transitive :
forall x y z : Z8, Z8_eq x y -> Z8_eq y z -> Z8_eq x z.
Lemma Z8_eq_is_equality : is_equality Z8 Z8_eq.
Lemma Z8_lt_is_wf : wf_ind Z8 Z8_lt.
Lemma Z8_lt_is_well_def_rht : is_well_def_rht Z8 Z8_lt Z8_eq.
Definition Z8_as_well_ordering :=
Build_well_ordering Z8 Z8_lt Z8_eq Z8_lt_is_order Z8_eq_is_equality
Z8_lt_is_wf Z8_lt_is_well_def_rht.