Zulip Chat Archive

Stream: mathlib4

Topic: cannot synth IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ)


Jireh Loreaux (Mar 14 2024 at 21:28):

Well, this is fun ...

import Mathlib.Topology.ContinuousFunction.Algebra
import Mathlib.Data.IsROrC.Basic

variable {R : Type*} [CommSemiring R] [TopologicalSpace R] [TopologicalSemiring R]

variable {π•œ : Type*} [IsROrC π•œ]

#synth Algebra R C(R, R) -- ContinuousMap.algebra
#synth IsScalarTower R C(R, R) C(R, R) -- IsScalarTower.right

#synth Algebra π•œ C(π•œ, π•œ) -- ContinuousMap.algebra

set_option trace.Meta.synthInstance true
set_option trace.Meta.isDefEq true
#synth IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) -- failed
/-
[Meta.synthInstance] ❌ IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) β–Ό
  [] new goal IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) β–Ά
  [] ❌ apply @ContinuousMap.instIsScalarTowerContinuousMapInstSMulInstSMul to IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) β–Ά
  [] ❌ apply @IsScalarTower.right to IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) β–Ό
    [tryResolve] ❌ IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) β‰Ÿ IsScalarTower ?m.8431 ?m.8432 ?m.8432 β–Ό
      [isDefEq] ❌ IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) =?= IsScalarTower ?m.8431 ?m.8432 ?m.8432 β–Ό
        [] βœ… π•œ =?= ?m.8431 β–Ά
        [] βœ… C(π•œ, π•œ) =?= ?m.8432 β–Ά
        [] βœ… C(π•œ, π•œ) =?= C(π•œ, π•œ)
        [synthInstance] πŸ’₯ Algebra π•œ C(π•œ, π•œ) β–Ά
        [] ❌ ContinuousMap.instSMul =?= Algebra.toSMul β–Ό
          [] ❌ { smul := fun r f => { toFun := r β€’ ⇑f, continuous_toFun := β‹― } } =?= Algebra.toSMul β–Ό
            [] ❌ { smul := fun r f => { toFun := r β€’ ⇑f, continuous_toFun := β‹― } } =?= ?m.8435.1 β–Ό
              [] βœ… SMul π•œ C(π•œ, π•œ) =?= SMul π•œ C(π•œ, π•œ) β–Ά
              [] ❌ SMul.smul =?= fun r f => { toFun := r β€’ ⇑f, continuous_toFun := β‹― } β–Ό
                [] ❌ fun r f => { toFun := r β€’ ⇑f, continuous_toFun := β‹― } =?= fun a => SMul.smul a β–Ό
                  [] βœ… π•œ =?= π•œ
                  [] ❌ fun f => { toFun := r β€’ ⇑f, continuous_toFun := β‹― } =?= SMul.smul r β–Ό
                    [] ❌ fun f => { toFun := r β€’ ⇑f, continuous_toFun := β‹― } =?= fun a => SMul.smul r a β–Ό
                      [] βœ… C(π•œ, π•œ) =?= C(π•œ, π•œ)
                      [] ❌ { toFun := r β€’ ⇑f, continuous_toFun := β‹― } =?= SMul.smul r f β–Ό
                        [] ❌ { toFun := r β€’ ⇑f, continuous_toFun := β‹― } =?= ?m.8435.1.1 r f β–Ό
                          [] βœ… C(π•œ, π•œ) =?= C(π•œ, π•œ)
                          [] ❌ (?m.8435.1.1 r f).toFun =?= r β€’ ⇑f β–Ά
                          [] ❌ @ContinuousMap.mk =?= ?m.8435.1.1 β–Ά
                          [onFailure] ❌ { toFun := r β€’ ⇑f, continuous_toFun := β‹― } =?= ?m.8435.1.1 r f β–Ά
                          [onFailure] ❌ { toFun := r β€’ ⇑f, continuous_toFun := β‹― } =?= ?m.8435.1.1 r f β–Ά
              [onFailure] ❌ { smul := fun r f => { toFun := r β€’ ⇑f, continuous_toFun := β‹― } } =?= ?m.8435.1 β–Ά
        [onFailure] ❌ IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) =?= IsScalarTower ?m.8431 ?m.8432 ?m.8432
        [onFailure] ❌ IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) =?= IsScalarTower ?m.8431 ?m.8432 ?m.8432
  [] ❌ apply IsScalarTower.left to IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) β–Ά
  [] ❌ apply @Semigroup.isScalarTower to IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) β–Ά
  [] ❌ apply @IsScalarTower.of_algHom to IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) β–Ά
-/

Matthew Ballard (Mar 14 2024 at 21:37):

Is pasting this into scratch.lean file at the root of mathlib supposed to bork the server?

Jireh Loreaux (Mar 14 2024 at 21:40):

oh, that's even worse. I didn't even notice that. I get that it prints this error:

4
54
46
96
146
44
94
144

Jireh Loreaux (Mar 14 2024 at 21:43):

The borking of the server is somehow due to the tracing (of the instances, not of the defeq), which seems very bad.

Matthew Ballard (Mar 14 2024 at 21:51):

It’s not the problem but ContinousMap.C should be reducible

Matthew Ballard (Mar 14 2024 at 21:52):

I am guessing metavariable depth is the culprit here

Matthew Ballard (Mar 14 2024 at 21:55):

[] πŸ’₯ ?m.18092 =?= ContinuousMap.instSemiringContinuousMap β–Ό
                  [] ?m.18092 [nonassignable] =?= ContinuousMap.instSemiringContinuousMap [nonassignable]

it fails to get the algebra structure here and just continuous with a metavariable

Matthew Ballard (Mar 14 2024 at 22:01):

Do we need Algebra R A for IsScalarTower.right?

Jireh Loreaux (Mar 14 2024 at 22:03):

But it gets the algebra structure fine when you ask it, see above.

Matthew Ballard (Mar 14 2024 at 22:07):

Right, for some reason it goes deeper into the docs#Lean.MetavarContext.depth and tries to assign it there (is my theory)

Jireh Loreaux (Mar 14 2024 at 22:22):

It succeeds if you replace π•œ with ℝ, but not with β„‚.

Jireh Loreaux (Mar 14 2024 at 22:37):

Your idea about metavariable context depth seems likely because of the unassignable, but also note that this succeeds:

example : IsScalarTower π•œ C(π•œ, π•œ) C(π•œ, π•œ) := @IsScalarTower.right _ C(π•œ, π•œ) _ _ _

Last updated: May 02 2025 at 03:31 UTC