Skip to content

Canonical structures and unification: treat all forms of primitive projections alike - #22789

Merged
coqbot-app[bot] merged 5 commits into
rocq-prover:masterfrom
mattam82:cs-primproj
Dec 3, 2026
Merged

coqbot-app[bot] merged 5 commits into
rocq-prover:masterfrom
mattam82:cs-primproj

Conversation

@mattam82

@mattam82 mattam82 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

This change was originally part of my universes-and-variances branch (initial evarconv refolding code by me), as using primitive projections for structures is necessary to get the right cumulativity constraints on packed classes but it's also a general purpose improvement: CS + primproj work better together, unification and evarconv have closer strategies for finding a solution to a CS problem (without disturbing the previous unification.ml behaviour too much) and ssrmatching can really match primproj-headed patterns up-to CS resolution. The speedup for math-comp is significant: around 10% overall.

A primitive projection appears in three forms: a Proj node (folded or unfolded), the application of its compatibility constant, and a projection pending on a reduction stack. Canonical structure inference, coercion classes, the unification of tactics and the ssreflect matcher treated these forms differently, so that an instance, a coercion or a pattern given in one form was not found in another. This PR makes them agree, with the aim of letting Hierarchy Builder declare its structures, mixins and factories as primitive records.

With the overlays below, math-comp, odd-order, finmap, bigenough and mathcomp-analysis build with primitive HB records.

Commits

  1. Canonical structures: treat all forms of a primitive projection alike. Structures keys and folds values headed by the compatibility constant as Proj_cs; Coercionops gives them the class CL_PROJ; Evarconv refolds projections pending on the stack, tries canonical structure inference for a projection stuck on an evar before unfolding the other side, and compares two forms of the same projection through their records.
  2. Tactic unification: keep the records of canonical primitive projections. Expanding a folded projection only unfolds it, an unfolded one comes after any other key, and the term a side was before being reduced is remembered and unified first with a flexible other side. Failing problems are not explored again while the reduction of such a projection is pending. Inconsistent canonical solutions are rejected at once.
  3. ssrmatching: patterns and values headed by primitive projections.
  4. Bench: use the analysis overlay automatically.
  5. Changelog and overlays.

The new steps of commits 1 and 2 only apply to projections of structures which have canonical instances (Structures.CSTable.has_canonical_instances). Other primitive projections are unified as on master: HoTT, UniMath and category-theory rely on that.

Which primitive projections have canonical instances is asked at each step of unification, so it is precomputed: a summary table next to the table of instances, filled where instances are registered. It is a unit Environ.QProjection.Repr.Map.t rather than a Names.PRset.t because the environment-aware name modules only provide maps, and the table of instances is itself looked up through Environ.QGlobRef.Map. The two are equivalent as long as these modules are implemented over user names.

Overlays

Timings

Bench with the overlays (job 8411410, user time and instructions against master): mathcomp-analysis −15.7% (−22.2%), odd-order −12.2% (−15.5%), group-representation −11.0% (−14.9%), field −10.4% (−13.6%), finite-group −6.2%, solvable −5.6%, algebra −2.3%, order and boot unchanged; iris_examples +4.6% (+4.4%).

The gains come from the primitive HB records: without the overlays, the math-comp packages are within +1.2% in instructions (local run), and this PR builds math-comp master with non-primitive records.

Known limitations

  • iris_examples builds without overlays but is 4.6% slower, mostly in logrel/F_mu_ref_conc/{binary,unary}/logrel.v (about +12% each): failing Proper candidates are unified through two chains of projections (ofe_equiv, bi_equiv, ...), and the slowest sentence takes 45k unification steps against 28k on master.
  • Lines 707 and 721 of lebesgue_integral_fubini.v in mathcomp-analysis take 0.34 s against 0.15 s on master (local measurement).
  • No test for the steps which avoid exploring failing problems again: the reproductions need iris and mathcomp-analysis.
  • Built locally: the test-suite, elpi, hierarchy-builder, math-comp, finmap, bigenough, analysis, odd-order, autosubst, stdpp, iris and iris_examples. The rest of the CI was not run locally.
  • Added / updated test-suite.
  • Added changelog.
  • Opened overlay pull requests.

@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Nov 11, 2026
@mattam82

Copy link
Copy Markdown
Member Author

@coqbot bench

@mattam82

Copy link
Copy Markdown
Member Author

@coqbot run full ci

@coqbot-app coqbot-app Bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Nov 11, 2026
@coqbot-app

coqbot-app Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

🏁 Bench results:

