Zulip Chat Archive
Stream: mathlib4
Topic: Synthesis failure for LinearEquiv.funUnique
Eric Wieser (Jan 09 2025 at 14:53):
I was rather surprised to see that this times out:
import Mathlib
set_option synthInstance.maxHeartbeats 100000
set_option maxSynthPendingDepth 3 in
example {๐} [RCLike ๐] := LinearEquiv.funUnique Unit ๐ ๐
Kevin Buzzard (Jan 09 2025 at 15:07):
example {๐ : Type*} [RCLike ๐] := LinearEquiv.funUnique Unit ๐ ๐
is immediate
Kevin Buzzard (Jan 09 2025 at 15:14):
import Mathlib
set_option synthInstance.maxHeartbeats 0
set_option maxHeartbeats 0
set_option trace.profiler true
set_option trace.Meta.synthInstance true
example {๐} [RCLike ๐] := LinearEquiv.funUnique Unit ๐ ๐
does work eventually:
[Elab.command] [14.435839] example {๐} [RCLike ๐] :=
LinearEquiv.funUnique Unit ๐ ๐ โผ
[step] [14.323702] expected type: (Unit โ ๐) โโ[๐] ๐, term
LinearEquiv.funUnique Unit ๐ ๐ โผ
[Meta.synthInstance] [0.000261] โ
๏ธ Unique Unit โถ
[Meta.synthInstance] [0.003494] โ
๏ธ Semiring ๐ โถ
[Meta.synthInstance] [14.314824] โ
๏ธ AddCommMonoid ๐ โผ
[] [0.000025] new goal AddCommMonoid ๐ โถ
[] [0.000128] โ
๏ธ apply @OrderedAddCommMonoid.toAddCommMonoid to AddCommMonoid ๐ โถ
[] [0.000141] โ
๏ธ apply @OrderedSemiring.toOrderedAddCommMonoid to OrderedAddCommMonoid ๐ โถ
[] [0.000139] โ
๏ธ apply @OrderedCommSemiring.toOrderedSemiring to OrderedSemiring ๐ โถ
[] [0.000131] โ
๏ธ apply @CanonicallyOrderedCommSemiring.toOrderedCommSemiring to OrderedCommSemiring ๐ โถ
[] [0.000122] โ
๏ธ apply @CanonicallyLinearOrderedSemifield.toCanonicallyOrderedCommSemiring to CanonicallyOrderedCommSemiring
๐ โถ
[] [0.000113] โ
๏ธ apply @StrictOrderedCommSemiring.toOrderedCommSemiring to OrderedCommSemiring ๐ โถ
[] [0.000125] โ
๏ธ apply @LinearOrderedCommSemiring.toStrictOrderedCommSemiring to StrictOrderedCommSemiring ๐ โถ
[] [0.000124] โ
๏ธ apply @LinearOrderedSemifield.toLinearOrderedCommSemiring to LinearOrderedCommSemiring ๐ โถ
[] [0.000111] โ
๏ธ apply @CanonicallyLinearOrderedSemifield.toLinearOrderedSemifield to LinearOrderedSemifield ๐ โถ
[] [0.000109] โ
๏ธ apply @LinearOrderedField.toLinearOrderedSemifield to LinearOrderedSemifield ๐ โถ
[] [0.000111] โ
๏ธ apply @ConditionallyCompleteLinearOrderedField.toLinearOrderedField to LinearOrderedField ๐ โถ
[] [0.000115] โ
๏ธ apply @NormedLinearOrderedField.toLinearOrderedField to LinearOrderedField ๐ โถ
[] [0.000129] โ
๏ธ apply @LinearOrderedCommRing.toLinearOrderedCommSemiring to LinearOrderedCommSemiring ๐ โถ
[] [0.000117] โ
๏ธ apply @LinearOrderedField.toLinearOrderedCommRing to LinearOrderedCommRing ๐ โถ
[] [0.000140] โ
๏ธ apply @StrictOrderedCommRing.toStrictOrderedCommSemiring to StrictOrderedCommSemiring ๐ โถ
[] [0.000156] โ
๏ธ apply @LinearOrderedCommRing.toStrictOrderedCommRing to StrictOrderedCommRing ๐ โถ
[] [0.000169] โ
๏ธ apply @OrderedCommRing.toOrderedCommSemiring to OrderedCommSemiring ๐ โถ
[] [0.000116] โ
๏ธ apply @StrictOrderedCommRing.toOrderedCommRing to OrderedCommRing ๐ โถ
[] [0.000134] โ
๏ธ apply @StrictOrderedSemiring.toOrderedSemiring to OrderedSemiring ๐ โถ
[] [0.000195] โ
๏ธ apply @LinearOrderedSemiring.toStrictOrderedSemiring to StrictOrderedSemiring ๐ โถ
[] [0.000167] โ
๏ธ apply @LinearOrderedCommSemiring.toLinearOrderedSemiring to LinearOrderedSemiring ๐ โถ
[] [0.000173] โ
๏ธ apply @LinearOrderedRing.toLinearOrderedSemiring to LinearOrderedSemiring ๐ โถ
[] [0.000189] โ
๏ธ apply @LinearOrderedCommRing.toLinearOrderedRing to LinearOrderedRing ๐ โถ
[] [0.000166] โ
๏ธ apply @StrictOrderedCommSemiring.toStrictOrderedSemiring to StrictOrderedSemiring ๐ โถ
[] [0.000172] โ
๏ธ apply @StrictOrderedRing.toStrictOrderedSemiring to StrictOrderedSemiring ๐ โถ
[] [0.000147] โ
๏ธ apply @LinearOrderedRing.toStrictOrderedRing to StrictOrderedRing ๐ โถ
[] [0.000143] โ
๏ธ apply @StrictOrderedCommRing.toStrictOrderedRing to StrictOrderedRing ๐ โถ
[] [0.000117] โ
๏ธ apply @OrderedRing.toOrderedSemiring to OrderedSemiring ๐ โถ
[] [0.000115] โ
๏ธ apply @OrderedCommRing.toOrderedRing to OrderedRing ๐ โถ
[] [0.000094] โ
๏ธ apply @StrictOrderedRing.toOrderedRing to OrderedRing ๐ โถ
[] [0.000123] โ
๏ธ apply @CanonicallyOrderedAddCommMonoid.toOrderedAddCommMonoid to OrderedAddCommMonoid ๐ โถ
[] [0.000109] โ
๏ธ apply @CanonicallyOrderedCommSemiring.toCanonicallyOrderedAddCommMonoid to CanonicallyOrderedAddCommMonoid
๐ โถ
[] [0.000113] โ
๏ธ apply @CanonicallyLinearOrderedAddCommMonoid.toCanonicallyOrderedAddCommMonoid to CanonicallyOrderedAddCommMonoid
๐ โถ
[] [0.000122] โ
๏ธ apply @CanonicallyLinearOrderedSemifield.toCanonicallyLinearOrderedAddCommMonoid to CanonicallyLinearOrderedAddCommMonoid
๐ โถ
[] [0.000112] โ
๏ธ apply @IdemSemiring.toCanonicallyOrderedAddCommMonoid to CanonicallyOrderedAddCommMonoid ๐ โถ
[] [0.000117] โ
๏ธ apply @KleeneAlgebra.toIdemSemiring to IdemSemiring ๐ โถ
[] [0.000114] โ
๏ธ apply @IdemCommSemiring.toIdemSemiring to IdemSemiring ๐ โถ
[] [0.000126] โ
๏ธ apply @LinearOrderedAddCommMonoid.toOrderedAddCommMonoid to OrderedAddCommMonoid ๐ โถ
[] [0.000111] โ
๏ธ apply @LinearOrderedSemiring.toLinearOrderedAddCommMonoid to LinearOrderedAddCommMonoid ๐ โถ
[] [0.000117] โ
๏ธ apply @LinearOrderedAddCommMonoidWithTop.toLinearOrderedAddCommMonoid to LinearOrderedAddCommMonoid ๐ โถ
[] [0.000128] โ
๏ธ apply @LinearOrderedAddCommGroupWithTop.toLinearOrderedAddCommMonoidWithTop to LinearOrderedAddCommMonoidWithTop
๐ โถ
[] [0.000097] โ
๏ธ apply @CanonicallyLinearOrderedAddCommMonoid.toLinearOrderedAddCommMonoid to LinearOrderedAddCommMonoid ๐ โถ
[] [0.000116] โ
๏ธ apply @LinearOrderedCancelAddCommMonoid.toLinearOrderedAddCommMonoid to LinearOrderedAddCommMonoid ๐ โถ
[] [0.000112] โ
๏ธ apply @LinearOrderedSemiring.toLinearOrderedCancelAddCommMonoid to LinearOrderedCancelAddCommMonoid ๐ โถ
[] [0.000115] โ
๏ธ apply @LinearOrderedAddCommGroup.toLinearOrderedAddCancelCommMonoid to LinearOrderedCancelAddCommMonoid ๐ โถ
[] [0.000120] โ
๏ธ apply @NormedLinearOrderedAddGroup.toLinearOrderedAddCommGroup to LinearOrderedAddCommGroup ๐ โถ
[] [0.000097] โ
๏ธ apply @LinearOrderedRing.toLinearOrderedAddCommGroup to LinearOrderedAddCommGroup ๐ โถ
[] [0.000116] โ
๏ธ apply @OrderedCancelAddCommMonoid.toOrderedAddCommMonoid to OrderedAddCommMonoid ๐ โถ
[] [0.000106] โ
๏ธ apply @StrictOrderedSemiring.toOrderedCancelAddCommMonoid to OrderedCancelAddCommMonoid ๐ โถ
[] 4453 more entries... โถ
[Meta.synthInstance] [0.003447] โ
๏ธ Module ๐ ๐ โถ
[def.processPreDef] [0.016145] process pre-definitions โถ
Congratulations on 4453 more entries
, I think that might be a new record.
Kevin Buzzard (Jan 09 2025 at 15:20):
The 5 megabyte trace can be viewed in full here.
Matthew Ballard (Jan 09 2025 at 15:20):
If I multiply out 0.0001 by 5000, then I am still pretty far off from 14
Kevin Buzzard (Jan 09 2025 at 15:29):
It occasionally goes completely off the rails and costs far more time. For example once we're into topological ring territory all kinds of fun can happen:
[Meta.synthInstance.answer] [0.000017] โ
๏ธ TopologicalRing ๐
[Meta.synthInstance.resume] [0.000034] propagating TopologicalRing ๐ to subgoal TopologicalRing ๐ of Finite ๐
[Meta.synthInstance.resume] size: 16
[Meta.synthInstance] [0.000022] new goal CompactSpace ๐
[Meta.synthInstance.instances] #[@Subsingleton.compactSpace, @Finite.compactSpace, @compactSpace_of_completeLinearOrder, TopologicalSpace.NoetherianSpace.compactSpace]
[Meta.synthInstance] [0.000284] โ
๏ธ apply TopologicalSpace.NoetherianSpace.compactSpace to CompactSpace ๐
[Meta.synthInstance.tryResolve] [0.000156] โ
๏ธ CompactSpace ๐ โ CompactSpace ๐
[Meta.synthInstance] [0.000093] new goal TopologicalSpace.NoetherianSpace ๐
[Meta.synthInstance.instances] #[@Finite.to_wellFoundedGT, @TopologicalSpace.Finite.to_noetherianSpace, @IsWellOrder.toIsWellFounded, @instWellFoundedGTOfGradeOrderOrderDualNat]
[Meta.synthInstance] [0.004712] โ
๏ธ apply @instWellFoundedGTOfGradeOrderOrderDualNat to TopologicalSpace.NoetherianSpace
๐
[Meta.synthInstance.tryResolve] [0.004581] โ
๏ธ TopologicalSpace.NoetherianSpace
๐ โ IsWellFounded (TopologicalSpace.Opens ๐) fun x1 x2 โฆ x1 > x2
[Meta.synthInstance] [0.001415] โ
๏ธ Preorder (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.000021] new goal Preorder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@PartialOrder.toPreorder]
[Meta.synthInstance] [0.000143] โ
๏ธ apply @PartialOrder.toPreorder to Preorder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000082] โ
๏ธ Preorder
(TopologicalSpace.Opens ๐) โ Preorder (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.000026] new goal PartialOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@SetLike.instPartialOrder, @LinearOrder.toPartialOrder, @SemilatticeSup.toPartialOrder, @SemilatticeInf.toPartialOrder, @OrderedAddCommMonoid.toPartialOrder, @OrderedCommMonoid.toPartialOrder, @OrderedAddCommGroup.toPartialOrder, @OrderedCommGroup.toPartialOrder, @CompleteSemilatticeSup.toPartialOrder, @CompleteSemilatticeInf.toPartialOrder, @OmegaCompletePartialOrder.toPartialOrder, @CompletePartialOrder.toPartialOrder]
[Meta.synthInstance] [0.000146] โ
๏ธ apply @CompletePartialOrder.toPartialOrder to PartialOrder
(TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000099] โ
๏ธ PartialOrder
(TopologicalSpace.Opens ๐) โ PartialOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.000013] new goal CompletePartialOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@CompleteLattice.toCompletePartialOrder]
[Meta.synthInstance] [0.000155] โ
๏ธ apply @CompleteLattice.toCompletePartialOrder to CompletePartialOrder
(TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000096] โ
๏ธ CompletePartialOrder
(TopologicalSpace.Opens ๐) โ CompletePartialOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.000031] new goal CompleteLattice (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@CompleteLinearOrder.toCompleteLattice, @Order.Frame.MinimalAxioms.toCompleteLattice, @Order.Coframe.MinimalAxioms.toCompleteLattice, @Order.Frame.toCompleteLattice, @Order.Coframe.toCompleteLattice, @CompletelyDistribLattice.toCompleteLattice, @CompleteBooleanAlgebra.toCompleteLattice, @CompleteAtomicBooleanAlgebra.toCompleteLattice, @TopologicalSpace.Opens.instCompleteLattice]
[Meta.synthInstance] [0.000468] โ
๏ธ apply @TopologicalSpace.Opens.instCompleteLattice to CompleteLattice
(TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000169] โ
๏ธ CompleteLattice
(TopologicalSpace.Opens ๐) โ CompleteLattice (TopologicalSpace.Opens ๐)
[Meta.synthInstance.answer] [0.000011] โ
๏ธ CompleteLattice (TopologicalSpace.Opens ๐)
[Meta.synthInstance.resume] [0.000024] propagating CompleteLattice
(TopologicalSpace.Opens
๐) to subgoal CompleteLattice
(TopologicalSpace.Opens ๐) of CompletePartialOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.resume] size: 1
[Meta.synthInstance.answer] [0.000014] โ
๏ธ CompletePartialOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.resume] [0.000025] propagating CompletePartialOrder
(TopologicalSpace.Opens
๐) to subgoal CompletePartialOrder
(TopologicalSpace.Opens ๐) of PartialOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.resume] size: 2
[Meta.synthInstance.answer] [0.000019] โ
๏ธ PartialOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.resume] [0.000032] propagating PartialOrder
(TopologicalSpace.Opens
๐) to subgoal PartialOrder (TopologicalSpace.Opens ๐) of Preorder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.resume] size: 3
[Meta.synthInstance.answer] [0.000027] โ
๏ธ Preorder (TopologicalSpace.Opens ๐)
[Meta.synthInstance] result PartialOrder.toPreorder
[Meta.synthInstance] [0.000049] new goal GradeOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@GradeMinOrder.toGradeOrder, @GradeMaxOrder.toGradeOrder]
[Meta.synthInstance] [0.000659] โ
๏ธ apply @GradeMaxOrder.toGradeOrder to GradeOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000560] โ
๏ธ GradeOrder โแตแต
(TopologicalSpace.Opens ๐) โ GradeOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.000033] new goal GradeMaxOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@GradeBoundedOrder.toGradeMaxOrder]
[Meta.synthInstance] [0.000425] โ
๏ธ apply @GradeBoundedOrder.toGradeMaxOrder to GradeMaxOrder โแตแต
(TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000329] โ
๏ธ GradeMaxOrder โแตแต
(TopologicalSpace.Opens ๐) โ GradeMaxOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.000033] new goal GradeBoundedOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@Preorder.toGradeBoundedOrder]
[Meta.synthInstance] [0.000161] โ๏ธ apply @Preorder.toGradeBoundedOrder to GradeBoundedOrder โแตแต
(TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000135] โ๏ธ GradeBoundedOrder โแตแต
(TopologicalSpace.Opens ๐) โ GradeBoundedOrder ?m.1408 ?m.1408
[Meta.synthInstance] [0.000405] โ
๏ธ apply @GradeMinOrder.toGradeOrder to GradeOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000300] โ
๏ธ GradeOrder โแตแต
(TopologicalSpace.Opens ๐) โ GradeOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.000037] new goal GradeMinOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@GradeBoundedOrder.toGradeMinOrder]
[Meta.synthInstance] [0.000426] โ
๏ธ apply @GradeBoundedOrder.toGradeMinOrder to GradeMinOrder โแตแต
(TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000366] โ
๏ธ GradeMinOrder โแตแต
(TopologicalSpace.Opens ๐) โ GradeMinOrder โแตแต (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.001292] โ
๏ธ apply @IsWellOrder.toIsWellFounded to TopologicalSpace.NoetherianSpace ๐
[Meta.synthInstance.tryResolve] [0.001158] โ
๏ธ TopologicalSpace.NoetherianSpace
๐ โ IsWellFounded (TopologicalSpace.Opens ๐) fun x1 x2 โฆ x1 > x2
[Meta.synthInstance] [0.000035] new goal IsWellOrder (TopologicalSpace.Opens ๐) fun x1 x2 โฆ x1 > x2
[Meta.synthInstance.instances] #[@instIsWellOrderOfIsEmpty, @isWellOrder_gt]
[Meta.synthInstance] [0.013369] โ๏ธ apply @isWellOrder_gt to IsWellOrder (TopologicalSpace.Opens ๐) fun x1 x2 โฆ
x1 > x2
[Meta.synthInstance.tryResolve] [0.013117] โ๏ธ IsWellOrder (TopologicalSpace.Opens ๐) fun x1 x2 โฆ
x1 > x2 โ IsWellOrder ?m.1445 fun x1 x2 โฆ x1 > x2
[Meta.isDefEq] [0.013058] โ๏ธ IsWellOrder (TopologicalSpace.Opens ๐) fun x1 x2 โฆ
x1 > x2 =?= IsWellOrder ?m.1445 fun x1 x2 โฆ x1 > x2
[Meta.isDefEq] [0.012971] โ๏ธ fun x1 x2 โฆ x1 > x2 =?= fun x1 x2 โฆ x1 > x2
[Meta.isDefEq] [0.012953] โ๏ธ x1โ > x2โ =?= x1โ > x2โ
[Meta.synthInstance] [0.005772] โ๏ธ LinearOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance] [0.000030] new goal LinearOrder (TopologicalSpace.Opens ๐)
[Meta.synthInstance.instances] #[@LinearOrderedAddCommMonoid.toLinearOrder, @LinearOrderedCommMonoid.toLinearOrder, @LinearOrderedAddCommGroup.toLinearOrder, @LinearOrderedCommGroup.toLinearOrder, @LinearOrderedRing.toLinearOrder, @CompleteLinearOrder.toLinearOrder, @ConditionallyCompleteLinearOrder.toLinearOrder, @NonemptyFiniteLinearOrder.toLinearOrder]
[Meta.synthInstance] [0.000144] โ
๏ธ apply @NonemptyFiniteLinearOrder.toLinearOrder to LinearOrder
(TopologicalSpace.Opens ๐)
[Meta.synthInstance.tryResolve] [0.000091] โ
๏ธ LinearOrder
(TopologicalSpace.Opens ๐) โ LinearOrder (TopologicalSpace.Opens ๐)
Kevin Buzzard (Jan 09 2025 at 15:30):
(I could have just quoted the last 15 lines but it was fun to see how it got there)
Kevin Buzzard (Jan 09 2025 at 15:31):
(This is @Andrew Yang 's new instance that a compact topological ring is finite btw, a result I didn't know before and which has a really nice proof)
Kevin Buzzard (Jan 09 2025 at 15:45):
So with timings turned off, the traces are here (over 10000 lines) for {๐}
and here (880 lines) for {๐ : Type*}
. They're identical up until line 686, where for some reason the short one starts working on OrderedAddCommGroup ๐
and the long one starts working on NormedField ๐
. I find it then difficult to unify them from that point on, but note that we're about 3/4 of the way through the short proof at that point.
Eric Wieser (Jan 09 2025 at 15:57):
Maybe example {๐} [RCLike ๐] : AddCommMonoid ๐ := inferInstance
is a better test
Last updated: May 02 2025 at 03:31 UTC