Skip to content

Commit a9495ec

Browse files
authored
Merge pull request #1589 from affeldt-aist/metric_space
metric structure
2 parents 04de644 + 8d2b37e commit a9495ec

10 files changed

Lines changed: 468 additions & 133 deletions

File tree

CHANGELOG_UNRELEASED.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,33 @@
190190
`variations_opp`, `nondecreasing_bounded_variation`
191191
- in `Rstruct.v`:
192192
+ lemmas `RleP`, `RltP` (change implicits)
193+
- new file `metric_structure.v`:
194+
+ mixin `PseudoMetric_isMetric`, structure `Metric`, type `metricType`
195+
* with fields `mdist`, `mdist_ge0`, `mdist_positivity`, `ballEmdist`
196+
+ lemmas `metric_sym`, `mdistxx`, `mdist_gt0`, `metric_triangle`,
197+
`metric_hausdorff`
198+
+ `R^o` declared to be an instance of `metricType`
199+
+ module `metricType_numDomainType`
200+
* lemmas `ball_mdistE`, `nbhs_nbhs_mdist`, `nbhs_mdistP`,
201+
`filter_from_mdist_nbhs`, `fcvgrPdist_lt`, `cvgrPdist_lt`,
202+
`cvgr_dist_lt`, `cvgr_dist_le`, `nbhsr0P`, `cvgrPdist_le`
203+
+ factory `isMetric`
204+
205+
- in `pseudometric_normed_Zmodule.v`:
206+
+ factory `NormedZmoduleMetric` with field `mdist_norm`
207+
208+
### Changed
209+
210+
- moved from `pseudometric_normed_Zmodule.v` to `num_topology.v`:
211+
+ notations `^'+`, `^'-`
212+
+ definitions `at_left`, `at_right`
213+
+ instances `at_right_proper_filter`, `at_left_proper_filter`
214+
+ lemmas `nbhs_right_gt`, `nbhs_left_lt`, `nbhs_right_neq`, `nbhs_left_neq`,
215+
`nbhs_left_neq`, `nbhs_left_le`, `nbhs_right_lt`, `nbhs_right_ltW`,
216+
`nbhs_right_ltDr`, `nbhs_right_le`, `not_near_at_rightP`
217+
218+
- moved from `realfun.v` to `metric_structure.v` and generalized:
219+
+ lemma `cvg_nbhsP`
193220

194221
### Renamed
195222

_CoqProject

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ theories/topology_theory/one_point_compactification.v
6464
theories/topology_theory/sigT_topology.v
6565
theories/topology_theory/discrete_topology.v
6666
theories/topology_theory/separation_axioms.v
67+
theories/topology_theory/metric_structure.v
6768

6869
theories/homotopy_theory/homotopy.v
6970
theories/homotopy_theory/wedge_sigT.v

theories/Make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ topology_theory/one_point_compactification.v
3131
topology_theory/sigT_topology.v
3232
topology_theory/discrete_topology.v
3333
topology_theory/separation_axioms.v
34+
topology_theory/metric_structure.v
3435

3536
homotopy_theory/homotopy.v
3637
homotopy_theory/wedge_sigT.v