┌─────────────────────────────────────┬──────────────────────────┬────────────────────────────────────────┬──────────────────────────┐
│                                     │      user time [s]       │            CPU instructions            │  max resident mem [KB]   │
│                                     │                          │                                        │                          │
│            package_name             │   NEW      OLD    PDIFF  │      NEW             OLD        PDIFF  │   NEW      OLD    PDIFF  │
├─────────────────────────────────────┼──────────────────────────┼────────────────────────────────────────┼──────────────────────────┤
│                 rocq-mathcomp-field │  154.08   173.57  -11.23 │  1021266400260   1191807415818  -14.31 │ 2344920  2655404  -11.69 │
│  rocq-mathcomp-group-representation │   73.12    81.71  -10.51 │   464582820016    542527399558  -14.37 │ 1531704  1511720    1.32 │
│              coq-mathcomp-odd-order │  401.23   446.18  -10.07 │  2745903120465   3154613212341  -12.96 │ 3531332  3711012   -4.84 │
│          rocq-mathcomp-finite-group │   21.45    23.20   -7.54 │   131542485175    147186888977  -10.63 │  641216   647092   -0.91 │
│              rocq-mathcomp-solvable │   71.84    76.93   -6.62 │   457546238087    500442140069   -8.57 │ 1014640  1031172   -1.60 │
│          rocq-metarocq-translations │   20.20    20.78   -2.79 │   148436911836    148376566065    0.04 │ 1211568  1211652   -0.01 │
│                           rocq-core │   10.90    11.19   -2.59 │    75426190584     75425827634    0.00 │  477652   477776   -0.03 │
│               rocq-mathcomp-algebra │  328.30   336.87   -2.54 │  2198093059820   2300724160804   -4.46 │ 1465000  1509356   -2.94 │
│              rocq-metarocq-template │   92.29    93.10   -0.87 │   651751202349    651547559637    0.03 │ 1669364  1668228    0.07 │
│           rocq-metarocq-safechecker │  298.48   300.29   -0.60 │  2237831968872   2235845567192    0.09 │ 2088720  2079968    0.42 │
│               coq-engine-bench-lite │  108.51   109.13   -0.57 │   855719066540    856225671084   -0.06 │ 1059408  1058280    0.11 │
│                         coq-coqutil │   42.37    42.58   -0.49 │   270913729781    270785427672    0.05 │  525252   526772   -0.29 │
│                rocq-metarocq-common │  124.20   124.73   -0.42 │   801744393838    800883467718    0.11 │ 2319176  2340972   -0.93 │
│                       coq-fourcolor │ 1316.03  1321.53   -0.42 │ 12250866883741  12300510093823   -0.40 │ 1084580  1087304   -0.25 │
│                       coq-fiat-core │   60.77    60.98   -0.34 │   401862412675    401691698733    0.04 │  544436   544352    0.02 │
│                        coq-coqprime │   58.26    58.42   -0.27 │   407126402570    406386484415    0.18 │  923184   923148    0.00 │
│                             coq-vst │  697.85   699.54   -0.24 │  5288238793997   5282781745484    0.10 │ 2233248  2228024    0.23 │
│                 rocq-metarocq-utils │   18.68    18.72   -0.21 │   126551073018    126473622416    0.06 │  628764   628220    0.09 │
│                        coq-compcert │  275.70   276.21   -0.18 │  1803013917290   1801931443169    0.06 │ 1386856  1400808   -1.00 │
│          coq-performance-tests-lite │  757.71   759.03   -0.17 │  6179270999035   6177317515242    0.03 │ 1761632  1893512   -6.96 │
│                            coq-core │    5.91     5.92   -0.17 │    42435578416     42432933485    0.01 │  112356   112556   -0.18 │
│                        coq-bedrock2 │  244.96   245.27   -0.13 │  1898488770751   1898070814792    0.02 │  958412   945728    1.34 │
│               rocq-metarocq-erasure │  752.00   752.73   -0.10 │  4896584355262   4891323329460    0.11 │ 2422976  2455564   -1.33 │
│                           coq-color │  216.63   216.80   -0.08 │  1404395646080   1403268653343    0.08 │ 1301028  1306248   -0.40 │
│                         rocq-stdlib │  234.21   234.30   -0.04 │  1515497532547   1513336931198    0.14 │  819276   814776    0.55 │
│        coq-fiat-crypto-with-bedrock │ 6826.00  6828.40   -0.04 │ 56163425282966  56138879070857    0.04 │ 5213164  5212628    0.01 │
│                        rocq-bignums │   22.97    22.97    0.00 │   146976036297    146852341245    0.08 │  513592   513576    0.00 │
│         coq-rewriter-perf-SuperFast │  381.46   381.39    0.02 │  2978035757231   2978627742057   -0.02 │ 2073204  2061980    0.54 │
│                      coq-coquelicot │   37.54    37.51    0.08 │   226738757517    226608415509    0.06 │  711108   710152    0.13 │
│                      rocq-equations │   14.10    14.08    0.14 │   101383183470    101291096511    0.09 │  424184   420968    0.76 │
│                 rocq-metarocq-pcuic │  639.28   638.21    0.17 │  4052337533087   4045198433076    0.18 │ 2903420  2928428   -0.85 │
│                        rocq-runtime │  268.83   268.19    0.24 │  1961064090739   1959630139732    0.07 │  590864   589688    0.20 │
│                            coq-corn │  561.39   559.78    0.29 │  3817618550248   3799025567464    0.49 │  725488   725080    0.06 │
│ coq-neural-net-interp-computed-lite │  252.12   251.36    0.30 │  2408982615713   2408822956797    0.01 │  954040   952056    0.21 │
│                        coq-rewriter │  297.63   296.72    0.31 │  2215243171202   2213882932538    0.06 │ 1519520  1519964   -0.03 │
│                    coq-math-classes │   74.46    74.23    0.31 │   451747404059    451251799267    0.11 │  554612   555120   -0.09 │
│                    coq-fiat-parsers │  266.86   265.88    0.37 │  2081753346930   2081026016216    0.03 │ 2298156  2301244   -0.13 │
│                           rocq-elpi │   25.17    25.07    0.40 │   180137676847    180071765763    0.04 │  493976   496160   -0.44 │
│                 rocq-mathcomp-order │   97.74    97.01    0.75 │   644323393769    649560228757   -0.81 │  985532   971816    1.41 │
│                  rocq-mathcomp-boot │   38.14    37.70    1.17 │   214671690709    215892262923   -0.57 │  690704   686848    0.56 │
│             rocq-mathcomp-ssreflect │    1.26     1.24    1.61 │     8157613176      8180774714   -0.28 │  662420   665060   -0.40 │
└─────────────────────────────────────┴──────────────────────────┴────────────────────────────────────────┴──────────────────────────┘

INFO: failed to install
coq-hott (in NEW)
rocq-mathcomp-analysis (in NEW)
coq-unimath (in NEW)
coq-iris-examples (dependency install failed in NEW)
coq-category-theory (in NEW)

