Zulip Chat Archive

Stream: lean4

Topic: more with simp and defeq


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

I am deeply confused. I have the following

example [UniformSpace α] [UniformSpace β] :
    (instTopologicalSpaceProd : TopologicalSpace (α × β)) = UniformSpace.toTopologicalSpace := by
 with_reducible_and_instances rfl  works

but I get the following error when tracing simp

[Meta.Tactic.simp.discharge] @ContinuousLinearMap.strongUniformity_topology_eq, failed to assign instance
      TopologicalSpace (M₁ × M₃)
    sythesized value
      instTopologicalSpaceProd
    is not definitionally equal to
      UniformSpace.toTopologicalSpace

What am I missing here?

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

The error comes from docs#Lean.Meta.Simp.synthesizeArgs.synthesizeInstance in the block

if ( withReducibleAndInstances <| isDefEq x val) then
        return true
      else
        trace[Meta.Tactic.simp.discharge] "{← ppOrigin thmId}, failed to assign instance{indentExpr type}\nsythesized value{indentExpr val}\nis not definitionally equal to{indentExpr x}"
        return false

Adam Topaz (Jan 25 2024 at 19:37):

Your --works line doesn't work for me.

Adam Topaz (Jan 25 2024 at 19:38):

Is the error suppressed somehow in your actual code?

Adam Topaz (Jan 25 2024 at 19:38):

Of course

import Mathlib

example [UniformSpace α] [UniformSpace β] :
    (instTopologicalSpaceProd : TopologicalSpace (α × β)) = UniformSpace.toTopologicalSpace := by
  rfl

works

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

Sorry I should have prefaced that I am working in branch#mrb/reducible_uniform_space_comap

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

The only change is that docs#UniformSpace.comap is reducible there

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

Actually branch#mrb/operator_norm might be better if you want try to replicate the error also.

Adam Topaz (Jan 25 2024 at 19:48):

I can't reproduce the error in your branch with

set_option trace.Meta.Tactic.simp.discharge true in
example [UniformSpace α] [UniformSpace β] :
    (instTopologicalSpaceProd : TopologicalSpace (α × β)) = UniformSpace.toTopologicalSpace := by
  with_reducible_and_instances rfl

Adam Topaz (Jan 25 2024 at 19:48):

Oh the error is in a different file!

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

Yes, sorry. To reproduce the error, checkout branch#mrb/operator_norm and in docs#ContinuousLinearMap.prodMapL remove the (_) from the last simp call in the proof

Adam Topaz (Jan 25 2024 at 19:52):

I'm going straight to strongUniformity_topology_eq

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

It looks like unification is taking using a different instance in simp than just before.

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

Should this be expected? Better version of the question below

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

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

This is where it ends up in the simp call

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

Do previous simp steps affect the priority of instances? Is it going to some cache that it didn’t have before?


Last updated: May 02 2025 at 03:31 UTC