Fix goal-tactic association in typeclass search#22037
Conversation
|
@coqbot run full ci |
|
@coqbot bench |
|
It seems the job got stuck somehow? Does it make sense to try again? |
|
@coqbot bench |
|
🏁 Bench results: INFO: failed to install rocq-metarocq-utils (dependency rocq-equations failed) 🐢 Top 25 slow downs┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SLOW DOWNS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 201 208 6.7809 3.37% 8 coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html │ │ 63.1 64.6 1.4659 2.32% 608 coq-bedrock2/bedrock2/src/bedrock2Examples/lightbulb.v.html │ │ 93.6 94.5 0.8384 0.90% 999 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 7.96 8.64 0.6846 8.60% 1331 coq-mathcomp-odd-order/theories/PFsection9.v.html │ │ 2.07 2.55 0.4829 23.36% 213 rocq-stdlib/theories/setoid_ring/Ncring_tac.v.html │ │ 7.07 7.53 0.4612 6.52% 604 coq-unimath/UniMath/CategoryTheory/EnrichedCats/Colimits/Examples/StructureEnrichedColimits.v.html │ │ 38.7 39.1 0.4193 1.08% 236 coq-rewriter/src/Rewriter/Rewriter/Examples/PerfTesting/LiftLetsMap.v.html │ │ 22.1 22.5 0.4129 1.87% 13 coq-fourcolor/theories/proof/job384to398.v.html │ │ 0.343 0.708 0.3654 106.64% 14 rocq-stdlib/theories/MSets/MSetToFiniteSet.v.html │ │ 36.5 36.8 0.3625 0.99% 139 coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html │ │ 0.384 0.739 0.3549 92.30% 596 rocq-stdlib/theories/Strings/Byte.v.html │ │ 22.2 22.6 0.3433 1.54% 13 coq-fourcolor/theories/proof/job303to306.v.html │ │ 9.37 9.70 0.3371 3.60% 435 coq-mathcomp-odd-order/theories/PFsection12.v.html │ │ 18.3 18.6 0.3258 1.78% 481 coq-verdi-raft/theories/RaftProofs/EndToEndLinearizability.v.html │ │ 48.3 48.6 0.3223 0.67% 376 coq-unimath/UniMath/ModelCategories/Generated/LNWFSMonoidalStructure.v.html │ │ 0.252 0.569 0.3177 126.25% 707 rocq-stdlib/theories/MSets/MSetList.v.html │ │ 38.1 38.4 0.2972 0.78% 224 coq-performance-tests-lite/PerformanceExperiments/rewrite_lift_lets_map.v.html │ │ 28.7 29.0 0.2944 1.03% 13 coq-fourcolor/theories/proof/job563to588.v.html │ │ 16.7 17.0 0.2908 1.74% 905 coq-unimath/UniMath/ModelCategories/Generated/LNWFSCocomplete.v.html │ │ 0.888 1.17 0.2848 32.05% 816 rocq-stdlib/theories/MSets/MSetRBT.v.html │ │ 24.5 24.8 0.2735 1.12% 13 coq-fourcolor/theories/proof/job319to322.v.html │ │ 0.485 0.756 0.2707 55.82% 207 rocq-stdlib/theories/setoid_ring/Ncring_tac.v.html │ │ 23.7 23.9 0.2612 1.10% 13 coq-fourcolor/theories/proof/job295to298.v.html │ │ 0.430 0.679 0.2497 58.14% 474 rocq-stdlib/theories/MSets/MSetWeakList.v.html │ │ 0.334 0.578 0.2435 72.87% 14 rocq-stdlib/theories/Numbers/Integer/Binary/ZBinary.v.html │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 🐇 Top 25 speed ups┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SPEED UPS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 1.73 0.616 -1.1166 -64.43% 2109 rocq-stdlib/theories/FSets/FMapFacts.v.html │ │ 0.622 0.197 -0.4251 -68.29% 16 rocq-stdlib/theories/Numbers/DecimalQ.v.html │ │ 1.47 1.06 -0.4114 -27.92% 572 rocq-stdlib/theories/MSets/MSetAVL.v.html │ │ 25.9 25.5 -0.3966 -1.53% 13 coq-fourcolor/theories/proof/job618to622.v.html │ │ 0.641 0.293 -0.3478 -54.28% 586 rocq-stdlib/theories/Strings/Byte.v.html │ │ 0.349 0.00289 -0.3458 -99.17% 143 coq-mathcomp-analysis/theories/lebesgue_measure.v.html │ │ 0.426 0.119 -0.3066 -72.03% 638 rocq-stdlib/theories/MSets/MSetAVL.v.html │ │ 0.556 0.253 -0.3027 -54.43% 11 rocq-stdlib/theories/ZArith/Zpow_alt.v.html │ │ 0.556 0.271 -0.2850 -51.30% 12 rocq-stdlib/theories/ZArith/Znumtheory.v.html │ │ 0.547 0.264 -0.2830 -51.73% 12 rocq-stdlib/theories/MSets/MSets.v.html │ │ 0.546 0.288 -0.2573 -47.15% 17 rocq-stdlib/theories/micromega/QMicromega.v.html │ │ 18.1 17.9 -0.2567 -1.42% 31 coq-engine-bench-lite/coq/PerformanceDemos/pattern.v.html │ │ 0.496 0.244 -0.2520 -50.84% 1 rocq-stdlib/theories/ZArith/Zcong.v.html │ │ 0.483 0.233 -0.2502 -51.80% 19 rocq-stdlib/theories/ZArith/Int.v.html │ │ 18.2 18.0 -0.2281 -1.25% 32 coq-performance-tests-lite/src/pattern.v.html │ │ 0.583 0.367 -0.2165 -37.10% 14 rocq-stdlib/theories/setoid_ring/Ring_polynom.v.html │ │ 0.624 0.415 -0.2090 -33.50% 1161 rocq-stdlib/theories/Strings/Byte.v.html │ │ 1.87 1.66 -0.2069 -11.07% 313 rocq-stdlib/theories/Strings/Byte.v.html │ │ 12.3 12.1 -0.2058 -1.67% 324 coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/PartialEqRels/Logic/Existential.v.html │ │ 10.3 10.1 -0.2057 -1.99% 496 coq-rewriter/src/Rewriter/Rewriter/Wf.v.html │ │ 0.535 0.332 -0.2033 -38.00% 15 rocq-stdlib/theories/micromega/ZifyInst.v.html │ │ 25.7 25.5 -0.2005 -0.78% 13 coq-fourcolor/theories/proof/job499to502.v.html │ │ 26.8 26.6 -0.2004 -0.75% 13 coq-fourcolor/theories/proof/job190to206.v.html │ │ 0.259 0.0672 -0.1918 -74.05% 676 rocq-stdlib/theories/MSets/MSetRBT.v.html │ │ 3.93 3.75 -0.1853 -4.71% 196 rocq-stdlib/theories/ZArith/ZModOffset.v.html │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ |
|
the failure in equations looks unrelated: https://coq.gitlabpages.inria.fr/-/coq/-/jobs/7348171/artifacts/_bench/logs/rocq-equations.NEW.opam_install.1.stderr.log |
|
The reasoning looks sound to me, and indeed it can fix the issue of goal / tactic desynchronization, so I'm happy with it. I don't have a better idea than the linear search ATM. |
|
Great! Does this need any changes before it can go in? |
The code was written by GPT-5.5 based on the findings from my debugging attempts in #21044. I have not changed the LLM's code yet. I hope the change is small enough to be reviewable. If the mechanism is acceptable, I will polish the code.
This change introduces a notion of search "generations" to
search_fixpoint. This allows us to track precisely which goals have been stuck for how long and which ones need to be retried when we make any kind of progress. Then, to make sure that goals and tactics stay properly aligned in the presence of goal reorderings, we look up the evar's index in the proofview goals and focus that index explicitly.The lookup is currently a linear search through the list of goals. I have previously tried to work with goal state instead. My idea was to keep an index in the goal that maps to a tactic in some kind of array/map. But Class_tactics drops goal state in several places and I could not make the change work. The LLM might have a better chance so I am happy to try that if the linear search is a problem and there is no easy workaround.
The change has been tested on skylabs code where it brings a very modest 0.1% overall speedup with no significant slowdowns. Full report
Fixes / closes #21044
make doc_gram_rsts.