🐢 Top 25 slow downs
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                              TOP 25 SLOW DOWNS                                                               │
│                                                                                                                                              │
│  OLD   NEW    DIFF    %DIFF     Ln                      FILE                                                                                 │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  41.2  44.6  3.3609     8.15%   370  coq-fiat-crypto-with-bedrock/src/Stringification/Zig.v.html                                             │
│ 0.232  2.84  2.6087  1123.06%   619  coq-mathcomp-odd-order/theories/PFsection3.v.html                                                       │
│  8.72  10.5  1.7930    20.56%  1332  coq-mathcomp-odd-order/theories/PFsection9.v.html                                                       │
│  30.0  31.3  1.2590     4.20%   809  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html                                    │
│  2.23  3.38  1.1514    51.59%   987  coq-mathcomp-odd-order/theories/PFsection9.v.html                                                       │
│  2.28  3.40  1.1146    48.79%  1199  coq-mathcomp-odd-order/theories/PFsection9.v.html                                                       │
│ 0.201  1.27  1.0646   530.54%  1156  rocq-mathcomp-group-representation/group_representation/inertia.v.html                                  │
│  29.0  29.9  0.9300     3.21%   803  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html                                    │
│  27.3  28.2  0.9082     3.33%   797  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html                                    │
│ 0.270  1.10  0.8312   308.09%  2105  coq-mathcomp-odd-order/theories/PFsection13.v.html                                                      │
│  77.8  78.5  0.7713     0.99%    48  coq-fiat-crypto-with-bedrock/src/Curves/Weierstrass/AffineProofs.v.html                                 │
│  20.1  20.9  0.7660     3.81%   777  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html                                    │
│  25.6  26.3  0.7593     2.97%   791  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html                                    │
│  78.5  79.3  0.7544     0.96%    22  coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html                                  │
│  1.11  1.69  0.5854    52.79%  1390  coq-mathcomp-odd-order/theories/PFsection9.v.html                                                       │
│   220   220  0.5693     0.26%     8  coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html           │
│   289   290  0.5405     0.19%     3  coq-rewriter-perf-SuperFast/src/Rewriter/Rewriter/Examples/PerfTesting/LiftLetsMap/_10_SuperFast.v.html │
│  19.6  20.1  0.5367     2.74%   669  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html                                    │
│  15.8  16.2  0.4489     2.84%   272  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Jacobian.v.html                                           │
│  10.5  10.9  0.4376     4.17%   757  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html                                    │
│  25.4  25.8  0.4284     1.69%    49  coq-fiat-crypto-with-bedrock/src/Curves/Weierstrass/AffineProofs.v.html                                 │
│  22.8  23.2  0.3956     1.73%    68  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/deps/riscv-coq/src/riscv/Proofs/VerifyDecode.v.html      │
│  8.38  8.78  0.3955     4.72%     3  coq-performance-tests-lite/PerformanceExperiments/Reify/LtacVariants/_4_SuperFast.v.html                │
│ 0.741  1.13  0.3899    52.60%    88  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Platform.v.html                                           │
│  10.2  10.5  0.3536     3.48%  2325  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/compiler/src/compiler/FlatToRiscvFunctions.v.html        │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
🐇 Top 25 speed ups
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                      TOP 25 SPEED UPS                                                      │
│                                                                                                                            │
│  OLD    NEW     DIFF     %DIFF   Ln                   FILE                                                                 │
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  7.48  0.0434  -7.4381  -99.42%  127  coq-mathcomp-odd-order/theories/BGappendixAB.v.html                                  │
│  8.46    5.46  -3.0043  -35.51%  708  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                             │
│  2.35  0.0725  -2.2781  -96.92%  405  coq-mathcomp-odd-order/theories/BGappendixC.v.html                                   │
│  1.67   0.197  -1.4746  -88.24%  423  rocq-mathcomp-group-representation/group_representation/mxabelem.v.html              │
│  6.71    5.25  -1.4642  -21.81%  606  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                             │
│  18.1    16.7  -1.3694   -7.57%  572  coq-mathcomp-odd-order/theories/PFsection9.v.html                                    │
│  67.2    65.9  -1.2743   -1.90%  999  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html      │
│  1.29  0.0179  -1.2694  -98.61%  919  coq-mathcomp-odd-order/theories/PFsection12.v.html                                   │
│  67.1    65.9  -1.2672   -1.89%  968  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html      │
│  19.4    18.2  -1.1962   -6.16%  560  coq-mathcomp-odd-order/theories/PFsection9.v.html                                    │
│  2.62    1.43  -1.1893  -45.45%   67  rocq-mathcomp-group-representation/group_representation/integral_char.v.html         │
│  1.24   0.116  -1.1286  -90.71%  397  coq-mathcomp-odd-order/theories/BGappendixC.v.html                                   │
│  1.19  0.0732  -1.1195  -93.86%  396  coq-mathcomp-odd-order/theories/BGappendixC.v.html                                   │
│  1.14  0.0391  -1.0976  -96.56%  151  coq-mathcomp-odd-order/theories/BGappendixAB.v.html                                  │
│  4.97    3.89  -1.0770  -21.68%  677  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                             │
│  1.06   0.168  -0.8960  -84.24%  152  coq-mathcomp-odd-order/theories/BGappendixAB.v.html                                  │
│  30.1    29.2  -0.8853   -2.94%  150  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html │
│  14.5    13.6  -0.8778   -6.06%  383  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Jacobian.v.html                        │
│  1.95    1.10  -0.8506  -43.64%  767  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                             │
│  30.3    29.5  -0.8390   -2.77%  159  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html │
│  30.0    29.1  -0.8096   -2.70%  200  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html │
│  30.1    29.4  -0.7926   -2.63%  168  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html │
│  30.0    29.2  -0.7800   -2.60%  182  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html │
│  30.1    29.4  -0.7616   -2.53%  141  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html │
│ 0.850   0.107  -0.7431  -87.45%  315  rocq-mathcomp-field/field/finfield.v.html                                            │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Nov 12, 2026

@mattam82 mattam82 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last commit repairs incompatibilities found in the CI.

@mattam82 mattam82 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coqbot run full ci

@coqbot-app coqbot-app Bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Nov 12, 2026

@mattam82 mattam82 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coqbot bench

@coqbot-app

coqbot-app Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

🏁 Bench results:

