Zulip Chat Archive

Stream: mathlib4

Topic: instance synth failure


Kevin Buzzard (Nov 13 2024 at 21:35):

This surprised me. I am running a Lean alg geom workshop next week so I thought I'd try and make the scheme associated to an elliptic curve. I made two affine patches but when attempting to glue them I ran into an error which I've minimised to this:

import Mathlib

suppress_compilation

inductive S : Type
| x : S
| y : S

abbrev R : Type := MvPolynomial S 

abbrev R.x : R := MvPolynomial.X S.x
abbrev R.y : R := MvPolynomial.X S.y

open R in
abbrev I : Ideal R := Ideal.span {y^2 - x^3 - 1}

abbrev Q := R  I

variable (A : Type) [CommRing A] in
#synth DistribMulAction A A -- works

#synth CommRing Q -- works
-- #synth DistribMulAction Q Q -- fails

set_option maxSynthPendingDepth 37 in
#synth DistribMulAction Q Q -- still fails

My experience was that setting maxSynthPendingDepth to be something like 2 would usually solve these problems.

Matthew Ballard (Nov 13 2024 at 21:38):

That seems to step just outside of the default limits for synthesis

Eric Wieser (Nov 13 2024 at 21:39):

set_option synthInstance.maxHeartbeats 21000 fixes it

Kevin Buzzard (Nov 13 2024 at 21:40):

Oh I'm a fool, thanks.

Matthew Ballard (Nov 13 2024 at 21:40):

Eric Wieser said:

set_option synthInstance.maxHeartbeats 21000 fixes it

Even 20150 works for me :)

Matthew Ballard (Nov 13 2024 at 21:46):

As does not using the abbrev. Lean doesn't want to peak into R for the matching on the keys which results in a ton of hits

Matthew Ballard (Nov 13 2024 at 21:48):

But the difference in heartbeats isn't very big without abbrev

Kevin Buzzard (Nov 13 2024 at 21:48):

I went with abbrevs everywhere because I wanted notation and didn't want to write weird stuff in front of the students justifying that things which were obviously rings, were rings. Maybe that's my mistake

Matthew Ballard (Nov 13 2024 at 21:49):

No I would expect the matching on keys to look into the abbrev. Notation makes sense


Last updated: May 02 2025 at 03:31 UTC