End intUnitRing.
End intUnitRing.
Canonical int_unitRingType :=
Eval hnf in UnitRingType int intUnitRing.comMixin.
Canonical int_comUnitRing := Eval hnf in [comUnitRingType of int].
Canonical int_iDomain :=
Eval hnf in IdomainType int intUnitRing.idomain_axiomz.
Canonical int_countZmodType := [countZmodType of int].
Canonical int_countRingType := [countRingType of int].
Canonical int_countComRingType := [countComRingType of int].
Canonical int_countUnitRingType := [countUnitRingType of int].
Canonical int_countComUnitRingType := [countComUnitRingType of int].
Canonical int_countIdomainType := [countIdomainType of int].
Definition absz m := match m with Posz p => p | Negz n => n.+1 end.
Notation "m - n" :=
(@GRing.add int_ZmodType m%N (@GRing.opp int_ZmodType n%N)) : distn_scope.
Arguments absz m%distn_scope.
Local Notation "`| m |" := (absz m) : nat_scope.
Module intOrdered.
Section intOrdered.
Implicit Types m n p : int.
Local Coercion Posz : nat >-> int.
Local Notation normz m := (absz m)%:Z.
Definition lez m n :=
match m, n with
| Posz m', Posz n' => (m' <= n')%N
| Posz m', Negz n' => false
| Negz m', Posz n' => true
| Negz m', Negz n' => (n' <= m')%N
end.
Definition ltz m n :=
match m, n with
| Posz m', Posz n' => (m' < n')%N
| Posz m', Negz n' => false
| Negz m', Posz n' => true
| Negz m', Negz n' => (n' < m')%N
end.
Fact lez_norm_add x y : lez (normz (x + y)) (normz x + normz y).
Fact ltz_add x y : ltz 0 x -> ltz 0 y -> ltz 0 (x + y).
Fact lez_def x y : (lez x y) = (normz (y - x) == y - x).
Definition Mixin :=
NumMixin lez_norm_add ltz_add eq0_normz (in2W lez_total) normzM
lez_def ltz_def.
End intOrdered.
End intOrdered.
Canonical int_numDomainType := NumDomainType int intOrdered.Mixin.
Canonical int_realDomainType := RealDomainType int (intOrdered.lez_total 0).
Section intOrderedTheory.
Local Coercion Posz : nat >-> int.
Implicit Types m n p : nat.
Implicit Types x y z : int.

(* Specifications: *)
Lemma lez_nat m n : (m <= n :> int) = (m <= n)%N.
Fact mulrzAC m n x : (x *~ n) *~ m = (x *~ m) *~ n.
Lemma mulrzBl_nat (m n : nat) x : x *~ (m%:Z - n%:Z) = x *~ m - x *~ n.
Fact mulrzDl x : {morph *~%R x : m n / m + n}.