@@ -30,9 +30,11 @@ From mathcomp Require Import num_normedtype.
3030(* *)
3131(* ## Normed topological abelian groups *)
3232(* ``` *)
33- (* pseudoMetricNormedZmodType R == interface type for a normed topological *)
34- (* abelian group equipped with a norm *)
35- (* The HB class is PseudoMetricNormedZmod. *)
33+ (* pseudoMetricNormedZmodType R == interface type for a normed topological *)
34+ (* abelian group equipped with a norm *)
35+ (* The HB class is PseudoMetricNormedZmod. *)
36+ (* NormedZmoduleMetric == factory for pseudoMetricNormedZmodType *)
37+ (* based on metric structures *)
3638(* ``` *)
3739(* *)
3840(* ## Closed balls *)
@@ -59,8 +61,6 @@ From mathcomp Require Import num_normedtype.
5961(* *)
6062(***************************************************************************** *)
6163
62- Reserved Notation "x ^'+" (at level 3, left associativity, format "x ^'+").
63- Reserved Notation "x ^'-" (at level 3, left associativity, format "x ^'-").
6464Reserved Notation "[ 'bounded' E | x 'in ' A ]"
6565 (at level 0, x name, format "[ 'bounded' E | x 'in ' A ]").
6666
@@ -97,97 +97,6 @@ End Shift.
9797Arguments shift {R} x / y.
9898Notation center c := (shift (- c)).
9999
100- Section at_left_right.
101- Variable R : numFieldType.
102-
103- Definition at_left (x : R) := within (fun u => u < x) (nbhs x).
104- Definition at_right (x : R) := within (fun u => x < u) (nbhs x).
105- Local Notation "x ^'-" := (at_left x) : classical_set_scope.
106- Local Notation "x ^'+" := (at_right x) : classical_set_scope.
107-
108- Global Instance at_right_proper_filter (x : R) : ProperFilter x^'+.
109- Proof .
110- apply: Build_ProperFilter => -[_/posnumP[d] /(_ (x + d%:num / 2))].
111- apply; last by rewrite ltrDl.
112- by rewrite /= opprD addNKr normrN ger0_norm// gtr_pMr// invf_lt1// ltr1n.
113- Qed .
114-
115- Global Instance at_left_proper_filter (x : R) : ProperFilter x^'-.
116- Proof .
117- apply: Build_ProperFilter => -[_ /posnumP[d] /(_ (x - d%:num / 2))].
118- apply; last by rewrite gtrBl.
119- by rewrite /= opprB addrC subrK ger0_norm// gtr_pMr// invf_lt1// ltr1n.
120- Qed .
121-
122- Lemma nbhs_right_gt x : \forall y \near x^'+, x < y.
123- Proof . by rewrite near_withinE; apply: nearW. Qed .
124-
125- Lemma nbhs_left_lt x : \forall y \near x^'-, y < x.
126- Proof . by rewrite near_withinE; apply: nearW. Qed .
127-
128- Lemma nbhs_right_neq x : \forall y \near x^'+, y != x.
129- Proof . by rewrite near_withinE; apply: nearW => ? /gt_eqF->. Qed .
130-
131- Lemma nbhs_left_neq x : \forall y \near x^'-, y != x.
132- Proof . by rewrite near_withinE; apply: nearW => ? /lt_eqF->. Qed .
133-
134- Lemma nbhs_right_ge x : \forall y \near x^'+, x <= y.
135- Proof . by rewrite near_withinE; apply: nearW; apply/ltW. Qed .
136-
137- Lemma nbhs_left_le x : \forall y \near x^'-, y <= x.
138- Proof . by rewrite near_withinE; apply: nearW => ?; apply/ltW. Qed .
139-
140- Lemma nbhs_right_lt x z : x < z -> \forall y \near x^'+, y < z.
141- Proof .
142- move=> xz; exists (z - x) => //=; first by rewrite subr_gt0.
143- by move=> y /= + xy; rewrite distrC ?ger0_norm ?subr_ge0 1?ltW// ltrD2r.
144- Qed .
145-
146- Lemma nbhs_right_ltW x z : x < z -> \forall y \near nbhs x^'+, y <= z.
147- Proof .
148- by move=> xz; near=> y; apply/ltW; near: y; exact: nbhs_right_lt.
149- Unshelve. all: by end_near. Qed .
150-
151- Lemma nbhs_right_ltDr x e : 0 < e -> \forall y \near x ^'+, y - x < e.
152- Proof .
153- move=> e0; near=> y; rewrite ltrBlDr; near: y.
154- by apply: nbhs_right_lt; rewrite ltrDr.
155- Unshelve. all: by end_near. Qed .
156-
157- Lemma nbhs_right_le x z : x < z -> \forall y \near x^'+, y <= z.
158- Proof . by move=> xz; near do apply/ltW; apply: nbhs_right_lt.
159- Unshelve. all: by end_near. Qed .
160-
161- (* NB: In not_near_at_rightP (and not_near_at_rightP), R has type numFieldType.
162- It is possible realDomainType could make the proof simpler and at least as
163- useful. *)
164- Lemma not_near_at_rightP (p : R) (P : pred R) :
165- ~ (\forall x \near p^'+, P x) <->
166- forall e : {posnum R}, exists2 x, p < x < p + e%:num & ~ P x.
167- Proof .
168- split=> [pPf e|ex_notPx].
169- - apply: contrapT => /forallPNP peP; apply: pPf; near=> t.
170- apply: contrapT; apply: peP; apply/andP; split.
171- + by near: t; exact: nbhs_right_gt.
172- + by near: t; apply: nbhs_right_lt; rewrite ltrDl.
173- - rewrite /at_right near_withinE nearE.
174- rewrite -filter_from_ballE /filter_from/= -forallPNP => _ /posnumP[d].
175- have [x /andP[px xpd] notPx] := ex_notPx d; rewrite -existsNP; exists x => /=.
176- apply: contra_not notPx; apply => //.
177- by rewrite /ball/= ltr0_norm ?subr_lt0// opprB ltrBlDl.
178- Unshelve. all: by end_near. Qed .
179-
180- End at_left_right.
181- #[global] Typeclasses Opaque at_left at_right.
182- Notation "x ^'-" := (at_left x) : classical_set_scope.
183- Notation "x ^'+" := (at_right x) : classical_set_scope.
184-
185- #[global] Hint Extern 0 (Filter (nbhs _^'+)) =>
186- (apply: at_right_proper_filter) : typeclass_instances.
187-
188- #[global] Hint Extern 0 (Filter (nbhs _^'-)) =>
189- (apply: at_left_proper_filter) : typeclass_instances.
190-
191100Section at_left_right_topologicalType.
192101Variables (R : numFieldType) (V : topologicalType) (f : R -> V) (x : R).
193102
@@ -225,6 +134,25 @@ HB.structure Definition PseudoMetricNormedZmod (R : numDomainType) :=
225134 {T of Num.NormedZmodule R T & PseudoMetric R T
226135 & NormedZmod_PseudoMetric_eq R T & isPointed T}.
227136
137+ (* alternative definition of a PseudoMetricNormedZmod *)
138+ HB.factory Record NormedZmoduleMetric (R : numDomainType) T
139+ of Num.NormedZmodule R T & Metric R T & isPointed T := {
140+ mdist_norm : forall x y : T, mdist x y = `|y - x|
141+ }.
142+
143+ HB.builders Context (R : numDomainType) T of NormedZmoduleMetric R T.
144+
145+ Let pseudo_metric_ball_norm : ball = ball_ (fun x : T => `| x |).
146+ Proof .
147+ apply/funext => /= t; apply/funext => d; rewrite ballEmdist.
148+ by apply/seteqP; split => [y|y]/=; rewrite mdist_norm distrC.
149+ Qed .
150+
151+ HB.instance Definition _ :=
152+ NormedZmod_PseudoMetric_eq.Build R T pseudo_metric_ball_norm.
153+
154+ HB.end .
155+
228156Section pseudoMetricNormedZmod_numDomainType.
229157Context {K : numDomainType} {V : pseudoMetricNormedZmodType K}.
230158
0 commit comments