Zulip Chat Archive

Stream: mathlib4

Topic: nested linear map norm failure


Matthew Ballard (Feb 25 2024 at 03:21):

This is strange

import Mathlib.Analysis.NormedSpace.OperatorNorm

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

#synth Norm ((π•œ β†’L[π•œ] π•œ) β†’L[π•œ] π•œ) -- ContinuousLinearMap.hasOpNorm
#synth Norm (π•œ β†’L[π•œ] (π•œ β†’L[π•œ] π•œ)) -- ContinuousLinearMap.hasOpNorm
#synth Norm (π•œ β†’L[π•œ] (π•œ β†’L[π•œ] π•œ) β†’L[π•œ] π•œ) -- failed

Patrick Massot (Feb 25 2024 at 03:59):

I’ve seen this many times, it’s the curse of the operator norm.

Matthew Ballard (Feb 25 2024 at 04:05):

Each time it pulls off a k except the last time we get

[synthInstance] βœ… SeminormedAddCommGroup k β–Ό
            [] result NonUnitalSeminormedRing.toSeminormedAddCommGroup (cached)

On the last one it, it doesn’t try to synthesize this and just puts in a metavariable. It then gets stuck of course

Matthew Ballard (Feb 25 2024 at 04:09):

First

[isDefEq] ❌ SeminormedAddCommGroup (k β†’L[k] k β†’L[k] k) =?= SeminormedAddCommGroup (?m.7403 β†’SL[?m.7411] ?m.7404) β–Ό
                  [] ❌ k β†’L[k] k β†’L[k] k =?= ?m.7403 β†’SL[?m.7411] ?m.7404 β–Ό
                    [] βœ… k =?= ?m.7401 β–Ά
                    [] βœ… k =?= ?m.7402 β–Ά
                    [] βœ… RingHom.id k =?= ?m.7411 β–Ά
                    [] βœ… k =?= ?m.7403 β–Ά
                    [] βœ… k β†’L[k] k =?= ?m.7404 β–Ά
                    [] βœ… DivisionSemiring.toSemiring =?= DivisionSemiring.toSemiring β–Ά
                    [] βœ… DivisionSemiring.toSemiring =?= DivisionSemiring.toSemiring
                    [synthInstance] βœ… SeminormedAddCommGroup k β–Ό
                      [] result NonUnitalSeminormedRing.toSeminormedAddCommGroup (cached)
                      [isDefEq] βœ… SeminormedAddCommGroup k =?= SeminormedAddCommGroup k
                    [] βœ… UniformSpace.toTopologicalSpace =?= UniformSpace.toTopologicalSpace β–Ά
                    [] βœ… NonUnitalNonAssocSemiring.toAddCommMonoid =?= AddCommGroup.toAddCommMonoid β–Ά
                    [synthInstance] ❌ SeminormedAddCommGroup (k β†’L[k] k) β–Ό

and then finally

[isDefEq] ❌ SeminormedAddCommGroup (k β†’L[k] k) =?= SeminormedAddCommGroup (?m.7426 β†’SL[?m.7434] ?m.7427) β–Ό
                            [] ❌ k β†’L[k] k =?= ?m.7426 β†’SL[?m.7434] ?m.7427 β–Ό
                              [] βœ… k =?= ?m.7424 β–Ά
                              [] βœ… k =?= ?m.7425 β–Ά
                              [] βœ… RingHom.id k =?= ?m.7434 β–Ά
                              [] βœ… k =?= ?m.7426 β–Ά
                              [] βœ… k =?= ?m.7427 β–Ά
                              [] βœ… DivisionSemiring.toSemiring =?= DivisionSemiring.toSemiring β–Ά
                              [] βœ… DivisionSemiring.toSemiring =?= DivisionSemiring.toSemiring
                              [] ❌ UniformSpace.toTopologicalSpace =?= UniformSpace.toTopologicalSpace β–Ά

Matthew Ballard (Feb 25 2024 at 04:12):

Replace k with distinct modules won’t fix it. That is where I came from

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

Aha! trace.Meta.synthPending reports:

[Meta.synthPending] too many nested synthPending invocations

Thank goodness this one was plugged in lol

Matthew Ballard (Feb 25 2024 at 04:26):

From docs#Lean.Meta.Context

Remark: in the current implementation, synthPending fails if synthPendingDepth > 0.
We will add a configuration option if necessary. -/

Matthew Ballard (Feb 25 2024 at 04:27):

I am not sure why we get depth > 0 after 4 copies of k and not less (or more?)

Matthew Ballard (Feb 25 2024 at 04:37):

It hits that because for k β†’L[k] k β†’L[k] k β†’L[k] k it needs to synth SeminormedAddCommGroup for the last k β†’L[k] k β†’L[k] k and then needs to do it again for k β†’L[k] k which trips the wire.

For k β†’L[k] k β†’L[k] k it does it once for k β†’L[k] k and then can figure out the SeminormedAddCommGroup k for the source and target

Jireh Loreaux (Feb 25 2024 at 05:58):

Note: this issue came up for me recently too. Search RegularNormedAlgebra

Matthew Ballard (Feb 25 2024 at 14:13):

Oh. I guess I missed something or I should have suspecting synthPending immediately.

Matthew Ballard (Feb 25 2024 at 17:22):

Going to test changes to the default synthPendingDepth. Anyone have any good numbers besides 0?

SΓ©bastien GouΓ«zel (Feb 25 2024 at 17:23):

1? 100?

Matthew Ballard (Feb 25 2024 at 17:24):

∞\infty :smiling_devil:

Ruben Van de Velde (Feb 25 2024 at 17:31):

37

Michael Stoll (Feb 25 2024 at 18:13):

5077

Matthew Ballard (Feb 25 2024 at 18:52):

I quickly learned this is the only thing keeping synthInstance from looping

Mario Carneiro (Feb 26 2024 at 02:00):

this discussion reminds me of https://www.youtube.com/watch?v=0obMRztklqU


Last updated: May 02 2025 at 03:31 UTC