The development of metric spaces in IsarMathLib is different from the usual treatment of the subject because the notion of a metric (or a pseudometric) is defined in the MetricSpace_ZF theory a more generally as a function valued in an ordered loop. This theory file brings the subject closer to the standard way by specializing that general definition to the usual special case where the value of the metric are nonnegative real numbers.
The reals context (locale) defined in the Real_ZF_2 theory fixes a model of reals (i.e. a complete ordered field) and defines notation for things like zero, one, the set of positive numbers, absolute value etc. For metric spaces we reuse the notation defined there.
The rpmetric_space locale extends the reals locale, adding the carrier \(X\) of the metric space and the metric \(\mathcal{d}\) to the context, together with the assumption that \(\mathcal{d}:X\times X \rightarrow \mathbb{R}^+\) is a pseudo metric. We choose to denote the disk in \(X\) with center \(c\) and radius \(r\) as \( ball(c,r) \) As in the pmetric_space locale we define the \(\tau\) to be the metric topology, i.e. the topology induced by the (real valued) pseudometric \(\mathcal{d}\). An alternative would be to define the rpmetric_space as an extension of the rpmetric_space context, but that is in turn an extension of the loop1 locale that defines notation for left and right division which which do not want in the context of real numbers.
locale rpmetric_space = reals +
assumes pmetricAssum: \( \text{IsApseudoMetric}(\mathcal{d} ,X,\mathbb{R} ,Add,ROrd) \)
defines \( ball(c,r) \equiv \text{Disk}(X,\mathcal{d} ,ROrd,c,r) \)
defines \( \tau \equiv \text{MetricTopology}(X,\mathbb{R} ,Add,ROrd,\mathcal{d} ) \)
defines \( int(D) \equiv \text{Interior}(D,\tau ) \)
defines \( cl(D) \equiv \text{Closure}(D,\tau ) \)
The propositions proven in the pmetric_space context defined in Metric_Space_ZF theory are valid in the rpmetric_space context.
lemma (in rpmetric_space) pmetric_space_rpmetric_space_valid:
shows \( pmetric\_space(\mathbb{R} ,Add,ROrd,\mathcal{d} ,X) \) unfolding pmetric_space_def, pmetric_space_axioms_def, loop1_def using pmetricAssum, reals_loopThe context rpmetric_space is a special case of context pmetric_space where the fixed objects in pmetric_space map to (in the order defined in pmetric_space) the set of real numbers, real addition, the order relation on reals, the strict order relation on reals, the set of non-negative reals and the set of positive reals. The metrics \(d\) maps to the real metrics \( \mathcal{d} \), the carrier of the metric space \(X\) is still \(X\), and the disks from pmetric_space are now called balls in rpmetric_space. The notation for right and left division from rpmetric_space is not used in pmetric_space.
using pmetric_space_rpmetric_space_valid
The rmetric_space locale (context) specializes the the rpmetric_space context by adding the assumption of identity of indiscernibles.
locale rmetric_space = rpmetric_space +
assumes ident_indisc: \( \forall x\in X.\ \forall y\in Y.\ \mathcal{d} \langle x,y\rangle = 0 \longrightarrow x=y \)
The propositions proven in the metric_space context defined in Metric_Space_ZF theory are valid in the rmetric_space context.
lemma (in rmetric_space) metric_space_rmetric_space_valid:
shows \( metric\_space(\mathbb{R} ,Add,ROrd,\mathcal{d} ,X) \) unfolding metric_space_def, metric_space_axioms_def using pmetric_space_rpmetric_space_valid, ident_indiscThe rmetric_space context is a special case of the metric_space context, with fixed objects mapping the same as in the mapping between rpmetric_space and pmetric_space above.
proof
The usual (real-valued) metric spaces are a special case of ordered loop valued metric spaces defined in the MetricSpace_ZF theory, hence they are \(T_2\) as topological spaces. Below we repeat the major theorems of MetricSpace_ZF theory specialized the standard setting of real valued metrics.
Since in the rpmetric_space context \(\mathfrak{d}\) is a pseudometrics the (real valued) metric topology indeed a topology.
theorem (in rpmetric_space) rpmetric_is_top:
shows \( \tau \text{ is a topology } \) using rord_down_directs, pmetric_is_topThe collection of open disks (caled balls in the rpmetric_space context is a base for the (real valued) metric topology.
theorem (in rpmetric_space) rdisks_are_base:
shows \( (\bigcup c\in X.\ \{ball(c,R).\ R\in \mathbb{R} _+\}) \text{ is a base for } \tau \) using rord_down_directs, disks_are_base\(X\) is the carrier of the (real valued) metric topology.
theorem (in rpmetric_space) rmetric_top_carrier:
shows \( \bigcup \tau = X \) using rord_down_directs, metric_top_carrierThe topology generated by a (real valued) metric is Hausdorff (i.e. \(T_2\)).
theorem (in rmetric_space) rmetric_space_T2:
shows \( \tau \text{ is }T_2 \) using rord_down_directs, metric_space_T2The ordered loop valued pseudometric spaces are uniform spaces. In this section we specialize major propositions from that context to the real valued pseudometric.
In the MetricSpace_ZF theory we define a property IsHalfable of an ordered loop that states that for every positive element \(b_1\) of the loop there is another (positive) one \(b_2\) such that \(b_2+b_2 \leq b_1\). This property is needed for the ordered loop valued pseudometric space to be a uniform space. In the next lemma we show that real numbers satisfy this property.
lemma (in reals) pos_reals_halfable:
shows \( \text{IsHalfable}(\mathbb{R} ,Add,ROrd) \)proofIn the rpmetric_space we will write \( \text{UniformGauge}(X,\mathbb{R} ,Add,ROrd,\mathcal{d} ) \) i.e. \(\{\mathcal{d}^{-1}([0,b]: b \in \mathbb{R}_+ \}\) as \(\mathfrak{U}\).
abbreviation (in rpmetric_space)
\( \mathfrak{U} \equiv \text{UniformGauge}(X,\mathbb{R} ,Add,ROrd,\mathcal{d} ) \)
\(\mathfrak{U}\) is a fundamental system of entourages, hence its supersets form a uniformity on \(X\) and hence those supersets define a topology on \(X\). This is a special case of the theorem metric_gauge_base from the Metric_Space_ZF theory but instead an ordered loop we have real numbers, so all the premises are automatically satisfied, except for the one of \(X\) being nonempty.
theorem (in rpmetric_space) metric_gauge_base:
assumes \( X\neq \emptyset \)
shows \( \mathfrak{U} \text{ is a uniform base on } X \), \( \text{Supersets}(X\times X,\mathfrak{U} ) \text{ is a uniformity on } X \), \( \text{UniformTopology}( \text{Supersets}(X\times X,\mathfrak{U} ),X) \text{ is a topology } \), \( \bigcup \text{UniformTopology}( \text{Supersets}(X\times X,\mathfrak{U} ),X) = X \) using assms, rord_down_directs, pos_non_empty, pos_reals_halfable, metric_gauge_baseThe topology generated by open disks is the same as the one coming from the the unifomity consisting of supersets of sets in \(\mathfrak{U}\).
theorem (in rpmetric_space) rmetric_top_is_uniform_top:
assumes \( X\neq \emptyset \)
shows \( \tau = \text{UniformTopology}( \text{Supersets}(X\times X,\mathfrak{U} ),X) \) using assms, rord_down_directs, pos_non_empty, pos_reals_halfable, metric_top_is_uniform_topassumes \( r \text{ down-directs } L_+ \)
shows \( \tau \text{ is a topology } \)assumes \( r \text{ down-directs } L_+ \)
defines \( B \equiv \bigcup c\in X.\ \{disk(c,R).\ R\in L_+\} \)
shows \( B \text{ is a base for } \tau \)assumes \( r \text{ down-directs } L_+ \)
shows \( \bigcup \tau = X \)assumes \( r \text{ down-directs } L_+ \)
shows \( \tau \text{ is }T_2 \)assumes \( 0 \lt a \), \( 0 \lt b \)
shows \( 0 \lt a\cdot b \)assumes \( a \lt b \)
shows \( a\in R \), \( b\in R \)assumes \( a\in R \)
shows \( ( - a) \in R \), \( ( - ( - a)) = a \), \( a + 0 = a \), \( 0 + a = a \), \( a\cdot 1 = a \), \( 1 \cdot a = a \), \( a - a = 0 \), \( a - 0 = a \), \( 2 \cdot a = a + a \), \( ( - a) + a = 0 \)assumes \( a\in R \), \( b\in R \), \( c\in R \)
shows \( a\cdot (b + c) = a\cdot b + a\cdot c \), \( (b + c)\cdot a = b\cdot a + c\cdot a \)assumes \( a\in R \)
shows \( a\leq a \)assumes \( X\neq \emptyset \)
shows \( \mathfrak{U} \text{ is a uniform base on } X \), \( \text{Supersets}(X\times X,\mathfrak{U} ) \text{ is a uniformity on } X \), \( \text{UniformTopology}( \text{Supersets}(X\times X,\mathfrak{U} ),X) \text{ is a topology } \), \( \bigcup \text{UniformTopology}( \text{Supersets}(X\times X,\mathfrak{U} ),X) = X \)assumes \( X\neq \emptyset \), \( L_+\neq \emptyset \), \( r \text{ down-directs } L_+ \), \( \text{IsHalfable}(L,A,r) \)
shows \( \tau = \text{UniformTopology}( \text{Supersets}(X\times X,\mathfrak{B} ),X) \)