11(* mathcomp analysis (c) 2025 Inria and AIST. License: CeCILL-C. *)
22From HB Require Import structures.
33From mathcomp Require Import all_ssreflect ssralg ssrint ssrnum matrix.
4- From mathcomp Require Import rat interval zmodp vector fieldext falgebra .
5- From mathcomp Require Import archimedean finmap.
4+ From mathcomp Require Import interval_inference rat interval zmodp vector.
5+ From mathcomp Require Import fieldext falgebra archimedean finmap.
66From mathcomp Require Import mathcomp_extra unstable boolp classical_sets.
7- From mathcomp Require Import interval_inference reals topology_structure.
7+ From mathcomp Require Import contra reals topology_structure.
88From mathcomp Require Import uniform_structure pseudometric_structure.
99From mathcomp Require Import num_topology product_topology separation_axioms.
1010
11+ (**md************************************************************************* *)
12+ (* # Metric spaces *)
13+ (* *)
14+ (* ``` *)
15+ (* metricType K == metric structure with distance mdist *)
16+ (* The mixin is defined by extending PseudoMetric. *)
17+ (* The HB class is Metric. *)
18+ (* R^o with R : numFieldType is shown to be a metric space. *)
19+ (* ``` *)
20+ (***************************************************************************** *)
21+
1122Set Implicit Arguments .
1223Unset Strict Implicit .
1324Unset Printing Implicit Defensive.
6778
6879Lemma metric_hausdorff : hausdorff_space T.
6980Proof .
70- move=> p q pq; apply: contrapT => qp; move: pq.
81+ move=> p q pq; absurd_not => qp; move: pq.
7182pose D := dist p q / 2; have D0 : 0 < D.
72- by rewrite divr_gt0// mdist_gt0; exact/eqP .
83+ by rewrite divr_gt0// mdist_gt0.
7384have p2Dq : ~ ball p (dist p q) q by rewrite ballEmdist/= ltxx.
7485move=> /(_ (ball p _) (ball q _) (nbhsx_ballx _ _ D0) (nbhsx_ballx _ _ D0)).
7586move/set0P/eqP; apply; rewrite -subset0 => x [pDx /ball_sym qDx].
@@ -93,22 +104,18 @@ Proof. by move/normr0_eq0/eqP; rewrite subr_eq0 => /eqP. Qed.
93104Let ballEmdist x d : ball x d = [set y | dist x y < d].
94105Proof . by apply/seteqP; split => [|]/= A; rewrite /ball/= distrC. Qed .
95106
96- Fail Check R^o : metricType R.
97-
98107HB.instance Definition _ :=
99108 @isMetric.Build R R^o dist dist_ge0 dist_positivity ballEmdist.
100109
101- Check R^o : metricType R.
102-
103110End numFieldType_metric.
104111
105112Module metricType_numDomainType.
106113(* tentative generalization of the section
107114pseudoMetricNormedZmod_numDomainType
108- from pseudoMetricNormedZmod_numDomainType
115+ from pseudoMetricNormedZmod
109116to
110117metricType *)
111- Section tmp .
118+ Section metricType_numDomainType .
112119Context {K : numDomainType} {V : metricType K}.
113120
114121Local Notation ball_mdist := (fun x d => [set y : V | mdist x y < d]).
@@ -158,9 +165,9 @@ Proof.
158165by move=> ? ? ?; near do rewrite ltW//; apply: cvgr_dist_lt.
159166Unshelve. all: by end_near. Qed .
160167
161- End tmp .
168+ End metricType_numDomainType .
162169
163- Section tmp2 .
170+ Section at_left_right_metricType .
164171(* tentative generalization of the section
165172at_left_right_pseudoMetricNormedZmod
166173from
@@ -209,18 +216,21 @@ Lemma cvgrPdist_le {T} {F : set_system T} {FF : Filter F} (f : T -> V) (y : V) :
209216 f @ F --> y <-> forall eps, 0 < eps -> \forall t \near F, mdist y (f t) <= eps.
210217Proof . exact: (cvgrP _ 0 1)%N. Qed .
211218
212- End tmp2 .
219+ End at_left_right_metricType .
213220
214- Section tmp3.
221+ End metricType_numDomainType.
222+
223+ Section cvg_nbhsP.
215224Variables (R : realType) (V : metricType R).
216225
226+ Import metricType_numDomainType.
227+
217228Lemma cvg_nbhsP (f : V -> V) (p l : V) : f x @[x --> p] --> l <->
218229 (forall u : nat -> V, (u n @[n --> \oo] --> p) -> f (u n) @[n --> \oo] --> l).
219230Proof .
220231split=> [/cvgrPdist_le /= fpl u /cvgrPdist_lt /= uyp|pfl].
221232 apply/cvgrPdist_le => e /fpl.
222- rewrite -filter_from_mdist_nbhs.
223- move=> [d d0 pdf].
233+ rewrite -filter_from_mdist_nbhs => -[d d0 pdf].
224234 by apply: filterS (uyp d d0) => t /pdf.
225235apply: contrapT => fpl; move: pfl; apply/existsNP.
226236suff: exists2 x : nat -> V,
@@ -232,26 +242,21 @@ have [e He] : exists e : {posnum R}, forall d : {posnum R},
232242 apply/cvgrPdist_le => e e0; have /existsNP[d] := h (PosNum e0).
233243 move/forallNP => {}h; near=> t.
234244 have /not_andP[abs|/negP] := h t.
235- - exfalso; apply : abs.
245+ - absurd : abs.
236246 near: t.
237- rewrite !near_simpl.
238- rewrite /prop_near1.
239- rewrite -nbhs_nbhs_mdist.
240- exists d%:num => //= z/=.
241- by rewrite metric_sym.
247+ rewrite !near_simpl /prop_near1 -nbhs_nbhs_mdist.
248+ by exists d%:num => //= z/=; rewrite metric_sym.
242249 - by rewrite -ltNge metric_sym => /ltW.
243- have invn n : 0 < n.+1%:R^-1 :> R by rewrite invr_gt0.
244- exists (fun n => sval (cid (He (PosNum (invn n))))).
250+ exists (fun n => sval (cid (He n.+1%:R^-1%:pos))).
245251 apply/cvgrPdist_lt => r r0; near=> t.
246252 rewrite /sval/=; case: cid => x [xpt _].
247- rewrite metric_sym (lt_le_trans xpt)// -[leRHS]invrK lef_pV2 ?posrE ?invr_gt0//.
248- near: t; exists (trunc r^-1) => // s /= rs.
253+ rewrite metric_sym (lt_le_trans xpt)//.
254+ rewrite -[leRHS]invrK lef_pV2 ?posrE ?invr_gt0//.
255+ near: t; exists (truncn r^-1) => // s /= rs.
249256 by rewrite (le_trans (ltW (truncnS_gt _)))// ler_nat.
250257move=> /cvgrPdist_lt/(_ e%:num (ltac:(by [])))[] n _ /(_ _ (leqnn _)).
251258rewrite /sval/=; case: cid => // x [px xpn].
252259by rewrite ltNge metric_sym => /negP.
253260Unshelve. all: end_near. Qed .
254261
255- End tmp3.
256-
257- End metricType_numDomainType.
262+ End cvg_nbhsP.
0 commit comments