┌─────────────────────────────────────┬──────────────────────────┬────────────────────────────────────────┬──────────────────────────┐
│                                     │      user time [s]       │            CPU instructions            │  max resident mem [KB]   │
│                                     │                          │                                        │                          │
│            package_name             │   NEW      OLD    PDIFF  │      NEW             OLD        PDIFF  │   NEW      OLD    PDIFF  │
├─────────────────────────────────────┼──────────────────────────┼────────────────────────────────────────┼──────────────────────────┤
│                 rocq-mathcomp-field │  156.20   176.53  -11.52 │  1009640524402   1178754969159  -14.35 │ 2333460  2652808  -12.04 │
│  rocq-mathcomp-group-representation │   73.92    82.97  -10.91 │   459157369933    536432258226  -14.41 │ 1524904  1507088    1.18 │
│              coq-mathcomp-odd-order │  404.29   452.08  -10.57 │  2714385329334   3120569930494  -13.02 │ 3525076  3705724   -4.87 │
│          rocq-mathcomp-finite-group │   21.92    23.75   -7.71 │   130041535778    145556965926  -10.66 │  634984   640740   -0.90 │
│              rocq-mathcomp-solvable │   73.34    78.30   -6.33 │   452460476716    495068727731   -8.61 │ 1010860  1023476   -1.23 │
│               rocq-mathcomp-algebra │  332.37   342.70   -3.01 │  2170780479859   2273090393140   -4.50 │ 1458332  1499744   -2.76 │
│ coq-neural-net-interp-computed-lite │  246.73   251.06   -1.72 │  2403987003470   2403911390409    0.00 │  947324   947896   -0.06 │
│                       coq-fiat-core │   63.51    64.14   -0.98 │   404852745868    404678510893    0.04 │  538392   539792   -0.26 │
│                       coq-fourcolor │ 1338.38  1351.13   -0.94 │ 12658748646914  12708492772278   -0.39 │ 1082292  1084344   -0.19 │
│          rocq-metarocq-translations │   20.71    20.90   -0.91 │   145902193875    145837183869    0.04 │ 1207780  1207548    0.02 │
│                rocq-metarocq-common │  126.00   127.07   -0.84 │   792914418519    791996151232    0.12 │ 2315908  2337040   -0.90 │
│             rocq-mathcomp-ssreflect │    1.31     1.32   -0.76 │     8302751324      8328773244   -0.31 │  657872   658792   -0.14 │
│                    coq-math-classes │   77.98    78.51   -0.68 │   448873672564    448327674015    0.12 │  548072   548500   -0.08 │
│                             coq-vst │  713.52   718.16   -0.65 │  5241607982353   5236630936549    0.10 │ 2226500  2222692    0.17 │
│                 rocq-metarocq-utils │   19.36    19.48   -0.62 │   124888932257    124696102883    0.15 │  623912   623212    0.11 │
│                         coq-unimath │ 1686.41  1696.57   -0.60 │ 14050104206865  14009742392174    0.29 │ 2077032  2012920    3.19 │
│                           coq-color │  223.68   224.96   -0.57 │  1388888187365   1387587421203    0.09 │ 1294480  1300412   -0.46 │
│               coq-engine-bench-lite │  110.03   110.62   -0.53 │   864865760363    863704877438    0.13 │ 1050052  1050000    0.00 │
│                    coq-fiat-parsers │  272.24   273.65   -0.52 │  2081190048828   2080629586548    0.03 │ 2293164  2292936    0.01 │
│          coq-performance-tests-lite │  774.69   778.56   -0.50 │  6185441541586   6183718374719    0.03 │ 1842120  1806700    1.96 │
│                         coq-coqutil │   44.28    44.49   -0.47 │   270082345504    269971173297    0.04 │  522272   521920    0.07 │
│         coq-rewriter-perf-SuperFast │  385.23   387.01   -0.46 │  2962915948982   2963765495857   -0.03 │ 2073572  2084336   -0.52 │
│              rocq-metarocq-template │   92.96    93.37   -0.44 │   640253773943    640034613323    0.03 │ 1660744  1660580    0.01 │
│                         rocq-stdlib │  243.39   244.12   -0.30 │  1496338225093   1494103897643    0.15 │  813340   807576    0.71 │
│                  rocq-mathcomp-boot │   38.59    38.70   -0.28 │   212077430131    213358077572   -0.60 │  687564   683816    0.55 │
│               rocq-metarocq-erasure │  760.59   762.67   -0.27 │  4846439276432   4840279150634    0.13 │ 2418252  2452828   -1.41 │
│                        coq-compcert │  281.62   282.32   -0.25 │  1789509284437   1788300766238    0.07 │ 1426060  1394484    2.26 │
│                      coq-coquelicot │   38.82    38.90   -0.21 │   224995169579    224879830895    0.05 │  704720   703860    0.12 │
│        coq-fiat-crypto-with-bedrock │ 6945.92  6959.09   -0.19 │ 56277996733521  56255300576873    0.04 │ 5209688  5209080    0.01 │
│                            coq-corn │  561.46   562.15   -0.12 │  3711333377568   3693040941523    0.50 │  718400   716756    0.23 │
│                        coq-rewriter │  304.17   304.45   -0.09 │  2228296119644   2226994502112    0.06 │ 1513844  1513696    0.01 │
│                        coq-bedrock2 │  251.98   252.07   -0.04 │  1888126674202   1887930117272    0.01 │  950944   937460    1.44 │
│                      rocq-equations │   14.28    14.28    0.00 │   100943249742    100844163371    0.10 │  417976   417716    0.06 │
│                        coq-coqprime │   59.51    59.50    0.02 │   402644832534    401881044384    0.19 │  917136   917124    0.00 │
│                 rocq-metarocq-pcuic │  648.48   648.09    0.06 │  4005743332515   3998447873251    0.18 │ 2896512  2924480   -0.96 │
│                 rocq-mathcomp-order │   98.75    98.67    0.08 │   636619810756    642044553592   -0.84 │  978864   968304    1.09 │
│                        rocq-runtime │  267.45   267.12    0.12 │  1962937382443   1961589662074    0.07 │  588184   587120    0.18 │
│           rocq-metarocq-safechecker │  302.79   302.27    0.17 │  2214788809384   2212754835965    0.09 │ 2081188  2076996    0.20 │
│                 coq-category-theory │ 1569.04  1563.23    0.37 │ 11205795023284  11198834656510    0.06 │ 7174344  7236704   -0.86 │
│                        rocq-bignums │   23.70    23.59    0.47 │   145348904319    145209590254    0.10 │  510848   510532    0.06 │
│                            coq-core │    5.91     5.88    0.51 │    42699636385     42702017555   -0.01 │  110148   109964    0.17 │
│                            coq-hott │  167.14   166.17    0.58 │  1060711520268   1048883413730    1.13 │  508804   508708    0.02 │
│                           rocq-elpi │   26.33    26.07    1.00 │   178173153661    178326942111   -0.09 │  489172   489012    0.03 │
│                           rocq-core │   11.48    11.32    1.41 │    74109020738     74098414723    0.01 │  474716   474560    0.03 │
│                   coq-iris-examples │  558.58   316.32   76.59 │  3870404175695   1957287685540   97.74 │ 1164624  1157188    0.64 │
└─────────────────────────────────────┴──────────────────────────┴────────────────────────────────────────┴──────────────────────────┘

INFO: failed to install
rocq-mathcomp-analysis (in NEW)

