diff options
| -rw-r--r-- | CHANGELOG_UNRELEASED.md | 16 | ||||
| -rw-r--r-- | mathcomp/algebra/ssrnum.v | 40 | ||||
| -rw-r--r-- | mathcomp/ssreflect/order.v | 81 |
3 files changed, 89 insertions, 48 deletions
diff --git a/CHANGELOG_UNRELEASED.md b/CHANGELOG_UNRELEASED.md index 08a16bd..8c8a1f7 100644 --- a/CHANGELOG_UNRELEASED.md +++ b/CHANGELOG_UNRELEASED.md @@ -31,6 +31,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). `contraPleq`, `contraPltn`, `contra_not_leq`, `contra_not_ltn`, `contra_leq_not`, `contra_ltn_not` - in `ssralg.v`, new lemma `sumr_const_nat` and `iter_addr_0` - in `ssrnum.v`, new lemma `ler_sum_nat` +- in `ssrnum.v`, new lemmas `big_real`, `sum_real`, `prod_real`, + `max_real`, `min_real`, `bigmax_real`, and `bigmin_real`. +- in `order.v`, new lemmas `comparable_bigl` and `comparable_bigr`. - in `seq.v`, new lemmas: `take_uniq`, `drop_uniq` - in `fintype.v`, new lemmas: `card_geqP`, `card_gt1P`, `card_gt2P`, @@ -274,6 +277,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - The `class_of` records of structures are turned into primitive records to prevent prevent potential issues of ambiguous paths and convertibility of structure instances. +- In `order.v`, rephrased `comparable_(min|max)[rl]` in terms of + `{in _, forall x y, _}`, hence reordering the arguments. Made them + hints for smoother combination with `comparable_big[lr]`. + +- In `order.v`, + + `>=< y` stands for `[pred x | x >=< y]` + + `>< y` stands for `[pred x | x >< y]` + + and the same holds for the dual `>=<^d`, `><^d`, the product + `>=<^p`, `><^p`, and lexicographic `>=<^l`, `><^l`. + The previous meanings can be obtained through `>=<%O x` and `><%O x`. +- In `srnum.v`, + + `>=< y` stands for `[pred x | x >=< y]` + ### Renamed diff --git a/mathcomp/algebra/ssrnum.v b/mathcomp/algebra/ssrnum.v index 2eefe8e..0244891 100644 --- a/mathcomp/algebra/ssrnum.v +++ b/mathcomp/algebra/ssrnum.v @@ -464,9 +464,6 @@ Notation "< y :> T" := (< (y : T)) (only parsing) : ring_scope. Notation "> y" := (lt y) : ring_scope. Notation "> y :> T" := (> (y : T)) (only parsing) : ring_scope. -Notation ">=< y" := (comparable y) : ring_scope. -Notation ">=< y :> T" := (>=< (y : T)) (only parsing) : ring_scope. - Notation "x <= y" := (le x y) : ring_scope. Notation "x <= y :> T" := ((x : T) <= (y : T)) (only parsing) : ring_scope. Notation "x >= y" := (y <= x) (only parsing) : ring_scope. @@ -490,12 +487,12 @@ Notation "x < y ?<= 'if' C" := (lterif x y C) : ring_scope. Notation "x < y ?<= 'if' C :> R" := ((x : R) < (y : R) ?<= if C) (only parsing) : ring_scope. -Notation ">=< x" := (comparable x) : ring_scope. -Notation ">=< x :> T" := (>=< (x : T)) (only parsing) : ring_scope. +Notation ">=< y" := [pred x | comparable x y] : ring_scope. +Notation ">=< y :> T" := (>=< (y : T)) (only parsing) : ring_scope. Notation "x >=< y" := (comparable x y) : ring_scope. -Notation ">< x" := (fun y => ~~ (comparable x y)) : ring_scope. -Notation ">< x :> T" := (>< (x : T)) (only parsing) : ring_scope. +Notation ">< y" := [pred x | ~~ comparable x y] : ring_scope. +Notation ">< y :> T" := (>< (y : T)) (only parsing) : ring_scope. Notation "x >< y" := (~~ (comparable x y)) : ring_scope. Canonical Rpos_keyed. @@ -1479,6 +1476,19 @@ rewrite sqrf_eq1 => /orP[/eqP //|]; rewrite -ger0_def le0r oppr_eq0 oner_eq0. by move/(addr_gt0 ltr01); rewrite subrr ltxx. Qed. +Lemma big_real x0 op I (P : pred I) F (s : seq I) : + {in real &, forall x y, op x y \is real} -> x0 \is real -> + {in P, forall i, F i \is real} -> \big[op/x0]_(i <- s | P i) F i \is real. +Proof. exact: comparable_bigr. Qed. + +Lemma sum_real I (P : pred I) (F : I -> R) (s : seq I) : + {in P, forall i, F i \is real} -> \sum_(i <- s | P i) F i \is real. +Proof. by apply/big_real; [apply: rpredD | apply: rpred0]. Qed. + +Lemma prod_real I (P : pred I) (F : I -> R) (s : seq I) : + {in P, forall i, F i \is real} -> \prod_(i <- s | P i) F i \is real. +Proof. by apply/big_real; [apply: rpredM | apply: rpred1]. Qed. + Section NormedZmoduleTheory. Variable V : normedZmodType R. @@ -1779,6 +1789,22 @@ move=> hx; rewrite -[X in `|X|]subr0; case: (@real_ltgtP 0 x); by rewrite ?subr0 ?sub0r //; constructor. Qed. +Lemma max_real : {in real &, forall x y, max x y \is real}. +Proof. exact: comparable_maxr. Qed. + +Lemma min_real : {in real &, forall x y, min x y \is real}. +Proof. exact: comparable_minr. Qed. + +Lemma bigmax_real I x0 (r : seq I) (P : pred I) (f : I -> R): + x0 \is real -> {in P, forall i : I, f i \is real} -> + \big[max/x0]_(i <- r | P i) f i \is real. +Proof. exact/big_real/max_real. Qed. + +Lemma bigmin_real I x0 (r : seq I) (P : pred I) (f : I -> R): + x0 \is real -> {in P, forall i : I, f i \is real} -> + \big[min/x0]_(i <- r | P i) f i \is real. +Proof. exact/big_real/min_real. Qed. + Lemma real_neqr_lt : {in real &, forall x y, (x != y) = (x < y) || (y < x)}. Proof. by move=> * /=; case: real_ltgtP. Qed. diff --git a/mathcomp/ssreflect/order.v b/mathcomp/ssreflect/order.v index b9ed011..da4d59d 100644 --- a/mathcomp/ssreflect/order.v +++ b/mathcomp/ssreflect/order.v @@ -419,7 +419,7 @@ Reserved Notation ">= y :> T" (at level 35, y at next level). Reserved Notation "< y :> T" (at level 35, y at next level). Reserved Notation "> y :> T" (at level 35, y at next level). Reserved Notation "x >=< y" (at level 70, no associativity). -Reserved Notation ">=< x" (at level 35). +Reserved Notation ">=< y" (at level 35). Reserved Notation ">=< y :> T" (at level 35, y at next level). Reserved Notation "x >< y" (at level 70, no associativity). Reserved Notation ">< x" (at level 35). @@ -454,7 +454,7 @@ Reserved Notation ">=^d y :> T" (at level 35, y at next level). Reserved Notation "<^d y :> T" (at level 35, y at next level). Reserved Notation ">^d y :> T" (at level 35, y at next level). Reserved Notation "x >=<^d y" (at level 70, no associativity). -Reserved Notation ">=<^d x" (at level 35). +Reserved Notation ">=<^d y" (at level 35). Reserved Notation ">=<^d y :> T" (at level 35, y at next level). Reserved Notation "x ><^d y" (at level 70, no associativity). Reserved Notation "><^d x" (at level 35). @@ -1146,9 +1146,6 @@ Notation "< y :> T" := (< (y : T)) (only parsing) : order_scope. Notation "> y" := (lt y) : order_scope. Notation "> y :> T" := (> (y : T)) (only parsing) : order_scope. -Notation ">=< y" := (comparable y) : order_scope. -Notation ">=< y :> T" := (>=< (y : T)) (only parsing) : order_scope. - Notation "x <= y" := (le x y) : order_scope. Notation "x <= y :> T" := ((x : T) <= (y : T)) (only parsing) : order_scope. Notation "x >= y" := (y <= x) (only parsing) : order_scope. @@ -1172,12 +1169,12 @@ Notation "x < y ?<= 'if' C" := (lteif x y C) : order_scope. Notation "x < y ?<= 'if' C :> T" := ((x : T) < (y : T) ?<= if C) (only parsing) : order_scope. -Notation ">=< x" := (comparable x) : order_scope. -Notation ">=< x :> T" := (>=< (x : T)) (only parsing) : order_scope. +Notation ">=< y" := [pred x | comparable x y] : order_scope. +Notation ">=< y :> T" := (>=< (y : T)) (only parsing) : order_scope. Notation "x >=< y" := (comparable x y) : order_scope. -Notation ">< x" := (fun y => ~~ (comparable x y)) : order_scope. -Notation ">< x :> T" := (>< (x : T)) (only parsing) : order_scope. +Notation ">< y" := [pred x | ~~ comparable x y] : order_scope. +Notation ">< y :> T" := (>< (y : T)) (only parsing) : order_scope. Notation "x >< y" := (~~ (comparable x y)) : order_scope. Notation "[ 'arg' 'min_' ( i < i0 | P ) F ]" := @@ -2541,9 +2538,6 @@ Notation "<^d y :> T" := (<^d (y : T)) (only parsing) : order_scope. Notation ">^d y" := (<^d%O y) : order_scope. Notation ">^d y :> T" := (>^d (y : T)) (only parsing) : order_scope. -Notation ">=<^d y" := (>=<^d%O y) : order_scope. -Notation ">=<^d y :> T" := (>=<^d (y : T)) (only parsing) : order_scope. - Notation "x <=^d y" := (<=^d%O x y) : order_scope. Notation "x <=^d y :> T" := ((x : T) <=^d (y : T)) (only parsing) : order_scope. Notation "x >=^d y" := (y <=^d x) (only parsing) : order_scope. @@ -2568,11 +2562,11 @@ Notation "x <^d y ?<= 'if' C :> T" := ((x : T) <^d (y : T) ?<= if C) (only parsing) : order_scope. Notation ">=<^d x" := (>=<^d%O x) : order_scope. -Notation ">=<^d x :> T" := (>=<^d (x : T)) (only parsing) : order_scope. +Notation ">=<^d y :> T" := (>=<^d (y : T)) (only parsing) : order_scope. Notation "x >=<^d y" := (>=<^d%O x y) : order_scope. -Notation "><^d x" := (fun y => ~~ (>=<^d%O x y)) : order_scope. -Notation "><^d x :> T" := (><^d (x : T)) (only parsing) : order_scope. +Notation "><^d y" := [pred x | ~~ dual_comparable x y] : order_scope. +Notation "><^d y :> T" := (><^d (y : T)) (only parsing) : order_scope. Notation "x ><^d y" := (~~ (><^d%O x y)) : order_scope. Notation "x `&^d` y" := (dual_meet x y) : order_scope. @@ -2973,17 +2967,17 @@ Proof. by rewrite !(fun_if, if_arg) ltxx/=; case: comparableP. Qed. Lemma max_maxxK x y : max x (max x y) = max x y. Proof. by rewrite !(fun_if, if_arg) ltxx/=; case: comparableP. Qed. -Lemma comparable_minl x y z : x >=< z -> y >=< z -> min x y >=< z. -Proof. by move=> cmp_xz cmp_yz; rewrite /min; case: ifP. Qed. +Lemma comparable_minl z : {in >=< z &, forall x y, min x y >=< z}. +Proof. by move=> x y cmp_xz cmp_yz; rewrite /min; case: ifP. Qed. -Lemma comparable_minr x y z : z >=< x -> z >=< y -> z >=< min x y. -Proof. by move=> cmp_xz cmp_yz; rewrite /min; case: ifP. Qed. +Lemma comparable_minr z : {in >=<%O z &, forall x y, z >=< min x y}. +Proof. by move=> x y cmp_xz cmp_yz; rewrite /min; case: ifP. Qed. -Lemma comparable_maxl x y z : x >=< z -> y >=< z -> max x y >=< z. -Proof. by move=> cmp_xz cmp_yz; rewrite /max; case: ifP. Qed. +Lemma comparable_maxl z : {in >=< z &, forall x y, max x y >=< z}. +Proof. by move=> x y cmp_xz cmp_yz; rewrite /max; case: ifP. Qed. -Lemma comparable_maxr x y z : z >=< x -> z >=< y -> z >=< max x y. -Proof. by move=> cmp_xz cmp_yz; rewrite /max; case: ifP. Qed. +Lemma comparable_maxr z : {in >=<%O z &, forall x y, z >=< max x y}. +Proof. by move=> x y cmp_xz cmp_yz; rewrite /max; case: ifP. Qed. Section Comparable2. Variables (z x y : T) (cmp_xy : x >=< y). @@ -3165,7 +3159,7 @@ Lemma comparable_minACA x y z t : Proof. move=> xy xz xt yz yt zt; rewrite comparable_minA// ?comparable_minl//. rewrite [min _ z]comparable_minAC// -comparable_minA// ?comparable_minl//. -by rewrite comparable_sym. +by rewrite inE comparable_sym. Qed. Lemma comparable_maxACA x y z t : @@ -3174,7 +3168,7 @@ Lemma comparable_maxACA x y z t : Proof. move=> xy xz xt yz yt zt; rewrite comparable_maxA// ?comparable_maxl//. rewrite [max _ z]comparable_maxAC// -comparable_maxA// ?comparable_maxl//. -by rewrite comparable_sym. +by rewrite inE comparable_sym. Qed. Lemma comparable_max_minr x y z : x >=< y -> x >=< z -> y >=< z -> @@ -3226,12 +3220,23 @@ Lemma nmono_in_leif (A : {pred T}) (f : T -> T) C : {in A &, forall x y, (f x <= f y ?= iff C) = (y <= x ?= iff C)}. Proof. by move=> mf x y Ax Ay; rewrite /leif !eq_le !mf. Qed. -Lemma nmono_leif (f : T -> T) C : - {mono f : x y /~ x <= y} -> +Lemma nmono_leif (f : T -> T) C : {mono f : x y /~ x <= y} -> forall x y, (f x <= f y ?= iff C) = (y <= x ?= iff C). Proof. by move=> mf x y; rewrite /leif !eq_le !mf. Qed. +Lemma comparable_bigl x x0 op I (P : pred I) F (s : seq I) : + {in >=< x &, forall y z, op y z >=< x} -> x0 >=< x -> + {in P, forall i, F i >=< x} -> \big[op/x0]_(i <- s | P i) F i >=< x. +Proof. by move=> *; elim/big_ind : _. Qed. + +Lemma comparable_bigr x x0 op I (P : pred I) F (s : seq I) : + {in >=<%O x &, forall y z, x >=< op y z} -> x >=< x0 -> + {in P, forall i, x >=< F i} -> x >=< \big[op/x0]_(i <- s | P i) F i. +Proof. by move=> *; elim/big_ind : _. Qed. + End POrderTheory. +Hint Resolve comparable_minr comparable_minl : core. +Hint Resolve comparable_maxr comparable_maxl : core. Section ContraTheory. Context {disp1 disp2 : unit} {T1 : porderType disp1} {T2 : porderType disp2}. @@ -5785,9 +5790,6 @@ Notation "<^p y :> T" := (<^p (y : T)) (only parsing) : order_scope. Notation ">^p y" := (<^p%O y) : order_scope. Notation ">^p y :> T" := (>^p (y : T)) (only parsing) : order_scope. -Notation ">=<^p y" := (>=<^p%O y) : order_scope. -Notation ">=<^p y :> T" := (>=<^p (y : T)) (only parsing) : order_scope. - Notation "x <=^p y" := (<=^p%O x y) : order_scope. Notation "x <=^p y :> T" := ((x : T) <=^p (y : T)) (only parsing) : order_scope. Notation "x >=^p y" := (y <=^p x) (only parsing) : order_scope. @@ -5807,12 +5809,12 @@ Notation "x <=^p y ?= 'iff' C" := (<?=^p%O x y C) : order_scope. Notation "x <=^p y ?= 'iff' C :> T" := ((x : T) <=^p (y : T) ?= iff C) (only parsing) : order_scope. -Notation ">=<^p x" := (>=<^p%O x) : order_scope. -Notation ">=<^p x :> T" := (>=<^p (x : T)) (only parsing) : order_scope. +Notation ">=<^p y" := [pred x | >=<^p%O x y] : order_scope. +Notation ">=<^p y :> T" := (>=<^p (y : T)) (only parsing) : order_scope. Notation "x >=<^p y" := (>=<^p%O x y) : order_scope. -Notation "><^p x" := (fun y => ~~ (>=<^p%O x y)) : order_scope. -Notation "><^p x :> T" := (><^p (x : T)) (only parsing) : order_scope. +Notation "><^p y" := [pred x | ~~ (>=<^p%O x y)] : order_scope. +Notation "><^p y :> T" := (><^p (y : T)) (only parsing) : order_scope. Notation "x ><^p y" := (~~ (><^p%O x y)) : order_scope. Notation "x `&^p` y" := (@meet prod_display _ x y) : order_scope. @@ -5898,9 +5900,6 @@ Notation "<^l y :> T" := (<^l (y : T)) (only parsing) : order_scope. Notation ">^l y" := (<^l%O y) : order_scope. Notation ">^l y :> T" := (>^l (y : T)) (only parsing) : order_scope. -Notation ">=<^l y" := (>=<^l%O y) : order_scope. -Notation ">=<^l y :> T" := (>=<^l (y : T)) (only parsing) : order_scope. - Notation "x <=^l y" := (<=^l%O x y) : order_scope. Notation "x <=^l y :> T" := ((x : T) <=^l (y : T)) (only parsing) : order_scope. Notation "x >=^l y" := (y <=^l x) (only parsing) : order_scope. @@ -5920,12 +5919,12 @@ Notation "x <=^l y ?= 'iff' C" := (<?=^l%O x y C) : order_scope. Notation "x <=^l y ?= 'iff' C :> T" := ((x : T) <=^l (y : T) ?= iff C) (only parsing) : order_scope. -Notation ">=<^l x" := (>=<^l%O x) : order_scope. -Notation ">=<^l x :> T" := (>=<^l (x : T)) (only parsing) : order_scope. +Notation ">=<^l y" := [pred x | >=<^l%O x y] : order_scope. +Notation ">=<^l y :> T" := (>=<^l (y : T)) (only parsing) : order_scope. Notation "x >=<^l y" := (>=<^l%O x y) : order_scope. -Notation "><^l x" := (fun y => ~~ (>=<^l%O x y)) : order_scope. -Notation "><^l x :> T" := (><^l (x : T)) (only parsing) : order_scope. +Notation "><^l y" := [pred x | ~~ (>=<^l%O x y)] : order_scope. +Notation "><^l y :> T" := (><^l (y : T)) (only parsing) : order_scope. Notation "x ><^l y" := (~~ (><^l%O x y)) : order_scope. Notation meetlexi := (@meet lexi_display _). |
