Section NumIntegralDomainTheory.
Variable R : numDomainType.
Implicit Types (V : normedZmodType R) (x y z t : R).
(* Lemmas from the signature (reexported from internals). *)
Definition ler_norm_add V (x y : V) : `|x + y| <= `|x| + `|y| :=
ler_norm_add x y.
Definition addr_gt0 x y : 0 < x -> 0 < y -> 0 < x + y := @addr_gt0 R x y.
Definition normr0_eq0 V (x : V) : `|x| = 0 -> x = 0 := @normr0_eq0 R V x.
Definition ger_leVge x y : 0 <= x -> 0 <= y -> (x <= y) || (y <= x) :=
@ger_leVge R x y.
Definition normrM : {morph norm : x y / (x : R) * y} := @normrM R.
Definition ler_def x y : (x <= y) = (`|y - x| == y - x) := ler_def x y.
Definition normrMn V (x : V) n : `|x *+ n| = `|x| *+ n := normrMn x n.
Definition normrN V (x : V) : `|- x| = `|x| := normrN x.
(* Predicate definitions. *)
(* General properties of <= and < *)
Hint Resolve ler01 ltr01 ler0n : core.
(* Ordered ring properties. *)
Definition lter01 := (ler01, ltr01).
(* Properties of the real subset. *)
Variant ger0_xor_lt0 (x : R) : R -> R -> R -> R -> R ->
bool -> bool -> Set :=
| Ger0NotLt0 of 0 <= x : ger0_xor_lt0 x 0 0 x x x false true
| Ltr0NotGe0 of x < 0  : ger0_xor_lt0 x x x 0 0 (- x) true false.
Variant ler0_xor_gt0 (x : R) : R -> R -> R -> R -> R ->
bool -> bool -> Set :=
| Ler0NotLe0 of x <= 0 : ler0_xor_gt0 x x x 0 0 (- x) false true
| Gtr0NotGt0 of 0 < x  : ler0_xor_gt0 x 0 0 x x x true false.
Variant comparer0 x : R -> R -> R -> R -> R ->
bool -> bool -> bool -> bool -> bool -> bool -> Set :=
| ComparerGt0 of 0 < x : comparer0 x 0 0 x x x false false false true false true
| ComparerLt0 of x < 0 : comparer0 x x x 0 0 (- x) false false true false true false
| ComparerEq0 of x = 0 : comparer0 x 0 0 0 0 0 true true true true false false.
(* mulr and ler/ltr *)
(* Binary forms, for backchaining. *)
(* complement for x *+ n and <= or < *)
(* real of mul *)
Definition mulr_egte1 := (mulr_ege1, mulr_egt1).
Definition mulr_cp1 := (mulr_ilte1, mulr_egte1).
(* ler and ^-1 *)
Definition exprn_gte0 := (exprn_ge0, exprn_gt0).
Definition exprn_ilte1 := (exprn_ile1, exprn_ilt1).
Definition exprn_egte1 := (exprn_ege1, exprn_egt1).
Definition exprn_cp1 := (exprn_ilte1, exprn_egte1).
Definition lter_iexpr := (ler_iexpr, ltr_iexpr).
Definition lter_eexpr := (ler_eexpr, ltr_eexpr).
Definition lter_expr := (lter_iexpr, lter_eexpr).
Definition lter_expn2r := (ler_expn2r, ltr_expn2r).
Definition lter_pexpn2r := (ler_pexpn2r, ltr_pexpn2r).
Definition expr_lte1 := (expr_le1, expr_lt1).
Definition expr_gte1 := (expr_ge1, expr_gt1).
Definition invr_gte1 := (invr_ge1, invr_gt1).

Lemma maxr_pmulr x y z : 0 <= x -> x * max y z = max (x * y) (x * z).