🐢 Top 25 slow downs
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                              TOP 25 SLOW DOWNS                                               │
│                                                                                                              │
│  OLD    NEW    DIFF      %DIFF     Ln               FILE                                                     │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  0.373  61.3  60.9206  16338.56%    72  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│  0.173  30.7  30.5460  17683.13%    82  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│  0.124  4.53   4.4086   3555.04%   125  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
│  0.126  4.47   4.3441   3439.53%   161  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│  0.102  4.32   4.2168   4128.42%   124  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
│  0.103  4.22   4.1181   3982.47%   160  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│  0.159  3.54   3.3813   2125.38%   163  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│  0.101  3.05   2.9533   2924.18%   144  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
│ 0.0896  2.99   2.8957   3232.78%   181  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│ 0.0701  2.88   2.8089   4009.78%   143  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
│ 0.0653  2.80   2.7397   4198.16%   180  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│ 0.0733  2.68   2.6106   3561.55%   126  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
│  0.240  2.85   2.6098   1087.06%   619  coq-mathcomp-odd-order/theories/PFsection3.v.html                    │
│   41.8  44.0   2.2142      5.30%   370  coq-fiat-crypto-with-bedrock/src/Stringification/Zig.v.html          │
│  0.123  2.30   2.1750   1773.18%   183  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│   8.36  10.3   1.9657     23.52%  1332  coq-mathcomp-odd-order/theories/PFsection9.v.html                    │
│   30.1  31.7   1.5834      5.25%   809  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html │
│ 0.0411  1.56   1.5193   3696.53%   145  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
│ 0.0482  1.42   1.3731   2847.16%   165  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│ 0.0467  1.42   1.3701   2934.02%   129  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
│ 0.0414  1.22   1.1801   2851.38%   134  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
│ 0.0389  1.21   1.1745   3018.80%   171  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│ 0.0880  1.18   1.0878   1235.55%   172  coq-iris-examples/theories/logrel/F_mu_ref_conc/binary/logrel.v.html │
│   29.0  30.1   1.0740      3.70%   803  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JoyeLadder.v.html │
│ 0.0468  1.10   1.0522   2250.30%   148  coq-iris-examples/theories/logrel/F_mu_ref_conc/unary/logrel.v.html  │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
🐇 Top 25 speed ups
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                               TOP 25 SPEED UPS                                                               │
│                                                                                                                                              │
│ OLD    NEW     DIFF     %DIFF   Ln                      FILE                                                                                 │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 7.59  0.0437  -7.5487  -99.42%  127  coq-mathcomp-odd-order/theories/BGappendixAB.v.html                                                     │
│  218     214  -4.2765   -1.96%    8  coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html           │
│ 8.73    5.58  -3.1504  -36.09%  708  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                                                │
│ 2.36  0.0718  -2.2856  -96.96%  405  coq-mathcomp-odd-order/theories/BGappendixC.v.html                                                      │
│ 18.3    16.7  -1.6009   -8.73%  572  coq-mathcomp-odd-order/theories/PFsection9.v.html                                                       │
│ 6.94    5.35  -1.5804  -22.79%  606  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                                                │
│ 19.6    18.1  -1.5557   -7.92%  560  coq-mathcomp-odd-order/theories/PFsection9.v.html                                                       │
│ 1.68   0.193  -1.4885  -88.53%  423  rocq-mathcomp-group-representation/group_representation/mxabelem.v.html                                 │
│ 45.5    44.2  -1.3836   -3.04%    2  coq-fiat-crypto-with-bedrock/src/ExtractionJsOfOCaml/fiat_crypto.v.html                                 │
│ 68.5    67.2  -1.3582   -1.98%  999  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html                         │
│ 48.0    46.7  -1.3319   -2.77%    3  coq-fiat-crypto-with-bedrock/src/ExtractionJsOfOCaml/WithBedrock/fiat_crypto.v.html                     │
│ 68.6    67.3  -1.2948   -1.89%  968  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html                         │
│ 2.70    1.42  -1.2802  -47.44%   67  rocq-mathcomp-group-representation/group_representation/integral_char.v.html                            │
│ 1.29  0.0197  -1.2657  -98.47%  919  coq-mathcomp-odd-order/theories/PFsection12.v.html                                                      │
│ 22.5    21.3  -1.2479   -5.53%  229  coq-unimath/UniMath/CategoryTheory/Presheaves/Sheafification.v.html                                     │
│  293     292  -1.2422   -0.42%    3  coq-rewriter-perf-SuperFast/src/Rewriter/Rewriter/Examples/PerfTesting/LiftLetsMap/_10_SuperFast.v.html │
│ 47.7    46.5  -1.1783   -2.47%    3  coq-performance-tests-lite/PerformanceExperiments/typeclass_reification_let_in_HOAS/_0_SuperFast.v.html │
│ 1.24   0.113  -1.1295  -90.92%  397  coq-mathcomp-odd-order/theories/BGappendixC.v.html                                                      │
│ 1.19  0.0720  -1.1142  -93.93%  396  coq-mathcomp-odd-order/theories/BGappendixC.v.html                                                      │
│ 1.15  0.0394  -1.1080  -96.57%  151  coq-mathcomp-odd-order/theories/BGappendixAB.v.html                                                     │
│ 5.11    4.03  -1.0805  -21.15%  677  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                                                │
│ 47.9    46.8  -1.0056   -2.10%    3  coq-fiat-crypto-with-bedrock/src/ExtractionOCaml/bedrock2_fiat_crypto.v.html                            │
│ 45.5    44.5  -0.9710   -2.13%  376  coq-unimath/UniMath/ModelCategories/Generated/LNWFSMonoidalStructure.v.html                             │
│ 40.9    39.9  -0.9704   -2.37%  467  coq-fiat-crypto-with-bedrock/src/Bedrock/End2End/X25519/GarageDoor.v.html                               │
│ 30.7    29.7  -0.9520   -3.10%  159  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html                    │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@github-actions github-actions Bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Nov 17, 2026
@coqbot-app coqbot-app Bot added needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. and removed needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. labels Nov 18, 2026
@mattam82

Copy link
Copy Markdown
Member Author

@coqbot run full ci

@coqbot-app coqbot-app Bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Nov 18, 2026
@mattam82

Copy link
Copy Markdown
Member Author

@coqbot bench

@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Nov 18, 2026

@mattam82 mattam82 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coqbot run full ci

@coqbot-app coqbot-app Bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Nov 18, 2026

@mattam82 mattam82 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coqbot bench

@mattam82
mattam82 marked this pull request as ready for review November 19, 2026 06:20
@mattam82
mattam82 requested review from a team as code owners November 19, 2026 06:20
@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Nov 19, 2026
@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Dec 1, 2026
mattam82 added a commit to mattam82/hierarchy-builder that referenced this pull request Dec 1, 2026
With rocq-prover/rocq#22789, canonical structure inference and
unification treat all forms of a primitive projection alike, so that
the records declared with #[primitive] can be used as the other ones:
- the terms HB declares use folded primitive projections, as the ones
  elaborated by Rocq (fold-projections, applied in log.coq.env.add-const*);
- clean-op-ty also rewrites operations used as primitive projections;
- parametrized mixin-src clauses typecheck the mixin argument;
- mixin-for, the non-forgetful inheritance check and HB.pack recognize a
  sort projection in its primitive form.

Records are still non-primitive unless #[primitive] is given.

Assisted by GenAI tools
mattam82 added a commit to mattam82/hierarchy-builder that referenced this pull request Dec 1, 2026
Records are now primitive unless #[primitive=no] is given.

tests/hnf: the parameter of the primitive projection f.y is printed
as "_".

Requires rocq-prover/rocq#22789.

Assisted by GenAI tools
@mattam82

mattam82 commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@coqbot bench

@mattam82

mattam82 commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@coqbot run full ci

@coqbot-app coqbot-app Bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Dec 2, 2026
A primitive projection appears as a [Proj] node (folded or unfolded), as
the application of its compatibility constant, or pending on a reduction
stack. Canonical structure inference and coercion classes distinguished
them, so that an instance or a coercion declared with one form was not
found with another.

- Structures: the key of a value headed by the applied compatibility
  constant of a primitive projection is [Proj_cs], and the stored value
  is folded. A value which is the projection as a function is
  eta-contracted to its compatibility constant.
- Coercionops: the class of the applied compatibility constant of a
  primitive projection is [CL_PROJ].
- Evarconv: [decompose_proj] refolds a projection pending on the stack;
  [check_conv_record] folds the value it looks up, and falls back to the
  key of the compatibility constant for partial applications; the keys
  cache records [Proj] heads. Two different forms of the same projection
  are compared as such, after unifying the types of their records, which
  stand for the parameters the primitive form does not carry.
- Evarconv: canonical structure inference is tried for a projection
  stuck on an evar before the other side is unfolded.

The steps which relate two forms of a projection through their records
are only taken when canonical structure inference may have to solve a
problem on the record: the projection has canonical instances, or its
record is itself headed by such a projection
([Structures.CSTable.has_canonical_instances]; the projections which
have instances are kept in the summary, next to the table of instances).
Developments using primitive records without canonical structures (HoTT,
UniMath, category-theory) rely on the other projections being reduced at
once.

When both sides have the same projection pending on their stacks and
the stacks fail to unify, the failure is remembered: stacks ending with
them are not unified again while the records are unfolded, as a
projection constant is unified first-order once before being unfolded.

Assisted by GenAI tools
Typeclass resolution, apply and rewrite use the unification of tactics,
which finds the instance of a meta by unfolding both sides of a problem
step by step. Unfolding a projection constant leaves a [match] without
a key, so the other side is unfolded next; a primitive projection always
had a key and its expansion reduced it completely, so one side was
unfolded to the end, metas got unfolded instances and canonical
structure inference no longer saw the record.

For a primitive projection which has canonical instances (see
[Structures.CSTable.has_canonical_instances]), and only for those:

