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
Using same refolding strategy for named cofixpoints in tactic "simpl" as is done for named fixpoints #18576
Using same refolding strategy for named cofixpoints in tactic "simpl" as is done for named fixpoints #18576
Conversation
@coqbot bench |
🏁 Bench results:
INFO: failed to install coq-mathcomp-fingroup (dependency coq-mathcomp-ssreflect failed) 🐢 Top 25 slow downs┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SLOW DOWNS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 19.8430 22.2420 2.3990 12.09% 2061 coq-fiat-crypto-with-bedrock/rupicola/bedrock2/compiler/src/compiler/FlatToRiscvFunctions.v.html │ │ 130.0910 131.5430 1.4520 1.12% 22 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html │ │ 3.8720 4.9930 1.1210 28.95% 22 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html │ │ 62.7070 63.7060 0.9990 1.59% 609 coq-fiat-crypto-with-bedrock/rupicola/bedrock2/bedrock2/src/bedrock2Examples/lightbulb.v.html │ │ 152.0810 152.8290 0.7480 0.49% 1190 coq-unimath/UniMath/CategoryTheory/GrothendieckConstruction/IsPullback.v.html │ │ 2.6630 3.3800 0.7170 26.92% 34 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html │ │ 100.8470 101.5190 0.6720 0.67% 20 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/NBE.v.html │ │ 66.3810 67.0500 0.6690 1.01% 1629 coq-metacoq-pcuic/pcuic/theories/PCUICSR.v.html │ │ 67.4300 68.0910 0.6610 0.98% 27 coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ToFancyWithCasts.v.html │ │ 44.0330 44.6780 0.6450 1.46% 827 coq-vst/veric/binop_lemmas4.v.html │ │ 77.9750 78.5450 0.5700 0.73% 48 coq-fiat-crypto-with-bedrock/src/Curves/Weierstrass/AffineProofs.v.html │ │ 22.5500 23.0820 0.5320 2.36% 595 coq-unimath/UniMath/CategoryTheory/GrothendieckConstruction/IsPullback.v.html │ │ 0.9930 1.3990 0.4060 40.89% 853 coq-stdlib/FSets/FMapAVL.v.html │ │ 95.2090 95.5920 0.3830 0.40% 999 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 3.9210 4.2860 0.3650 9.31% 8 coq-engine-bench-lite/coq/PerformanceDemos/repeated_conj.v.html │ │ 37.4010 37.7580 0.3570 0.95% 3 coq-fiat-crypto-with-bedrock/src/ExtractionJsOfOCaml/with_bedrock2_fiat_crypto.v.html │ │ 18.0920 18.4180 0.3260 1.80% 31 coq-engine-bench-lite/coq/PerformanceDemos/pattern.v.html │ │ 32.8950 33.2130 0.3180 0.97% 1333 coq-fiat-crypto-with-bedrock/rupicola/bedrock2/compiler/src/compiler/FlatToRiscvFunctions.v.html │ │ 17.8690 18.1790 0.3100 1.73% 3158 coq-fiat-crypto-with-bedrock/src/Assembly/WithBedrock/Proofs.v.html │ │ 94.1100 94.3930 0.2830 0.30% 103 coq-fiat-crypto-with-bedrock/src/Arithmetic/BarrettReduction.v.html │ │ 14.9400 15.2170 0.2770 1.85% 3090 coq-fiat-crypto-with-bedrock/src/Assembly/WithBedrock/Proofs.v.html │ │ 0.6100 0.8810 0.2710 44.43% 816 coq-stdlib/MSets/MSetRBT.v.html │ │ 95.3800 95.6420 0.2620 0.27% 968 coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html │ │ 9.2110 9.4580 0.2470 2.68% 183 coq-fiat-crypto-with-bedrock/rupicola/bedrock2/compiler/src/compiler/FlatToRiscvMetric.v.html │ │ 8.5880 8.8320 0.2440 2.84% 27 coq-rewriter/src/Rewriter/Rewriter/Examples/PerfTesting/UnderLetsPlus0.v.html │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 🐇 Top 25 speed ups┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TOP 25 SPEED UPS │ │ │ │ OLD NEW DIFF %DIFF Ln FILE │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 10.4470 0.9790 -9.4680 -90.63% 603 coq-unimath/UniMath/Algebra/GroupAction.v.html │ │ 267.1490 260.4370 -6.7120 -2.51% 8 coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html │ │ 182.0740 178.4420 -3.6320 -1.99% 233 coq-fiat-crypto-with-bedrock/rupicola/bedrock2/deps/riscv-coq/src/riscv/Proofs/DecodeByExtension.v.html │ │ 34.0850 33.3800 -0.7050 -2.07% 839 coq-unimath/UniMath/CategoryTheory/GrothendieckConstruction/IsPullback.v.html │ │ 27.4540 26.9370 -0.5170 -1.88% 68 coq-fiat-crypto-with-bedrock/rupicola/bedrock2/deps/riscv-coq/src/riscv/Proofs/VerifyDecode.v.html │ │ 36.6820 36.2340 -0.4480 -1.22% 2 coq-fiat-crypto-with-bedrock/src/ExtractionJsOfOCaml/fiat_crypto.v.html │ │ 0.4220 0.0150 -0.4070 -96.45% 259 coq-unimath/UniMath/CategoryTheory/Subobjects.v.html │ │ 4.7230 4.3530 -0.3700 -7.83% 733 coq-category-theory/Construction/Comma/Adjunction.v.html │ │ 0.5400 0.1820 -0.3580 -66.30% 90 coq-unimath/UniMath/Semantics/LinearLogic/LiftingModel.v.html │ │ 2.7850 2.4300 -0.3550 -12.75% 490 coq-stdlib/Reals/Cauchy/ConstructiveCauchyRealsMult.v.html │ │ 1.0980 0.7700 -0.3280 -29.87% 384 coq-stdlib/MSets/MSetAVL.v.html │ │ 13.8900 13.5870 -0.3030 -2.18% 216 coq-fiat-crypto-with-bedrock/src/Fancy/Barrett256.v.html │ │ 0.3130 0.0360 -0.2770 -88.50% 290 coq-unimath/UniMath/Algebra/Archimedean.v.html │ │ 17.3350 17.0700 -0.2650 -1.53% 481 coq-verdi-raft/theories/RaftProofs/EndToEndLinearizability.v.html │ │ 13.1330 12.8680 -0.2650 -2.02% 1028 coq-unimath/UniMath/CategoryTheory/LocalizingClass.v.html │ │ 0.5570 0.3140 -0.2430 -43.63% 868 coq-stdlib/MSets/MSetRBT.v.html │ │ 0.6070 0.3820 -0.2250 -37.07% 2108 coq-stdlib/FSets/FMapFacts.v.html │ │ 0.7450 0.5220 -0.2230 -29.93% 590 coq-stdlib/Strings/Byte.v.html │ │ 10.3750 10.1570 -0.2180 -2.10% 304 coq-fiat-crypto-with-bedrock/src/Fancy/Montgomery256.v.html │ │ 0.2890 0.0720 -0.2170 -75.09% 250 coq-metacoq-safechecker/safechecker/theories/PCUICSafeRetyping.v.html │ │ 0.2170 0.0010 -0.2160 -99.54% 430 coq-metacoq-erasure/erasure/theories/EWcbvEvalCstrsAsBlocksInd.v.html │ │ 41.1570 40.9440 -0.2130 -0.52% 139 coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html │ │ 0.2120 0.0000 -0.2120 -100.00% 374 coq-metacoq-erasure/erasure/theories/EGenericGlobalMap.v.html │ │ 0.2070 0.0000 -0.2070 -100.00% 360 coq-metacoq-pcuic/pcuic/theories/Bidirectional/BDFromPCUIC.v.html │ │ 0.2180 0.0120 -0.2060 -94.50% 303 coq-metacoq-pcuic/pcuic/theories/PCUICEtaExpand.v.html │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ |
CI green at this stage (except coq_library_undecidability and http as in other PRs). |
b0824ed
to
b3961e7
Compare
pretyping/reductionops.mli
Outdated
@@ -58,7 +58,8 @@ module Stack : sig | |||
|
|||
val pr_app_node : (EConstr.t -> Pp.t) -> app_node -> Pp.t | |||
|
|||
type case_stk | |||
type case_stk = | |||
case_info * EInstance.t * EConstr.t array * EConstr.t pcase_return * EConstr.t pcase_invert * EConstr.t pcase_branch array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems you only build values of this type. If that's the case (no pun intended) don't expose the type definition but a builder function instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the case... Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't hide the type though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol, looks like I was a bit absent-minded. Done
b3961e7
to
2f6c5d9
Compare
Because the argument of a Case cannot be a lambda.
At the same time, we start putting an architecture to nest the recursive calls "simpl", so that it can (eventually!) be configured to work like "cbn", as in: Definition pred_add x y := pred (x+y). Eval simpl in pred_add 3 4. (* Currently unreduced *) Eval cbn in pred_add 3 4. (* 6 *) Definition add_succ x y := (x+y) + 1. Eval simpl in add_succ 3 4. (* Currently unreduced *) Eval cbn in pred_add 3 4. (* 8 *)
We mostly reuse the code existing to refold fixpoints.
2f6c5d9
to
a90fcef
Compare
@coqbot run full ci |
reversible constants, eventually refolding to the initial constant | ||
for unary fixpoints and to the last constant encapsulating the Fix | ||
for mutual fixpoints *) | ||
|
||
let compute_consteval ((cache,_),allowed_reds as cache_reds) env sigma ref u = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should introduce a proper record for reduction caches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually yes. I could do it as soon as this PR if you insist, or, maybe, simpler to me, at the time of rebasing PR #18580 which also adds a new component.
@coqbot merge now |
@ppedrot: You can't merge the PR because it hasn't been approved yet. |
@coqbot merge now |
We mostly reuse for named cofixpoints the code existing to refold named fixpoints.
Fixes #4056 and makes
simpl
's behavior more uniform and a bit closer tocbn
.The 5 first commit are code restructuration (no change of semantics in principle). The 6th is a shortcut in the code. Only the last commit changes the behavior wrt cofixpoints refolding.
Note: I'm considering eventually introducing refolding also in
lazy
andcbv
.