theories/lebesgue_integral_theory/lebesgue_integral_under.v

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ have [Z [mZ Z0 /subsetCPl ncfZ]] := cf.
6262
have BZ_cf x : x \in B `\` Z -> {in I, continuous (f ^~ x)}.
6363
by rewrite inE/= => -[Bx nZx]; exact: ncfZ.
6464
have [vu|uv] := lerP v u.
65-
by move: (Ia); rewrite /I set_itv_ge// -leNgt bnd_simp.
66-
apply/cvg_nbhsP => w wa.
65+
by move: Ia; rewrite /I set_itv_ge// -leNgt bnd_simp.
66+
apply/(@cvg_nbhsP _ R^o) => w wa.
6767
have /near_in_itvoo[e /= e0 aeuv] : a \in `]u, v[ by rewrite inE.
6868
move/cvgrPdist_lt : (wa) => /(_ _ e0)[N _ aue].
6969
have IwnN n : I (w (n + N)) by apply: aeuv; apply: aue; exact: leq_addl.
7070
have : forall n, {ae mu, forall y, B y -> `|f (w (n + N)) y| <= g y}.
7171
by move=> n; exact: g_ub.
72-
move/choice => [/= U /all_and3[mU U0 Ug_ub]].
72+
move/choice => [/= U /all_and3[mU U0 Ug_ub]].
7373
have mUU n : measurable (\big[setU/set0]_(k < n) U k).
7474
exact: bigsetU_measurable.
7575
set UU := \bigcup_n U n.
@@ -115,7 +115,7 @@ apply: (@dominated_cvg _ _ _ mu _ _
115115
move: BZUUx; rewrite inE/= => -[Bx nZUUx]; rewrite inE/=; split => //.
116116
by apply: contra_not nZUUx; left.
117117
move/(BZ_cf x)/(_ a); move/mem_set : Ia => /[swap] /[apply].
118-
by move/cvg_nbhsP; apply; rewrite (cvg_shiftn N).
118+
by move/(@cvg_nbhsP _ R^o); apply; rewrite (cvg_shiftn N).
119119
- by apply: (integrableS mB) => //; exact: measurableD.
120120
- move=> n x [Bx ZUUx]; rewrite lee_fin.
121121
move/subsetCPl : (Ug_ub n); apply => //=.
@@ -126,7 +126,8 @@ End continuity_under_integral.
126126

127127
Section differentiation_under_integral.
128128

129-
Definition partial1of2 {R : realType} {T : Type} (f : R -> T -> R) : R -> T -> R := fun x y => (f ^~ y)^`() x.
129+
Definition partial1of2 {R : realType} {T : Type} (f : R -> T -> R) : R -> T -> R
130+
:= fun x y => (f ^~ y)^`() x.
130131

131132
Local Notation "'d1 f" := (partial1of2 f).
132133

theories/normedtype_theory/pseudometric_normed_Zmodule.v

Lines changed: 24 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -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 ^'-").
6464
Reserved 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.
9797
Arguments shift {R} x / y.
9898
Notation 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-
191100
Section at_left_right_topologicalType.
192101
Variables (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+
228156
Section pseudoMetricNormedZmod_numDomainType.
229157
Context {K : numDomainType} {V : pseudoMetricNormedZmodType K}.
230158

theories/realfun.v

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -199,37 +199,6 @@ apply: cvg_at_right_left_dnbhs.
199199
- by apply/cvg_at_leftP => u [pu ?]; apply: pfl; split => // n; rewrite lt_eqF.
200200
Unshelve. all: end_near. Qed.
201201

202-
Lemma cvg_nbhsP f p l : f x @[x --> p] --> l <->
203-
(forall u : R^nat, (u n @[n --> \oo] --> p) -> f (u n) @[n --> \oo] --> l).
204-
Proof.
205-
split=> [/cvgrPdist_le /= fpl u /cvgrPdist_lt /= uyp|pfl].
206-
apply/cvgrPdist_le => e /fpl[d d0 pdf].
207-
by apply: filterS (uyp d d0) => t /pdf.
208-
apply: contrapT => fpl; move: pfl; apply/existsNP.
209-
suff: exists2 x : R ^nat,
210-
x n @[n --> \oo] --> p & ~ f (x n) @[n --> \oo] --> l.
211-
by move=> [x_] hp; exists x_; exact/not_implyP.
212-
have [e He] : exists e : {posnum R}, forall d : {posnum R},
213-
exists xn, `|xn - p| < d%:num /\ `|f xn - l| >= e%:num.
214-
apply: contrapT; apply: contra_not fpl => /forallNP h.
215-
apply/cvgrPdist_le => e e0; have /existsNP[d] := h (PosNum e0).
216-
move/forallNP => {}h; near=> t.
217-
have /not_andP[abs|/negP] := h t.
218-
- exfalso; apply: abs.
219-
by near: t; exists d%:num => //= z/=; rewrite distrC.
220-
- by rewrite -ltNge distrC => /ltW.
221-
have invn n : 0 < n.+1%:R^-1 :> R by rewrite invr_gt0.
222-
exists (fun n => sval (cid (He (PosNum (invn n))))).
223-
apply/cvgrPdist_lt => r r0; near=> t.
224-
rewrite /sval/=; case: cid => x [xpt _].
225-
rewrite distrC (lt_le_trans xpt)// -[leRHS]invrK lef_pV2 ?posrE ?invr_gt0//.
226-
near: t; exists (truncn r^-1) => // s /= rs.
227-
by rewrite (le_trans (ltW (truncnS_gt _)))// ler_nat.
228-
move=> /cvgrPdist_lt/(_ e%:num (ltac:(by [])))[] n _ /(_ _ (leqnn _)).
229-
rewrite /sval/=; case: cid => // x [px xpn].
230-
by rewrite ltNge distrC => /negP.
231-
Unshelve. all: end_near. Qed.
232-
233202
End cvgr_fun_cvg_seq.
234203

235204
Section cvge_fun_cvg_seq.

0 commit comments

Comments
 (0)