- Expanding a folded projection only unfolds it. The unfolded projection
  is still a key, expanded by reducing it, but it comes after any other
  key, as the [match] of a projection constant does.
- As in Evarconv, the term a side was before being reduced or unfolded
  is remembered when it is headed by such a projection. When the other
  side becomes flexible (a meta or an evar, possibly applied), it is
  unified with that term first, and with its reduct only if this fails.
- Failing problems are not explored again: unfolding the projection
  changes neither the first-order problem, nor canonical structure
  inference, nor the reduction of the other side, so only the reduction
  of the unfolded projection is tried. While that reduction is pending,
  an unfolding of the other side only matters when it exposes the same
  projection (tried first-order and with canonical structures), a
  projection canonical structure inference applies to, or a meta or an
  evar ([unify_pending_projection]). Otherwise two chains of definitions
  going through such projections, e.g. the ones of ofe and bi in Iris,
  were explored in every interleaving.

Besides:
- The instances the arguments of a canonical instance get while the
  canonical solution is unified are compared at once, instead of when
  the whole unification is over, so that the other steps are tried when
  they are inconsistent.
- [whd_betaiota_deltazeta_for_iota_state] knows the values of metas: the
  kernel machine is resumed on the value of a meta when it is stuck on
  one.

Assisted by GenAI tools
- Count the arguments of canonical projection patterns and of instance
  values in both forms of a primitive projection.
- Folded and unfolded projections are the same head; a structure
  projection head asks for canonical structure inference or reduction as
  a projection constant does.
- Unify the terms before their types when a projection is involved: the
  type of a primitive projection does not determine its parameters.

Assisted by GenAI tools
The bench builds rocq-mathcomp-analysis, with rocq-mathcomp-classical
and rocq-mathcomp-reals as dependencies from the same repository: map
the analysis CI project to them so that a PR overlay is used.

Assisted by GenAI tools
Overlay, for Hierarchy Builder structures declared as primitive records:
- hierarchy-builder: math-comp/hierarchy-builder#610

