Stop using infer_conv_ustate in unification#21675
Open
SkySkimmer wants to merge 1 commit intorocq-prover:masterfrom
Open
Stop using infer_conv_ustate in unification#21675SkySkimmer wants to merge 1 commit intorocq-prover:masterfrom
SkySkimmer wants to merge 1 commit intorocq-prover:masterfrom
Conversation
The type compatibility check throws away the univ constraints, so we use a univ-ignoring comparison instead. The main call is incorrect when alpha equality infers unsatisfiable constraints and reducing is needed. Fix rocq-prover#21674
Contributor
Author
|
@coqbot bench |
Contributor
|
🏁 Bench results: 🐢 Top 25 slow downs┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SLOW DOWNS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 62.4 66.1 3.6401 5.83% 608 coq-bedrock2/bedrock2/src/bedrock2Examples/lightbulb.v.html │ │ 1.76 3.00 1.2402 70.38% 1479 rocq-metarocq-pcuic/pcuic/theories/PCUICSubstitution.v.html │ │ 93.8 95.0 1.2249 1.31% 999 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 2.06 2.89 0.8297 40.37% 102 coq-fiat-parsers/src/Parsers/ParserImplementation.v.html │ │ 2.47 3.27 0.8081 32.78% 34 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html │ │ 0.856 1.57 0.7094 82.84% 2601 rocq-metarocq-safechecker/safechecker/theories/PCUICTypeChecker.v.html │ │ 0.933 1.61 0.6750 72.36% 2493 rocq-metarocq-safechecker/safechecker/theories/PCUICTypeChecker.v.html │ │ 21.2 21.8 0.6221 2.93% 651 rocq-stdlib/theories/Zmod/ZmodBase.v.html │ │ 1.18 1.80 0.6171 52.11% 78 rocq-metarocq-pcuic/pcuic/theories/PCUICConversion.v.html │ │ 0.304 0.915 0.6114 201.15% 153 rocq-mathcomp-algebra/algebra/spectral.v.html │ │ 0.668 1.26 0.5912 88.47% 298 rocq-metarocq-pcuic/pcuic/theories/Bidirectional/BDUnique.v.html │ │ 9.25 9.83 0.5791 6.26% 434 coq-mathcomp-odd-order/theories/PFsection12.v.html │ │ 0.792 1.37 0.5732 72.38% 395 rocq-metarocq-pcuic/pcuic/theories/PCUICElimination.v.html │ │ 0.316 0.876 0.5602 177.53% 245 rocq-metarocq-pcuic/pcuic/theories/PCUICSR.v.html │ │ 16.9 17.4 0.5558 3.30% 905 coq-unimath/UniMath/ModelCategories/Generated/LNWFSCocomplete.v.html │ │ 0.686 1.23 0.5417 78.98% 278 rocq-metarocq-pcuic/pcuic/theories/Bidirectional/BDUnique.v.html │ │ 0.657 1.19 0.5357 81.48% 266 rocq-metarocq-pcuic/pcuic/theories/Bidirectional/BDUnique.v.html │ │ 0.616 1.12 0.5067 82.31% 770 rocq-metarocq-pcuic/pcuic/theories/PCUICEquality.v.html │ │ 1.58 2.08 0.4984 31.58% 42 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ToFancyWithCasts.v.html │ │ 94.4 94.9 0.4888 0.52% 968 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 0.196 0.668 0.4715 240.40% 682 rocq-stdlib/theories/Numbers/DecimalFacts.v.html │ │ 58.3 58.7 0.4710 0.81% 660 coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JacobianCoZ.v.html │ │ 0.00100 0.437 0.4361 43439.54% 292 coq-mathcomp-odd-order/theories/BGsection11.v.html │ │ 0.491 0.915 0.4237 86.26% 409 rocq-metarocq-pcuic/pcuic/theories/PCUICConvCumInversion.v.html │ │ 0.459 0.882 0.4230 92.07% 1815 rocq-metarocq-safechecker/safechecker/theories/PCUICTypeChecker.v.html │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 🐇 Top 25 speed ups┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SPEED UPS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 67.2 62.4 -4.8098 -7.15% 608 coq-fiat-crypto-with-bedrock/rupicola/bedrock2/bedrock2/src/bedrock2Examples/lightbulb.v.html │ │ 203 201 -2.2395 -1.10% 8 coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html │ │ 61.2 59.3 -1.8370 -3.00% 27 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ToFancyWithCasts.v.html │ │ 5.36 4.34 -1.0172 -18.98% 2862 rocq-metarocq-safechecker/safechecker/theories/PCUICTypeChecker.v.html │ │ 120 119 -0.9882 -0.83% 22 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html │ │ 94.7 93.9 -0.7761 -0.82% 20 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/NBE.v.html │ │ 29.6 28.9 -0.6926 -2.34% 31 coq-fiat-crypto-with-bedrock/src/Bedrock/End2End/X25519/MontgomeryLadderRISCV.v.html │ │ 1.17 0.497 -0.6724 -57.49% 1604 rocq-stdlib/theories/micromega/Tauto.v.html │ │ 0.772 0.233 -0.5391 -69.80% 17 rocq-stdlib/theories/micromega/Env.v.html │ │ 27.4 26.9 -0.5147 -1.88% 34 coq-fiat-crypto-with-bedrock/src/Bedrock/End2End/X25519/MontgomeryLadderRISCV.v.html │ │ 0.426 0.00327 -0.4230 -99.23% 75 rocq-mathcomp-algebra/algebra/spectral.v.html │ │ 0.423 0.00938 -0.4138 -97.78% 154 rocq-mathcomp-algebra/algebra/spectral.v.html │ │ 0.446 0.0387 -0.4077 -91.33% 140 rocq-mathcomp-solvable/solvable/extraspecial.v.html │ │ 21.9 21.5 -0.4015 -1.83% 49 coq-fiat-crypto-with-bedrock/src/Curves/Weierstrass/AffineProofs.v.html │ │ 0.683 0.289 -0.3943 -57.73% 19 rocq-stdlib/theories/ZArith/Int.v.html │ │ 30.4 30.0 -0.3820 -1.26% 307 coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/Addchain.v.html │ │ 0.806 0.425 -0.3815 -47.31% 59 rocq-stdlib/theories/ZArith/Zeuclid.v.html │ │ 27.7 27.4 -0.3689 -1.33% 129 coq-fiat-crypto-with-bedrock/src/Curves/Weierstrass/Projective.v.html │ │ 24.0 23.7 -0.3641 -1.52% 777 coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html │ │ 1.18 0.818 -0.3611 -30.63% 408 rocq-stdlib/theories/MSets/MSetAVL.v.html │ │ 28.7 28.3 -0.3297 -1.15% 795 coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html │ │ 22.9 22.6 -0.3282 -1.43% 1073 rocq-metarocq-safechecker/safechecker/theories/PCUICSafeReduce.v.html │ │ 1.04 0.722 -0.3154 -30.40% 702 rocq-stdlib/theories/Numbers/HexadecimalFacts.v.html │ │ 31.5 31.2 -0.3120 -0.99% 259 coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Coord.v.html │ │ 0.754 0.443 -0.3111 -41.25% 11 rocq-stdlib/theories/ZArith/Zpow_alt.v.html │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ |
Member
|
Strangely enough it seems to be slightly slower on some examples. |
Contributor
Author
|
If syntactic equality produces invalid constraints we now do full conversion, so it makes sense that some cases are slower IMO |
Member
|
It's not a crazy slowdown so it's fine to me. Should we backport this to 9.2.X though? |
ppedrot
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The type compatibility check throws away the univ constraints, so we use a univ-ignoring comparison instead.
The main call is incorrect when alpha equality infers unsatisfiable constraints and reducing is needed.
Fix #21674