IMetricSpace String via the discrete metric #
We equip String with the discrete IMetricSpace instance:
idist s t = 0 if s = t, and idist s t = 1 otherwise.
This is the correct choice for two reasons:
Stringis the.strsummand of๐(a direct data constructor inValue.F), so its metric contributes to the metric on๐via theโconstruction. Programs only test string equality, so the discrete metric faithfully captures the only observable proximity.- The label-type occurrences of
String(domains ofString โแตค Option โin.structand.func) do not depend onIMetricSpace String: the uniform topology on the domain of aโแตคdoes not enter the sup-metric on the function space.
@[implicit_reducible]
The discrete IMetricSpace on String.
Equations
- instIMetricSpaceString = { toIMetricSpace := IMetricSpace.discrete, idist_discrete := instIMetricSpaceString._proof_1 }
The discrete metric on String induces the discrete topology.
String is complete under the discrete metric: every Cauchy sequence is eventually
constant, hence converges.