The changes elpi, math-comp and mathcomp-analysis need were merged
(LPCIC/coq-elpi#1143, math-comp/math-comp#1691, math-comp/analysis#2181).

Assisted by GenAI tools
@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Dec 2, 2026
@SkySkimmer

Copy link
Copy Markdown
Contributor

@coqbot run full ci

@coqbot-app coqbot-app Bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Dec 2, 2026
@SkySkimmer

Copy link
Copy Markdown
Contributor

@coqbot bench

@coqbot-app

coqbot-app Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

🏁 Bench results:

┌─────────────────────────────────────┬──────────────────────────┬────────────────────────────────────────┬──────────────────────────┐
│                                     │      user time [s]       │            CPU instructions            │  max resident mem [KB]   │
│                                     │                          │                                        │                          │
│            package_name             │   NEW      OLD    PDIFF  │      NEW             OLD        PDIFF  │   NEW      OLD    PDIFF  │
├─────────────────────────────────────┼──────────────────────────┼────────────────────────────────────────┼──────────────────────────┤
│              rocq-mathcomp-analysis │  951.90  1125.93  -15.46 │  6189179431470   7880005655504  -21.46 │ 2359760  2425816   -2.72 │
│              coq-mathcomp-odd-order │  342.49   388.53  -11.85 │  2334534039982   2749075992224  -15.08 │ 3539176  3714752   -4.73 │
│                 rocq-mathcomp-field │  139.84   157.20  -11.04 │   933813225168   1078230137768  -13.39 │ 2264908  2654084  -14.66 │
│  rocq-mathcomp-group-representation │   64.68    72.48  -10.76 │   408190509853    477415871970  -14.50 │ 1544528  1555236   -0.69 │
│          rocq-mathcomp-finite-group │   19.46    20.59   -5.49 │   117024341473    127091582760   -7.92 │  639684   644380   -0.73 │
│              rocq-mathcomp-solvable │   62.84    66.31   -5.23 │   395427375570    425485056976   -7.06 │ 1010784  1014432   -0.36 │
│                rocq-mathcomp-finmap │    9.18     9.60   -4.38 │    54358393397     59080157808   -7.99 │  581972   587244   -0.90 │
│               rocq-mathcomp-algebra │  300.11   309.29   -2.97 │  2025258342346   2103967482391   -3.74 │ 1429376  1432036   -0.19 │
│                 rocq-mathcomp-reals │   41.25    42.26   -2.39 │   258279401057    268880436003   -3.94 │ 2072608  2072236    0.02 │
│                         coq-ext-lib │   11.76    12.03   -2.24 │    81156986483     81142710806    0.02 │  432312   435716   -0.78 │
│                            coq-core │    5.82     5.93   -1.85 │    42460493395     42455821947    0.01 │  112456   112620   -0.15 │
│                 rocq-metarocq-utils │   18.52    18.69   -0.91 │   125192933801    125188066715    0.00 │  629460   627472    0.32 │
│                       coq-fiat-core │   61.24    61.64   -0.65 │   401765580011    401556496369    0.05 │  540972   541788   -0.15 │
│                          rocq-stdpp │   62.98    63.34   -0.57 │   374180804338    373694389666    0.13 │  779296   781196   -0.24 │
│                      rocq-equations │   14.06    14.14   -0.57 │   101939971133    101898852038    0.04 │  424916   423076    0.43 │
│                       coq-fourcolor │ 1342.04  1348.59   -0.49 │ 13033132756046  13078069332616   -0.34 │ 1086884  1091280   -0.40 │
│             rocq-mathcomp-classical │   88.30    88.61   -0.35 │   559923171545    565583727941   -1.00 │ 1793968  1786120    0.44 │
│        rocq-metarocq-template-pcuic │   38.01    38.12   -0.29 │   241659697018    241445949894    0.09 │ 1289772  1300508   -0.83 │
│                        rocq-runtime │  273.99   274.50   -0.19 │  2005548430445   2003264850262    0.11 │  597056   596104    0.16 │
│                            coq-hott │  154.29   154.56   -0.17 │  1036189024669   1035229463659    0.09 │  494620   493136    0.30 │
│               coq-engine-bench-lite │  112.42   112.56   -0.12 │   870111608111    869867467226    0.03 │ 1052312  1054076   -0.17 │
│                         coq-unimath │ 1565.14  1567.03   -0.12 │ 13461726455159  13498376434044   -0.27 │ 1925544  1926508   -0.05 │
│           rocq-metarocq-safechecker │  271.34   271.55   -0.08 │  2024459932425   2022052112919    0.12 │ 2042260  2038140    0.20 │
│                         coq-coqutil │   42.80    42.83   -0.07 │   271521232673    271455033592    0.02 │  527296   528988   -0.32 │
│                 coq-fourcolor-reals │    6.71     6.71    0.00 │    39208810080     39362224652   -0.39 │ 1078156  1083728   -0.51 │
│         coq-rewriter-perf-SuperFast │  370.56   370.44    0.03 │  2895104069684   2896436306824   -0.05 │ 2066956  2073628   -0.32 │
│ coq-neural-net-interp-computed-lite │  253.67   253.56    0.04 │  2523080148001   2522992873075    0.00 │  950020   953164   -0.33 │
│                         rocq-stdlib │  232.83   232.49    0.15 │  1485293130094   1484248075656    0.07 │  812452   816620   -0.51 │
│                        coq-bedrock2 │  240.05   239.54    0.21 │  1839647892837   1838592770991    0.06 │  942952   944992   -0.22 │
│        coq-fiat-crypto-with-bedrock │ 6493.64  6479.54    0.22 │ 53827501627149  53795539749725    0.06 │ 5213420  5213132    0.01 │
│                           coq-color │  216.39   215.89    0.23 │  1383706798072   1382433453918    0.09 │ 1277864  1286776   -0.69 │
│                    coq-fiat-parsers │  266.58   265.88    0.26 │  2101180479378   2098391987088    0.13 │ 2297052  2296556    0.02 │
│                 coq-category-theory │ 1212.56  1209.23    0.28 │  8730653599225   8724557705222    0.07 │ 1241628  1230848    0.88 │
│                 rocq-mathcomp-order │   92.16    91.85    0.34 │   607683065763    611212271851   -0.58 │  991964   979072    1.32 │
│                    coq-math-classes │   73.60    73.35    0.34 │   445089963331    444244392651    0.19 │  553396   550280    0.57 │
│          coq-performance-tests-lite │  736.28   733.74    0.35 │  5998402559380   5993982594318    0.07 │ 1803304  1826936   -1.29 │
│                           coq-flocq │   77.72    77.44    0.36 │   451785599422    450913686309    0.19 │  943452   947660   -0.44 │
│               rocq-metarocq-erasure │  718.52   715.76    0.39 │  4609712320629   4598200178370    0.25 │ 2412328  2422892   -0.44 │
│          rocq-metarocq-translations │   20.32    20.24    0.40 │   142436761911    142420938508    0.01 │ 1250040  1250256   -0.02 │
│                        coq-rewriter │  284.82   283.49    0.47 │  2147631141961   2146874398826    0.04 │ 1531376  1538364   -0.45 │
│                             coq-vst │  698.31   694.89    0.49 │  5232146215265   5225562066038    0.13 │ 2293832  2233352    2.71 │
│                        coq-coqprime │   57.59    57.29    0.52 │   392871318922    392307478675    0.14 │  922824   922256    0.06 │
│                        coq-compcert │  277.73   276.21    0.55 │  1802275554397   1799079453424    0.18 │ 1439152  1382520    4.10 │
│                  rocq-mathcomp-boot │   38.09    37.88    0.55 │   214948680228    215306116334   -0.17 │  696768   696648    0.02 │
│                rocq-metarocq-common │  123.03   122.26    0.63 │   784754595615    783211330959    0.20 │ 2282072  2286760   -0.21 │
│              rocq-metarocq-template │   92.17    91.55    0.68 │   636296123504    636061549160    0.04 │ 1706376  1705532    0.05 │
│                            coq-corn │  540.57   535.99    0.85 │  3630890857447   3616273462703    0.40 │  756416   753404    0.40 │
│                 rocq-metarocq-pcuic │  590.12   585.11    0.86 │  3693227089103   3682388198337    0.29 │ 2926488  2899620    0.93 │
│                        rocq-bignums │   21.41    21.22    0.90 │   138142731683    137938370989    0.15 │  517248   515260    0.39 │
│                           rocq-core │   11.18    11.07    0.99 │    75395352863     75383542142    0.02 │  454712   454584    0.03 │
│                      coq-coquelicot │   37.49    37.09    1.08 │   223045070524    222869498691    0.08 │  701812   701736    0.01 │
│                           rocq-elpi │   25.99    25.68    1.21 │   186417264236    186402624799    0.01 │  504832   498864    1.20 │
│                 rocq-iris-heap-lang │   73.60    71.72    2.62 │   455802730222    442856461062    2.92 │  839092   843656   -0.54 │
│                           rocq-iris │  283.70   274.74    3.26 │  1701708566499   1645142081383    3.44 │  797472   778216    2.47 │
│             rocq-mathcomp-ssreflect │    1.18     1.14    3.51 │     7385447798      7401764911   -0.22 │  670212   672256   -0.30 │
│                  rocq-iris-examples │  333.95   320.29    4.26 │  2109553305350   2023491164232    4.25 │ 1157040  1164512   -0.64 │
└─────────────────────────────────────┴──────────────────────────┴────────────────────────────────────────┴──────────────────────────┘

🐢 Top 25 slow downs
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                            TOP 25 SLOW DOWNS                                                             │
│                                                                                                                                          │
│  OLD     NEW    DIFF    %DIFF    Ln                     FILE                                                                             │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│   24.4   26.0  1.6261    6.66%   359  rocq-iris/iris/algebra/view.v.html                                                                 │
│   49.8   50.9  1.1270    2.26%   968  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html                    │
│   50.2   51.0  0.8400    1.67%   999  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html                    │
│   65.7   66.4  0.6547    1.00%   302  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/Addchain.v.html                                 │
│   31.1   31.7  0.6382    2.05%   197  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Jacobian.v.html                                      │
│   37.4   38.0  0.6052    1.62%   116  coq-bedrock2/bedrock2/src/bedrock2Examples/full_mul.v.html                                         │
│   35.2   35.7  0.4752    1.35%    27  coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ToFancyWithCasts.v.html                           │
│  0.471  0.925  0.4536   96.28%  1732  rocq-mathcomp-analysis/theories/realfun.v.html                                                     │
│  0.478  0.926  0.4471   93.44%  1727  rocq-mathcomp-analysis/theories/realfun.v.html                                                     │
│   6.70   7.15  0.4451    6.64%   820  coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/PartialEqRels/NNORecursiveMap.v.html             │
│   30.0   30.4  0.4262    1.42%    96  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/deps/riscv-coq/src/riscv/Proofs/VerifyDecode.v.html │
│   17.4   17.8  0.4063    2.33%   708  coq-fiat-crypto-with-bedrock/src/Rewriter/RulesProofs.v.html                                       │
│   18.9   19.3  0.4016    2.12%  1073  rocq-metarocq-safechecker/_build/default/theories/SafeChecker/PCUICSafeReduce.v.html               │
│ 0.0904  0.461  0.3704  409.83%   886  coq-mathcomp-odd-order/theories/PFsection4.v.html                                                  │
│   43.6   43.9  0.3609    0.83%    52  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html               │
│   37.7   38.1  0.3580    0.95%   116  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/bedrock2/src/bedrock2Examples/full_mul.v.html       │
│   25.7   26.1  0.3450    1.34%   310  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/Addchain.v.html                                 │
│   17.7   18.1  0.3209    1.81%   978  coq-category-theory/Instance/Grp/Colimit/Presentation.v.html                                       │
│  0.305  0.616  0.3112  102.01%  1570  rocq-mathcomp-analysis/theories/realfun.v.html                                                     │
│   8.75   9.06  0.3100    3.54%     3  coq-performance-tests-lite/PerformanceExperiments/Reify/Ltac2/_5_SuperFast.v.html                  │
│   25.8   26.2  0.3080    1.19%   334  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Coord.v.html                                         │
│   43.3   43.6  0.3075    0.71%    52  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html               │
│  0.312  0.612  0.2998   96.16%  1577  rocq-mathcomp-analysis/theories/realfun.v.html                                                     │
│   25.6   25.9  0.2951    1.15%   258  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Coord.v.html                                         │
│   11.2   11.5  0.2831    2.52%     3  coq-performance-tests-lite/PerformanceExperiments/Reify/Ltac2/_4_SuperFast.v.html                  │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
🐇 Top 25 speed ups
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                     TOP 25 SPEED UPS                                                      │
│                                                                                                                           │
│ OLD    NEW      DIFF     %DIFF    Ln                  FILE                                                                │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 10.6   0.297  -10.2980  -97.20%  2108  rocq-mathcomp-analysis/theories/ftc.v.html                                         │
│ 8.80   0.301   -8.4976  -96.58%   245  rocq-mathcomp-analysis/theories/gauss_integral.v.html                              │
│ 7.48  0.0425   -7.4398  -99.43%   127  coq-mathcomp-odd-order/theories/BGappendixAB.v.html                                │
│ 4.96   0.191   -4.7655  -96.14%  2061  rocq-mathcomp-analysis/theories/ftc.v.html                                         │
│ 8.24    5.37   -2.8697  -34.84%   708  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                           │
│ 2.89   0.565   -2.3256  -80.45%  1324  rocq-mathcomp-analysis/theories/realfun.v.html                                     │
│ 3.50    1.18   -2.3204  -66.25%   184  rocq-mathcomp-analysis/theories/topology_theory/function_spaces.v.html             │
│ 2.88   0.564   -2.3190  -80.43%  1327  rocq-mathcomp-analysis/theories/realfun.v.html                                     │
│ 2.32  0.0688   -2.2560  -97.04%   405  coq-mathcomp-odd-order/theories/BGappendixC.v.html                                 │
│ 19.7    17.9   -1.7328   -8.81%   560  coq-mathcomp-odd-order/theories/PFsection9.v.html                                  │
│ 8.91    7.19   -1.7171  -19.28%  1332  coq-mathcomp-odd-order/theories/PFsection9.v.html                                  │
│ 2.61   0.926   -1.6815  -64.48%   393  rocq-mathcomp-analysis/theories/elementary_functions/trigonometry_functions.v.html │
│ 1.99   0.329   -1.6592  -83.45%  1386  rocq-mathcomp-analysis/theories/ftc.v.html                                         │
│ 18.0    16.4   -1.6403   -9.11%   572  coq-mathcomp-odd-order/theories/PFsection9.v.html                                  │
│ 4.18    2.56   -1.6193  -38.76%   260  coq-unimath/UniMath/CategoryTheory/Monoidal/RezkCompletion/LiftedMonoidal.v.html   │
│ 1.98   0.403   -1.5762  -79.63%  2847  rocq-mathcomp-analysis/theories/realfun.v.html                                     │
│ 1.98   0.403   -1.5735  -79.61%  2856  rocq-mathcomp-analysis/theories/realfun.v.html                                     │
│ 1.70   0.193   -1.5049  -88.61%   423  rocq-mathcomp-group-representation/group_representation/mxabelem.v.html            │
│ 2.27   0.852   -1.4145  -62.40%  1222  rocq-mathcomp-analysis/theories/normedtype_theory/tvs.v.html                       │
│ 6.60    5.30   -1.2961  -19.65%   606  rocq-mathcomp-field/field/algebraics_fundamentals.v.html                           │
│ 1.77   0.478   -1.2944  -73.02%  2888  rocq-mathcomp-analysis/theories/realfun.v.html                                     │
│ 1.26  0.0169   -1.2474  -98.66%   919  coq-mathcomp-odd-order/theories/PFsection12.v.html                                 │
│ 2.65    1.44   -1.2159  -45.80%    67  rocq-mathcomp-group-representation/group_representation/integral_char.v.html       │
│ 1.46   0.263   -1.1988  -82.00%  2331  rocq-mathcomp-analysis/theories/realfun.v.html                                     │
│ 1.44   0.250   -1.1873  -82.60%  2309  rocq-mathcomp-analysis/theories/realfun.v.html                                     │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@ppedrot

ppedrot commented Dec 3, 2026

Copy link
Copy Markdown
Member

Note that the iris slowdown is likely due to the fact that it is very sensitive to TC resolution of classes with primitive projections. I suspect that #22934 will help tremendously here, at the very least it will hide the slowdown in the big speedup and may even cancel it completely as most TC resolutions of primitive records are just skipped.

@mattam82

mattam82 commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

Yes, indeed. It's unification through typeclass resolution going through the new paths, which I tried to cut as much as possible while staying correct/return the same unifiers as evar_conv did.

Comment thread pretyping/structures.ml
(* The primitive projections which have an entry in [object_table], through
their compatibility constant: this is asked at each step of unification *)
let prim_projections_table =
Summary.ref (ProjReprMap.empty : unit ProjReprMap.t)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a map to unit is better done with a set

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we don't have set in the quotiented apis

@SkySkimmer

Copy link
Copy Markdown
Contributor

@coqbot merge now

@coqbot-app
coqbot-app Bot merged commit a51d1d7 into rocq-prover:master Dec 3, 2026
8 of 10 checks passed
@coqbot-app

coqbot-app Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

@SkySkimmer: Please take care of the following overlays:

  • 22789-mattam82-cs-primproj.sh

mattam82 added a commit to mattam82/hierarchy-builder that referenced this pull request Dec 3, 2026
With rocq-prover/rocq#22789, canonical structure inference and
unification treat all forms of a primitive projection alike, so that
the records declared with #[primitive] can be used as the other ones:
- the terms HB declares use folded primitive projections, as the ones
  elaborated by Rocq (fold-projections, applied in log.coq.env.add-const*);
- clean-op-ty also rewrites operations used as primitive projections;
- parametrized mixin-src clauses typecheck the mixin argument;
- mixin-for, the non-forgetful inheritance check and HB.pack recognize a
  sort projection in its primitive form.

Records are still non-primitive unless #[primitive] is given.

Assisted by GenAI tools
mattam82 added a commit to mattam82/hierarchy-builder that referenced this pull request Dec 3, 2026
With rocq-prover/rocq#22789, canonical structure inference and
unification treat all forms of a primitive projection alike, so that
the records declared with #[primitive] can be used as the other ones:
- the terms HB declares use folded primitive projections, as the ones
  elaborated by Rocq (fold-projections, applied in log.coq.env.add-const*);
- clean-op-ty also rewrites operations used as primitive projections;
- parametrized mixin-src clauses typecheck the mixin argument;
- mixin-for, the non-forgetful inheritance check and HB.pack recognize a
  sort projection in its primitive form.

Records are still non-primitive unless #[primitive] is given.

Assisted by GenAI tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: enhancement Enhancement to an existing user-facing feature, tactic, etc. kind: fix This fixes a bug or incorrect documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants