@@ -47,7 +47,8 @@ From HB Require Import structures.
4747From mathcomp Require Import boot order algebra.
4848#[warning="-warn-library-file-internal-analysis"]
4949From mathcomp Require Import unstable.
50- From mathcomp Require Import mathcomp_extra boolp classical_sets set_interval.
50+ From mathcomp Require Import mathcomp_extra boolp classical_sets contra
51+ set_interval.
5152
5253Declare Scope real_scope.
5354
@@ -647,13 +648,35 @@ move=> SBA AB Ai; rewrite lerNl opprK sup_le// ?has_inf_supN//.
647648exact/nonemptyN.
648649Qed .
649650
651+ Lemma supS A B : A !=set0 -> has_sup B -> A `<=` B -> sup A <= sup B.
652+ Proof .
653+ by move=> ? ? AB; apply: sup_le => //; apply: (subset_trans AB (@le_down _)).
654+ Qed .
655+
656+ Lemma infS A B : has_inf A -> B !=set0 -> B `<=` A -> inf A <= inf B.
657+ Proof .
658+ by move=> infA B0 AB; rewrite /inf lerN2 supS//;
659+ [exact/nonemptyN|exact/has_inf_supN|exact/image_subset].
660+ Qed .
661+
662+ Lemma le_supP A x : has_sup A -> sup A <= x <-> ubound A x.
663+ Proof .
664+ move=> hsA; split=> [? ? ?|Ax]; first exact: (le_trans (sup_upper_bound hsA _)).
665+ by apply: ge_sup => //; apply/set0P; contra: (@has_sup0 _ R) => <-.
666+ Qed .
667+
668+ Lemma gt_sup A x : has_sup A -> sup A < x -> forall y, A y -> y < x.
669+ Proof .
670+ by move=> hsA sAx y Ay; apply: le_lt_trans sAx; exact: sup_upper_bound.
671+ Qed .
672+
650673Lemma sup_down A : sup (down A) = sup A.
651674Proof .
652675have [supA|supNA] := pselect (has_sup A); last first.
653676 by rewrite !sup_out // => /has_sup_down.
654677have supDA : has_sup (down A) by apply/has_sup_down.
655678apply/eqP; rewrite eq_le !sup_le //.
656- - by case: supA => -[x xA] _; exists x; apply /le_down.
679+ - by case: supA => -[x xA] _; exists x; exact /le_down.
657680- by rewrite downK; exact: le_down.
658681- by case: supA.
659682Qed .
@@ -687,6 +710,12 @@ have [[_ Aub]|supA] := pselect (has_sup A); last by rewrite sup_out.
687710by rewrite (le_trans (A0 _ Aa))// ub_le_sup.
688711Qed .
689712
713+ Lemma inf_ge0 A : (forall x, A x -> 0 <= x) -> 0 <= inf A.
714+ Proof .
715+ move=> BA; have [->|A0] := eqVneq A set0; first by rewrite inf0.
716+ by apply: lb_le_inf => //; exact/set0P.
717+ Qed .
718+
690719Lemma has_sup_wpZl A (a : R) : 0 <= a -> has_sup A ->
691720 has_sup [set a * x | x in A ].
692721Proof .
@@ -701,7 +730,7 @@ move=> a0 [[_ [x Ax _]] [b ub]]; split; first by exists x.
701730by exists (b / a) => y Ay; rewrite ler_pdivlMr// mulrC ub//; exists y.
702731Qed .
703732
704- Lemma ge0_supZl A (a : R) : 0 <= a -> sup [set a * x | x in A ] = a * sup A.
733+ Lemma ge0_supZl A (a : R) : 0 <= a -> sup [set a * x | x in A ] = a * sup A.
705734Proof .
706735rewrite le_eqVlt => /predU1P[<-|an0].
707736 have [->|A0] := eqVneq A set0; first by rewrite image_set0 sup0 mulr0.
@@ -721,6 +750,20 @@ have [x1 ubx1] := ubA.
721750by exists (a * x1) => _ [x2 Ax2 <-]; rewrite ler_pM2l// ubx1.
722751Qed .
723752
753+ Lemma ge0_infZl A (a : R) : 0 <= a -> inf [set a * x | x in A] = a * inf A.
754+ Proof .
755+ move=> a0; rewrite /inf mulrN -(ge0_supZl (-%R @` A) a0); congr (- sup _).
756+ by rewrite !image_comp/=; apply: eq_imagel => //= ? _; rewrite mulrN.
757+ Qed .
758+
759+ Lemma inf_pos : inf [set r : R | 0 < r] = 0.
760+ Proof .
761+ apply/eqP; rewrite eq_le; apply/andP; split; last first.
762+ by apply: inf_ge0 => x /ltW.
763+ apply/ler_addgt0Pr => e e0; rewrite add0r; apply: ge_inf => //=.
764+ by exists 0 => r /ltW.
765+ Qed .
766+
724767Lemma has_sup_Mn A n : has_sup A -> has_sup [set x *+n | x in A].
725768Proof .
726769move=> [[x Ax] [y Ay]]; split; first by exists (x *+ n), x.
0 commit comments