-
Couldn't load subscription status.
- Fork 697
Add a generic mechanism for rewriting with any equality satisfying J #21098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
5d85858 to
04fdca3
Compare
|
@coqbot run full ci |
04fdca3 to
9e27b8c
Compare
a30387b to
428b37f
Compare
|
@coqbot run full ci |
428b37f to
e8c319f
Compare
32830da to
a1b5bbf
Compare
|
@coqbot run full ci |
|
@coqbot run full ci |
|
@coqbot bench |
1 similar comment
|
@coqbot bench |
|
🏁 Bench results: INFO: failed to install 🐢 Top 25 slow downs┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SLOW DOWNS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 31.929 33.923 1.9940 6.25% 97 coq-vst/veric/binop_lemmas5.v.html │ │ 200 201 1.7352 0.87% 8 coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html │ │ 41.391 42.468 1.0770 2.60% 834 coq-vst/veric/binop_lemmas4.v.html │ │ 0.404 1.457 1.0530 260.64% 946 coq-vst/veric/binop_lemmas2.v.html │ │ 3.797 4.27 0.4730 12.46% 477 coq-vst/veric/expr_lemmas3.v.html │ │ 16.3 16.7 0.4671 2.87% 31 coq-engine-bench-lite/coq/PerformanceDemos/pattern.v.html │ │ 38.1 38.5 0.4322 1.14% 224 coq-performance-tests-lite/PerformanceExperiments/rewrite_lift_lets_map.v.html │ │ 18.9 19.3 0.4059 2.14% 481 coq-verdi-raft/theories/RaftProofs/EndToEndLinearizability.v.html │ │ 96.7 97.0 0.3521 0.36% 968 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 38.7 39.1 0.3361 0.87% 236 coq-rewriter/src/Rewriter/Rewriter/Examples/PerfTesting/LiftLetsMap.v.html │ │ 2.05 2.37 0.3203 15.63% 469 rocq-metarocq-safechecker/safechecker/theories/PCUICEqualityDec.v.html │ │ 6.146 6.46 0.3140 5.11% 192 coq-vst/veric/binop_lemmas5.v.html │ │ 0.484 0.787 0.3031 62.61% 597 rocq-stdlib/theories/Strings/Byte.v.html │ │ 4.272 4.559 0.2870 6.72% 171 coq-vst/veric/binop_lemmas5.v.html │ │ 0.280 0.552 0.2713 96.80% 19 rocq-stdlib/theories/MSets/MSetFacts.v.html │ │ 0.389 0.649 0.2599 66.79% 615 rocq-stdlib/theories/setoid_ring/Field_theory.v.html │ │ 0.333 0.588 0.2545 76.43% 1 rocq-stdlib/theories/ZArith/Zdivisibility.v.html │ │ 96.6 96.9 0.2500 0.26% 999 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 0.417 0.665 0.2489 59.75% 1 rocq-stdlib/theories/btauto/Algebra.v.html │ │ 0.00181 0.241 0.2394 13246.04% 147 rocq-mathcomp-field/field/algnum.v.html │ │ 0.00195 0.239 0.2366 12115.31% 227 rocq-mathcomp-solvable/solvable/extraspecial.v.html │ │ 8.13 8.36 0.2347 2.89% 1265 coq-verdi-raft/theories/Raft/CommonTheorems.v.html │ │ 0.000636 0.222 0.2212 34787.42% 232 rocq-mathcomp-field/field/closed_field.v.html │ │ 0.000562 0.219 0.2182 38826.16% 558 rocq-mathcomp-field/field/closed_field.v.html │ │ 0.349 0.565 0.2163 62.03% 16 rocq-stdlib/theories/extraction/ExtrOcamlIntConv.v.html │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 🐇 Top 25 speed ups┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SPEED UPS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 3.77 3.17 -0.5972 -15.84% 196 rocq-stdlib/theories/ZArith/ZModOffset.v.html │ │ 26.4 25.8 -0.5957 -2.25% 12 coq-fourcolor/theories/proof/job466to485.v.html │ │ 25.3 24.7 -0.5766 -2.28% 12 coq-fourcolor/theories/proof/job319to322.v.html │ │ 22.1 21.6 -0.5724 -2.58% 651 rocq-stdlib/theories/Zmod/ZmodBase.v.html │ │ 26.0 25.5 -0.5220 -2.01% 12 coq-fourcolor/theories/proof/job618to622.v.html │ │ 4.68 4.23 -0.4588 -9.80% 492 rocq-stdlib/theories/Reals/Cauchy/ConstructiveCauchyRealsMult.v.html │ │ 35.07 34.618 -0.4520 -1.29% 147 coq-vst/veric/expr_lemmas4.v.html │ │ 16.5 16.1 -0.3838 -2.32% 32 coq-performance-tests-lite/src/pattern.v.html │ │ 20.9 20.5 -0.3796 -1.81% 12 coq-fourcolor/theories/proof/job283to286.v.html │ │ 34.032 33.661 -0.3710 -1.09% 194 coq-vst/veric/expr_lemmas4.v.html │ │ 1.52 1.17 -0.3534 -23.27% 1142 rocq-stdlib/theories/FSets/FMapAVL.v.html │ │ 0.567 0.238 -0.3285 -57.97% 104 coq-mathcomp-analysis/theories/lebesgue_integral_theory/lebesgue_integral_under.v.html │ │ 1.09 0.761 -0.3275 -30.08% 215 rocq-stdlib/theories/setoid_ring/Ncring_tac.v.html │ │ 24.5 24.2 -0.3232 -1.32% 12 coq-fourcolor/theories/proof/job231to234.v.html │ │ 0.466 0.155 -0.3109 -66.73% 586 rocq-stdlib/theories/Strings/Byte.v.html │ │ 8.44 8.13 -0.3085 -3.66% 1331 coq-mathcomp-odd-order/theories/PFsection9.v.html │ │ 0.463 0.177 -0.2862 -61.84% 592 rocq-stdlib/theories/MSets/MSetAVL.v.html │ │ 0.252 0.00362 -0.2483 -98.56% 148 rocq-mathcomp-field/field/algnum.v.html │ │ 3.56 3.31 -0.2449 -6.89% 213 rocq-stdlib/theories/setoid_ring/Ncring_tac.v.html │ │ 0.675 0.433 -0.2412 -35.76% 21 rocq-stdlib/theories/FSets/FMapAVL.v.html │ │ 0.599 0.358 -0.2410 -40.21% 11 rocq-stdlib/theories/Strings/OctalString.v.html │ │ 0.239 0.00268 -0.2366 -98.88% 228 rocq-mathcomp-solvable/solvable/extraspecial.v.html │ │ 0.996 0.769 -0.2271 -22.81% 170 rocq-stdlib/theories/Numbers/HexadecimalNat.v.html │ │ 1.21 0.987 -0.2256 -18.60% 2109 rocq-stdlib/theories/FSets/FMapFacts.v.html │ │ 31.3 31.0 -0.2254 -0.72% 12 coq-fourcolor/theories/proof/job254to270.v.html │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ |
|
@coqbot run full ci |
b95c3d9 to
895b0b1
Compare
|
@coqbot run full ci |
|
@coqbot bench |
|
🏁 Bench results: INFO: failed to install 🐢 Top 25 slow downs┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SLOW DOWNS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 31.852 34.081 2.2290 7.00% 97 coq-vst/veric/binop_lemmas5.v.html │ │ 0.402 1.454 1.0520 261.69% 946 coq-vst/veric/binop_lemmas2.v.html │ │ 38.0 39.0 1.0461 2.75% 224 coq-performance-tests-lite/PerformanceExperiments/rewrite_lift_lets_map.v.html │ │ 16.0 16.8 0.8392 5.26% 32 coq-performance-tests-lite/src/pattern.v.html │ │ 41.615 42.337 0.7220 1.73% 834 coq-vst/veric/binop_lemmas4.v.html │ │ 39.1 39.6 0.5556 1.42% 236 coq-rewriter/src/Rewriter/Rewriter/Examples/PerfTesting/LiftLetsMap.v.html │ │ 3.774 4.297 0.5230 13.86% 477 coq-vst/veric/expr_lemmas3.v.html │ │ 36.5 37.0 0.4687 1.28% 139 coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html │ │ 21.2 21.7 0.4577 2.16% 651 rocq-stdlib/theories/Zmod/ZmodBase.v.html │ │ 2.03 2.38 0.3539 17.47% 469 rocq-metarocq-safechecker/safechecker/theories/PCUICEqualityDec.v.html │ │ 1.96 2.29 0.3257 16.62% 2 coq-mathcomp-analysis/theories/homotopy_theory/homotopy.v.html │ │ 0.354 0.669 0.3146 88.78% 10 rocq-stdlib/theories/extraction/ExtrHaskellZNum.v.html │ │ 6.148 6.452 0.3040 4.94% 192 coq-vst/veric/binop_lemmas5.v.html │ │ 0.00376 0.302 0.2987 7953.06% 202 coq-mathcomp-analysis/theories/normedtype_theory/ereal_normedtype.v.html │ │ 0.351 0.649 0.2982 85.01% 249 rocq-stdlib/theories/Structures/OrdersEx.v.html │ │ 4.272 4.568 0.2960 6.93% 171 coq-vst/veric/binop_lemmas5.v.html │ │ 0.340 0.630 0.2895 85.05% 12 rocq-stdlib/theories/MSets/MSets.v.html │ │ 0.318 0.581 0.2628 82.63% 11 rocq-stdlib/theories/QArith/Qpower.v.html │ │ 1.02 1.28 0.2595 25.53% 89 coq-engine-bench-lite/coq/PerformanceDemos/quadratic_reduction.v.html │ │ 25.0 25.2 0.2577 1.03% 79 coq-rewriter/src/Rewriter/Rewriter/Examples/PerfTesting/SieveOfEratosthenes.v.html │ │ 2.923 3.171 0.2480 8.48% 475 coq-vst/veric/binop_lemmas3.v.html │ │ 0.00179 0.243 0.2415 13470.61% 147 rocq-mathcomp-field/field/algnum.v.html │ │ 0.00215 0.240 0.2382 11101.07% 227 rocq-mathcomp-solvable/solvable/extraspecial.v.html │ │ 0.491 0.727 0.2365 48.18% 13 rocq-stdlib/theories/FSets/FMapPositive.v.html │ │ 0.000630 0.223 0.2226 35337.14% 232 rocq-mathcomp-field/field/closed_field.v.html │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 🐇 Top 25 speed ups┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SPEED UPS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 203 203 -0.8314 -0.41% 8 coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html │ │ 3.31 2.55 -0.7689 -23.20% 607 rocq-stdlib/theories/Zmod/ZmodBase.v.html │ │ 1.71 1.12 -0.5880 -34.45% 813 rocq-stdlib/theories/MSets/MSetRBT.v.html │ │ 7.46 6.94 -0.5180 -6.94% 604 coq-unimath/UniMath/CategoryTheory/EnrichedCats/Colimits/Examples/StructureEnrichedColimits.v.html │ │ 35.093 34.589 -0.5040 -1.44% 147 coq-vst/veric/expr_lemmas4.v.html │ │ 8.44 7.98 -0.4601 -5.45% 1331 coq-mathcomp-odd-order/theories/PFsection9.v.html │ │ 1.57 1.11 -0.4573 -29.19% 1142 rocq-stdlib/theories/FSets/FMapAVL.v.html │ │ 0.752 0.341 -0.4110 -54.65% 1 rocq-stdlib/theories/Zmod/ZstarDef.v.html │ │ 3.60 3.20 -0.3978 -11.04% 196 rocq-stdlib/theories/ZArith/ZModOffset.v.html │ │ 15.1 14.8 -0.3414 -2.26% 12 coq-fourcolor/theories/proof/job215to218.v.html │ │ 1.85 1.53 -0.3278 -17.68% 313 rocq-stdlib/theories/Strings/Byte.v.html │ │ 25.7 25.4 -0.3213 -1.25% 12 coq-fourcolor/theories/proof/job299to302.v.html │ │ 34.03 33.721 -0.3090 -0.91% 194 coq-vst/veric/expr_lemmas4.v.html │ │ 0.529 0.236 -0.2928 -55.35% 13 rocq-stdlib/theories/micromega/ZCoeff.v.html │ │ 0.477 0.200 -0.2774 -58.14% 374 rocq-stdlib/theories/Sorting/SetoidList.v.html │ │ 0.488 0.226 -0.2629 -53.83% 19 rocq-stdlib/theories/ZArith/Int.v.html │ │ 7.55 7.29 -0.2603 -3.45% 602 coq-unimath/UniMath/CategoryTheory/EnrichedCats/Limits/Examples/StructureEnrichedLimits.v.html │ │ 15.439 15.19 -0.2490 -1.61% 1209 coq-vst/floyd/Component.v.html │ │ 0.252 0.00376 -0.2480 -98.51% 148 rocq-mathcomp-field/field/algnum.v.html │ │ 25.6 25.3 -0.2460 -0.96% 12 coq-fourcolor/theories/proof/job291to294.v.html │ │ 0.534 0.290 -0.2443 -45.76% 36 rocq-stdlib/theories/MSets/MSetAVL.v.html │ │ 25.6 25.4 -0.2398 -0.94% 12 coq-fourcolor/theories/proof/job223to226.v.html │ │ 0.240 0.00267 -0.2369 -98.89% 228 rocq-mathcomp-solvable/solvable/extraspecial.v.html │ │ 26.2 26.0 -0.2295 -0.87% 375 coq-unimath/UniMath/ModelCategories/Generated/LNWFSMonoidalStructure.v.html │ │ 0.686 0.465 -0.2213 -32.24% 60 rocq-stdlib/theories/Numbers/DecimalString.v.html │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ |
|
🏁 Bench results: INFO: failed to install 🐢 Top 25 slow downs┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SLOW DOWNS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 32.126 33.847 1.7210 5.36% 97 coq-vst/veric/binop_lemmas5.v.html │ │ 0.403 1.453 1.0500 260.55% 946 coq-vst/veric/binop_lemmas2.v.html │ │ 96.5 97.3 0.7782 0.81% 968 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 41.119 41.877 0.7580 1.84% 834 coq-vst/veric/binop_lemmas4.v.html │ │ 1.41 1.96 0.5526 39.25% 313 rocq-stdlib/theories/Strings/Byte.v.html │ │ 96.2 96.7 0.5161 0.54% 999 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 4.10 4.59 0.4989 12.18% 492 rocq-stdlib/theories/Reals/Cauchy/ConstructiveCauchyRealsMult.v.html │ │ 3.787 4.251 0.4640 12.25% 477 coq-vst/veric/expr_lemmas3.v.html │ │ 0.869 1.23 0.3657 42.09% 408 rocq-stdlib/theories/MSets/MSetAVL.v.html │ │ 32.8 33.2 0.3593 1.09% 12 coq-fourcolor/theories/proof/job439to465.v.html │ │ 18.2 18.5 0.3386 1.87% 12 coq-fourcolor/theories/proof/job271to278.v.html │ │ 0.269 0.602 0.3327 123.70% 12 rocq-stdlib/theories/MSets/MSets.v.html │ │ 24.3 24.6 0.3275 1.35% 12 coq-fourcolor/theories/proof/job486to489.v.html │ │ 2.03 2.35 0.3231 15.93% 469 rocq-metarocq-safechecker/safechecker/theories/PCUICEqualityDec.v.html │ │ 1.55 1.87 0.3189 20.54% 75 rocq-stdlib/theories/Numbers/HexadecimalString.v.html │ │ 19.2 19.5 0.3151 1.64% 481 coq-verdi-raft/theories/RaftProofs/EndToEndLinearizability.v.html │ │ 25.2 25.5 0.3137 1.25% 12 coq-fourcolor/theories/proof/job517to530.v.html │ │ 0.00373 0.302 0.2978 7995.73% 202 coq-mathcomp-analysis/theories/normedtype_theory/ereal_normedtype.v.html │ │ 29.4 29.6 0.2843 0.97% 12 coq-fourcolor/theories/proof/job323to383.v.html │ │ 0.0896 0.352 0.2627 293.28% 312 rocq-stdlib/theories/Reals/Abstract/ConstructiveAbs.v.html │ │ 6.166 6.428 0.2620 4.25% 192 coq-vst/veric/binop_lemmas5.v.html │ │ 2.01 2.27 0.2565 12.76% 2 coq-mathcomp-analysis/theories/homotopy_theory/homotopy.v.html │ │ 27.0 27.3 0.2560 0.95% 12 coq-fourcolor/theories/proof/job611to617.v.html │ │ 25.1 25.4 0.2458 0.98% 12 coq-fourcolor/theories/proof/job227to230.v.html │ │ 0.354 0.596 0.2425 68.50% 11 rocq-stdlib/theories/QArith/Qround.v.html │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 🐇 Top 25 speed ups┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SPEED UPS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 30.7 30.2 -0.5143 -1.67% 12 coq-fourcolor/theories/proof/job165to189.v.html │ │ 8.39 7.97 -0.4191 -5.00% 1331 coq-mathcomp-odd-order/theories/PFsection9.v.html │ │ 0.555 0.148 -0.4063 -73.24% 11 rocq-stdlib/theories/omega/OmegaLemmas.v.html │ │ 0.520 0.130 -0.3904 -75.03% 1166 rocq-stdlib/theories/Strings/Byte.v.html │ │ 48.9 48.5 -0.3817 -0.78% 376 coq-unimath/UniMath/ModelCategories/Generated/LNWFSMonoidalStructure.v.html │ │ 1.62 1.24 -0.3795 -23.38% 813 rocq-stdlib/theories/MSets/MSetRBT.v.html │ │ 0.520 0.234 -0.2862 -55.07% 18 rocq-stdlib/theories/micromega/VarMap.v.html │ │ 0.601 0.327 -0.2737 -45.58% 11 rocq-stdlib/theories/ZArith/Zdiv_facts.v.html │ │ 36.7 36.4 -0.2681 -0.73% 139 coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html │ │ 1.02 0.747 -0.2680 -26.40% 170 rocq-stdlib/theories/Numbers/HexadecimalNat.v.html │ │ 0.251 0.00364 -0.2475 -98.55% 148 rocq-mathcomp-field/field/algnum.v.html │ │ 3.22 2.98 -0.2383 -7.41% 607 rocq-stdlib/theories/Zmod/ZmodBase.v.html │ │ 0.489 0.262 -0.2269 -46.39% 17 rocq-stdlib/theories/Logic/IndefiniteDescription.v.html │ │ 201 201 -0.2232 -0.11% 8 coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html │ │ 0.221 0.000098 -0.2213 -99.96% 219 rocq-mathcomp-algebra/algebra/spectral.v.html │ │ 0.733 0.514 -0.2194 -29.93% 21 rocq-stdlib/theories/MSets/MSetPositive.v.html │ │ 0.542 0.323 -0.2194 -40.47% 19 rocq-stdlib/theories/Sorting/Heap.v.html │ │ 0.220 0.000824 -0.2187 -99.62% 112 rocq-mathcomp-field/field/galois.v.html │ │ 0.218 0.00261 -0.2155 -98.80% 145 coq-fourcolor/theories/proof/discretize.v.html │ │ 26.3 26.1 -0.2151 -0.82% 375 coq-unimath/UniMath/ModelCategories/Generated/LNWFSMonoidalStructure.v.html │ │ 0.213 0.00122 -0.2119 -99.43% 513 rocq-metarocq-safechecker/safechecker/theories/PCUICSafeChecker.v.html │ │ 0.196 0.00194 -0.1943 -99.01% 136 coq-mathcomp-odd-order/theories/BGsection1.v.html │ │ 19.1 19.0 -0.1936 -1.01% 12 coq-fourcolor/theories/proof/job207to214.v.html │ │ 0.230 0.0367 -0.1932 -84.02% 84 rocq-metarocq-pcuic/pcuic/theories/Bidirectional/BDUnique.v.html │ │ 0.196 0.00376 -0.1924 -98.09% 11 coq-mathcomp-odd-order/theories/BGsection2.v.html │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ |
|
I think the PR is ready (the first order heuristic is not used anymore and can be removed here). Only rocq-community/paramcoq#142 needs to be fixed @ppedrot. |
This PR has a mechanism to make rewrite and discrimante parametrized over any equality satisfying reflexivity and Martin-Löf style J eliminator. The (ad-hoc) parametrization is done using typeclass inference.
This PR is on top of #21161 which provides a way to use the typeclass system on a different DB than
typeclass_instances. For equality, we use the DBrewrite_instances. This avoids being sensitive to the local content of typeclass_instances.Instead of having simply on class for J, we support all the variants used by rewrite (e.g., non-dependent, _r , forward, and so on) for backward compatibility.
Note some for some use cases, supporting those variants is crucial for the guard condition as a rewritten term is a substerm only if the rewriting occurs as a direct pattern-matching (hence for instance the tricky definition of eq_rect_r_dep).
Previously, all those subtleties were handle under the hood by generating internal_rew_... scheme on the fly.
We can now rewrite with an equality where the transport is not based on matching (see for instance Observational.v in the test-suite).
For backward compatibility reason,
eq_rec_ris now a annotation overeq_rect_r.Overlays (to be merged before the current PR)