Variant sgr_val x : R -> bool -> bool -> bool -> bool -> bool -> bool
-> bool -> bool -> bool -> bool -> bool -> bool -> R -> Set :=
| SgrNull of x = 0 : sgr_val x 0 true true true true false false
true false false true false false 0
| SgrPos of x > 0 : sgr_val x x false false true false false true
false false true false false true 1
| SgrNeg of x < 0 : sgr_val x (- x) false true false false true false
false true false false true false (-1).

(* Specifications: *)
Lemma sgrP x :
sgr_val x `|x| (0 == x) (x <= 0) (0 <= x) (x == 0) (x < 0) (0 < x)
(0 == sg x) (-1 == sg x) (1 == sg x)
(sg x == 0)  (sg x == -1) (sg x == 1) (sg x).
Lemma normrEsg x : `|x| = sg x * x.
Lemma sgrN x : sg (- x) = - sg x.
Lemma addr_max_min x y : max x y + min x y = x + y.
Lemma minrCA : @left_commutative R R min.
Lemma oppr_max x y : - max x y = min (- x) (- y).
Lemma oppr_min x y : - min x y = max (- x) (- y).
Lemma eqr_minl x y : (min x y == x) = (x <= y).
Lemma ler_minl x y z : (min y z <= x) = (y <= x) || (z <= x).
Lemma ler_maxr x y z : (x <= max y z) = (x <= y) || (x <= z).
Lemma addr_minr : @right_distributive R R +%R min.
Lemma addr_maxl : @left_distributive R R +%R max.
Lemma addr_maxr : @right_distributive R R +%R max.
Lemma minrK x y : max (min x y) x = x.
Lemma maxr_minr : @right_distributive R R max min.
Lemma minr_maxr : @right_distributive R R min max.
Lemma minr_nmulr x y z : x <= 0 -> x * min y z = max (x * y) (x * z).
Lemma maxr_pmulr x y z : 0 <= x -> x * max y z = max (x * y) (x * z).
Lemma maxr_nmulr x y z : x <= 0 -> x * max y z = min (x * y) (x * z).
Lemma minr_pmull x y z : 0 <= x -> min y z * x = min (y * x) (z * x).
Lemma maxNr x : max (- x) x = `|x|.
Lemma monic_Cauchy_bound : p \is monic -> {b | forall x, x >= b -> p.[x] > 0}.
End PolyBounds.