22From HB Require Import structures.
33From mathcomp Require Import all_ssreflect_compat finmap ssralg ssrnum ssrint.
44From mathcomp Require Import archimedean rat interval zmodp vector.
5- From mathcomp Require Import interval_inference fieldext falgebra.
65#[warning="-warn-library-file-internal-analysis"]
7- From mathcomp Require Import unstable.
6+ From mathcomp Require Import mathcomp_extra unstable.
87From mathcomp Require Import boolp classical_sets filter functions cardinality.
98From mathcomp Require Import set_interval ereal reals topology real_interval.
109From mathcomp Require Import convex prodnormedzmodule tvs num_normedtype.
@@ -20,6 +19,9 @@ From mathcomp Require Import ereal_normedtype pseudometric_normed_Zmodule.
2019(* normedModType K == interface type for a normed module *)
2120(* structure over the numDomainType K *)
2221(* The HB class is NormedModule. *)
22+ (* normedVectType K == interface type for a normed vectType *)
23+ (* structure over the numDomainType K *)
24+ (* The HB class is NormedVector. *)
2325(* `|x| == the norm of x (notation from ssrnum.v) *)
2426(* ``` *)
2527(* *)
@@ -86,15 +88,16 @@ HB.structure Definition NormedModule (K : numDomainType) :=
8688 {T of PseudoMetricNormedZmod K T & ConvexTvs K T
8789 & PseudoMetricNormedZmod_ConvexTvs_isNormedModule K T}.
8890
89- HB.factory Record PseudoMetricNormedZmod_Lmodule_isNormedModule (K : numFieldType) V
90- & PseudoMetricNormedZmod K V & GRing.Lmodule K V := {
91+ HB.factory Record PseudoMetricNormedZmod_Lmodule_isNormedModule
92+ (K : numFieldType) V & PseudoMetricNormedZmod K V & GRing.Lmodule K V := {
9193 normrZ : forall (l : K) (x : V), `| l *: x | = `| l | * `| x |;
9294}.
9395
9496HB.builders Context K V & PseudoMetricNormedZmod_Lmodule_isNormedModule K V.
9597
96- (* add_continuous has been moved to pseudometric_normed_Zmodule.v,
97- scale_continuous is proved but is not proved again anymore later in this file *)
98+ (**md `add_continuous` has been moved to `pseudometric_normed_Zmodule.v`,
99+ `scale_continuous` is proved but is not proved again anymore later in this
100+ file. *)
98101Let add_continuous : continuous (fun x : V * V => x.1 + x.2).
99102Proof . exact: add_continuous. Qed .
100103
@@ -148,6 +151,10 @@ HB.instance Definition _ :=
148151
149152HB.end .
150153
154+ #[short(type="normedVectType")]
155+ HB.structure Definition NormedVector (K : numDomainType) :=
156+ {T of NormedModule K T & Vector K T}.
157+
151158(**md see also `Section standard_topology_pseudoMetricNormedZmod` in
152159 `pseudometric_normed_Zmodule.v` *)
153160Section standard_topology_normedMod.
@@ -365,6 +372,13 @@ Lemma normrZV (K : numDomainType) (V : normedModType K) (x : V) :
365372 `|x| \in GRing.unit -> `| `| x |^-1 *: x | = 1.
366373Proof . by move=> nxu; rewrite normrZ normrV// normr_id mulVr. Qed .
367374
375+ HB.instance Definition _ (K : numDomainType) (V : normedModType K) :=
376+ Norm.isSemiNorm.Build K V (@Num.norm K V) (normr0 V)
377+ (@normr_ge0 _ V) (@ler_normD _ V) (@normrZ _ V).
378+
379+ HB.instance Definition _ (K : numDomainType) (V : normedModType K) :=
380+ Norm.SemiNorm_isNorm.Build K V (@Num.norm K V) (@normr0_eq0 _ V).
381+
368382Definition self_sub (K : numDomainType) (V W : normedModType K)
369383 (f : V -> W) (x : V * V) : W := f x.1 - f x.2.
370384Arguments self_sub {K V W} f x /.
@@ -2463,3 +2477,215 @@ Lemma open_disjoint_itv_bigcup : U = \bigcup_q open_disjoint_itv q.
24632477Proof . by rewrite /open_disjoint_itv; case: cid => //= I [_]. Qed .
24642478
24652479End open_set_disjoint_real_intervals.
2480+
2481+ Section EquivalenceNorms.
2482+ Variables (R : realType).
2483+
2484+ (* FIXME: Specialize to vector space with basis and expose this definition
2485+ (see https://github.com/math-comp/analysis/issues/1911).
2486+ It will also be possible to generalize to `numFieldType`. *)
2487+ Let max_norm (V : vectType R) x : R :=
2488+ \big[Order.max/0]_(i < \dim (@fullv _ V)) `|coord (vbasis fullv) i x|.
2489+
2490+ Definition max_space (V : vectType R) : Type := V.
2491+
2492+ HB.instance Definition _ (V : vectType R) := Vector.on (max_space V).
2493+
2494+ HB.instance Definition _ (V : vectType R) := Pointed.copy (max_space V) V^o.
2495+
2496+ Let max_norm_ge0 (V : vectType R) (x : V) : 0 <= max_norm x.
2497+ Proof .
2498+ rewrite /max_norm.
2499+ by elim/big_ind : _ => //= ? ? ? ?; rewrite /Order.max; case: ifP.
2500+ Qed .
2501+
2502+ (* FIXME: expose *)
2503+ Let le_coord_max_norm (V : vectType R) (x : V) i :
2504+ `|coord (vbasis fullv) i x| <= max_norm x :> R.
2505+ Proof .
2506+ rewrite /max_norm; elim: (index_enum _) (mem_index_enum i) => //= j l IHl.
2507+ rewrite inE big_cons [X in _ <= X _ _]/Order.max/= => /predU1P[<-|/IHl {}IHl];
2508+ case: ifP => [/ltW|]// /negbT.
2509+ set b := (X in _ < X).
2510+ have bR : b \is Num.real by apply: bigmax_real => // a _; apply: normr_real.
2511+ have /comparable_leNgt <- :=
2512+ real_comparable bR (normr_real (coord (vbasis fullv) j x)).
2513+ by move=> /(le_trans IHl).
2514+ Qed .
2515+
2516+ Let max_norm0 (V : vectType R) : @max_norm V 0 = 0.
2517+ Proof .
2518+ apply: le_anti; rewrite max_norm_ge0 andbT.
2519+ apply: bigmax_le => // i _.
2520+ have <-: \sum_(i < \dim (@fullv _ V)) 0 *: (vbasis (@fullv _ V))`_i = 0.
2521+ under eq_bigr do rewrite scale0r.
2522+ by rewrite sumr_const mul0rn.
2523+ by rewrite coord_sum_free ?normr0// (basis_free (vbasisP _)).
2524+ Qed .
2525+
2526+ Let ler_max_normD (V : vectType R) (x y : V) :
2527+ max_norm (x + y) <= max_norm x + max_norm y.
2528+ Proof .
2529+ apply: bigmax_le => [|/= i _]; first by rewrite addr_ge0// max_norm_ge0.
2530+ by rewrite raddfD/= (le_trans (ler_normD _ _))// lerD// le_coord_max_norm.
2531+ Qed .
2532+
2533+ Let max_norm0_eq0 (V : vectType R) (x : V) : max_norm x = 0 -> x = 0.
2534+ Proof .
2535+ move=> x0; rewrite (coord_vbasis (memvf x)).
2536+ suff: forall i, coord (vbasis fullv) i x = 0.
2537+ by move=> {}x0; rewrite big1//= => j _; rewrite x0 scale0r.
2538+ by move=> i; apply/normr0_eq0/le_anti; rewrite normr_ge0 -x0 le_coord_max_norm.
2539+ Qed .
2540+
2541+ Let max_normZ (V : vectType R) r (x : V) : max_norm (r *: x) = `|r| * max_norm x.
2542+ Proof .
2543+ rewrite /max_norm.
2544+ under eq_bigr do rewrite linearZ/= normrM.
2545+ elim: (index_enum _) => [|i l IHl]; first by rewrite !big_nil mulr0.
2546+ by rewrite !big_cons IHl maxr_pMr.
2547+ Qed .
2548+
2549+ HB.instance Definition _ (V : vectType R) := Norm.isSemiNorm.Build R V
2550+ (@max_norm V) (max_norm0 V) (@max_norm_ge0 V) (@ler_max_normD V)
2551+ (@max_normZ V).
2552+
2553+ HB.instance Definition _ (V : vectType R) := Norm.SemiNorm_isNorm.Build R V
2554+ (@max_norm V) (@max_norm0_eq0 V).
2555+
2556+ Let max_normMn (V : vectType R) (x : V) n : max_norm (x *+ n) = max_norm x *+ n.
2557+ Proof .
2558+ exact: (Norm.Theory.normMn (@normed_module_max_norm__canonical__Norm_Norm V)).
2559+ Qed .
2560+
2561+ Let max_normN (V : vectType R) (x : V) : max_norm (- x) = max_norm x.
2562+ Proof .
2563+ exact: (Norm.Theory.normN (@normed_module_max_norm__canonical__Norm_Norm V)).
2564+ Qed .
2565+
2566+ HB.instance Definition _ (V : vectType R) := Num.Zmodule_isNormed.Build R
2567+ (max_space V) (@ler_max_normD V) (@max_norm0_eq0 V) (@max_normMn V)
2568+ (@max_normN V).
2569+
2570+ HB.instance Definition _ (V : vectType R) :=
2571+ PseudoMetric.copy (max_space V) (pseudoMetric_normed (max_space V)).
2572+
2573+ HB.instance Definition _ (V : vectType R) :=
2574+ NormedZmod_PseudoMetric_eq.Build R (max_space V) erefl.
2575+
2576+ HB.instance Definition _ (V : vectType R) :=
2577+ PseudoMetricNormedZmod_Lmodule_isNormedModule.Build R (max_space V)
2578+ (@Norm.normZ _ _ (@max_norm V)).
2579+
2580+ (* NB: Get Trocq to prove the continuity part automatically. *)
2581+ Lemma sup_closed_ball_compact (V : vectType R) :
2582+ compact (closed_ball (0 : max_space V) 1).
2583+ Proof .
2584+ rewrite closed_ballE// /closed_ball_.
2585+ under eq_set do rewrite sub0r normrN.
2586+ rewrite -[forall x, _]/(compact _).
2587+ pose f (X : {ptws 'I_(\dim (@fullv _ V)) -> R}) : V :=
2588+ \sum_(i < \dim (@fullv _ V)) X i *: (vbasis fullv)`_i.
2589+ have -> : [set x : max_space V | `|x| <= 1] =
2590+ f @` [set X | forall i, `[-1, 1]%classic (X i)].
2591+ apply/seteqP; split=> [x/= x1|x/= [X X1 <-]].
2592+ (* FIXME: The type annotation on x is mandatory, otherwise we try to unify V
2593+ with its eta-expansion. *)
2594+ - exists (coord (vbasis fullv) ^~ (x : V)); last first.
2595+ exact/esym/coord_vbasis/memvf.
2596+ by move=> i; rewrite in_itv/= -ler_norml (le_trans _ x1) ?le_coord_max_norm.
2597+ - rewrite /normr/= /max_norm bigmax_le => //= i _.
2598+ by rewrite coord_sum_free ?ler_norml; [exact/basis_free/vbasisP|exact: X1].
2599+ apply: (@continuous_compact _ _ (f : _ -> max_space V)).
2600+ - apply/continuous_subspaceT/sum_continuous => /= i _ x.
2601+ exact/continuousZr_tmp/proj_continuous.
2602+ - apply: (@tychonoff 'I_(\dim (@fullv _ V)) (fun=> R^o)
2603+ (fun=> `[-1, 1]%classic)) => _.
2604+ exact: segment_compact.
2605+ Qed .
2606+
2607+ Lemma equivalence_norms (V : vectType R) (N N' : Norm.Norm.type V) :
2608+ exists2 M, 0 < M & forall x : max_space V, N' x <= M * N x /\ N x <= M * N' x.
2609+ Proof .
2610+ suff: forall (N : Norm.Norm.type V), exists2 M,
2611+ 0 < M & forall x : max_space V, `|x| <= M * N x /\ N x <= M * `|x|.
2612+ move=> /[dup] /(_ N) []/= M M0 Noo /(_ N') []/= M' M'0 N'oo.
2613+ exists (M * M') => [|x]; first exact: mulr_gt0.
2614+ move: Noo N'oo => /(_ x) [] Nge Nle /(_ x) [] N'ge N'le.
2615+ split; first by apply: (le_trans N'le); rewrite mulrAC mulrC ler_pM2r.
2616+ by rewrite (le_trans Nle)// -mulrA ler_pM2l.
2617+ move=> {N'}N.
2618+ set M0 := 1 + \sum_(i < \dim (@fullv _ V)) N (vbasis fullv)`_i.
2619+ have M00 : 0 < M0 by rewrite ltr_pwDl// sumr_ge0// => ? _; exact: Norm.norm_ge0.
2620+ have leNoo (x : max_space V) : N x <= M0 * `|x|.
2621+ rewrite [in leLHS](coord_vbasis (memvf (x : V))).
2622+ rewrite (le_trans (Norm.Theory.ler_norm_sum _ _ _))//.
2623+ rewrite mulrDl mul1r mulr_suml ler_wpDl// ler_sum => //= i _.
2624+ by rewrite Norm.normZ mulrC ler_pM// ?le_coord_max_norm// Norm.norm_ge0.
2625+ have NC0 : continuous (N : max_space V -> R).
2626+ move=> /= x; rewrite /continuous_at.
2627+ apply: cvg_zero; first exact: nbhs_filter.
2628+ apply/cvgr0Pnorm_le; first exact: nbhs_filter.
2629+ move=> /= e e0.
2630+ near=> y.
2631+ rewrite -[_ y]/(N y - N x) (@le_trans _ _ (N (y - x)))//.
2632+ apply/ler_normlP.
2633+ have NB a b : N a <= N b + N (a - b).
2634+ by rewrite (le_trans _ (Norm.ler_normD _ _))// subrKC.
2635+ by rewrite opprB !lerBlDl NB -opprB Norm.Theory.normN NB.
2636+ rewrite (le_trans (leNoo _))// mulrC -ler_pdivlMr// -opprB normrN.
2637+ by near: y; apply: cvgr_dist_le; [exact: cvg_id|exact: divr_gt0].
2638+ have: compact [set x : max_space V | `|x| = 1].
2639+ apply: (subclosed_compact _ (@sup_closed_ball_compact V)).
2640+ - apply: (@closed_comp _ _ _ [set 1 : R]); last exact: closed_eq.
2641+ by move=> *; exact: norm_continuous.
2642+ - by move => x/=; rewrite closed_ballE// /closed_ball_/= sub0r normrN => ->.
2643+ move=> /(@continuous_compact _ _ (N : max_space V -> R)) -/(_ _)/wrap[].
2644+ exact: continuous_subspaceT.
2645+ move=> /(@continuous_compact _ _ (@GRing.inv R)) -/(_ _)/wrap[].
2646+ move=> /= x; rewrite /continuous_at.
2647+ apply: (@continuous_in_subspaceT _ _
2648+ [set N x | x in [set x : max_space V | `|x| = 1]] (@GRing.inv R)).
2649+ move=> /= r /set_mem/= [y y1 <-].
2650+ apply: inv_continuous.
2651+ apply: contra_eq_neq y1 => /Norm.norm0_eq0 ->.
2652+ by rewrite normr0 eq_sym oner_eq0.
2653+ move=> /compact_bounded[M1 [M1R /(_ (1 + M1))]] /(_ (ltr_pwDl ltr01 (lexx _))).
2654+ rewrite /globally/= => M1N.
2655+ exists (maxr M0 (1 + M1)) => [|x]; first by rewrite lt_max M00.
2656+ split; last by rewrite (le_trans (leNoo x))// ler_wpM2r// le_max lexx.
2657+ have [->|x0] := eqVneq x 0; first by rewrite normr0 Norm.norm0 mulr0.
2658+ have Nx0 : 0 < N x.
2659+ rewrite lt0r Norm.norm_ge0 andbT.
2660+ by move: x0; apply: contra_neq => /Norm.norm0_eq0.
2661+ have normx0 : 0 < `|x| by rewrite normr_gt0.
2662+ move: M1N => /(_ (`|x| / N x)) -/(_ _)/wrap[].
2663+ exists (N x / `|x|); last by rewrite invf_div.
2664+ exists (`|x|^-1 *: x); last by rewrite Norm.normZ mulrC ger0_norm.
2665+ by rewrite normrZ normfV normr_id mulVf// gt_eqF.
2666+ rewrite ger0_norm; first by rewrite divr_ge0// Norm.norm_ge0.
2667+ rewrite ler_pdivrMr// => /le_trans; apply.
2668+ by rewrite ler_pM2r// le_max lexx orbT.
2669+ Unshelve. all: by end_near. Qed .
2670+
2671+ Lemma linear_findim_continuous (V : normedVectType R) (W : normedModType R)
2672+ (f : {linear V -> W}) : continuous f.
2673+ Proof .
2674+ set V' := @fullv _ V.
2675+ set B := vbasis V'.
2676+ move=> /= x; rewrite /continuous_at.
2677+ rewrite [x in f x](coord_vbasis (memvf x)) raddf_sum.
2678+ rewrite (@eq_cvg _ _ _ _ (fun y => \sum_(i < \dim V') coord B i y *: f B`_i)).
2679+ move=> y; rewrite [y in LHS](coord_vbasis (memvf y)) raddf_sum.
2680+ by apply: eq_big => // i _; apply: linearZ.
2681+ apply: cvg_sum => i _.
2682+ rewrite [X in _ --> X]linearZ/= -/B.
2683+ apply: cvgZr_tmp.
2684+ move: x; apply/linear_bounded_continuous/bounded_funP => r/=.
2685+ have [M M0 MP] := equivalence_norms (@Num.norm _ V) (@max_norm V).
2686+ exists (M * r) => x.
2687+ move: MP => /(_ x) [Mx _] xr.
2688+ by rewrite (le_trans (le_coord_max_norm _ _))// (le_trans Mx) ?ler_wpM2l// ltW.
2689+ Qed .
2690+
2691+ End EquivalenceNorms.
0 commit comments