# [isabelle-dev] locales, groups, metric spaces?

Fabian Immler immler at in.tum.de
Tue Apr 16 15:08:37 CEST 2019

```Combining it with the anonymous relativization efforts
https://github.com/xanonec/HOL-Types_To_Sets_Ext/blob/master/Topology/Topological_Space_OW.thy#L52
it could look like this:

locale topological_space_ow =
fixes π :: "'at set" and Ο :: "'at set β bool"
assumes open_UNIV[simp, intro]: "Ο π"
assumes open_Int[intro]: "β¦ S β π; T β π; Ο S; Ο T β§ βΉ Ο (S β© T)"
assumes open_Union[intro]: "β¦ K β Pow π; βSβK. Ο S β§ βΉ Ο (βK)"

locale metric_space_ow = topological_space_ow +
fixes dist:: "'at β 'at β real"
assumes open_dist: "S β π βΉ Ο S β· (βxβS. βe>0. βy. dist y x < e βΆ y
β S)"
assumes dist_eq_0_iff [simp]: "x β π βΉ y β π βΉ dist x y = 0 β· x = y"
and dist_triangle2: "x β π βΉ y β π βΉ dist x y β€ dist x z + dist y z"

Of course, this is yet another approach and different from the
"topology-as-value" approach from Abstract_Topology
(http://isabelle.in.tum.de/repos/isabelle/file/538919322852/src/HOL/Analysis/Abstract_Topology.thy#l19)

One would need to think about if or how it makes sense to combine such a
"locale-only" approach with a
"topology-as-value"/"metric-space-as-value" approach.  (Projecting the
topology out of the metric-space value and having these as parameters of
the locales?)

Fabian

On 4/16/2019 7:29 AM, Lawrence Paulson wrote:
> And what about metric spaces themselves? (Not that we could include very much in the next release, but still)
> Larry
>
>> On 15 Apr 2019, at 16:31, Fabian Immler <immler at in.tum.de> wrote:
>>
>>
>> On 4/15/2019 5:57 AM, Lawrence Paulson wrote:
>>> In the context of the recent discussions about Algebra, we could revisit these issues in the context of metric spaces, which we still donβt have (except as type classes). A metric space has a carrier and a binary relation, so syntactically itβs similar to a monoid, except that we donβt expect to extend one with additional fields. So, at least, we should be able to avoid records.
>>> But what about the path from metric spaces to normed vector spaces, etc.?
>> Do you mean with explicit carrier sets and without records?
>>
>> The algebraic part could look like this [1]:
>>
>>   fixes S::"'a set" and pls::"'aβ'aβ'a"
>>   assumes add_assoc: "a β S βΉ b β S βΉ c β S βΉ pls (pls a b) c = pls a (pls b c)"
>>   assumes add_mem: "a β S βΉ b β S βΉ pls a b β S"
>>
>> Which leads up to the notion of vector space [2]:
>> "vector_space_on_with S pls mns um zero (scl::'a::field\<Rightarrow>_)"
>> which looks horrible here because of the explicit mention of all of the parameters (I don't recall why). Written as a locale with named parameters, it would look much nicer:
>>
>> locale vector_space_on_with = ab_group_add_on_with +
>>   fixes scl::"'f::comm_ring_1β_"
>>   assumes "x β S βΉ y β S βΉ scl a (pls x y) = pls (scl a x) (scl a y)"  β¦
>>
>> For a normed vector space, I guess one would write something like this (assuming that the parameters for the carrier set have the same name in metric_space and vector_space_on_with)
>>
>> locale normed_vector_space = metric_space + vector_space_on_with +
>>   fixes norm::"'a => real"
>>   assumes "dist x y = norm (x - y)"
>>   assumes "norm (x + y) <= norm x + norm y" ...
>>
>> Fabian
>>
>>
>> [1] http://isabelle.in.tum.de/repos/isabelle/file/538919322852/src/HOL/Types_To_Sets/Examples/Group_On_With.thy#l12
>> [2] http://isabelle.in.tum.de/repos/isabelle/file/538919322852/src/HOL/Types_To_Sets/Examples/Linear_Algebra_On_With.thy#l90
>>
>>
>>> Larry
>>> _______________________________________________
>>> isabelle-dev mailing list
>>> isabelle-dev at in.tum.de
>>> https://mailman46.in.tum.de/mailman/listinfo/isabelle-dev
>>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5581 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mailman46.in.tum.de/pipermail/isabelle-dev/attachments/20190416/ce1d41a9/attachment.bin>
```