Zulip Chat Archive

Stream: mathlib4

Topic: PseudoMetricSpace.toUniformSpace


Matthew Ballard (Jan 25 2024 at 20:42):

Why is toUniformSpace a field of docs#PseudoMetricSpace instead having PseudoMetricSpace extend UniformSpace?

Jireh Loreaux (Jan 25 2024 at 20:50):

(deleted)

Matthew Ballard (Jan 25 2024 at 20:58):

Related question: how can I make the following work

import Mathlib.Topology.MetricSpace.PseudoMetric

variable (M₁ M₃ : Type*) [PseudoMetricSpace M₁] [PseudoMetricSpace M₃]

example :
    (instTopologicalSpaceProd : TopologicalSpace (M₁ × M₃)) = PseudoMetricSpace.toUniformSpace.toTopologicalSpace := by
  with_reducible_and_instances rfl -- fails

Matthew Ballard (Jan 25 2024 at 20:59):

It doesn’t want to unfold PseudoMetricSpace.toUniformSpace

Yury G. Kudryashov (Jan 25 2024 at 21:04):

What if you use extends instead of an explicit field?

Yury G. Kudryashov (Jan 25 2024 at 21:05):

It's possible that someone chose an explicit field for some reason that no longer applies in Lean 4.

Matthew Ballard (Jan 25 2024 at 21:08):

At first glance, I get many errors

Yury G. Kudryashov (Jan 25 2024 at 21:12):

I wonder why

Matthew Ballard (Jan 25 2024 at 21:18):

Looks like most come from the autoparams from the other fields. Just sorry-ing everything removes errors until the docs#Prod.pseudoMetricSpaceMax but still not unfolding.

Jireh Loreaux (Jan 25 2024 at 21:18):

I think the issue is that you want it for the default by intros; rfl proof of uniformity_dist.

Matthew Ballard (Jan 25 2024 at 21:19):

That was the source of most errors when moving to a parent class

Jireh Loreaux (Jan 25 2024 at 21:19):

And for that to work in general you need the special construction docs#UniformSpace.ofDist to be supplied as the default field.

Jireh Loreaux (Jan 25 2024 at 21:20):

This is all coming back to me now from when I added bornology.

Yury G. Kudryashov (Jan 25 2024 at 21:45):

But many constructions already have a UniformSpace instance.

Yury G. Kudryashov (Jan 25 2024 at 21:45):

In fact, I think that forcing a user to explicitly provide toUniformSpace if there is no instance yet is a good thing.

Matthew Ballard (Jan 25 2024 at 22:06):

I was looking at the wrong place. I need to make docs#PseudoEMetricSpace.toPseudoMetricSpaceOfDist reducible

Matthew Ballard (Jan 25 2024 at 22:06):

It was choking there in the definition of docs#Prod.pseudoMetricSpaceMax

Jireh Loreaux (Jan 25 2024 at 22:10):

Yury, I can see why we might want to always (or mostly) provide our own UniformSpace instance in Mathlib, but for downstream users I think it's quite inconvenient if things like this are not autoparams.

Eric Wieser (Jan 25 2024 at 22:31):

I think we need a tryThisParam instead of autoParam that inserts a template for the user, so that they are at least aware that a default is being use

Matthew Ballard (Jan 25 2024 at 22:33):

You have to guess what the autoParam is trying to do when it errors right now which is extra overhead


Last updated: May 02 2025 at 03:31 UTC