Skip to content
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

Ltac1 and Ltac2: don't normalize evars for open_constr:() #17704

Merged
merged 1 commit into from Nov 8, 2023

Conversation

SkySkimmer
Copy link
Contributor

Close? #13977

Unlike #17346 we still expand in constr:(), hopefully we trigger less bugs this way.

@SkySkimmer SkySkimmer added the request: full CI Use this label when you want your next push to trigger a full CI. label Jun 8, 2023
@SkySkimmer SkySkimmer requested review from a team as code owners June 8, 2023 11:48
@coqbot-app coqbot-app bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Jun 8, 2023
@SkySkimmer
Copy link
Contributor Author

@coqbot bench

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 9, 2023

🏁 Bench results:

┌─────────────────────────────┬─────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┬─────────────────────────┐
│                             │      user time [s]      │              CPU cycles               │           CPU instructions            │  max resident mem [KB]  │
│                             │                         │                                       │                                       │                         │
│        package_name         │   NEW      OLD    PDIFF │      NEW             OLD        PDIFF │      NEW             OLD        PDIFF │   NEW      OLD    PDIFF │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┤
│                coq-bedrock2 │  313.84   316.18  -0.74 │  1413901040191   1426088548361  -0.85 │  2805370754907   2805300853564   0.00 │  837272   836184   0.13 │
│            coq-math-classes │   85.45    85.97  -0.60 │   383121059628    384564085339  -0.38 │   539541326824    538674177495   0.16 │  516944   517812  -0.17 │
│      coq-mathcomp-ssreflect │  247.53   249.02  -0.60 │  1118459739967   1125438572784  -0.62 │  1962014020188   1962214967554  -0.01 │ 4771560  4774168  -0.05 │
│                coq-rewriter │  348.12   349.89  -0.51 │  1569163900551   1574792719101  -0.36 │  2631271369585   2630944481971   0.01 │ 1328588  1319868   0.66 │
│                coq-coqprime │   45.75    45.97  -0.48 │   203708252495    204965870153  -0.61 │   313358103506    313691573375  -0.11 │  777128   776748   0.05 │
│               coq-fourcolor │ 1553.27  1559.78  -0.42 │  6858153120683   6885747550378  -0.40 │ 12474960612359  12478140491233  -0.03 │ 2290924  2291512  -0.03 │
│           coq-metacoq-pcuic │  621.54   624.12  -0.41 │  2794739446405   2804904098525  -0.36 │  4163748060243   4157514691931   0.15 │ 2092612  2091988   0.03 │
│          coq-mathcomp-field │  243.07   244.03  -0.39 │  1096861528908   1101460219999  -0.42 │  1892409522605   1893929723299  -0.08 │ 1511148  1511236  -0.01 │
│                     coq-vst │  856.14   858.87  -0.32 │  3849671647497   3865469340409  -0.41 │  6374219094055   6377748926058  -0.06 │ 2263968  2113904   7.10 │
│                coq-compcert │  287.26   287.94  -0.24 │  1283077189595   1288044555778  -0.39 │  1969134598510   1968060105820   0.05 │ 1133924  1132560   0.12 │
│                  coq-stdlib │  412.31   413.22  -0.22 │  1748101088053   1748730540643  -0.04 │  1450136450618   1449645368154   0.03 │  651604   649024   0.40 │
│                   coq-verdi │   46.78    46.86  -0.17 │   209663123800    209305613778   0.17 │   322520293079    322949026286  -0.13 │  526192   526168   0.00 │
│               coq-perennial │ 5726.06  5731.79  -0.10 │ 25885674775906  25917317731670  -0.12 │ 43526266332389  43550910827266  -0.06 │ 2140616  2140596   0.00 │
│        coq-mathcomp-algebra │  602.40   602.89  -0.08 │  2718953105276   2722014414066  -0.11 │  4754656161366   4754632293319   0.00 │ 4065720  4056944   0.22 │
│                  coq-geocoq │  610.45   610.92  -0.08 │  2755380539445   2757736940479  -0.09 │  4369504563503   4354722990534   0.34 │  931400   931712  -0.03 │
│           coq-iris-examples │  478.17   478.32  -0.03 │  2156078716498   2156324135596  -0.01 │  3336391693081   3335780202453   0.02 │ 1073972  1071948   0.19 │
│ coq-rewriter-perf-SuperFast │  740.02   739.61   0.06 │  3299048075349   3301464119908  -0.07 │  5784492043855   5786289770082  -0.03 │ 1446800  1421348   1.79 │
│         coq-category-theory │  717.65   717.17   0.07 │  3257250636866   3256655319766   0.02 │  5614595869959   5618047544818  -0.06 │  881100   894028  -1.45 │
│                    coq-hott │  149.32   149.21   0.07 │   667698673236    666905293567   0.12 │  1061441874266   1059463493524   0.19 │  622528   620716   0.29 │
│       coq-mathcomp-solvable │  147.38   147.13   0.17 │   666692991120    666347813843   0.05 │  1087455221705   1087266287347   0.02 │ 1726628  1726572   0.00 │
│      coq-mathcomp-odd-order │  845.95   844.48   0.17 │  3854040141074   3847204913773   0.18 │  6594028368388   6593386293845   0.01 │ 1611468  1611312   0.01 │
│                    coq-corn │  784.36   782.83   0.20 │  3536533745953   3528367496514   0.23 │  5519168279954   5509372495673   0.18 │  742008   741532   0.06 │
│      coq-mathcomp-character │  157.92   157.59   0.21 │   716977123422    714893618155   0.29 │  1124448218095   1124494935749  -0.00 │ 1618196  1617188   0.06 │
│    coq-metacoq-translations │   18.07    18.03   0.22 │    78902849302     78980333981  -0.10 │   128423034625    128254905211   0.13 │  905696   905332   0.04 │
│                    coq-core │  116.37   116.11   0.22 │   452023670950    450672603836   0.30 │   478322955207    478189182386   0.03 │  291128   291476  -0.12 │
│                 coq-coqutil │   39.46    39.35   0.28 │   174691094570    174356348412   0.19 │   253268726168    253260811671   0.00 │  558592   558716  -0.02 │
│         coq-metacoq-erasure │  307.42   306.54   0.29 │  1380069539410   1376966984223   0.23 │  2195096535301   2194152475649   0.04 │ 2069988  2044340   1.25 │
│              coq-coquelicot │   38.50    38.37   0.34 │   170190875540    170475400236  -0.17 │   238008762500    238411080055  -0.17 │  816336   811764   0.56 │
│  coq-performance-tests-lite │  763.19   760.55   0.35 │  3401807093660   3390382197502   0.34 │  6045559054986   6042136597078   0.06 │ 1667592  1669520  -0.12 │
│     coq-metacoq-safechecker │  373.87   372.57   0.35 │  1701030090966   1695065119472   0.35 │  2852332472451   2852422465092  -0.00 │ 2058024  2053944   0.20 │
│              coq-verdi-raft │  558.77   556.47   0.41 │  2533968563966   2522791383559   0.44 │  3972161671899   3971017855584   0.03 │  825260   819320   0.72 │
│               coq-fiat-core │   60.86    60.54   0.53 │   256416210659    256210024916   0.08 │   378753910789    378739368767   0.00 │  491640   492356  -0.15 │
│               coq-equations │   10.83    10.77   0.56 │    46188473912     46132747140   0.12 │    73155558851     73175522570  -0.03 │  413632   414232  -0.14 │
│                 coq-bignums │   28.27    28.11   0.57 │   126966686290    126197140200   0.61 │   181044730591    180914836646   0.07 │  489776   487364   0.49 │
│                 coq-unimath │ 1502.79  1494.06   0.58 │  6798958003490   6754961583068   0.65 │ 12835078792385  12834191344582   0.01 │ 1332056  1329440   0.20 │
│        coq-metacoq-template │  164.94   163.98   0.59 │   727365619804    724280185100   0.43 │  1159451497567   1157140044174   0.20 │ 1261500  1257780   0.30 │
│                   coq-color │  226.91   225.22   0.75 │  1010893839288   1005818954809   0.50 │  1476460532404   1476457221803   0.00 │ 1173196  1169060   0.35 │
│            coq-fiat-parsers │  333.37   330.84   0.76 │  1467941270011   1455982756055   0.82 │  2449023364343   2448879275192   0.01 │ 2419408  2421852  -0.10 │
│       coq-engine-bench-lite │  158.53   156.94   1.01 │   674545674184    667217521154   1.10 │  1252487083925   1251093594520   0.11 │ 1326348  1326248   0.01 │
│       coq-mathcomp-fingroup │   37.90    37.41   1.31 │   171468995072    169530325466   1.14 │   262504522296    262538550648  -0.01 │  570172   569820   0.06 │
└─────────────────────────────┴─────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┴─────────────────────────┘

INFO: failed to install
coq-fiat-crypto-with-bedrock

🐢 Top 25 slow downs
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                           TOP 25 SLOW DOWNS                                                            │
│                                                                                                                                        │
│   OLD       NEW      DIFF     %DIFF     Ln                    FILE                                                                     │
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 141.2530  142.3930  1.1400      0.81%  1190  coq-unimath/UniMath/CategoryTheory/GrothendieckConstruction/IsPullback.v.html             │
│  61.9490   62.8900  0.9410      1.52%   139  coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html                              │
│ 129.7010  130.4230  0.7220      0.56%   999  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html           │
│   2.2310    2.8690  0.6380     28.60%   122  coq-stdlib/setoid_ring/Ncring_initial.v.html                                              │
│   1.8510    2.4850  0.6340     34.25%   209  coq-stdlib/setoid_ring/Ncring_tac.v.html                                                  │
│ 130.0100  130.5930  0.5830      0.45%   968  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html           │
│   2.9820    3.5430  0.5610     18.81%   487  coq-stdlib/Numbers/HexadecimalFacts.v.html                                                │
│  40.2460   40.7830  0.5370      1.33%   224  coq-performance-tests-lite/PerformanceExperiments/rewrite_lift_lets_map.v.html            │
│   0.0050    0.5210  0.5160  10320.00%   753  coq-metacoq-pcuic/pcuic/theories/PCUICTyping.v.html                                       │
│   1.1080    1.4720  0.3640     32.85%   566  coq-stdlib/setoid_ring/Ncring_polynom.v.html                                              │
│   0.3510    0.6910  0.3400     96.87%   870  coq-stdlib/MSets/MSetRBT.v.html                                                           │
│   0.0390    0.3690  0.3300    846.15%  1423  coq-perennial/src/program_proof/aof/proof.v.html                                          │
│   1.2420    1.5670  0.3250     26.17%   316  coq-stdlib/Strings/Byte.v.html                                                            │
│  31.1520   31.4540  0.3020      0.97%   839  coq-unimath/UniMath/CategoryTheory/GrothendieckConstruction/IsPullback.v.html             │
│   3.2430    3.5420  0.2990      9.22%   477  coq-perennial/src/program_proof/memkv/bank_proof.v.html                                   │
│  10.1030   10.3930  0.2900      2.87%   603  coq-unimath/UniMath/Algebra/GroupAction.v.html                                            │
│  16.0450   16.3330  0.2880      1.79%    31  coq-engine-bench-lite/coq/PerformanceDemos/pattern.v.html                                 │
│   4.3600    4.6030  0.2430      5.57%   102  coq-engine-bench-lite/coq/PerformanceDemos/rewrite_strat_repeated_app.v.html              │
│   2.6740    2.9140  0.2400      8.98%  1824  coq-unimath/UniMath/CategoryTheory/EnrichedCats/Examples/KleisliEnriched.v.html           │
│   2.0180    2.2560  0.2380     11.79%   486  coq-perennial/src/program_proof/memkv/memkv_shard_clerk_proof.v.html                      │
│  19.1300   19.3660  0.2360      1.23%   214  coq-engine-bench-lite/coq/PerformanceDemos/one_step_reduction.v.html                      │
│  41.3810   41.6160  0.2350      0.57%   236  coq-rewriter/src/Rewriter/Rewriter/Examples/PerfTesting/LiftLetsMap.v.html                │
│  41.0940   41.3260  0.2320      0.56%   236  coq-rewriter-perf-SuperFast/src/Rewriter/Rewriter/Examples/PerfTesting/LiftLetsMap.v.html │
│   3.9300    4.1610  0.2310      5.88%  4414  coq-unimath/UniMath/HomologicalAlgebra/MappingCone.v.html                                 │
│  19.1350   19.3640  0.2290      1.20%   325  coq-engine-bench-lite/coq/PerformanceDemos/one_step_reduction.v.html                      │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
🐇 Top 25 speed ups
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                              TOP 25 SPEED UPS                                              │
│                                                                                                            │
│   OLD      NEW     DIFF     %DIFF    Ln               FILE                                                 │
├────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 20.3150  18.3780  -1.9370   -9.53%   808  coq-perennial/src/program_proof/wal/logger_proof.v.html          │
│ 46.9470  45.5810  -1.3660   -2.91%   558  coq-bedrock2/bedrock2/src/bedrock2Examples/insertionsort.v.html  │
│ 81.0810  79.9060  -1.1750   -1.45%   618  coq-bedrock2/bedrock2/src/bedrock2Examples/lightbulb.v.html      │
│ 35.9790  34.9060  -1.0730   -2.98%    12  coq-fourcolor/theories/job254to270.v.html                        │
│ 29.1460  28.5690  -0.5770   -1.98%    12  coq-fourcolor/theories/job517to530.v.html                        │
│ 34.4610  33.9670  -0.4940   -1.43%    12  coq-fourcolor/theories/job165to189.v.html                        │
│ 24.3280  23.8440  -0.4840   -1.99%    12  coq-fourcolor/theories/job542to545.v.html                        │
│  5.8800   5.4350  -0.4450   -7.57%   167  coq-vst/veric/binop_lemmas6.v.html                               │
│ 33.3460  32.9080  -0.4380   -1.31%    12  coq-fourcolor/theories/job589to610.v.html                        │
│ 28.4760  28.0490  -0.4270   -1.50%    12  coq-fourcolor/theories/job291to294.v.html                        │
│  1.4250   1.0210  -0.4040  -28.35%   372  coq-stdlib/setoid_ring/Ncring_polynom.v.html                     │
│ 21.2170  20.8380  -0.3790   -1.79%    12  coq-fourcolor/theories/job311to314.v.html                        │
│  2.1770   1.8070  -0.3700  -17.00%     6  coq-mathcomp-algebra/mathcomp/algebra/intdiv.v.html              │
│  4.5380   4.1690  -0.3690   -8.13%   130  coq-category-theory/Functor/Strong/Product.v.html                │
│ 27.3320  26.9660  -0.3660   -1.34%    12  coq-fourcolor/theories/job486to489.v.html                        │
│  3.2230   2.8740  -0.3490  -10.83%  1409  coq-perennial/src/program_proof/wal/installer_proof.v.html       │
│  0.3340   0.0020  -0.3320  -99.40%  1451  coq-perennial/src/program_proof/aof/proof.v.html                 │
│ 30.1360  29.8110  -0.3250   -1.08%    12  coq-fourcolor/theories/job190to206.v.html                        │
│ 40.3780  40.0830  -0.2950   -0.73%   827  coq-vst/veric/binop_lemmas4.v.html                               │
│  0.9180   0.6280  -0.2900  -31.59%   877  coq-metacoq-pcuic/pcuic/theories/PCUICTyping.v.html              │
│ 27.3700  27.0830  -0.2870   -1.05%    12  coq-fourcolor/theories/job231to234.v.html                        │
│ 22.0920  21.8120  -0.2800   -1.27%   667  coq-perennial/src/program_proof/simplepb/pb_roapply_proof.v.html │
│ 11.1180  10.8580  -0.2600   -2.34%    88  coq-rewriter/src/Rewriter/Rewriter/Examples.v.html               │
│ 32.4730  32.2150  -0.2580   -0.79%    12  coq-fourcolor/theories/job563to588.v.html                        │
│  3.5630   3.3170  -0.2460   -6.90%   274  coq-perennial/src/program_proof/examples/dir_proof.v.html        │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 9, 2023

🔴 CI failure at commit cecd173 without any failure in the test-suite

✔️ Corresponding job for the base commit 6e739ce succeeded

❔ Ask me to try to extract a minimal test case that can be added to the test-suite

🏃 @coqbot ci minimize will minimize the following target: ci-fiat_crypto
  • You can also pass me a specific list of targets to minimize as arguments.

@SkySkimmer
Copy link
Contributor Author

@coqbot ci minimize

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 9, 2023

I have initiated minimization at commit cecd173 for the suggested target ci-fiat_crypto as requested.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 9, 2023

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src/PushButtonSynthesis/Primitives.v (from ci-fiat_crypto) (interrupted by timeout, being automatically continued) (full log on GitHub Actions)

Partially Minimized Coq File (timeout)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Crypto.PushButtonSynthesis.Primitives") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Expected coqc runtime on this file: 10.177 sec *)
Require Crypto.Util.Tactics.SubstEvars.
Require Crypto.Util.ListUtil.Filter.
Require Crypto.Language.IdentifierParameters.
Require Rewriter.Util.plugins.RewriterBuildRegistry.

Declare ML Module "coq-rewriter.rewriter_build".
Import Crypto.Language.PreExtra.
Import Crypto.Language.IdentifierParameters.
Import Crypto.Util.ListUtil.Filter.

Module Export Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.
  Rewriter Emit Inductives From Scraped
           {| ScrapedData.base_type_list_named := base_type_list_named ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}
           As base ident raw_ident pattern_ident.

  Definition package : GoalType.package_with_args scraped_data var_like_idents base ident.
  Proof.
Tactic.make_package.
Defined.
Module Export APINotations.
Import Ltac2.Ltac2.
Module Export Compilers.
  Export Reify.Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.Tactic.

  Definition exprInfo : Classes.ExprInfoT := Eval hnf in GoalType.exprInfo package.

  Global Existing Instances
         baseHasNat
         baseHasNatCorrect
         try_make_base_transport_cps_correct
         buildEagerIdent
         buildInterpEagerIdentCorrect
         toRestrictedIdent
         toFromRestrictedIdent
         buildInterpIdentCorrect
         invertIdent
         buildInvertIdentCorrect
         base_default
         exprInfo
  .
  Ltac2 mk_reify_base_type () :=
    let package := reify_package_of_package 'package in
    reify_base_type_via_reify_package package.
  Ltac2 mk_reify_type () :=
    let package := reify_package_of_package 'package in
    reify_type_via_reify_package package.
  Ltac2 mk_reify_ident_opt () :=
    let package := reify_package_of_package 'package in
    reify_ident_via_reify_package_opt package.
  Ltac2 reify_type (ty : constr) : constr := mk_reify_type () ty.
  #[deprecated(since="8.15",note="Use Ltac2 instead.")]
   Ltac reify_type term :=
    let f := ltac2:(term
                    |- Control.refine (fun () => reify_type (Option.get (Ltac1.to_constr term)))) in
    constr:(ltac:(f term)).

  Module Export base.

    Notation type := (@base.type base) (only parsing).
    Notation base_interp := Compilers.base_interp (only parsing).
    Notation interp := (base.interp Compilers.base_interp) (only parsing).
  End base.

  Ltac2 _Reify_rhs () : unit :=
    let reify_base_type := mk_reify_base_type () in
    let reify_ident_opt := mk_reify_ident_opt () in
    expr._Reify_rhs 'base.type 'ident reify_base_type reify_ident_opt '@base.interp '@ident_interp ().
  Ltac Reify_rhs _ :=
    ltac2:(_Reify_rhs ()).

  Module Import invert_expr.

    End invert_expr.

  End Compilers.

End APINotations.

    Notation Expr := (@expr.Expr base.type ident).

    Notation Interp := (@expr.Interp base.type ident base.interp (@ident_interp)).

    Notation reify_type t := (ltac:(let rt := reify_type t in exact rt)) (only parsing).
    Notation reify_type_of e := (reify_type ((fun t (_ : t) => t) _ e)) (only parsing).

Import Coq.Relations.Relation_Definitions.
Import Crypto.Util.Tactics.SubstEvars.
Import Language.Wf.Compilers.

Fixpoint pointwise_equal {t} : relation (type.interp base.interp t)
  := match t with
     | type.base t => Logic.eq
     | type.arrow s d
       => fun (f g : type.interp base.interp s -> type.interp base.interp d)
          => forall x, pointwise_equal (f x) (g x)
     end.
Definition is_reification_of' {t} (e : Expr t) (v : type.interp base.interp t) : Prop.
exact (pointwise_equal (Interp e) v /\ Wf e).
Defined.

Notation is_reification_of rop op
  := (match @is_reification_of' (reify_type_of op) rop op with
      | T
        => ltac:(
             let T := (eval cbv [pointwise_equal is_reification_of' T] in T) in
             let T := (eval cbn [type.interp base.interp base.base_interp] in T) in
             exact T)
      end)
       (only parsing).

Ltac cache_reify _ :=
  split;
  [ intros;
    etransitivity;
    [
    | repeat match goal with |- _ = ?f' ?x => is_var x; apply (f_equal (fun f => f _)) end;
      Reify_rhs ();
      reflexivity ];
    subst_evars;
    reflexivity
  | prove_Wf () ].
Import Coq.ZArith.ZArith.

Derive reified_id_gen
       SuchThat (is_reification_of reified_id_gen (@id (list Z)))
       As reified_id_gen_correct.
Proof.
Time cache_reify ().
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.4MiB file on GitHub Actions Artifacts under build.log)
ZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.p7ljKrbzLG
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.LXBFDw1uoL
MINIMIZER_DEBUG: files: 
make --no-print-directory -C bedrock2/bedrock2 noex
Generating Makefile.coq.noex
rm -f .coqdeps.d
make -f Makefile.coq.noex
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.pf37h7FPnO
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.cuqu1h4xmd
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.qbBye38ADp
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.7Jr1tmFZnu
MINIMIZER_DEBUG: files: 
rm -f .coqdeps.d
make -f Makefile.coq
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.Ods1wXi09a
MINIMIZER_DEBUG: files: 
COQDEP VFILES
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.B3rCvGZj4y
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.hZXy6U2csN
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.5LSyOmr43q
MINIMIZER_DEBUG: files: 
make[4]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.oYUv7pSlGg
MINIMIZER_DEBUG: files: 
COQC src/PushButtonSynthesis/Primitives.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -w +implicit-core-hint-db\,+implicits-in-term\,+non-reversible-notation\,+deprecated-intros-until-0\,+deprecated-focus\,+unused-intro-pattern\,+variable-collision\,+unexpected-implicit-declaration\,+omega-is-deprecated\,+deprecated-instantiate-syntax\,+non-recursive\,+undeclared-scope\,+deprecated-hint-rewrite-without-locality\,+deprecated-hint-without-locality\,+deprecated-instance-without-locality\,+deprecated-typeclasses-transparency-without-locality\,unsupported-attributes -w -notation-overridden\,-deprecated-hint-constr\,-fragile-hint-constr\,-native-compiler-disabled\,-ambiguous-paths\,-masking-absolute-name -w -deprecated-native-compiler-option -native-compiler ondemand -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil coqutil -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola Rupicola -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2 bedrock2 -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src Crypto src/PushButtonSynthesis/Primitives.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.BpzVuxELiD
MINIMIZER_DEBUG: files:  src/PushButtonSynthesis/Primitives.v
Finished failing transaction in 0.095 secs (0.094u,0.s) (failure)
File "./src/PushButtonSynthesis/Primitives.v", line 93, characters 12-26:
Error: Some unresolved existential variables remain

Command exited with non-zero status 1
src/PushButtonSynthesis/Primitives.vo (real: 3.37, user: 2.85, sys: 0.51, mem: 1019468 ko)
Makefile.coq:809: recipe for target 'src/PushButtonSynthesis/Primitives.vo' failed
make[1]: *** [src/PushButtonSynthesis/Primitives.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto'
Aggregating timing log...
    Time |   Peak Mem | File Name                        
---------------------------------------------------------
0m02.85s | 1019468 ko | Total Time / Peak Mem            
---------------------------------------------------------
0m02.85s | 1019468 ko | PushButtonSynthesis/Primitives.vo
Makefile.ci:151: recipe for target 'ci-fiat_crypto' failed
make: *** [ci-fiat_crypto] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 431KiB file on GitHub Actions Artifacts under bug.log)
ds unsuccessful.
No successful changes.

I will now attempt to replace Qeds with admit. Defined.
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpvg24tfw4/Crypto/PushButtonSynthesis/Primitives.v", line 274, characters 9-19:
Error: The reference baseHasNat was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmp3el8q946/Crypto/PushButtonSynthesis/Primitives.v", line 275, characters 9-19:
Error: The reference baseHasNat was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to remove all lines, one at a time
Line removal successful

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Qed Obligation with Admit Obligations
�[92m
Admitting Qed Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qed Obligations unsuccessful.
No successful changes.

I will now attempt to replace Qeds with Admitteds
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to replace Qeds with admit. Defined.
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpqy48_7gv/Crypto/PushButtonSynthesis/Primitives.v", line 28, characters 9-19:
Error: The reference baseHasNat was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmp33625k5k/Crypto/PushButtonSynthesis/Primitives.v", line 19, characters 0-8:
Error:  (in proof package): Attempt to save a proof with given up goals. If
this is really what you want to do, use Admitted in place of Qed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 9, 2023

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src/PushButtonSynthesis/Primitives.v (from ci-fiat_crypto) (interrupted by timeout, being automatically continued) (full log on GitHub Actions)

Partially Minimized Coq File (could not inline Rewriter.Util.plugins.RewriterBuildRegistry) (truncated to 32KiB; full 35KiB file on GitHub Actions Artifacts under bug.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Modules that could not be inlined: Rewriter.Util.plugins.RewriterBuildRegistry
   Expected coqc runtime on this file: 8.783 sec *)
Require Coq.Init.Ltac.
Require Crypto.Util.Tactics.SubstEvars.
Require Coq.micromega.Lia.
Require Coq.Arith.Arith.
Require Coq.Lists.List.
Require Coq.Classes.Morphisms.
Require Crypto.Util.GlobalSettings.
Require Crypto.Util.FixCoqMistakes.
Require Crypto.Util.ListUtil.Filter.
Require Coq.Arith.Peano_dec.
Require Coq.Bool.Bool.
Require Coq.Classes.CMorphisms.
Require Coq.Classes.RelationClasses.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.NArith.BinNat.
Require Coq.NArith.NArith.
Require Coq.Numbers.BinNums.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Relations.Relation_Definitions.
Require Coq.Setoids.Setoid.
Require Coq.Strings.Ascii.
Require Coq.Strings.String.
Require Coq.ZArith.BinInt.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.ZArith_dec.
Require Crypto.Util.Comparison.
Require Crypto.Util.HProp.
Require Crypto.Util.Isomorphism.
Require Crypto.Util.Tactics.ConstrFail.
Require Crypto.Util.Tactics.Contains.
Require Crypto.Util.Tactics.GetGoal.
Require Crypto.Util.Tactics.Test.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.Tactics.GetGoal.
Require Crypto.Util.IffT.
Require Crypto.Util.Pointed.
Require Crypto.Util.Tactics.Not.
Require Crypto.Util.Tactics.SetoidSubst.
Require Rewriter.Util.FixCoqMistakes.
Require Crypto.Util.Equality.
Require Crypto.Util.Notations.
Require Crypto.Util.Tactics.DestructHyps.
Require Crypto.Util.Tactics.Head.
Require Crypto.Util.Tactics.SpecializeBy.
Require Crypto.Util.Tactics.SplitInContext.
Require Rewriter.Util.Notations.
Require Crypto.Util.Tactics.BreakMatch.
Require Crypto.Util.Sigma.
Require Crypto.Util.Tactics.DestructHead.
Require Crypto.Util.Tactics.DoWithHyp.
Require Crypto.Util.ZUtil.Notations.
Require Crypto.Util.Tactics.RewriteHyp.
Require Rewriter.Util.LetIn.
Require Crypto.Util.NatUtil.
Require Crypto.Util.PrimitiveProd.
Require Crypto.Util.Option.
Require Crypto.Util.Prod.
Require Crypto.Util.LetIn.
Require Crypto.Util.Decidable.
Require Crypto.Util.ListUtil.SetoidList.
Require Crypto.Util.Sum.
Require Crypto.Util.ZUtil.Definitions.
Require Crypto.Util.ListUtil.
Require Crypto.Util.Tuple.
Require Crypto.Util.Bool.Reflect.
Require Crypto.Util.ZRange.
Require Ltac2.Init.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.HProp.
Require Rewriter.Util.Equality.
Require Rewriter.Util.PrimitiveProd.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Language.Pre.
Require Rewriter.Util.Bool.
Require Rewriter.Util.NatUtil.
Require Rewriter.Util.Pointed.
Require Rewriter.Util.Prod.
Require Rewriter.Util.Sigma.
Require Rewriter.Util.Decidable.
Require Rewriter.Util.Tactics.Head.
Require Rewriter.Util.Tactics.BreakMatch.
Require Rewriter.Util.Tactics.DestructHyps.
Require Rewriter.Util.Tactics.DestructHead.
Require Rewriter.Util.Option.
Require Rewriter.Util.Tactics.SpecializeBy.
Require Rewriter.Util.Tactics.Test.
Require Rewriter.Util.Tactics.Not.
Require Rewriter.Util.Tactics.DoWithHyp.
Require Rewriter.Util.Tactics.RewriteHyp.
Require Rewriter.Util.Tactics.ConstrFail.
Require Rewriter.Util.Tactics.SplitInContext.
Require Rewriter.Util.ListUtil.
Require Rewriter.Language.PreLemmas.
Require Ltac2.Int.
Require Ltac2.Message.
Require Ltac2.Control.
Require Ltac2.Bool.
Require Ltac2.Array.
Require Ltac2.Char.
Require Ltac2.Constant.
Require Ltac2.Constr.
Require Ltac2.Constructor.
Require Ltac2.Std.
Require Ltac2.Env.
Require Ltac2.Evar.
Require Ltac2.Float.
Require Ltac2.List.
Require Ltac2.Fresh.
Require Ltac2.Ident.
Require Ltac2.Ind.
Require Ltac2.Ltac1.
Require Ltac2.Meta.
Require Ltac2.Option.
Require Ltac2.Pattern.
Require Ltac2.Printf.
Require Ltac2.Proj.
Require Ltac2.String.
Require Ltac2.Uint63.
Require Ltac2.FSet.
Require Ltac2.FMap.
Require Ltac2.Notations.
Require Ltac2.Ltac2.
Require Coq.FSets.FMapPositive.
Require Rewriter.Util.OptionList.
Require Rewriter.Util.CPSNotations.
Require Rewriter.Util.ListUtil.SetoidList.
Require Rewriter.Util.Tactics.Contains.
Require Rewriter.Util.Tactics.SetoidSubst.
Require Rewriter.Util.Sum.
Require Rewriter.Util.Comparison.
Require Rewriter.Util.Bool.Reflect.
Require Rewriter.Language.Language.
Require Rewriter.Language.UnderLets.
Require Rewriter.Language.UnderLetsCacheProofs.
Require Rewriter.Util.Tactics.RunTacticAsConstr.
Require Rewriter.Util.Tactics.DebugPrint.
Require Rewriter.Util.Tactics2.List.
Require Rewriter.Util.Tactics2.Ltac1.
Require Rewriter.Util.Tactics2.Message.
Require Rewriter.Util.Tactics2.Ident.
Require Rewriter.Util.Tactics2.Char.
Require Rewriter.Util.Tactics2.String.
Require Rewriter.Util.Tactics2.Array.
Require Rewriter.Util.Tactics2.Proj.
Require Rewriter.Util.Tactics2.Option.
Require Rewriter.Util.Tactics2.Iterate.
Require Rewriter.Util.plugins.Ltac2Extra.
Require Rewriter.Util.Tactics2.Constr.
Require Rewriter.Util.Tactics2.DestEvar.
Require Rewriter.Util.Tactics2.InstantiateEvar.
Require Rewriter.Util.Tactics2.Constr.Unsafe.MakeAbbreviations.
Require Rewriter.Util.Tactics2.FixNotationsForPerformance.
Require Rewriter.Language.Reify.
Require Rewriter.Util.Tactics.FindHyp.
Require Rewriter.Util.Tactics.UniquePose.
Require Rewriter.Util.Tactics.SpecializeAllWays.
Require Rewriter.Language.Inversion.
Require Rewriter.Language.IdentifiersBasicLibrary.
Require Rewriter.Util.TypeList.
Require Rewriter.Util.Tactics.HeadUnderBinders.
Require Rewriter.Util.Tactics.PrintContext.
Require Rewriter.Util.Tactics.PrintGoal.
Require Rewriter.Util.Tactics.EvarNormalize.
Require Rewriter.Util.Tactics.ClearFree.
Require Rewriter.Util.Tactics.CacheTerm.
Require Rewriter.Util.Tactics2.Notations.
Require Rewriter.Language.IdentifiersBasicGenerate.
Require Coq.MSets.MSetPositive.
Require Coq.Program.Tactics.
Require Coq.Relations.Relations.
Require Rewriter.Util.ListUtil.Forall.
Require Rewriter.Util.Logic.ProdForall.
Require Rewriter.Language.Wf.
Require Rewriter.Language.UnderLetsProofs.
Require Coq.derive.Derive.
Require Rewriter.Util.PrimitiveSigma.
Require Rewriter.Language.IdentifiersLibrary.
Require Coq.MSets.MSetFacts.
Require Rewriter.Util.Logic.ExistsEqAnd.
Require Rewriter.Util.MSetPositive.Facts.
Require Rewriter.Language.IdentifiersLibraryProofs.
Require Rewriter.Rewriter.Rewriter.
Require Rewriter.Util.Tactics.CPSId.
Require Rewriter.Util.Bool.Equality.
Require Rewriter.Util.FMapPositive.Equality.
Require Rewriter.Util.MSetPositive.Equality.
Require Rewriter.Util.Sigma.Related.
Require Rewriter.Rewriter.ProofsCommon.
Require Rewriter.Util.Tactics.WarnIfGoalsRemain.
Require Rewriter.Language.IdentifiersGenerate.
Require Rewriter.Language.IdentifiersGenerateProofs.
Require Rewriter.Util.Tactics2.Head.
Require Rewriter.Util.Tactics2.HeadReference.
Require Rewriter.Util.Tactics2.DecomposeLambda.
Require Rewriter.Util.Tactics2.ReplaceByPattern.
Require Rewriter.Util.Tactics2.InFreshContext.
Require Rewriter.Rewriter.Reify.
Require Rewriter.Rewriter.ProofsCommonTactics.
Require Rewriter.Rewriter.Wf.
Require Rewriter.Util.Tactics.SetEvars.
Require Rewriter.Util.Tactics.SubstEvars.
Require Rewriter.Util.Tactics.TransparentAssert.
Require Rewriter.Rewriter.InterpProofs.
Require Rewriter.Rewriter.AllTactics.
Require Rewriter.Util.plugins.StrategyTactic.
Require Rewriter.Util.plugins.RewriterBuildRegistryImports.
Require Rewriter.Util.plugins.RewriterBuildRegistry.

Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.

Module Export Crypto_DOT_Util_DOT_ZRange_DOT_Operations_WRAPPED.
Module Export Operations.
Import Coq.ZArith.ZArith.
Import Crypto.Util.ZRange.
Import Crypto.Util.ZUtil.Definitions.
Import Crypto.Util.Notations.

Module Export ZRange.
  Local Open Scope Z_scope.
  Local Open Scope zrange_scope.

  Local Notation eta v := r[ lower v ~> upper v ].

  Definition flip (v : zrange) : zrange
    := r[ upper v ~> lower v ].

  Definition union (x y : zrange) : zrange
    := let (lx, ux) := eta x in
       let (ly, uy) := eta y in
       r[ Z.min lx ly ~> Z.max ux uy ].

  Definition intersection (x y : zrange) : zrange
    := let (lx, ux) := eta x in
       let (ly, uy) := eta y in
       r[ Z.max lx ly ~> Z.min ux uy ].

  Definition normalize (v : zrange) : zrange
    := r[ Z.min (lower v) (upper v) ~> Z.max (upper v) (lower v) ].

  Definition normalize' (v : zrange) : zrange
    := union v (flip v).

  Lemma normalize'_eq : normalize = normalize'.
Admitted.

  Definition size (v : zrange) : Z := upper (normalize v) - lower (normalize v).

  Definition abs (v : zrange) : zrange
    := let (l, u) := eta v in
       r[ 0 ~> Z.max (Z.abs l) (Z.abs u) ].

  Definition opp (v : zrange) : zrange
    := let (l, u) := eta v in
       r[ -u ~> -l ].

  Definition map (f : Z -> Z) (v : zrange) : zrange
    := let (l, u) := eta v in
       r[ f l ~> f u ].

  Definition split_range_at_0 (x : zrange) : option zrange   * option zrange   * option zrange  
    := let (l, u) := eta x in
       (if (0 <=? l)%Z
        then None
        else Some r[l ~> Z.min u (-1)],
        if ((0 <? l)%Z || (u <? 0)%Z)%bool
        then None
        else Some r[0 ~> 0],
        if (u <=? 0)%Z
        then None
        else Some r[Z.max 1 l ~> u]).

  Definition apply_to_split_range (f : zrange -> zrange) (v : zrange) : zrange
    := match split_range_at_0 v with
       | (Some n, Some z, Some p) => union (union (f n) (f p)) (f z)
       | (Some v1, Some v2, None) | (Some v1, None, Some v2) | (None, Some v1, Some v2) => union (f v1) (f v2)
       | (Some v, None, None) | (None, Some v, None) | (None, None, Some v) => f v
       | (None, None, None) => f v
       end.

  Definition apply_to_range (f : BinInt.Z -> zrange) (v : zrange) : zrange
    := let (l, u) := eta v in
       union (f l) (f u).

  Definition apply_to_each_split_range (f : BinInt.Z -> zrange) (v : zrange) : zrange
    := apply_to_split_range (apply_to_range f) v.

  Definition constant (v : Z) : zrange := r[v ~> v].

  Fixpoint nary_T (A B : Type) (n : nat) :=
    match n with
    | O => B
    | S n => A -> nary_T A B n
    end.

  Fixpoint under_args {A B B'} (F : B -> B') {n : nat} : nary_T A B n -> nary_T A B' n
    := match n with
       | O => F
       | S n => fun f x => @under_args A B B' F n (f x)
       end.

  Fixpoint under_args2 {A B B' B''} (F : B -> B' -> B'') {n : nat} : nary_T A B n -> nary_T A B' n -> nary_T A B'' n
    := match n with
       | O => F
       | S n => fun f g x => @under_args2 A B B' B'' F n (f x) (g x)
       end.

  Definition apply_to_range_under_args {A} {n} (f : Z -> nary_T A zrange n) (v : zrange) : nary_T A zrange n
    := let (l, u) := eta v in
       under_args2 union (f l) (f u).

  Definition apply_to_split_range_under_args {A} {n} (f : zrange -> nary_T A zrange n) (v : zrange) : nary_T A zrange n
    := match split_range_at_0 v with
       | (Some n, Some z, Some p) => under_args2 union (under_args2 union (f n) (f p)) (f z)
       | (Some v1, Some v2, None) | (Some v1, None, Some v2) | (None, Some v1, Some v2) => under_args2 union (f v1) (f v2)
       | (Some v, None, None) | (None, Some v, None) | (None, None, Some v) => f v
       | (None, None, None) => f v
       end.

  Definition apply_to_each_split_range_under_args {A} {n} (f : BinInt.Z -> nary_T A zrange n) (v : zrange) : nary_T A zrange n
    := apply_to_split_range_under_args (apply_to_range_under_args f) v.

  Fixpoint nary_is_bounded_by {n : nat} : nary_T Z Z n -> nary_T zrange zrange n -> Prop
    := match n return nary_T Z Z n -> nary_T zrange zrange n -> Prop with
       | O => fun z r => is_bounded_by_bool z r = true
       | S n
         => fun (f : Z -> nary_T Z Z n) (fb : zrange -> nary_T zrange zrange n)
            => forall z r, is_bounded_by_bool z r = true -> nary_is_bounded_by (f z) (fb r)
       end.

  Fixpoint n_corners {n : nat} : nary_T Z Z n -> nary_T zrange zrange n
    := match n with
       | O => constant
       | S n
         => fun (f : Z -> nary_T Z Z n) (v : zrange)
            => apply_to_range_under_args (fun x => n_corners (f x)) v
       end.

  Fixpoint n_corners_and_zero {n : nat} : nary_T Z Z n -> nary_T zrange zrange n
    := match n with
       | O => constant
       | S n
         => fun (f : Z -> nary_T Z Z n) (v : zrange)
            => apply_to_each_split_range_under_args (fun x => n_corners_and_zero (f x)) v
       end.

  Fixpoint apply_to_n_split_range {n : nat} : nary_T zrange zrange n -> nary_T zrange zrange n
    := match n with
       | O => fun x => x
       | S n
         => fun (f : zrange -> nary_T zrange zrange n) (v : zrange)
            => apply_to_n_split_range (apply_to_split_range_under_args f v)
       end.

  Definition two_corners (f : Z -> Z) (v : zrange) : zrange
    := apply_to_range (fun x => constant (f x)) v.
  Definition four_corners (f : Z -> Z -> Z) (x y : zrange) : zrange
    := apply_to_range (fun x => two_corners (f x) y) x.
  Definition eight_corners (f : Z -> Z -> Z -> Z) (x y z : zrange) : zrange
    := apply_to_range (fun x => four_corners (f x) y z) x.

  Definition two_corners_and_zero (f : Z -> Z) (v : zrange) : zrange
    := apply_to_each_split_range (fun x => constant (f x)) v.
  Definition four_corners_and_zero (f : Z -> Z -> Z) (x y : zrange) : zrange
    := apply_to_split_range (apply_to_range (fun x => two_corners_and_zero (f x) y)) x.
  Definition eight_corners_and_zero (f : Z -> Z -> Z -> Z) (x y z : zrange) : zrange
    := apply_to_split_range (apply_to_range (fun x => four_corners_and_zero (f x) y z)) x.

  Definition split_range_one (f : zrange -> zrange) : zrange -> zrange
    := apply_to_n_split_range (n := 1) f.
  Definition split_range_two (f : zrange -> zrange -> zrange) : zrange -> zrange -> zrange
    := apply_to_n_split_range (n := 2) f.

  Definition two_corners' (f : Z -> Z) (v : zrange) : zrange
    := normalize' (map f v).

  Lemma two_corners'_eq x y : two_corners x y = two_corners' x y.
Admitted.

  Definition extend_land_lor_bounds (v : zrange) : zrange
    := let (l, u) := eta v in
       r[ Z.min 0 l ~> Z.max (-1) u ].

  Definition land_lor_bounds (f : BinInt.Z -> BinInt.Z -> BinInt.Z) (x y : zrange) : zrange
    := four_corners_and_zero (fun x y => f (Z.round_lor_land_bound x) (Z.round_lor_land_bound y))
                             (extend_land_lor_bounds x) (extend_land_lor_bounds y).
Definition lor_bounds : zrange -> zrange -> zrange. exact (land_lor_bounds Z.lor). Defined.
Definition land_bounds (x y : zrange) : zrange. exact (let low := if ((lower x <? 0) && (lower y <? 0))%bool
                 then
                   let logx := Z.log2_up (-lower x) in
                   let logy := Z.log2_up (-lower y) in
                   - 2 ^ (Z.max logx logy)
                 else 0 in
      let high := if ((0 <=? lower x)%Z && (0 <=? lower y)%Z)%bool
                  then  
                    if ((0 <=? upper x)%Z && (0 <=? upper y)%Z)%bool
                    then Z.min (upper x) (upper y)
                    else  
                      Z.max (Z.max (lower x) (upper x))
                            (Z.max (lower y) (upper y))
                  else if ((upper x <? 0) && (upper y <? 0))%bool
                       then 0  
                       else Z.max (upper x) (upper y) in
      r[low~>high]). Defined.
Definition split_bounds_pos (r : zrange) (split_at : BinInt.Z) : zrange * zrange. exact (if upper r <? split_at
    then if (0 <=? lower r)%Z
         then (r, {| lower := 0; upper := 0 |})
         else ( {| lower := 0; upper := split_at - 1 |},
                {| lower := lower r / split_at; upper := (upper r / split_at) |} )
    else ( {| lower := 0; upper := split_at - 1 |},
           {| lower := lower r / split_at; upper := (upper r / split_at) |} )). Defined.
Definition split_bounds (r : zrange) (split_at : BinInt.Z) : zrange * zrange. exact (if (0 <? split_at)%Z
    then split_bounds_pos r split_at
    else if (split_at =? 0)%Z
         then (ltac:(match eval hnf in (1 mod 0) with | 0 => exact {| lower := 0; upper := 0 |} | _ => exact r end), {| lower := 0; upper := 0 |})
         else let '(q, r) := split_bounds_pos (opp r) (-split_at) in
              (opp q, r)). Defined.
Definition good (r : zrange) : Prop. exact (lower r <= upper r). Defined.
Definition goodb (r : zrange) : bool. exact ((lower r <=? upper r)%Z). Defined.
  Definition covers (rs : list zrange) (r : zrange)
    := forall z, is_bounded_by_bool z r = true -> exists r', is_bounded_by_bool z r' = true /\ List.In r' rs.

  Notation log2 := (ZRange.two_corners Z.log2).
  Notation log2_up := (ZRange.two_corners Z.log2_up).
  Notation add := (ZRange.four_corners Z.add).
  Notation sub := (ZRange.four_corners Z.sub).
  Notation mul := (ZRange.four_corners Z.mul).
  Notation div := (ZRange.four_corners_and_zero Z.div).
  Notation shiftr := (ZRange.four_corners_and_zero Z.shiftr).
  Notation shiftl := (ZRange.four_corners_and_zero Z.shiftl).
  Notation land := land_bounds.
  Notation lor := lor_bounds.
  Notation cc_m s := (ZRange.two_corners (Z.cc_m s)).

  Module Export ZRangeNotations.
    Notation "- x" := (opp x) : zrange_scope.
    Infix "+" := add : zrange_scope.
    Infix "-" := sub : zrange_scope.
    Infix "*" := mul : zrange_scope.
    Infix "/" := div : zrange_scope.
    Infix ">>" := shiftr : zrange_scope.
    Infix "<<" := shiftl : zrange_scope.
    Infix "&'" := land : zrange_scope.
     
    Notation "( x , y , .. , z )" := (pair .. (pair x%zrange y%zrange) .. z%zrange) : zrange_scope.
  End ZRangeNotations.
End ZRange.

Export ZRange.ZRangeNotations.

End Operations.

End Crypto_DOT_Util_DOT_ZRange_DOT_Operations_WRAPPED.
Module Export Crypto_DOT_Util_DOT_ZRange_DOT_Operations.
Module Export Crypto.
Module Export Util.
Module Export ZRange.
Module Export Operations.
Include Crypto_DOT_Util_DOT_ZRange_DOT_Operations_WRAPPED.Operations.
End Operations.

End ZRange.

End Util.

End Crypto.

End Crypto_DOT_Util_DOT_ZRange_DOT_Operations.

Import Coq.ZArith.BinInt.
Import Crypto.Util.ZRange.
Import Crypto.Util.ZRange.Operations.
Import Crypto.Util.ZUtil.Definitions.
Export Rewriter.Language.Pre.
Local Open Scope bool_scope.
Local Open Scope Z_scope.

Module Export ident.
  Section cast.
Definition is_more_pos_than_neg (r : zrange) (v : BinInt.Z) : bool.
Admitted.
Let cast_outside_of_range (r : zrange) (v : BinInt.Z) : BinInt.Z.
Admitted.

    Definition cast (r : zrange) (x : BinInt.Z)
      := let r := ZRange.normalize r in
         if (lower r <=? x) && (x <=? upper r)
         then x
         else if is_more_pos_than_neg r x
              then cast_outside_of_range r x
              else -cast_outside_of_range (-r) (-x).
    Definition cast2 (r : zrange * zrange) (x : BinInt.Z * BinInt.Z)
      := (cast (Datatypes.fst r) (Datatypes.fst x),
          cast (Datatypes.snd r) (Datatypes.snd x)).
  End cast.

  Section comment.
    Definition comment {A} (x : A) := tt.

    Definition comment_no_keep {A} (x : A) := tt.
  End comment.

  Module Export fancy.
    Module Export with_wordmax.
      Section with_wordmax.
        Context (log2wordmax : BinInt.Z).
Definition add (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition addc (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition sub (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition subb (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition mulll : Z * Z -> Z.
Admitted.
Definition mullh : Z * Z -> Z.
Admitted.
Definition mulhl : Z * Z -> Z.
Admitted.
Definition mulhh : Z * Z -> Z.
Admitted.
Definition selm : Z * Z * Z -> Z.
Admitted.
Definition rshi (n : Z) : Z * Z -> Z.
Admitted.
      End with_wordmax.
    End with_wordmax.

    Definition add : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.add] in fun x => with_wordmax.add (fst (fst x)) (snd (fst x)) (snd x).
    Definition addc : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.addc] in fun x => with_wordmax.addc (fst (fst x)) (snd (fst x)) (snd x).
    Definition sub : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.sub] in fun x => with_wordmax.sub (fst (fst x)) (snd (fst x)) (snd x).
    Definition subb : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.subb] in fun x => with_wordmax.subb (fst (fst x)) (snd (fst x)) (snd x).
    Definition mulll : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulll] in fun x => with_wordmax.mulll (fst x) (snd x).
    Definition mullh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mullh] in fun x => with_wordmax.mullh (fst x) (snd x).
    Definition mulhl : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhl] in fun x => with_wordmax.mulhl (fst x) (snd x).
    Definition mulhh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhh] in fun x => with_wordmax.mulhh (fst x) (snd x).
    Definition selm : Z * (Z * Z * Z) -> Z
      := Eval cbv [with_wordmax.selm] in fun x => with_wordmax.selm (fst x) (snd x).
    Definition rshi : (Z * Z) * (Z * Z) -> Z
      := Eval cbv [with_wordmax.rshi] in fun x => with_wordmax.rshi (fst (fst x)) (snd (fst x)) (snd x).
Definition selc : Z * Z * Z -> Z.
Admitted.
Definition sell : Z * Z * Z -> Z.
Admitted.
Definition addm : Z * Z * Z -> Z.
Admitted.

Notation prod_rect_nodep := Rewriter.Util.Prod.prod_rect_nodep (only parsing).
Notation nat_rect_arrow_nodep := Rewriter.Util.NatUtil.nat_rect_arrow_nodep (only parsing).
Notation list_rect_arrow_nodep := Rewriter.Util.ListUtil.list_rect_arrow_nodep (only parsing).
Notation bool_rect_nodep := Rewriter.Util.Bool.bool_rect_nodep (only parsing).

Module Export Thunked.
  Notation bool_rect := Rewriter.Util.Bool.Thunked.bool_rect (only parsing).
  Notation list_rect := Rewriter.Util.ListUtil.Thunked.list_rect (only parsing).
  Notation list_case := Rewriter.Util.ListUtil.Thunked.list_case (only parsing).
  Notation nat_rect := Rewriter.Util.NatUtil.Thunked.nat_rect (only parsing).
  Notation option_rect := Rewriter.Util.Option.Thunked.option_rect (only parsing).
Import Crypto.Util.ListUtil.
Import Coq.Lists.List.
Definition var_like_idents : InductiveHList.hlist.
Admitted.
Definition base_type_list_named : InductiveHList.hlist.
exact ([with_name Z BinInt.Z
      ; with_name bool Datatypes.bool
      ; with_name nat Datatypes.nat
      ; with_name zrange ZRange.zrange
      ; with_name string String.string]%hlist).
Defined.
Definition all_ident_named_interped : InductiveHList.hlist.
exact ([with_name ident_Literal (@ident.literal)
      ; with_name ident_comment (@ident.comment)
      ; with_name ident_comment_no_keep (@ident.comment_no_keep)
      ; with_name ident_value_barrier (@Z.value_barrier)
      ; with_name ident_Nat_succ Nat.succ
      ; with_name ident_Nat_pred Nat.pred
      ; with_name ident_Nat_max Nat.max
      ; with_name ident_Nat_mul Nat.mul
      ; with_name ident_Nat_add Nat.add
      ; with_name ident_Nat_sub Nat.sub
      ; with_name ident_Nat_eqb Nat.eqb
      ; with_name ident_nil (@Datatypes.nil)
      ; with_name ident_cons (@Datatypes.cons)
      ; with_name ident_tt Datatypes.tt
      ; with_name ident_pair (@Datatypes.pair)
      ; with_name ident_fst (@Datatypes.fst)
      ; with_name ident_snd (@Datatypes.snd)
      ; with_name ident_prod_rect (@prod_rect_nodep)
      ; with_name ident_bool_rect (@Thunked.bool_rect)
      ; with_name ident_bool_rect_nodep (@bool_rect_nodep)
      ; with_name ident_nat_rect (@Thunked.nat_rect)
      ; with_name ident_eager_nat_rect (ident.eagerly (@Thunked.nat_rect))
      ; with_name ident_nat_rect_arrow (@nat_rect_arrow_nodep)
      ; with_name ident_eager_nat_rect_arrow (ident.eagerly (@nat_rect_arrow_nodep))
      ; with_name ident_list_rect (@Thunked.list_rect)
      ; with_name ident_eager_list_rect (ident.eagerly (@Thunked.list_rect))
      ; with_name ident_list_rect_arrow (@list_rect_arrow_nodep)
      ; with_name ident_eager_list_rect_arrow (ident.eagerly (@list_rect_arrow_nodep))
      ; with_name ident_list_case (@Thunked.list_case)
      ; with_name ident_List_length (@List.length)
      ; with_name ident_List_seq (@List.seq)
      ; with_name ident_List_firstn (@List.firstn)
      ; with_name ident_List_skipn (@List.skipn)
      ; with_name ident_List_repeat (@repeat)
      ; with_name ident_List_combine (@List.combine)
      ; with_name ident_List_map (@List.map)
      ; with_name ident_List_app (@List.app)
      ; with_name ident_List_rev (@List.rev)
      ; with_name ident_List_flat_map (@List.flat_map)
      ; with_name ident_List_partition (@List.partition)
      ; with_name ident_List_filter (@List.filter)
      ; with_name ident_List_fold_right (@List.fold_right)
      ; with_name ident_List_update_nth (@update_nth)
      ; with_name ident_List_nth_default (@nth_default)
      ; with_name ident_eager_List_nth_default (ident.eagerly (@nth_default))
      ; with_name ident_Z_add Z.add
      ; with_name ident_Z_mul Z.mul
      ; with_name ident_Z_pow Z.pow
      ; with_name ident_Z_sub Z.sub
      ; with_name ident_Z_opp Z.opp
      ; with_name ident_Z_div Z.div
      ; with_name ident_Z_modulo Z.modulo
      ; with_name ident_Z_eqb Z.eqb
      ; with_name ident_Z_leb Z.leb
      ; with_name ident_Z_ltb Z.ltb
      ; with_name ident_Z_geb Z.geb
      ; with_name ident_Z_gtb Z.gtb
      ; with_name ident_Z_log2 Z.log2
      ; with_name ident_Z_log2_up Z.log2_up
      ; with_name ident_Z_of_nat Z.of_nat
      ; with_name ident_Z_to_nat Z.to_nat
      ; with_name ident_Z_shiftr Z.shiftr
      ; with_name ident_Z_shiftl Z.shiftl
      ; with_name ident_Z_land Z.land
      ; with_name ident_Z_lor Z.lor
      ; with_name ident_Z_min Z.min
      ; with_name ident_Z_max Z.max
      ; with_name ident_Z_mul_split Z.mul_split
      ; with_name ident_Z_mul_high Z.mul_high
      ; with_name ident_Z_add_get_carry Z.add_get_carry_full
      ; with_name ident_Z_add_with_carry Z.add_with_carry
      ; with_name ident_Z_add_with_get_carry Z.add_with_get_carry_full
      ; with_name ident_Z_sub_get_borrow Z.sub_get_borrow_full
      ; with_name ident_Z_sub_with_get_borrow Z.sub_with_get_borrow_full
      ; with_name ident_Z_ltz Z.ltz
      ; with_name ident_Z_zselect Z.zselect
      ; with_name ident_Z_add_modulo Z.add_modulo
      ; with_name ident_Z_truncating_shiftl Z.truncating_shiftl
      ; with_name ident_Z_bneg Z.bneg
      ; with_name ident_Z_lnot_modulo Z.lnot_modulo
      ; with_name ident_Z_lxor Z.lxor
      ; with_name ident_Z_rshi Z.rshi
      ; with_name ident_Z_cc_m Z.cc_m
      ; with_name ident_Z_combine_at_bitwidth Z.combine_at_bitwidth
      ; with_name ident_Z_cast ident.cast
      ; with_name ident_Z_cast2 ident.cast2
      ; with_name ident_Some (@Datatypes.Some)
      ; with_name ident_None (@Datatypes.None)
      ; with_name ident_option_rect (@Thunked.option_rect)
      ; with_name ident_Build_zrange ZRange.Build_zrange
      ; with_name ident_zrange_rect (@ZRange.zrange_rect_nodep)
      ; with_name ident_fancy_add ident.fancy.add
      ; with_name ident_fancy_addc ident.fancy.addc
      ; with_name ident_fancy_sub ident.fancy.sub
      ; with_name ident_fancy_subb ident.fancy.subb
      ; with_name ident_fancy_mulll ident.fancy.mulll
      ; with_name ident_fancy_mullh ident.fancy.mullh
      ; with_name ident_fancy_mulhl ident.fancy.mulhl
      ; with_name ident_fancy_mulhh ident.fancy.mulhh
      ; with_name ident_fancy_rshi ident.fancy.rshi
      ; with_name ident_fancy_selc ident.fancy.selc
      ; with_name ident_fancy_selm ident.fancy.selm
      ; with_name ident_fancy_sell ident.fancy.sell
      ; with_name ident_fancy_addm ident.fancy.addm
     ]%hlist).
Defined.
Definition scraped_data : ScrapedData.t.
exact ({| ScrapedData.base_type_list_named := base_type_list_named
        ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}).
Defined.

Declare ML Module "coq-rewriter.rewriter_build".
Import Crypto.Util.ListUtil.Filter.

Module Export Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.
  Rewriter Emit Inductives From Scraped
           {| ScrapedData.base_type_list_named := base_type_list_named ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}
           As base ident raw_ident pattern_ident.

  Definition package : GoalType.package_with_args scraped_data var_like_idents base ident.
  Proof.
Tactic.make_package.
Defined.
Module Export APINotations.
Import Ltac2.Ltac2.
Module Export Compilers.
  Export Reify.Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.Tactic.

  Definition exprInfo : Classes.ExprInfoT := Eval hnf in GoalType.exprInfo package.

  Global Existing Instances
         baseHasNat
         baseHasNatCorrect
         try_make_base_transport_cps_correct
         buildEagerIdent
         buildInterpEagerIdentCorrect
         toRestrictedIdent
         toFromRestrictedIdent
         buildInterpIdentCorrect
         invertIdent
         buildInvertIdentCorrect
         base_default
         exprInfo
  .
  Ltac2 mk_reify_base_type () :=
    let package := reify_package_of_package 'package in
    reify_base_type_via_reify_package package.
  Ltac2 mk_reify_type () :=
    let package := reify_package_of_package 'package in
    reify_type_via_reify_package package.
  Ltac2 mk_reify_ident_opt () :=
    let package := reify_package_of_package 'package in
    reify_ident_via_reify_package_opt package.
  Ltac2 reify_type (ty : constr) : constr := mk_reify_type () ty.
  #[deprecated(since="8.15",note="Use Ltac2 instead.")]
   Ltac reify_type term :=
    let f := ltac2:(term
                    |- Control.refine (fun () => reify_type (Option.get (Ltac1.to_constr term)))) in
    constr:(ltac:(f term)).

  Module Export base.

    Notation type := (@base.type base) (only parsing).
  
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted) (truncated to 8.0KiB; full 15KiB file on GitHub Actions Artifacts under tmp.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 350 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Expected coqc runtime on this file: 0.000 sec *)
Require Coq.Init.Ltac.
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Crypto.Util.Tactics.SubstEvars.
Require Crypto.Util.ListUtil.Filter.
Require Crypto.Language.IdentifierParameters.
Require Coq.Arith.Arith.
Require Coq.Arith.Peano_dec.
Require Coq.Bool.Bool.
Require Coq.Classes.CMorphisms.
Require Coq.Classes.Morphisms.
Require Coq.Classes.RelationClasses.
Require Coq.FSets.FMapPositive.
Require Coq.Lists.List.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.MSets.MSetFacts.
Require Coq.MSets.MSetPositive.
Require Coq.NArith.BinNat.
Require Coq.NArith.NArith.
Require Coq.Numbers.BinNums.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Program.Tactics.
Require Coq.Relations.Relation_Definitions.
Require Coq.Relations.Relations.
Require Coq.Setoids.Setoid.
Require Coq.Strings.Ascii.
Require Coq.Strings.String.
Require Coq.ZArith.BinInt.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.ZArith_dec.
Require Coq.derive.Derive.
Require Coq.micromega.Lia.
Require Ltac2.Init.
Require Rewriter.Util.Comparison.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.HProp.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.Tactics.CPSId.
Require Rewriter.Util.Tactics.ClearFree.
Require Rewriter.Util.Tactics.ConstrFail.
Require Rewriter.Util.Tactics.Contains.
Require Rewriter.Util.Tactics.EvarNormalize.
Require Rewriter.Util.Tactics.GetGoal.
Require Rewriter.Util.Tactics.PrintContext.
Require Rewriter.Util.Tactics.SetEvars.
Require Rewriter.Util.Tactics.SubstEvars.
Require Rewriter.Util.Tactics.Test.
Require Rewriter.Util.Tactics.TransparentAssert.
Require Rewriter.Util.TypeList.
Require Rewriter.Util.plugins.StrategyTactic.
Require Ltac2.Bool.
Require Ltac2.Constant.
Require Ltac2.Constr.
Require Ltac2.Constructor.
Require Ltac2.Evar.
Require Ltac2.FSet.
Require Ltac2.Float.
Require Ltac2.Ident.
Require Ltac2.Ind.
Require Ltac2.Int.
Require Ltac2.Ltac1.
Require Ltac2.Message.
Require Ltac2.Meta.
Require Ltac2.Proj.
Require Ltac2.Std.
Require Ltac2.String.
Require Ltac2.Uint63.
Require Rewriter.Util.Bool.Equality.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Pointed.
Require Rewriter.Util.Tactics.DebugPrint.
Require Rewriter.Util.Tactics.Not.
Require Rewriter.Util.Tactics.PrintGoal.
Require Rewriter.Util.Tactics.SetoidSubst.
Require Ltac2.Char.
Require Ltac2.Control.
Require Ltac2.Env.
Require Ltac2.FMap.
Require Ltac2.Printf.
Require Rewriter.Util.Bool.
Require Rewriter.Util.FixCoqMistakes.
Require Rewriter.Util.Tactics.CacheTerm.
Require Rewriter.Util.Tactics.WarnIfGoalsRemain.
Require Ltac2.Option.
Require Ltac2.Pattern.
Require Rewriter.Util.Equality.
Require Rewriter.Util.Logic.ProdForall.
Require Rewriter.Util.Notations.
Require Rewriter.Util.Sigma.Related.
Require Rewriter.Util.Tactics.DestructHyps.
Require Rewriter.Util.Tactics.FindHyp.
Require Rewriter.Util.Tactics.Head.
Require Rewriter.Util.Tactics.HeadUnderBinders.
Require Rewriter.Util.Tactics.RunTacticAsConstr.
Require Rewriter.Util.Tactics.SpecializeBy.
Require Rewriter.Util.Tactics.SplitInContext.
Require Rewriter.Util.CPSNotations.
Require Rewriter.Util.Tactics.BreakMatch.
Require Rewriter.Util.Tactics.UniquePose.
Require Ltac2.Array.
Require Ltac2.List.
Require Rewriter.Util.Sigma.
Require Rewriter.Util.Tactics.DestructHead.
Require Rewriter.Util.Tactics.DoWithHyp.
Require Rewriter.Util.Tactics.SpecializeAllWays.
Require Ltac2.Fresh.
Require Rewriter.Util.LetIn.
Require Rewriter.Util.Tactics.RewriteHyp.
Require Rewriter.Util.Logic.ExistsEqAnd.
Require Rewriter.Util.NatUtil.
Require Rewriter.Util.PrimitiveProd.
Require Ltac2.Notations.
Require Rewriter.Util.Option.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.PrimitiveSigma.
Require Rewriter.Util.Prod.
Require Rewriter.Util.OptionList.
Require Rewriter.Util.Decidable.
Require Rewriter.Util.ListUtil.SetoidList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Util.ListUtil.Forall.
Require Rewriter.Language.Pre.
Require Rewriter.Util.FMapPositive.Equality.
Require Rewriter.Util.MSetPositive.Equality.
Require Rewriter.Util.MSetPositive.Facts.
Require Rewriter.Util.Sum.
Require Ltac2.Ltac2.
Require Rewriter.Util.plugins.Ltac2Extra.
Require Rewriter.Util.Tactics2.Array.
Require Rewriter.Util.Tactics2.Char.
Require Rewriter.Util.Tactics2.Constr.Unsafe.MakeAbbreviations.
Require Rewriter.Util.Tactics2.DestEvar.
Require Rewriter.Util.Tactics2.FixNotationsForPerformance.
Require Rewriter.Util.Tactics2.Head.
Require Rewriter.Util.Tactics2.Ident.
Require Rewriter.Util.Tactics2.InstantiateEvar.
Require Rewriter.Util.Tactics2.Iterate.
Require Rewriter.Util.Tactics2.List.
Require Rewriter.Util.Tactics2.Ltac1.
Require Rewriter.Util.Tactics2.Message.
Require Rewriter.Util.Tactics2.Notations.
Require Rewriter.Util.Tactics2.Option.
Require Rewriter.Util.Tactics2.Proj.
Require Rewriter.Util.Tactics2.HeadReference.
Require Rewriter.Util.Tactics2.InFreshContext.
Require Rewriter.Util.Tactics2.String.
Require Rewriter.Util.Tactics2.Constr.
Require Rewriter.Util.Tactics2.DecomposeLambda.
Require Rewriter.Util.ListUtil.
Require Rewriter.Util.Tactics2.ReplaceByPattern.
Require Rewriter.Language.PreLemmas.
Require Rewriter.Util.Bool.Reflect.
Require Rewriter.Language
Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.4MiB file on GitHub Actions Artifacts under build.log)
_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.gqoV755tm9
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.64ebX6p4ab
MINIMIZER_DEBUG: files: 
make --no-print-directory -C bedrock2/bedrock2 noex
Generating Makefile.coq.noex
rm -f .coqdeps.d
make -f Makefile.coq.noex
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.8QCUrORMkq
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.Qr2swkL2IG
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.kgxaBN9O1E
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.CVIapVZmUu
MINIMIZER_DEBUG: files: 
rm -f .coqdeps.d
make -f Makefile.coq
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.GLjTdy7dDL
MINIMIZER_DEBUG: files: 
COQDEP VFILES
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.4coP9mW2Jc
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.BMmnHWvjKx
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.mzOfkBD6xN
MINIMIZER_DEBUG: files: 
make[4]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.B2gUMefbrD
MINIMIZER_DEBUG: files: 
COQC src/PushButtonSynthesis/Primitives.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -w +implicit-core-hint-db\,+implicits-in-term\,+non-reversible-notation\,+deprecated-intros-until-0\,+deprecated-focus\,+unused-intro-pattern\,+variable-collision\,+unexpected-implicit-declaration\,+omega-is-deprecated\,+deprecated-instantiate-syntax\,+non-recursive\,+undeclared-scope\,+deprecated-hint-rewrite-without-locality\,+deprecated-hint-without-locality\,+deprecated-instance-without-locality\,+deprecated-typeclasses-transparency-without-locality\,unsupported-attributes -w -notation-overridden\,-deprecated-hint-constr\,-fragile-hint-constr\,-native-compiler-disabled\,-ambiguous-paths\,-masking-absolute-name -w -deprecated-native-compiler-option -native-compiler ondemand -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil coqutil -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola Rupicola -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2 bedrock2 -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src Crypto src/PushButtonSynthesis/Primitives.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.rSSBl8dfzf
MINIMIZER_DEBUG: files:  src/PushButtonSynthesis/Primitives.v
Finished failing transaction in 0.082 secs (0.071u,0.011s) (failure)
File "./src/PushButtonSynthesis/Primitives.v", line 93, characters 12-26:
Error: Some unresolved existential variables remain

Command exited with non-zero status 1
src/PushButtonSynthesis/Primitives.vo (real: 2.81, user: 2.39, sys: 0.41, mem: 1022240 ko)
Makefile.coq:809: recipe for target 'src/PushButtonSynthesis/Primitives.vo' failed
make[1]: *** [src/PushButtonSynthesis/Primitives.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto'
Aggregating timing log...
    Time |   Peak Mem | File Name                        
---------------------------------------------------------
0m02.39s | 1022240 ko | Total Time / Peak Mem            
---------------------------------------------------------
0m02.39s | 1022240 ko | PushButtonSynthesis/Primitives.vo
Makefile.ci:151: recipe for target 'ci-fiat_crypto' failed
make: *** [ci-fiat_crypto] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 494KiB file on GitHub Actions Artifacts under bug.log)
lib/coq/user-contrib/Coqprime Coqprime -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Ltac2 Ltac2 -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Rewriter Rewriter -top Top.bug_01 -o /tmp/bug_01.vo -dump-glob bug_01.glob bug_01.v
getting bug_01.glob (/github/workspace/cwd/bug_01.glob)
getting bug_01.glob (/github/workspace/cwd/bug_01.glob)
�[92m
Succeeded in normalizing Requires.�[0m

Now, I will attempt to split up [Require] statements...
getting /github/workspace/cwd/bug_01.v
getting /github/workspace/cwd/bug_01.glob
getting /github/workspace/cwd/bug_01.glob

No Requires to split.

In order to efficiently manipulate the file, I have to break it into statements.  I will attempt to do this by matching on periods.
�[92m
Splitting successful.�[0m

I will now attempt to remove any lines after the line which generates the error.

No lines to trim.

In order to efficiently manipulate the file, I have to break it into definitions.  I will now attempt to do this.
Sending statements to coqtop...
Done.  Splitting to definitions...
�[92m
Splitting to definitions successful.�[0m

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmpfnmw8oax/Top/bug_01.v", line 401, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpfnmw8oax/Top/bug_01.v", line 448, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpfnmw8oax/Top/bug_01.v", line 401, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpfnmw8oax/Top/bug_01.v", line 448, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Qed Obligation with Admit Obligations
�[92m
Admitting Qed Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qed Obligations unsuccessful.
No successful changes.

I will now attempt to replace Qeds with Admitteds
�[92m
Admitting Qeds successful.�[0m
Success!

I will now attempt to replace Qeds with admit. Defined.
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmp5g4qcdds/Top/bug_01.v", line 397, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp5g4qcdds/Top/bug_01.v", line 444, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmp5g4qcdds/Top/bug_01.v", line 397, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp5g4qcdds/Top/bug_01.v", line 444, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmp5g4qcdds/Top/bug_01.v", line 397, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp5g4qcdds/Top/bug_01.v", line 444, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmp5g4qcdds/Top/bug_01.v", line 397, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp5g4qcdds/Top/bug_01.v", line 444, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted
�[92m
Admitting lemmas successful.�[0m
Success!

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpqp8z3pdw/Top/bug_01.v", line 503, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpqp8z3pdw/Top/bug_01.v", line 604, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpzuc50v72/Top/bug_01.v", line 503, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpzuc50v72/Top/bug_01.v", line 607, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

cc @JasonGross

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 9, 2023

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src/PushButtonSynthesis/Primitives.v (from ci-fiat_crypto) (interrupted by timeout, being automatically continued) (full log on GitHub Actions)

Partially Minimized Coq File (could not inline Rewriter.Util.plugins.RewriterBuildRegistry) (truncated to 32KiB; full 145KiB file on GitHub Actions Artifacts under bug.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Modules that could not be inlined: Rewriter.Util.plugins.RewriterBuildRegistry
   Expected coqc runtime on this file: 12.181 sec *)
Require Coq.Init.Ltac.
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Crypto.Util.Tactics.SubstEvars.
Require Crypto.Util.ListUtil.Filter.
Require Crypto.Util.ZUtil.Definitions.
Require Coq.Arith.Arith.
Require Coq.Arith.Peano_dec.
Require Coq.Bool.Bool.
Require Coq.Classes.Morphisms.
Require Coq.Classes.RelationClasses.
Require Coq.Lists.List.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.NArith.BinNat.
Require Coq.NArith.NArith.
Require Coq.Numbers.BinNums.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Relations.Relation_Definitions.
Require Coq.Setoids.Setoid.
Require Coq.ZArith.BinInt.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.ZArith_dec.
Require Coq.micromega.Lia.
Require Crypto.Util.GlobalSettings.
Require Crypto.Util.HProp.
Require Crypto.Util.Isomorphism.
Require Crypto.Util.Tactics.ConstrFail.
Require Crypto.Util.Tactics.Test.
Require Crypto.Util.IffT.
Require Crypto.Util.Pointed.
Require Crypto.Util.Tactics.Not.
Require Crypto.Util.FixCoqMistakes.
Require Crypto.Util.Equality.
Require Crypto.Util.Notations.
Require Crypto.Util.Tactics.DestructHyps.
Require Crypto.Util.Tactics.Head.
Require Crypto.Util.Tactics.SpecializeBy.
Require Crypto.Util.Tactics.SplitInContext.
Require Crypto.Util.Tactics.BreakMatch.
Require Crypto.Util.Sigma.
Require Crypto.Util.Tactics.DestructHead.
Require Crypto.Util.Tactics.DoWithHyp.
Require Crypto.Util.Tactics.RewriteHyp.
Require Crypto.Util.NatUtil.
Require Crypto.Util.Option.
Require Crypto.Util.Prod.
Require Crypto.Util.Decidable.

Module Crypto_DOT_Util_DOT_ListUtil_WRAPPED.
Module ListUtil.
Import Coq.Lists.List.
Import Coq.Lists.SetoidList.
Import Coq.micromega.Lia.
Import Coq.Arith.Peano_dec.
Import Coq.ZArith.ZArith.
Import Coq.Arith.Arith.
Import Coq.Classes.Morphisms.
Import Coq.Numbers.Natural.Peano.NPeano.
Import Crypto.Util.NatUtil.
Import Crypto.Util.Pointed.
Import Crypto.Util.Prod.
Import Crypto.Util.Decidable.
Export Crypto.Util.FixCoqMistakes.
Export Crypto.Util.Tactics.BreakMatch.
Export Crypto.Util.Tactics.DestructHead.
Import Crypto.Util.Tactics.SpecializeBy.
Import Crypto.Util.Tactics.RewriteHyp.
Import Crypto.Util.Tactics.ConstrFail.
Import Crypto.Util.Tactics.SplitInContext.
Import ListNotations.
Local Open Scope list_scope.

Scheme Equality for list.

Definition list_case
           {A} (P : list A -> Type) (N : P nil) (C : forall x xs, P (cons x xs))
           (ls : list A)
  : P ls
  := match ls return P ls with
     | nil => N
     | cons x xs => C x xs
     end.

Definition list_case_nodep
           {A} (P : Type) (N : P) (C : A -> list A -> P)
           (ls : list A)
  : P
  := match ls with
     | nil => N
     | cons x xs => C x xs
     end.

Global Instance list_rect_Proper_dep_gen {A P} (RP : forall x : list A, P x -> P x -> Prop)
  : Proper (RP nil ==> forall_relation (fun x => forall_relation (fun xs => RP xs ==> RP (cons x xs))) ==> forall_relation RP) (@list_rect A P) | 10.
Proof.
  cbv [forall_relation respectful]; intros N N' HN C C' HC ls.
  induction ls as [|l ls IHls]; cbn [list_rect];
    repeat first [ apply IHls | apply HC | apply HN | progress intros | reflexivity ].
Qed.
Global Instance list_rect_Proper_dep {A P} : Proper (eq ==> forall_relation (fun _ => forall_relation (fun _ => forall_relation (fun _ => eq))) ==> forall_relation (fun _ => eq)) (@list_rect A P) | 1.
Proof.
  cbv [forall_relation respectful Proper]; intros; eapply (@list_rect_Proper_dep_gen A P (fun _ => eq)); cbv [forall_relation respectful]; intros; subst; eauto.
Qed.
Global Instance list_rect_arrow_Proper_dep {A P Q} : Proper ((eq ==> eq) ==> forall_relation (fun _ => forall_relation (fun _ => (eq ==> eq) ==> (eq ==> eq))) ==> forall_relation (fun _ => eq ==> eq)) (@list_rect A (fun x => P x -> Q x)) | 10.
Proof.
  cbv [forall_relation respectful Proper]; intros; eapply (@list_rect_Proper_dep_gen A (fun x => P x -> Q x) (fun _ => eq ==> eq)%signature); intros; subst; eauto.
Qed.
Global Instance list_case_Proper_dep {A P} : Proper (eq ==> forall_relation (fun _ => forall_relation (fun _ => eq)) ==> forall_relation (fun _ => eq)) (@list_case A P) | 1.
Proof.
  cbv [forall_relation]; intros N N' ? C C' HC ls; subst N'; revert N; destruct ls; eauto.
Qed.
Global Instance list_rect_Proper_gen {A P} R
  : Proper (R ==> (eq ==> eq ==> R ==> R) ==> eq ==> R) (@list_rect A (fun _ => P)) | 10.
Proof.
repeat intro; subst; apply (@list_rect_Proper_dep_gen A (fun _ => P) (fun _ => R)); cbv [forall_relation respectful] in *; eauto.
Qed.
Global Instance list_rect_Proper {A P} : Proper (eq ==> pointwise_relation _ (pointwise_relation _ (pointwise_relation _ eq)) ==> eq ==> eq) (@list_rect A (fun _ => P)).
Proof.
repeat intro; subst; apply (@list_rect_Proper_dep A (fun _ => P)); eauto.
Qed.
Global Instance list_rect_arrow_Proper {A P Q}
  : Proper ((eq ==> eq) ==> (eq ==> eq ==> (eq ==> eq) ==> eq ==> eq) ==> eq ==> eq ==> eq)
           (@list_rect A (fun _ => P -> Q)) | 10.
Proof.
eapply list_rect_Proper_gen.
Qed.
Global Instance list_case_Proper {A P} : Proper (eq ==> pointwise_relation _ (pointwise_relation _ eq) ==> eq ==> eq) (@list_case A (fun _ => P)).
Proof.
repeat intro; subst; apply (@list_case_Proper_dep A (fun _ => P)); eauto.
Qed.

Create HintDb distr_length discriminated.
Create HintDb simpl_set_nth discriminated.
Create HintDb simpl_update_nth discriminated.
Create HintDb simpl_nth_default discriminated.
Create HintDb simpl_nth_error discriminated.
Create HintDb simpl_firstn discriminated.
Create HintDb simpl_skipn discriminated.
Create HintDb simpl_fold_right discriminated.
Create HintDb simpl_fold_left discriminated.
Create HintDb simpl_sum_firstn discriminated.
Create HintDb push_map discriminated.
Create HintDb push_combine discriminated.
Create HintDb push_flat_map discriminated.
Create HintDb push_rev discriminated.
Create HintDb push_fold_right discriminated.
Create HintDb push_fold_left discriminated.
Create HintDb push_partition discriminated.
Create HintDb pull_nth_error discriminated.
Create HintDb push_nth_error discriminated.
Create HintDb pull_nth_default discriminated.
Create HintDb push_nth_default discriminated.
Create HintDb pull_firstn discriminated.
Create HintDb push_firstn discriminated.
Create HintDb pull_skipn discriminated.
Create HintDb push_skipn discriminated.
Create HintDb push_sum discriminated.
Create HintDb pull_update_nth discriminated.
Create HintDb push_update_nth discriminated.
Create HintDb znonzero discriminated.

#[global]
Hint Rewrite
  @app_length
  @rev_length
  @map_length
  @seq_length
  @fold_left_length
  @split_length_l
  @split_length_r
  @firstn_length
  @combine_length
  @prod_length
  : distr_length.

#[global]
Hint Rewrite
     rev_involutive
  : push_rev.

Global Hint Extern 1 => progress autorewrite with distr_length in * : distr_length.
Ltac distr_length := autorewrite with distr_length in *;
  try solve [simpl in *; intros; (idtac + exfalso); lia].

Module Export List.
  Local Set Implicit Arguments.
  Import ListNotations.
   

  Section Elts.
    Variable A : Type.

     

    Lemma nth_error_In l n (x : A) : nth_error l n = Some x -> In x l.
    Proof using Type.
      revert n.
induction l as [|a l IH]; intros [|n]; simpl; try easy.
      - injection 1; auto.
      - eauto.
    Qed.
  End Elts.

  Section Map.
    Variables (A : Type) (B : Type).
    Variable f : A -> B.

    Lemma map_nil : forall A B (f : A -> B), map f nil = nil.
    Proof using Type.
reflexivity.
Qed.
    Lemma map_cons (x:A)(l:list A) : map f (x::l) = (f x) :: (map f l).
    Proof using Type.
      reflexivity.
    Qed.
    Lemma map_repeat x n : map f (List.repeat x n) = List.repeat (f x) n.
    Proof using Type.
induction n; simpl List.repeat; simpl map; congruence.
Qed.
  End Map.
#[global]
  Hint Rewrite @map_cons @map_nil @map_repeat : push_map.
#[global]
  Hint Rewrite @map_app : push_map.

  Section FlatMap.
    Lemma flat_map_nil {A B} (f:A->list B) : List.flat_map f (@nil A) = nil.
    Proof.
reflexivity.
Qed.
    Lemma flat_map_cons {A B} (f:A->list B) x xs :
      (List.flat_map f (x::xs) = (f x++List.flat_map f xs))%list.
    Proof.
reflexivity.
Qed.
  End FlatMap.
#[global]
  Hint Rewrite @flat_map_cons @flat_map_nil : push_flat_map.

  Lemma rev_cons {A} x ls : @rev A (x :: ls) = rev ls ++ [x].
Proof.
reflexivity.
Qed.
#[global]
  Hint Rewrite @rev_cons : list.

  Section FoldRight.
    Context {A B} (f:B->A->A).
    Lemma fold_right_nil : forall {A B} (f:B->A->A) a,
        List.fold_right f a nil = a.
    Proof using Type.
reflexivity.
Qed.
    Lemma fold_right_cons : forall a b bs,
      fold_right f a (b::bs) = f b (fold_right f a bs).
    Proof using Type.
reflexivity.
Qed.
    Lemma fold_right_snoc a x ls:
      @fold_right A B f a (ls ++ [x]) = fold_right f (f x a) ls.
    Proof using Type.
      rewrite <-(rev_involutive ls), <-rev_cons.
      rewrite !fold_left_rev_right; reflexivity.
    Qed.
  End FoldRight.
#[global]
  Hint Rewrite @fold_right_nil @fold_right_cons @fold_right_snoc : simpl_fold_right push_fold_right.

  Section Partition.
    Lemma partition_nil {A} (f:A->_) : partition f nil = (nil, nil).
    Proof.
reflexivity.
                                        Qed.
    Lemma partition_cons {A} (f:A->_) x xs : partition f (x::xs) =
                                             if f x
                                             then (x :: (fst (partition f xs)), (snd (partition f xs)))
                                             else ((fst (partition f xs)), x :: (snd (partition f xs))).
    Proof.
cbv [partition]; break_match; reflexivity.
          Qed.
  End Partition.
#[global]
  Hint Rewrite @partition_nil @partition_cons : push_partition.

  Lemma in_seq len start n :
    In n (seq start len) <-> start <= n < start+len.
  Proof.
   revert start.
induction len as [|len IHlen]; simpl; intros.
   - rewrite <- plus_n_O.
split;[easy|].
     intros (H,H').
apply (Lt.lt_irrefl _ (Lt.le_lt_trans _ _ _ H H')).
   - rewrite IHlen, <- plus_n_Sm; simpl; split.
     * intros [H|H]; subst; intuition auto with arith.
     * intros (H,H').
destruct (Lt.le_lt_or_eq _ _ H); intuition.
  Qed.

  Section Facts.

    Variable A : Type.

    Theorem length_zero_iff_nil (l : list A):
      length l = 0 <-> l=[].
    Proof using Type.
      split; [now destruct l | now intros ->].
    Qed.
  End Facts.

  Section Cutting.

    Variable A : Type.

    Local Notation firstn := (@firstn A).

    Lemma firstn_nil n: firstn n [] = [].
    Proof using Type.
induction n; now simpl.
Qed.

    Lemma firstn_cons n a l: firstn (S n) (a::l) = a :: (firstn n l).
    Proof using Type.
now simpl.
Qed.

    Lemma firstn_all l: firstn (length l) l = l.
    Proof using Type.
induction l as [| ? ? H]; simpl; [reflexivity | now rewrite H].
Qed.

    Lemma firstn_all2 n: forall (l:list A), (length l) <= n -> firstn n l = l.
    Proof using Type.
induction n as [|k iHk].
           - intro l.
inversion 1 as [H1|?].
             rewrite (length_zero_iff_nil l) in H1.
subst.
now simpl.
           - destruct l as [|x xs]; simpl.
             * now reflexivity.
             * simpl.
intro H.
apply Peano.le_S_n in H.
f_equal.
apply iHk, H.
    Qed.

    Lemma firstn_O l: firstn 0 l = [].
    Proof using Type.
now simpl.
Qed.

    Lemma firstn_le_length n: forall l:list A, length (firstn n l) <= n.
    Proof using Type.
      induction n as [|k iHk]; simpl; [auto | destruct l as [|x xs]; simpl].
      - auto with arith.
      - apply le_n_S, iHk.
    Qed.

    Lemma firstn_length_le: forall l:list A, forall n:nat,
          n <= length l -> length (firstn n l) = n.
    Proof using Type.
induction l as [|x xs Hrec].
           - simpl.
intros n H.
apply le_n_0_eq in H.
rewrite <- H.
now simpl.
           - destruct n as [|n].
             * now simpl.
             * simpl.
intro H.
apply le_S_n in H.
now rewrite (Hrec n H).
    Qed.

    Lemma firstn_app n:
      forall l1 l2,
        firstn n (l1 ++ l2) = (firstn n l1) ++ (firstn (n - length l1) l2).
    Proof using Type.
induction n as [|k iHk]; intros l1 l2.
           - now simpl.
           - destruct l1 as [|x xs].
             * unfold List.firstn at 2, length.
now rewrite 2!app_nil_l, <- minus_n_O.
             * rewrite <- app_comm_cons.
simpl.
f_equal.
apply iHk.
    Qed.

    Lemma firstn_app_2 n:
      forall l1 l2,
        firstn ((length l1) + n) (l1 ++ l2) = l1 ++ firstn n l2.
    Proof using Type.
induction n as [| k iHk];intros l1 l2.
           - unfold List.firstn at 2.
rewrite <- plus_n_O, app_nil_r.
             rewrite firstn_app.
rewrite <- minus_diag_reverse.
             unfold List.firstn at 2.
rewrite app_nil_r.
apply firstn_all.
           - destruct l2 as [|x xs].
             * simpl.
rewrite app_nil_r.
apply firstn_all2.
auto with arith.
             * rewrite firstn_app.
assert (H0 : (length l1 + S k - length l1) = S k).
               auto with arith.
               rewrite H0, firstn_all2; [reflexivity | auto with arith].
    Qed.

    Lemma firstn_firstn:
      forall l:list A,
      forall i j : nat,
        firstn i (firstn j l) = firstn (min i j) l.
    Proof using Type.
induction l as [|x xs Hl].
           - intros.
simpl.
now rewrite ?firstn_nil.
           - destruct i.
             * intro.
now simpl.
             * destruct j.
             + now simpl.
             + simpl.
f_equal.
apply Hl.
    Qed.

  End Cutting.

  Lemma fold_right_rev_left A B (f : B -> A -> B) (l : list A) (i : B)
    : fold_left f (rev l) i = fold_right (fun x y => f y x) i l.
  Proof.
    now rewrite <- fold_left_rev_right, rev_involutive.
  Qed.

  Section FoldLeft.
    Context {A B} (f:A->B->A).
    Lemma fold_left_nil : forall {A B} (f:A->B->A) a,
        List.fold_left f nil a = a.
    Proof using Type.
reflexivity.
Qed.
    Lemma fold_left_cons : forall a b bs,
      fold_left f (b::bs) a = fold_left f bs (f a b).
    Proof using Type.
reflexivity.
Qed.
    Lemma fold_left_snoc a x ls:
      @fold_left A B f (ls ++ [x]) a = f (fold_left f ls a) x.
    Proof using Type.
      rewrite <-(rev_involutive ls), <-rev_cons.
      rewrite !fold_right_rev_left; reflexivity.
    Qed.
  End FoldLeft.
#[global]
  Hint Rewrite @fold_left_nil @fold_left_cons @fold_left_snoc : simpl_fold_left push_fold_left.

   
  Definition enumerate {A} (ls : list A) : list (nat * A)
    := combine (seq 0 (length ls)) ls.
End List.

#[global]
Hint Rewrite @firstn_skipn : simpl_firstn.
#[global]
Hint Rewrite @firstn_skipn : simpl_skipn.
#[global]
Hint Rewrite @firstn_nil @firstn_cons @List.firstn_all @firstn_O @firstn_app_2 @List.firstn_firstn : push_firstn.
#[global]
Hint Rewrite @firstn_nil @firstn_cons @List.firstn_all @firstn_O @firstn_app_2 @List.firstn_firstn : simpl_firstn.
#[global]
Hint Rewrite @firstn_app : push_firstn.
#[global]
Hint Rewrite <- @firstn_cons @firstn_app @List.firstn_firstn : pull_firstn.
#[global]
Hint Rewrite @firstn_all2 @removelast_firstn @firstn_removelast using lia : push_firstn.
#[global]
Hint Rewrite @firstn_all2 @removelast_firstn @firstn_removelast using lia : simpl_firstn.

Local Arguments value / _ _.
Local Arguments error / _.

Definition list_beq_hetero {A B} (f : A -> B -> bool)
  := fix list_beq_hetero (l1 : list A) (l2 : list B) : bool
       := match l1, l2 with
          | [], [] => true
          | [], _ | _, [] => false
          | x :: xs, y :: ys => f x y && list_beq_hetero xs ys
          end%bool.

Definition sum_firstn l n := fold_right Z.add 0%Z (firstn n l).

Definition sum xs := sum_firstn xs (length xs).

Section map2.
  Context {A B C}
          (f : A -> B -> C).

  Fixpoint map2 (la : list A) (lb : list B) : list C :=
    match la, lb with
    | nil, _ => nil
    | _, nil => nil
    | a :: la', b :: lb'
      => f a b :: map2 la' lb'
    end.
End map2.

 
Fixpoint update_nth {T} n f (xs:list T) {struct n} :=
        match n with
        | O => match xs with
                                 | nil => nil
                                 | x'::xs' => f x'::xs'
                                 end
        | S n' =>  match xs with
                                 | nil => nil
                                 | x'::xs' => x'::update_nth n' f xs'
                                 end
  end.

 
Definition set_nth {T} n x (xs:list T)
  := update_nth n (fun _ => x) xs.

Definition splice_nth {T} n (x:T) xs := firstn n xs ++ x :: skipn (S n) xs.
#[global]
Hint Unfold splice_nth : core.

Fixpoint take_while {T} (f : T -> bool) (ls : list T) : list T
  := match ls with
     | nil => nil
     | cons x xs => if f x then x :: @take_while T f xs else nil
     end.

Fixpoint drop_while {T} (f : T -> bool) (ls : list T) : list T
  := match ls with
     | nil => nil
     | cons x xs => if f x then @drop_while T f xs else x :: xs
     end.
Ltac boring :=
  simpl; intuition auto with zarith datatypes;
  repeat match goal with
           | [ H : _ |- _ ] => rewrite H; clear H
           | [ |- context[match ?pf with end] ] => solve [ case pf ]
           | _ => progress autounfold in *
           | _ => progress autorewrite with core
           | _ => progress simpl in *
           | _ => progress intuition auto with zarith datatypes
         end; eauto.

Ltac boring_list :=
  repeat match goal with
         | _ => progress boring
         | _ => progress autorewrite with distr_length simpl_nth_default simpl_update_nth simpl_set_nth simpl_nth_error in *
         end.

Section Relations.
  Fixpoint list_eq {A B} eq (x : list A) (y : list B) :=
    match x, y with
    | [], [] => True
    | [], _ | _, [] => False
    | x :: xs, y :: ys => eq x y /\ list_eq eq xs ys
    end.

  Local Ltac t :=
    repeat first [ progress cbn in *
                 | progress break_match
                 | intro
                 | intuition congruence
                 | progress destruct_head'_and
                 | solve [ apply reflexivity
                         | apply symmetry; eassumption
                         | eapply transitivity; eassumption
                         | eauto ] ].

  Fixpoint list_eq_refl {T} {R} {Reflexive_R:@Reflexive T R} (ls : list T) : list_eq R ls ls.
  Proof.
destruct ls; cbn; repeat split; auto.
Defined.
  Global Instance Reflexive_list_eq {T} {R} {Reflexive_R:@Reflexive T R}
    : Reflexive (list_eq R) | 1
    := list_eq_refl.

  Lemma list_eq_sym {A B} {R1 R2 : _ -> _ -> Prop} (HR : forall v1 v2, R1 v1 v2 -> R2 v2 v1)
    : forall v1 v2, @list_eq A B R1 v1 v2 -> list_eq R2 v2 v1.
  Proof.
induction v1; t.
Qed.

  Lemma list_eq_trans {A B C} {R1 R2 R3 : _ -> _ -> Prop}
        (HR : forall v1 v2 v3, R1 v1 v2 -> R2 v2 v3 -> R3 v1 v3)
    : forall v1 v2 v3, @list_eq A B R1 v1 v2 -> @list_eq B C R2 v2 v3 -> @list_eq A C R3 v1 v3.
  Proof.
induction v1; t.
Qed.

  Global Instance Transitive_list_eq {T} {R} {Transitive_R:@Transitive T R}
    : Transitive (list_eq R) | 1 := list_eq_trans Transitive_R.

  Global Instance Symmetric_list_eq {T} {R} {Symmetric_R:@Symmetric T R}
    : Symmetric (list_eq R) | 1 := list_eq_sym Symmetric_R.

  Global Instance Equivalence_list_eq {T} {R} {Equivalence_R:@Equivalence T R}
    : Equivalence (list_eq R).
Proof.
split; exact _.
Qed.
End Relations.

Definition list_leq_to_eq {A} {x y : list A} : x = y -> list_eq eq x y.
Proof.
destruct 1; reflexivity.
Defined.

Fixpoint list_eq_to_leq {A} {x y : list A} {struct x} : list_eq eq x y -> x = y.
Proof.
  destruct x, y; cbn; try reflexivity; destruct 1; try apply f_equal2; eauto.
Defined.

Lemma list_leq_to_eq_refl {A x} : @list_leq_to_eq A x x eq_refl = reflexivity _.
Proof.
destruct x; cbn; reflexivity.
Qed.

Lemma list_eq_to_leq_refl {A x} : @list_eq_to_leq A x x (reflexivity _) = eq_refl.
Proof.
  induction x as [|x xs IH]; cbn; rewrite ?IH; try reflexivity.
Qed.

Lemma list_leq_to_eq_to_leq {A x y} v : @list_eq_to_leq A x y (@list_leq_to_eq A x y v) = v.
Proof.
  now subst; rewrite list_leq_to_eq_refl, list_eq_to_leq_refl.
Qed.

Lemma list_eq_to_leq_to_eq {A x y} v : @list_leq_to_eq A x y (@list_eq_to_leq A x y v) = v.
Proof.
  revert y v.
  induction x as [|x xs IH], y as [|y ys]; try specialize (IH ys); cbn.
  1-3: intro H; destruct H; reflexivity.
  intro H; destruct H as [? H]; subst; specialize (IH H).
  cbv [list_leq_to_eq] in *; subst.
  break_innermost_match_hyps; subst; reflexivity.
Qed.

Lemma UIP_nil {A} (p q : @nil A = @nil A) : p = q.
Proof.
  rewrite <- (list_leq_to_eq_to_leq p), <- (list_leq_to_eq_to_leq q); simpl; reflexivity.
Qed.

Lemma invert_list_eq {A x y} (p : @list_eq A A eq x y) : { pf : x = y | list_leq_to_eq pf = p }.
Proof.
eexists; apply list_eq_to_leq_to_eq.
Qed.

Lemma invert_eq_list {A x y} (p : x = y) : { pf : @list_eq A A eq x y | list_eq_to_leq pf = p }.
Proof.
eexists; apply list_leq_to_eq_to_leq.
Qed.

Ltac destr_list_eq H :=
  lazymatch type of H with
  | True => first [ clear H | destruct H ]
  | False => destruct H
  | _ = _ /\ _
    => let H' := fresh in
       destruct H as [H' H];
       destr_list_eq H
  | list_eq eq _ _
    => first [ apply list_eq_to_leq in H
             | let H' := fresh in
               rename H into H';
               destruct (invert_list_eq H') as [H ?]; subst H' ]
  end.
Ltac inversion_list_step :=
  match goal with
  | [ H : nil = nil |- _ ] => clear H
  | [ H : cons _ _ = nil |- _ ] => solve [ inversion H ]
  | [ H : nil = cons _ _ |- _ ] => solve [ inversion H ]
  | [ H : nil = nil |- _ ]
    => assert (eq_refl = H) by apply UIP_nil; subst H
  | [ H : cons _ _ = cons _ _ |- _ ]
    => apply list_leq_to_eq in H; cbn [list_eq] in H;
       destr_list_eq H
  | [ H : cons _ _ = cons _ _ |- _ ]
    => let H' := fresh in
       rename H into H';
       destruct (invert_eq_list H') as [H ?]; subst H';
       cbn [list_eq] in H; destr_list_eq H
  end.

Ltac inversion_list := repeat inversion_list_step.

Lemma list_bl_hetero {A B} {AB_beq : A -> B -> bool} {AB_R : A -> B -> Prop}
      (AB_bl : forall x y, AB_beq x y = true -> AB_R x y)
  : forall {x y},
    list_beq_hetero AB_beq x y = true -> list_eq AB_R x y.
Proof using Type.
  induction x, y; cbn in *; eauto; try congruence.
  rewrite Bool.andb_true_iff; intuition eauto.
Qed.

Lemma list_lb_hetero {A B} {AB_beq : A -> B -> bool} {AB_R : A -> B -> Prop}
      (AB_lb : forall x y, AB_R x y -> AB_beq x y = true)
  : forall {x y},
    list_eq AB_R x y -> list_beq_hetero AB_beq x y = true.
Proof using Type.
  induction x, y; cbn in *; rewrite ?Bool.andb_true_iff; intuition (congruence || eauto).
Qed.

Lemma list_beq_hetero_uniform {A : Type} A_beq {x y}
  : list_beq_hetero A_beq x y = @list_beq A A_beq x y.
Proof.
destruct x, y; cbn; reflexivity.
Qed.

Lemma list_bl_hetero_eq {A}
      {A_beq : A -> A -> bool}
      (A_bl : forall x y, A_beq x y = true -> x = y)
      {x y}
  : list_beq_hetero A_beq x y = true -> x = y.
Proof using Type.
rewrite list_beq_hetero_uniform; now apply internal_list_dec_bl.
Qed.

Lemma list_lb_hetero_eq {A}
      {A_beq : A -> A -> bool}
      (A_lb : forall x y, x = y -> A_beq x y = true)
      {x y}
  : x = y -> list_beq_hetero A_beq x y = true.
Proof using Type.
rewrite list_beq_hetero_uniform; now apply internal_list_dec_lb.
Qed.

Lemma eqlistA_bl {A eqA} {R : relation A}
      (H : forall x y : A, eqA x y = true -> R x y)
  : forall x y, list_beq A eqA x y = true -> eqlistA R x y.
Proof.
  induction x, y; cbn; auto; try discriminate; constructor.
  all: rewrite Bool.andb_true_iff in *; destruct_head'_and; eauto.
Qed.

Lemma eqlistA_lb {A eqA} {R : relation A}
      (H : forall x y : A, R x y -> eqA x y = true)
  : forall x y, eqlistA R x y -> list_beq A eqA x y = true.
Proof.
  induction x, y; cbn; auto; try discriminate; inversion 1; subst.
  all: rewrite Bool.andb_true_iff; eauto.
Qed.

Lemma nth_default_cons : forall {T} (x u0 : T) us, nth_default x (u0 :: us) 0 = u0.
Proof.
auto.
Qed.

#[global]
Hint Rewrite @nth_default_cons : simpl_nth_default.
#[global]
Hint Rewrite @nth_default_cons : push_nth_default.

Lemma nth_default_cons_S : forall {A} us (u0 : A) n d,
  nth_default d (u0 :: us) (S n) = nth_default d us n.
Proof.
boring.
Qed.

#[global]
Hint Rewrite @nth_default_cons_S : simpl_nth_default.
#[global]
Hint Rewrite @nth_default_cons_S : push_nth_default.

Lemma nth_default_nil : forall {T} n (d : T), nth_default d nil n = d.
Proof.
induction n; boring.
Qed.

#[global]
Hint Rewrite @nth_default_nil : simpl_nth_default.
#[global]
Hint Rewrite @nth_default_nil : push_nth_default.

Lemma nth_error_nil_error : forall {A} n, nth_error (@nil A) n = None.
Proof.
induction n; boring.
Qed.

#[global]
Hint Rewrite @nth_error_nil_error : simpl_nth_error.

Ltac nth_tac' :=
  intros; simpl in *; unfold error,value in *; repeat progress (match goal with
    | [  |- context[nth_error nil ?n] ] => rewrite nth_error_nil_error
    | [ H: ?x = Some _  |- context[match ?x with Some _ => ?a | None => ?a end ] ] => destruct x
    | [ H: ?x = None _  |- context[match ?x with Some _ => ?a | None => ?a end ] ] => destruct x
    | [  |- context[match ?x with Some _ => ?a | None => ?a end ] ] => destruct x
    | [  |- context[match nth_error ?xs ?i with Some _ => _ | None => _ end ] ] => case_eq (nth_error xs i); intros
    | [ |- context[(if lt_dec ?a ?b then _ else _) = _] ] => destruct (lt_dec a b)
    | [ |- context[_ = (if lt_dec ?a ?b then _ else _)] ] => destruct (lt_dec a b)
    | [ H: context[(if lt_dec ?a ?b then _ else _) = _] |- _ ] => destruct (lt_dec a b)
    | [ H: context[_ = (if lt_dec ?a ?b then _ else _)] |- _ ] => destruct (lt_dec a b)
    | [ H: _ /\ _ |- _ ] => destruct H
    | [ H: Some _ = Some _ |- _ ] => injection H; clear H; intros; subst
    | [ H: None = Some _  |- _ ] => inversion H
    | [ H: Some _ = None |- _ ] => inversion H
    | [ |- Some _ = Some _ ] => apply f_equal
  end); eauto; try (autorewrite with list in *); try lia; eauto.
Lemma nth_error_map {A B f n l}
  : nth_error (@map A B f l) n = option_map f (nth_error l n).
Proof.
revert n; induction l, n; nth_tac'.
Qed.
Lemma nth_error_map_ex : forall A B (f:A->B) i xs y,
  nth_error (map f xs) i = Some y ->
  exists x, nth_error xs i = Some x /\ f x = y.
Proof.
intros *; rewrite nth_error_map; edestruct nth_error; nth_tac'.
Qed.

Lemma nth_error_seq : forall i start len,
  nth_error (seq start len) i =
  if lt_dec i len
  then Some (start + i)
  else None.
  induction i as [|? IHi]; destruct len; nth_tac'; erewrite IHi; nth_tac'.
Qed.

Lemma nth_error_error_length : forall A i (xs:list A), nth_error xs i = None ->
  i >= length xs.
Proof.
  induction i as [|? IHi]; destruct xs; nth_tac'; try match goal with H : _ |- _ => specialize (IHi _ H) end; lia.
Qed.

Lemma nth_error_value_length : forall A i (xs:list A) x, nth_error xs i = Some x ->
  i < length xs.
Proof.
  induction i as [|? IHi]; destruct xs; nth_tac'; try match goal with H : _ |- _ => specialize (IHi _ _ H) end; lia.
Qed.

Lemma nth_error_length_error : forall A i (xs:list A),
  i >= length xs ->
  nth_error xs i = None.
Proof.
  induction i as [|? IHi]; destruct xs; nth_tac'; rewrite IHi by lia; auto.
Qed.
Global Hint Resolve nth_error_length_error : core.
#[global]
Hint Rewrite @nth_error_length_error using lia : simpl_nth_error.

Lemma map_nth_default : forall (A B : Type) (f : A -> B) n x y l,
  (n < length l) -> nth_default y (map f l) n = f (nth_default x l n).
Proof.
  intros A B f n x y l H.
  unfold nth_default.
  erewrite map_nth_error.
  reflexivity.
  nth_tac'.
  let H0 := match goal with H0 : _ = None |- _ => H0 end in
  pose proof (nth_error_error_length A n l H0).
  lia.
Qed.

#[global]
Hint Rewrite @map_nth_default using lia : push_nth_default.

Ltac nth_tac :=
  repeat progress (try nth_tac'; try (match goal with
    | [ H: nth_error (map _ _) _ = Some _ |- _ ] => destruct (nth_error_map_ex _ _ _ _ _ _ H); clear H
    | [ H: nth_error (seq _ _) _ = Some _ |- _ ] => rewrite nth_error_seq in H
    | [H: nth_error _ _ = None |- _ ] => specialize (nth_error_error_length _ _ _ H); intro; clear H
  end)).

Lemma app_cons_app_app : forall T xs (y:T) ys, xs ++ y :: ys = (xs ++ (y::nil)) ++ ys.
Proof.
induction xs; boring.
Qed.

Lemma unfold_set_nth {T} n x
  : forall xs,
    @set_nth T n x xs
    = match n with
      | O => match xs with
             | nil => nil
             | x'::xs' => x::xs'
             end
      | S n' =>  match xs with
                 | nil => nil
                 | x'::xs' => x'::set_nth n' x xs'
                 end
      end.
Proof.
  induction n; destruct xs; reflexivity.
Qed.

Lemma simpl_set_nth_0 {T} x
  : forall xs,
    @set_nth T 0 x xs
    = match xs with
      | nil => nil
      | x'::xs' => x::xs'
      end.
Proof.
intro; rewrite unfold_set_nth; reflexivity.
Qed.

Lemma simpl_set_nth_S {T} x n
  : forall xs,
    @set_nth T (S n) x xs
    = match xs with
      | nil => nil
      | x'::xs' => x'::set_nth n x xs'
      end.
Proof.
intro; rewrite unfold_set_nth; reflexivity.
Qed.

#[global]
Hint Rewrite @simpl_set_nth_S @simpl_set_nth_0 : simpl_set_nth.

Lemma update_nth_ext {T} f g n
  : forall xs, (forall x, nth_error xs n = Some x -> f x = g x)
               -> @update_nth T n f xs = @update_nth T n g xs.
Proof.
  induction n as [|n IHn]; destruct xs; simpl; intros H;
    try rewrite IHn; try rewrite H;
      try congruence; trivial.
Qed.

Global Instance update_nth_Proper {T}
  : Proper (eq ==> pointwise_relation _ eq ==> eq ==> eq) (@update_nth T).
Pr
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted) (truncated to 8.0KiB; full 25KiB file on GitHub Actions Artifacts under tmp.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 575 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Expected coqc runtime on this file: 0.000 sec *)
Require Coq.Init.Ltac.
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Crypto.Util.Tactics.SubstEvars.
Require Crypto.Util.ListUtil.Filter.
Require Crypto.Util.ZUtil.Definitions.
Require Crypto.Util.ZRange.
Require Coq.Arith.Arith.
Require Coq.Arith.Peano_dec.
Require Coq.Bool.Bool.
Require Coq.Classes.CMorphisms.
Require Coq.Classes.Morphisms.
Require Coq.Classes.RelationClasses.
Require Coq.FSets.FMapPositive.
Require Coq.Lists.List.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.MSets.MSetFacts.
Require Coq.MSets.MSetPositive.
Require Coq.NArith.BinNat.
Require Coq.NArith.NArith.
Require Coq.Numbers.BinNums.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Program.Tactics.
Require Coq.Relations.Relation_Definitions.
Require Coq.Relations.Relations.
Require Coq.Setoids.Setoid.
Require Coq.Strings.Ascii.
Require Coq.Strings.String.
Require Coq.ZArith.BinInt.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.ZArith_dec.
Require Coq.derive.Derive.
Require Coq.micromega.Lia.
Require Ltac2.Init.
Require Rewriter.Util.Comparison.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.HProp.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.Tactics.CPSId.
Require Rewriter.Util.Tactics.ClearFree.
Require Rewriter.Util.Tactics.ConstrFail.
Require Rewriter.Util.Tactics.Contains.
Require Rewriter.Util.Tactics.EvarNormalize.
Require Rewriter.Util.Tactics.GetGoal.
Require Rewriter.Util.Tactics.PrintContext.
Require Rewriter.Util.Tactics.SetEvars.
Require Rewriter.Util.Tactics.SubstEvars.
Require Rewriter.Util.Tactics.Test.
Require Rewriter.Util.Tactics.TransparentAssert.
Require Rewriter.Util.TypeList.
Require Rewriter.Util.plugins.StrategyTactic.
Require Ltac2.Bool.
Require Ltac2.Constant.
Require Ltac2.Constr.
Require Ltac2.Constructor.
Require Ltac2.Evar.
Require Ltac2.FSet.
Require Ltac2.Float.
Require Ltac2.Ident.
Require Ltac2.Ind.
Require Ltac2.Int.
Require Ltac2.Ltac1.
Require Ltac2.Message.
Require Ltac2.Meta.
Require Ltac2.Proj.
Require Ltac2.Std.
Require Ltac2.String.
Require Ltac2.Uint63.
Require Rewriter.Util.Bool.Equality.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Pointed.
Require Rewriter.Util.Tactics.DebugPrint.
Require Rewriter.Util.Tactics.Not.
Require Rewriter.Util.Tactics.PrintGoal.
Require Rewriter.Util.Tactics.SetoidSubst.
Require Ltac2.Char.
Require Ltac2.Control.
Require Ltac2.Env.
Require Ltac2.FMap.
Require Ltac2.Printf.
Require Rewriter.Util.Bool.
Require Rewriter.Util.FixCoqMistakes.
Require Rewriter.Util.Tactics.CacheTerm.
Require Rewriter.Util.Tactics.WarnIfGoalsRemain.
Require Ltac2.Option.
Require Ltac2.Pattern.
Require Rewriter.Util.Equality.
Require Rewriter.Util.Logic.ProdForall.
Require Rewriter.Util.Notations.
Require Rewriter.Util.Sigma.Related.
Require Rewriter.Util.Tactics.DestructHyps.
Require Rewriter.Util.Tactics.FindHyp.
Require Rewriter.Util.Tactics.Head.
Require Rewriter.Util.Tactics.HeadUnderBinders.
Require Rewriter.Util.Tactics.RunTacticAsConstr.
Require Rewriter.Util.Tactics.SpecializeBy.
Require Rewriter.Util.Tactics.SplitInContext.
Require Rewriter.Util.CPSNotations.
Require Rewriter.Util.Tactics.BreakMatch.
Require Rewriter.Util.Tactics.UniquePose.
Require Ltac2.Array.
Require Ltac2.List.
Require Rewriter.Util.Sigma.
Require Rewriter.Util.Tactics.DestructHead.
Require Rewriter.Util.Tactics.DoWithHyp.
Require Rewriter.Util.Tactics.SpecializeAllWays.
Require Ltac2.Fresh.
Require Rewriter.Util.LetIn.
Require Rewriter.Util.Tactics.RewriteHyp.
Require Rewriter.Util.Logic.ExistsEqAnd.
Require Rewriter.Util.NatUtil.
Require Rewriter.Util.PrimitiveProd.
Require Ltac2.Notations.
Require Rewriter.Util.Option.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.PrimitiveSigma.
Require Rewriter.Util.Prod.
Require Rewriter.Util.OptionList.
Require Rewriter.Util.Decidable.
Require Rewriter.Util.ListUtil.SetoidList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Util.ListUtil.Forall.
Require Rewriter.Language.Pre.
Require Rewriter.Util.FMapPositive.Equality.
Require Rewriter.Util.MSetPositive.Equality.
Require Rewriter.Util.MSetPositive.Facts.
Require Rewriter.Util.Sum.
Require Ltac2.Ltac2.
Require Rewriter.Util.plugins.Ltac2Extra.
Require Rewriter.Util.Tactics2.Array.
Require Rewriter.Util.Tactics2.Char.
Require Rewriter.Util.Tactics2.Constr.Unsafe.MakeAbbreviations.
Require Rewriter.Util.Tactics2.DestEvar.
Require Rewriter.Util.Tactics2.FixNotationsForPerformance.
Require Rewriter.Util.Tactics2.Head.
Require Rewriter.Util.Tactics2.Ident.
Require Rewriter.Util.Tactics2.InstantiateEvar.
Require Rewriter.Util.Tactics2.Iterate.
Require Rewriter.Util.Tactics2.List.
Require Rewriter.Util.Tactics2.Ltac1.
Require Rewriter.Util.Tactics2.Message.
Require Rewriter.Util.Tactics2.Notations.
Require Rewriter.Util.Tactics2.Option.
Require Rewriter.Util.Tactics2.Proj.
Require Rewriter.Util.Tactics2.HeadReference.
Require Rewriter.Util.Tactics2.InFreshContext.
Require Rewriter.Util.Tactics2.String.
Require
Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.4MiB file on GitHub Actions Artifacts under build.log)
_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.UIhjf0bNJw
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.EkqPpeXEkK
MINIMIZER_DEBUG: files: 
make --no-print-directory -C bedrock2/bedrock2 noex
Generating Makefile.coq.noex
rm -f .coqdeps.d
make -f Makefile.coq.noex
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.79Ll1WAhBu
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.k0Pvz7pBhs
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.SVQeM6LQ65
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.vWdTcBNVHh
MINIMIZER_DEBUG: files: 
rm -f .coqdeps.d
make -f Makefile.coq
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.cPE5nPVpPo
MINIMIZER_DEBUG: files: 
COQDEP VFILES
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.rzjuy4jhiH
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.cHpmqGB0LB
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.r9Ztz64qm9
MINIMIZER_DEBUG: files: 
make[4]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.OVpHjhvADm
MINIMIZER_DEBUG: files: 
COQC src/PushButtonSynthesis/Primitives.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -w +implicit-core-hint-db\,+implicits-in-term\,+non-reversible-notation\,+deprecated-intros-until-0\,+deprecated-focus\,+unused-intro-pattern\,+variable-collision\,+unexpected-implicit-declaration\,+omega-is-deprecated\,+deprecated-instantiate-syntax\,+non-recursive\,+undeclared-scope\,+deprecated-hint-rewrite-without-locality\,+deprecated-hint-without-locality\,+deprecated-instance-without-locality\,+deprecated-typeclasses-transparency-without-locality\,unsupported-attributes -w -notation-overridden\,-deprecated-hint-constr\,-fragile-hint-constr\,-native-compiler-disabled\,-ambiguous-paths\,-masking-absolute-name -w -deprecated-native-compiler-option -native-compiler ondemand -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil coqutil -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola Rupicola -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2 bedrock2 -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src Crypto src/PushButtonSynthesis/Primitives.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.B1Tm0BtLR7
MINIMIZER_DEBUG: files:  src/PushButtonSynthesis/Primitives.v
Finished failing transaction in 0.065 secs (0.061u,0.003s) (failure)
File "./src/PushButtonSynthesis/Primitives.v", line 93, characters 12-26:
Error: Some unresolved existential variables remain

Command exited with non-zero status 1
src/PushButtonSynthesis/Primitives.vo (real: 2.32, user: 1.98, sys: 0.32, mem: 1020932 ko)
Makefile.coq:809: recipe for target 'src/PushButtonSynthesis/Primitives.vo' failed
make[1]: *** [src/PushButtonSynthesis/Primitives.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto'
Aggregating timing log...
    Time |   Peak Mem | File Name                        
---------------------------------------------------------
0m01.98s | 1020932 ko | Total Time / Peak Mem            
---------------------------------------------------------
0m01.98s | 1020932 ko | PushButtonSynthesis/Primitives.vo
Makefile.ci:151: recipe for target 'ci-fiat_crypto' failed
make: *** [ci-fiat_crypto] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 642KiB file on GitHub Actions Artifacts under bug.log)
rock2 -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Bignums Bignums -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Coqprime Coqprime -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Ltac2 Ltac2 -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Rewriter Rewriter -q -w +implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes -w -notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name -w -deprecated-native-compiler-option -native-compiler ondemand -R /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/src Crypto -Q /github/workspace/cwd Top -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil coqutil -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/src/Rupicola Rupicola -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2 bedrock2 -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-passing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Bignums Bignums -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Coqprime Coqprime -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Ltac2 Ltac2 -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Rewriter Rewriter -top Top.bug_01 -o /tmp/bug_01.vo -dump-glob bug_01.glob bug_01.v
getting bug_01.glob (/github/workspace/cwd/bug_01.glob)
getting bug_01.glob (/github/workspace/cwd/bug_01.glob)

Non-fatal error: Failed to normalize Requires and preserve the error.  
The new error was:
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 431, characters 27-39:
Warning: Notation lt_irrefl is deprecated since 8.16.
The Arith.Lt file is obsolete. Use Nat.lt_irrefl instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 431, characters 43-57:
Warning: Notation le_lt_trans is deprecated since 8.16.
The Arith.Lt file is obsolete. Use Nat.le_lt_trans instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 431, characters 27-39:
Warning: Notation lt_irrefl is deprecated since 8.16.
The Arith.Lt file is obsolete. Use Nat.lt_irrefl instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 431, characters 43-57:
Warning: Notation le_lt_trans is deprecated since 8.16.
The Arith.Lt file is obsolete. Use Nat.le_lt_trans instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 434, characters 32-46:
Warning: Notation le_lt_or_eq is deprecated since 8.16.
The Arith.Lt file is obsolete. Use the bidirectional version Nat.lt_eq_cases instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 434, characters 32-46:
Warning: Notation le_lt_or_eq is deprecated since 8.16.
The Arith.Lt file is obsolete. Use the bidirectional version Nat.lt_eq_cases instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 485, characters 38-47:
Warning: Notation le_n_0_eq is deprecated since 8.16.
The Arith.Le file is obsolete. Use the bidirectional version Nat.le_0_r (with symmetry of equality) instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 485, characters 38-47:
Warning: Notation le_n_0_eq is deprecated since 8.16.
The Arith.Le file is obsolete. Use the bidirectional version Nat.le_0_r (with symmetry of equality) instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 497, characters 76-85:
Warning: Notation minus_n_O is deprecated since 8.16.
The Arith.Minus file is obsolete. Use Nat.sub_0_r (and symmetry of equality) instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 497, characters 76-85:
Warning: Notation minus_n_O is deprecated since 8.16.
The Arith.Minus file is obsolete. Use Nat.sub_0_r (and symmetry of equality) instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 497, characters 76-85:
Warning: Notation minus_n_O is deprecated since 8.16.
The Arith.Minus file is obsolete. Use Nat.sub_0_r (and symmetry of equality) instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 506, characters 44-62:
Warning: Notation minus_diag_reverse is deprecated since 8.16.
The Arith.Minus file is obsolete. Use Nat.sub_diag (and symmetry of equality) instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 506, characters 44-62:
Warning: Notation minus_diag_reverse is deprecated since 8.16.
The Arith.Minus file is obsolete. Use Nat.sub_diag (and symmetry of equality) instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 506, characters 44-62:
Warning: Notation minus_diag_reverse is deprecated since 8.16.
The Arith.Minus file is obsolete. Use Nat.sub_diag (and symmetry of equality) instead.
[deprecated-syntactic-definition-since-8.16,deprecated-since-8.16,deprecated-syntactic-definition,deprecated,default]
File "/tmp/tmp1vp9tuop/Top/bug_01.v", line 798, characters 51-81:
Error: The variable internal_list_dec_bl was not found in the current
environment.


�[93mChanged file not saved.�[0m

Now, I will attempt to split up [Require] statements...
getting /github/workspace/cwd/bug_01.v
getting /github/workspace/cwd/bug_01.glob
getting /github/workspace/cwd/bug_01.glob

No Requires to split.

In order to efficiently manipulate the file, I have to break it into statements.  I will attempt to do this by matching on periods.
�[92m
Splitting successful.�[0m

I will now attempt to remove any lines after the line which generates the error.

No lines to trim.

In order to efficiently manipulate the file, I have to break it into definitions.  I will now attempt to do this.
Sending statements to coqtop...
Done.  Splitting to definitions...

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

cc @JasonGross

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 10, 2023

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src/PushButtonSynthesis/Primitives.v (from ci-fiat_crypto) (interrupted by timeout, being automatically continued) (full log on GitHub Actions)

Partially Minimized Coq File (could not inline Rewriter.Util.plugins.RewriterBuildRegistry)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines, then from 4405 lines to 389 lines, then from 402 lines to 615 lines, then from 621 lines to 464 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Modules that could not be inlined: Rewriter.Util.plugins.RewriterBuildRegistry
   Expected coqc runtime on this file: 9.060 sec *)
Require Coq.Init.Ltac.
Require Crypto.Util.Tactics.SubstEvars.
Require Coq.micromega.Lia.
Require Coq.Arith.Arith.
Require Coq.Lists.List.
Require Coq.Classes.Morphisms.
Require Crypto.Util.GlobalSettings.
Require Crypto.Util.FixCoqMistakes.
Require Crypto.Util.ListUtil.Filter.
Require Coq.Logic.Eqdep_dec.
Require Coq.NArith.BinNat.
Require Coq.Relations.Relation_Definitions.
Require Crypto.Util.ZUtil.Notations.
Require Crypto.Util.LetIn.
Require Crypto.Util.Decidable.
Require Rewriter.Util.plugins.RewriterBuildRegistry.
Import Coq.ZArith.ZArith.
Import Crypto.Util.Decidable.
Import Crypto.Util.ZUtil.Notations.
Import Crypto.Util.LetIn.
Local Open Scope Z_scope.

Module Export Z.

  Definition zselect (cond zero_case nonzero_case : Z) :=
    if cond =? 0 then zero_case else nonzero_case.

  Definition add_modulo x y modulus :=
    if (modulus <=? x + y) then (x + y) - modulus else (x + y).
Definition lnot_modulo (v : Z) (modulus : Z) : Z. exact (Z.lnot v mod modulus). Defined.
Definition bneg (v : Z) : Z. exact (if dec (v = 0) then 1 else 0). Defined.

   
  Definition cc_m s x := if dec (2 ^ (Z.log2 s) = s) then x >> (Z.log2 s - 1) else x / (s / 2).

   
  Definition rshi s hi lo n :=
       let k := Z.log2 s in
       if dec (2 ^ k = s)
       then ((lo + (hi << k)) >> n) &' (Z.ones k)
       else ((lo + hi * s) >> n) mod s.

   
  Definition truncating_shiftl bw x n := (x << n) mod (2^bw).
Definition get_carry (bitwidth : Z) (v : Z) : Z * Z. exact ((v mod 2^bitwidth, v / 2^bitwidth)). Defined.
Definition add_with_carry (c : Z) (x y : Z) : Z. exact (c + x + y). Defined.
Definition add_with_get_carry (bitwidth : Z) (c : Z) (x y : Z) : Z * Z. exact (dlet v := add_with_carry c x y in get_carry bitwidth v). Defined.
Definition add_get_carry (bitwidth : Z) (x y : Z) : Z * Z. exact (add_with_get_carry bitwidth 0 x y). Defined.
Definition get_borrow (bitwidth : Z) (v : Z) : Z * Z. exact (let '(v, c) := get_carry bitwidth v in
       (v, -c)). Defined.
Definition sub_with_borrow (c : Z) (x y : Z) : Z. exact (add_with_carry (-c) x (-y)). Defined.
Definition sub_with_get_borrow (bitwidth : Z) (c : Z) (x y : Z) : Z * Z. exact (dlet v := sub_with_borrow c x y in get_borrow bitwidth v). Defined.
Definition sub_get_borrow (bitwidth : Z) (x y : Z) : Z * Z. exact (sub_with_get_borrow bitwidth 0 x y). Defined.
Definition add_get_carry_full (bound : Z) (x y : Z) : Z * Z. exact (if 2 ^ (Z.log2 bound) =? bound
       then add_get_carry (Z.log2 bound) x y
       else ((x + y) mod bound, (x + y) / bound)). Defined.
Definition add_with_get_carry_full (bound : Z) (c x y : Z) : Z * Z. exact (if 2 ^ (Z.log2 bound) =? bound
       then add_with_get_carry (Z.log2 bound) c x y
       else ((c + x + y) mod bound, (c + x + y) / bound)). Defined.
Definition sub_get_borrow_full (bound : Z) (x y : Z) : Z * Z. exact (if 2 ^ (Z.log2 bound) =? bound
       then sub_get_borrow (Z.log2 bound) x y
       else ((x - y) mod bound, -((x - y) / bound))). Defined.
Definition sub_with_get_borrow_full (bound : Z) (c x y : Z) : Z * Z. exact (if 2 ^ (Z.log2 bound) =? bound
       then sub_with_get_borrow (Z.log2 bound) c x y
       else ((x - y - c) mod bound, -((x - y - c) / bound))). Defined.
Definition mul_split_at_bitwidth (bitwidth : Z) (x y : Z) : Z * Z. exact (dlet xy := x * y in
       (if Z.geb bitwidth 0
        then xy &' Z.ones bitwidth
        else xy mod 2^bitwidth,
        if Z.geb bitwidth 0
        then xy >> bitwidth
        else xy / 2^bitwidth)). Defined.
Definition mul_split (s x y : Z) : Z * Z. exact (if s =? 2^Z.log2 s
       then mul_split_at_bitwidth (Z.log2 s) x y
       else ((x * y) mod s, (x * y) / s)). Defined.
Definition mul_high (s x y : Z) : Z. exact (snd (mul_split s x y)). Defined.
Definition ltz (x y : Z) : Z. exact (if x <? y then 1 else 0). Defined.
Definition combine_at_bitwidth (bitwidth lo hi : Z) : Z. exact (lo + (hi << bitwidth)). Defined.

   
  Definition value_barrier (x : Z) := x.
Import Coq.Lists.List.

  Fixpoint update_nth {T} n f (xs:list T) {struct n} :=
        match n with
        | O => match xs with
                                 | nil => nil
                                 | x'::xs' => f x'::xs'
                                 end
        | S n' =>  match xs with
                                 | nil => nil
                                 | x'::xs' => x'::update_nth n' f xs'
                                 end
  end.

Import Coq.Bool.Bool.

Notation reflect_rel P b := (forall x y, reflect (P x y) (b x y)).

Module Export Crypto_DOT_Util_DOT_ZRange_WRAPPED.
Module Export ZRange.
Import Coq.ZArith.ZArith.

Declare Scope zrange_scope.

Record zrange := { lower : Z ; upper : Z }.
Bind Scope zrange_scope with zrange.
Scheme Minimality for zrange Sort Type.
Definition zrange_beq (x y : zrange) : bool.
Admitted.

Global Instance reflect_zrange_eq : reflect_rel (@eq zrange) zrange_beq | 10.
Admitted.

End ZRange.

End Crypto_DOT_Util_DOT_ZRange_WRAPPED.
Import Coq.ZArith.ZArith.

Module Export ZRange.
Definition normalize (v : zrange) : zrange.
Admitted.
Definition opp (v : zrange) : zrange.
Admitted.
    Notation "- x" := (opp x) : zrange_scope.
Export Rewriter.Language.Pre.
Local Open Scope Z_scope.

Module Export ident.
  Section cast.
Definition is_more_pos_than_neg (r : zrange) (v : BinInt.Z) : bool.
Admitted.
Let cast_outside_of_range (r : zrange) (v : BinInt.Z) : BinInt.Z.
Admitted.

    Definition cast (r : zrange) (x : BinInt.Z)
      := let r := ZRange.normalize r in
         if (lower r <=? x) && (x <=? upper r)
         then x
         else if is_more_pos_than_neg r x
              then cast_outside_of_range r x
              else -cast_outside_of_range (-r) (-x).
    Definition cast2 (r : zrange * zrange) (x : BinInt.Z * BinInt.Z)
      := (cast (Datatypes.fst r) (Datatypes.fst x),
          cast (Datatypes.snd r) (Datatypes.snd x)).
  End cast.

  Section comment.
    Definition comment {A} (x : A) := tt.

    Definition comment_no_keep {A} (x : A) := tt.
  End comment.

  Module Export fancy.
    Module Export with_wordmax.
      Section with_wordmax.
        Context (log2wordmax : BinInt.Z).
Definition add (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition addc (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition sub (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition subb (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition mulll : Z * Z -> Z.
Admitted.
Definition mullh : Z * Z -> Z.
Admitted.
Definition mulhl : Z * Z -> Z.
Admitted.
Definition mulhh : Z * Z -> Z.
Admitted.
Definition selm : Z * Z * Z -> Z.
Admitted.
Definition rshi (n : Z) : Z * Z -> Z.
Admitted.
      End with_wordmax.
    End with_wordmax.

    Definition add : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.add] in fun x => with_wordmax.add (fst (fst x)) (snd (fst x)) (snd x).
    Definition addc : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.addc] in fun x => with_wordmax.addc (fst (fst x)) (snd (fst x)) (snd x).
    Definition sub : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.sub] in fun x => with_wordmax.sub (fst (fst x)) (snd (fst x)) (snd x).
    Definition subb : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.subb] in fun x => with_wordmax.subb (fst (fst x)) (snd (fst x)) (snd x).
    Definition mulll : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulll] in fun x => with_wordmax.mulll (fst x) (snd x).
    Definition mullh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mullh] in fun x => with_wordmax.mullh (fst x) (snd x).
    Definition mulhl : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhl] in fun x => with_wordmax.mulhl (fst x) (snd x).
    Definition mulhh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhh] in fun x => with_wordmax.mulhh (fst x) (snd x).
    Definition selm : Z * (Z * Z * Z) -> Z
      := Eval cbv [with_wordmax.selm] in fun x => with_wordmax.selm (fst x) (snd x).
    Definition rshi : (Z * Z) * (Z * Z) -> Z
      := Eval cbv [with_wordmax.rshi] in fun x => with_wordmax.rshi (fst (fst x)) (snd (fst x)) (snd x).
Definition selc : Z * Z * Z -> Z.
Admitted.
Definition sell : Z * Z * Z -> Z.
Admitted.
Definition addm : Z * Z * Z -> Z.
Admitted.

Notation prod_rect_nodep := Rewriter.Util.Prod.prod_rect_nodep (only parsing).
Notation nat_rect_arrow_nodep := Rewriter.Util.NatUtil.nat_rect_arrow_nodep (only parsing).
Notation list_rect_arrow_nodep := Rewriter.Util.ListUtil.list_rect_arrow_nodep (only parsing).
Notation bool_rect_nodep := Rewriter.Util.Bool.bool_rect_nodep (only parsing).

Module Export Thunked.
  Notation bool_rect := Rewriter.Util.Bool.Thunked.bool_rect (only parsing).
  Notation list_rect := Rewriter.Util.ListUtil.Thunked.list_rect (only parsing).
  Notation list_case := Rewriter.Util.ListUtil.Thunked.list_case (only parsing).
  Notation nat_rect := Rewriter.Util.NatUtil.Thunked.nat_rect (only parsing).
  Notation option_rect := Rewriter.Util.Option.Thunked.option_rect (only parsing).
Definition var_like_idents : InductiveHList.hlist.
Admitted.
Definition base_type_list_named : InductiveHList.hlist.
exact ([with_name Z BinInt.Z
      ; with_name bool Datatypes.bool
      ; with_name nat Datatypes.nat
      ; with_name zrange ZRange.zrange
      ; with_name string String.string]%hlist).
Defined.
Definition all_ident_named_interped : InductiveHList.hlist.
exact ([with_name ident_Literal (@ident.literal)
      ; with_name ident_comment (@ident.comment)
      ; with_name ident_comment_no_keep (@ident.comment_no_keep)
      ; with_name ident_value_barrier (@Z.value_barrier)
      ; with_name ident_Nat_succ Nat.succ
      ; with_name ident_Nat_pred Nat.pred
      ; with_name ident_Nat_max Nat.max
      ; with_name ident_Nat_mul Nat.mul
      ; with_name ident_Nat_add Nat.add
      ; with_name ident_Nat_sub Nat.sub
      ; with_name ident_Nat_eqb Nat.eqb
      ; with_name ident_nil (@Datatypes.nil)
      ; with_name ident_cons (@Datatypes.cons)
      ; with_name ident_tt Datatypes.tt
      ; with_name ident_pair (@Datatypes.pair)
      ; with_name ident_fst (@Datatypes.fst)
      ; with_name ident_snd (@Datatypes.snd)
      ; with_name ident_prod_rect (@prod_rect_nodep)
      ; with_name ident_bool_rect (@Thunked.bool_rect)
      ; with_name ident_bool_rect_nodep (@bool_rect_nodep)
      ; with_name ident_nat_rect (@Thunked.nat_rect)
      ; with_name ident_eager_nat_rect (ident.eagerly (@Thunked.nat_rect))
      ; with_name ident_nat_rect_arrow (@nat_rect_arrow_nodep)
      ; with_name ident_eager_nat_rect_arrow (ident.eagerly (@nat_rect_arrow_nodep))
      ; with_name ident_list_rect (@Thunked.list_rect)
      ; with_name ident_eager_list_rect (ident.eagerly (@Thunked.list_rect))
      ; with_name ident_list_rect_arrow (@list_rect_arrow_nodep)
      ; with_name ident_eager_list_rect_arrow (ident.eagerly (@list_rect_arrow_nodep))
      ; with_name ident_list_case (@Thunked.list_case)
      ; with_name ident_List_length (@List.length)
      ; with_name ident_List_seq (@List.seq)
      ; with_name ident_List_firstn (@List.firstn)
      ; with_name ident_List_skipn (@List.skipn)
      ; with_name ident_List_repeat (@repeat)
      ; with_name ident_List_combine (@List.combine)
      ; with_name ident_List_map (@List.map)
      ; with_name ident_List_app (@List.app)
      ; with_name ident_List_rev (@List.rev)
      ; with_name ident_List_flat_map (@List.flat_map)
      ; with_name ident_List_partition (@List.partition)
      ; with_name ident_List_filter (@List.filter)
      ; with_name ident_List_fold_right (@List.fold_right)
      ; with_name ident_List_update_nth (@update_nth)
      ; with_name ident_List_nth_default (@nth_default)
      ; with_name ident_eager_List_nth_default (ident.eagerly (@nth_default))
      ; with_name ident_Z_add Z.add
      ; with_name ident_Z_mul Z.mul
      ; with_name ident_Z_pow Z.pow
      ; with_name ident_Z_sub Z.sub
      ; with_name ident_Z_opp Z.opp
      ; with_name ident_Z_div Z.div
      ; with_name ident_Z_modulo Z.modulo
      ; with_name ident_Z_eqb Z.eqb
      ; with_name ident_Z_leb Z.leb
      ; with_name ident_Z_ltb Z.ltb
      ; with_name ident_Z_geb Z.geb
      ; with_name ident_Z_gtb Z.gtb
      ; with_name ident_Z_log2 Z.log2
      ; with_name ident_Z_log2_up Z.log2_up
      ; with_name ident_Z_of_nat Z.of_nat
      ; with_name ident_Z_to_nat Z.to_nat
      ; with_name ident_Z_shiftr Z.shiftr
      ; with_name ident_Z_shiftl Z.shiftl
      ; with_name ident_Z_land Z.land
      ; with_name ident_Z_lor Z.lor
      ; with_name ident_Z_min Z.min
      ; with_name ident_Z_max Z.max
      ; with_name ident_Z_mul_split Z.mul_split
      ; with_name ident_Z_mul_high Z.mul_high
      ; with_name ident_Z_add_get_carry Z.add_get_carry_full
      ; with_name ident_Z_add_with_carry Z.add_with_carry
      ; with_name ident_Z_add_with_get_carry Z.add_with_get_carry_full
      ; with_name ident_Z_sub_get_borrow Z.sub_get_borrow_full
      ; with_name ident_Z_sub_with_get_borrow Z.sub_with_get_borrow_full
      ; with_name ident_Z_ltz Z.ltz
      ; with_name ident_Z_zselect Z.zselect
      ; with_name ident_Z_add_modulo Z.add_modulo
      ; with_name ident_Z_truncating_shiftl Z.truncating_shiftl
      ; with_name ident_Z_bneg Z.bneg
      ; with_name ident_Z_lnot_modulo Z.lnot_modulo
      ; with_name ident_Z_lxor Z.lxor
      ; with_name ident_Z_rshi Z.rshi
      ; with_name ident_Z_cc_m Z.cc_m
      ; with_name ident_Z_combine_at_bitwidth Z.combine_at_bitwidth
      ; with_name ident_Z_cast ident.cast
      ; with_name ident_Z_cast2 ident.cast2
      ; with_name ident_Some (@Datatypes.Some)
      ; with_name ident_None (@Datatypes.None)
      ; with_name ident_option_rect (@Thunked.option_rect)
      ; with_name ident_Build_zrange ZRange.Build_zrange
      ; with_name ident_zrange_rect (@ZRange.zrange_rect_nodep)
      ; with_name ident_fancy_add ident.fancy.add
      ; with_name ident_fancy_addc ident.fancy.addc
      ; with_name ident_fancy_sub ident.fancy.sub
      ; with_name ident_fancy_subb ident.fancy.subb
      ; with_name ident_fancy_mulll ident.fancy.mulll
      ; with_name ident_fancy_mullh ident.fancy.mullh
      ; with_name ident_fancy_mulhl ident.fancy.mulhl
      ; with_name ident_fancy_mulhh ident.fancy.mulhh
      ; with_name ident_fancy_rshi ident.fancy.rshi
      ; with_name ident_fancy_selc ident.fancy.selc
      ; with_name ident_fancy_selm ident.fancy.selm
      ; with_name ident_fancy_sell ident.fancy.sell
      ; with_name ident_fancy_addm ident.fancy.addm
     ]%hlist).
Defined.
Definition scraped_data : ScrapedData.t.
exact ({| ScrapedData.base_type_list_named := base_type_list_named
        ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}).
Defined.

Declare ML Module "coq-rewriter.rewriter_build".
Import Crypto.Util.ListUtil.Filter.

Module Export Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.
  Rewriter Emit Inductives From Scraped
           {| ScrapedData.base_type_list_named := base_type_list_named ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}
           As base ident raw_ident pattern_ident.

  Definition package : GoalType.package_with_args scraped_data var_like_idents base ident.
  Proof.
Tactic.make_package.
Defined.
Module Export APINotations.
Import Ltac2.Ltac2.
Module Export Compilers.
  Export Reify.Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.Tactic.

  Definition exprInfo : Classes.ExprInfoT := Eval hnf in GoalType.exprInfo package.

  Global Existing Instances
         baseHasNat
         baseHasNatCorrect
         try_make_base_transport_cps_correct
         buildEagerIdent
         buildInterpEagerIdentCorrect
         toRestrictedIdent
         toFromRestrictedIdent
         buildInterpIdentCorrect
         invertIdent
         buildInvertIdentCorrect
         base_default
         exprInfo
  .
  Ltac2 mk_reify_base_type () :=
    let package := reify_package_of_package 'package in
    reify_base_type_via_reify_package package.
  Ltac2 mk_reify_type () :=
    let package := reify_package_of_package 'package in
    reify_type_via_reify_package package.
  Ltac2 mk_reify_ident_opt () :=
    let package := reify_package_of_package 'package in
    reify_ident_via_reify_package_opt package.
  Ltac2 reify_type (ty : constr) : constr := mk_reify_type () ty.
  #[deprecated(since="8.15",note="Use Ltac2 instead.")]
   Ltac reify_type term :=
    let f := ltac2:(term
                    |- Control.refine (fun () => reify_type (Option.get (Ltac1.to_constr term)))) in
    constr:(ltac:(f term)).

  Module Export base.

    Notation type := (@base.type base) (only parsing).
    Notation base_interp := Compilers.base_interp (only parsing).
    Notation interp := (base.interp Compilers.base_interp) (only parsing).
  End base.

  Ltac2 _Reify_rhs () : unit :=
    let reify_base_type := mk_reify_base_type () in
    let reify_ident_opt := mk_reify_ident_opt () in
    expr._Reify_rhs 'base.type 'ident reify_base_type reify_ident_opt '@base.interp '@ident_interp ().
  Ltac Reify_rhs _ :=
    ltac2:(_Reify_rhs ()).

  Module Import invert_expr.

    End invert_expr.

  End Compilers.

End APINotations.

    Notation Expr := (@expr.Expr base.type ident).

    Notation Interp := (@expr.Interp base.type ident base.interp (@ident_interp)).

    Notation reify_type t := (ltac:(let rt := reify_type t in exact rt)) (only parsing).
    Notation reify_type_of e := (reify_type ((fun t (_ : t) => t) _ e)) (only parsing).

Import Coq.Relations.Relation_Definitions.
Import Crypto.Util.Tactics.SubstEvars.
Import Language.Wf.Compilers.

Fixpoint pointwise_equal {t} : relation (type.interp base.interp t)
  := match t with
     | type.base t => Logic.eq
     | type.arrow s d
       => fun (f g : type.interp base.interp s -> type.interp base.interp d)
          => forall x, pointwise_equal (f x) (g x)
     end.
Definition is_reification_of' {t} (e : Expr t) (v : type.interp base.interp t) : Prop.
exact (pointwise_equal (Interp e) v /\ Wf e).
Defined.

Notation is_reification_of rop op
  := (match @is_reification_of' (reify_type_of op) rop op with
      | T
        => ltac:(
             let T := (eval cbv [pointwise_equal is_reification_of' T] in T) in
             let T := (eval cbn [type.interp base.interp base.base_interp] in T) in
             exact T)
      end)
       (only parsing).

Ltac cache_reify _ :=
  split;
  [ intros;
    etransitivity;
    [
    | repeat match goal with |- _ = ?f' ?x => is_var x; apply (f_equal (fun f => f _)) end;
      Reify_rhs ();
      reflexivity ];
    subst_evars;
    reflexivity
  | prove_Wf () ].
Import Coq.ZArith.ZArith.

Derive reified_id_gen
       SuchThat (is_reification_of reified_id_gen (@id (list Z)))
       As reified_id_gen_correct.
Proof.
Time cache_reify ().
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted) (truncated to 8.0KiB; full 26KiB file on GitHub Actions Artifacts under tmp.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines, then from 4405 lines to 389 lines, then from 402 lines to 607 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Expected coqc runtime on this file: 0.000 sec *)

Require Coq.Init.Ltac.
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Crypto.Util.Tactics.SubstEvars.
Require Crypto.Util.ListUtil.Filter.
Require Crypto.Util.ZUtil.Definitions.
Import Coq.Lists.List.

  Fixpoint update_nth {T} n f (xs:list T) {struct n} :=
        match n with
        | O => match xs with
                                 | nil => nil
                                 | x'::xs' => f x'::xs'
                                 end
        | S n' =>  match xs with
                                 | nil => nil
                                 | x'::xs' => x'::update_nth n' f xs'
                                 end
  end.

Import Coq.Bool.Bool.

Notation reflect_rel P b := (forall x y, reflect (P x y) (b x y)).
Require Coq.Arith.Arith.
Require Coq.Arith.Peano_dec.
Require Coq.Bool.Bool.
Require Coq.Classes.CMorphisms.
Require Coq.Classes.Morphisms.
Require Coq.Classes.RelationClasses.
Require Coq.FSets.FMapPositive.
Require Coq.Lists.List.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.MSets.MSetFacts.
Require Coq.MSets.MSetPositive.
Require Coq.NArith.BinNat.
Require Coq.NArith.NArith.
Require Coq.Numbers.BinNums.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Program.Tactics.
Require Coq.Relations.Relation_Definitions.
Require Coq.Relations.Relations.
Require Coq.Setoids.Setoid.
Require Coq.Strings.Ascii.
Require Coq.Strings.String.
Require Coq.ZArith.BinInt.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.ZArith_dec.
Require Coq.derive.Derive.
Require Coq.micromega.Lia.
Require Ltac2.Init.
Require Rewriter.Util.Comparison.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.HProp.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.Tactics.CPSId.
Require Rewriter.Util.Tactics.ClearFree.
Require Rewriter.Util.Tactics.ConstrFail.
Require Rewriter.Util.Tactics.Contains.
Require Rewriter.Util.Tactics.EvarNormalize.
Require Rewriter.Util.Tactics.GetGoal.
Require Rewriter.Util.Tactics.PrintContext.
Require Rewriter.Util.Tactics.SetEvars.
Require Rewriter.Util.Tactics.SubstEvars.
Require Rewriter.Util.Tactics.Test.
Require Rewriter.Util.Tactics.TransparentAssert.
Require Rewriter.Util.TypeList.
Require Rewriter.Util.plugins.StrategyTactic.
Require Ltac2.Bool.
Require Ltac2.Constant.
Require Ltac2.Constr.
Require Ltac2.Constructor.
Require Ltac2.Evar.
Require Ltac2.FSet.
Require Ltac2.Float.
Require Ltac2.Ident.
Require Ltac2.Ind.
Require Ltac2.Int.
Require Ltac2.Ltac1.
Require Ltac2.Message.
Require Ltac2.Meta.
Require Ltac2.Proj.
Require Ltac2.Std.
Require Ltac2.String.
Require Ltac2.Uint63.
Require Rewriter.Util.Bool.Equality.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Pointed.
Require Rewriter.Util.Tactics.DebugPrint.
Require Rewriter.Util.Tactics.Not.
Require Rewriter.Util.Tactics.PrintGoal.
Require Rewriter.Util.Tactics.SetoidSubst.
Require Ltac2.Char.
Require Ltac2.Control.
Require Ltac2.Env.
Require Ltac2.FMap.
Require Ltac2.Printf.
Require Rewriter.Util.Bool.
Require Rewriter.Util.FixCoqMistakes.
Require Rewriter.Util.Tactics.CacheTerm.
Require Rewriter.Util.Tactics.WarnIfGoalsRemain.
Require Ltac2.Option.
Require Ltac2.Pattern.
Require Rewriter.Util.Equality.
Require Rewriter.Util.Logic.ProdForall.
Require Rewriter.Util.Notations.
Require Rewriter.Util.Sigma.Related.
Require Rewriter.Util.Tactics.DestructHyps.
Require Rewriter.Util.Tactics.FindHyp.
Require Rewriter.Util.Tactics.Head.
Require Rewriter.Util.Tactics.HeadUnderBinders.
Require Rewriter.Util.Tactics.RunTacticAsConstr.
Require Rewriter.Util.Tactics.SpecializeBy.
Require Rewriter.Util.Tactics.SplitInContext.
Require Rewriter.Util.CPSNotations.
Require Rewriter.Util.Tactics.BreakMatch.
Require Rewriter.Util.Tactics.UniquePose.
Require Ltac2.Array.
Require Ltac2.List.
Require Rewriter.Util.Sigma.
Require Rewriter.Util.Tactics.DestructHead.
Require Rewriter.Util.Tactics.DoWithHyp.
Require Rewriter.Util.Tactics.SpecializeAllWays.
Require Ltac2.Fresh.
Require Rewriter.Util.LetIn.
Require Rewriter.Util.Tactics.RewriteHyp.
Require Rewriter.Util.Logic.ExistsEqAnd.
Require Rewriter.Util.NatUtil.
Require Rewriter.Util.PrimitiveProd.
Require Ltac2.Notations.
Require Rewriter.Util.Option.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.PrimitiveSigma.
Require Rewriter.Util.Prod.
Require Rewriter.Util.OptionList.
Require Rewriter.Util.Decidable.
Require Rewriter.Util.ListUtil.SetoidList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Util.ListUtil.Forall.
Require Rewriter.Language.Pre.
Require Rewriter.Util.FMapPositive.Equality.
Require Rewriter.Util.MSetPositive.Equality.
Require Rewriter.Util.MSetPositive.Facts.
Require Rewriter.Util.Sum.
Require Ltac2.Ltac2.
Require Rewriter.Util.plugins.Ltac2Extra.
Requir
Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.4MiB file on GitHub Actions Artifacts under build.log)
ZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.UlkXm7R2J6
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.ssfp1Gb3YR
MINIMIZER_DEBUG: files: 
make --no-print-directory -C bedrock2/bedrock2 noex
Generating Makefile.coq.noex
rm -f .coqdeps.d
make -f Makefile.coq.noex
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.ZYZIK5ztsV
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.qHx3QBniP8
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.nvVzXUWcqi
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.fmOHrUsn8e
MINIMIZER_DEBUG: files: 
rm -f .coqdeps.d
make -f Makefile.coq
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.bM1h5OKNhO
MINIMIZER_DEBUG: files: 
COQDEP VFILES
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.a7fJA9Poi9
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.hX5kIao2CP
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.ZXmIxDClOu
MINIMIZER_DEBUG: files: 
make[4]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.5BAXGVAGxa
MINIMIZER_DEBUG: files: 
COQC src/PushButtonSynthesis/Primitives.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -w +implicit-core-hint-db\,+implicits-in-term\,+non-reversible-notation\,+deprecated-intros-until-0\,+deprecated-focus\,+unused-intro-pattern\,+variable-collision\,+unexpected-implicit-declaration\,+omega-is-deprecated\,+deprecated-instantiate-syntax\,+non-recursive\,+undeclared-scope\,+deprecated-hint-rewrite-without-locality\,+deprecated-hint-without-locality\,+deprecated-instance-without-locality\,+deprecated-typeclasses-transparency-without-locality\,unsupported-attributes -w -notation-overridden\,-deprecated-hint-constr\,-fragile-hint-constr\,-native-compiler-disabled\,-ambiguous-paths\,-masking-absolute-name -w -deprecated-native-compiler-option -native-compiler ondemand -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil coqutil -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola Rupicola -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2 bedrock2 -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src Crypto src/PushButtonSynthesis/Primitives.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.d57pwUj6uz
MINIMIZER_DEBUG: files:  src/PushButtonSynthesis/Primitives.v
Finished failing transaction in 0.072 secs (0.072u,0.s) (failure)
File "./src/PushButtonSynthesis/Primitives.v", line 93, characters 12-26:
Error: Some unresolved existential variables remain

Command exited with non-zero status 1
src/PushButtonSynthesis/Primitives.vo (real: 2.49, user: 2.11, sys: 0.36, mem: 1019676 ko)
Makefile.coq:809: recipe for target 'src/PushButtonSynthesis/Primitives.vo' failed
make[1]: *** [src/PushButtonSynthesis/Primitives.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto'
Aggregating timing log...
    Time |   Peak Mem | File Name                        
---------------------------------------------------------
0m02.10s | 1019676 ko | Total Time / Peak Mem            
---------------------------------------------------------
0m02.11s | 1019676 ko | PushButtonSynthesis/Primitives.vo
Makefile.ci:151: recipe for target 'ci-fiat_crypto' failed
make: *** [ci-fiat_crypto] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 604KiB file on GitHub Actions Artifacts under bug.log)
ng bug_01.glob (/github/workspace/cwd/bug_01.glob)
getting bug_01.glob (/github/workspace/cwd/bug_01.glob)
�[92m
Succeeded in normalizing Requires.�[0m

Now, I will attempt to split up [Require] statements...
getting /github/workspace/cwd/bug_01.v
getting /github/workspace/cwd/bug_01.glob
getting /github/workspace/cwd/bug_01.glob

No Requires to split.

In order to efficiently manipulate the file, I have to break it into statements.  I will attempt to do this by matching on periods.
�[92m
Splitting successful.�[0m

I will now attempt to remove any lines after the line which generates the error.

No lines to trim.

In order to efficiently manipulate the file, I have to break it into definitions.  I will now attempt to do this.
Sending statements to coqtop...
Done.  Splitting to definitions...
�[92m
Splitting to definitions successful.�[0m

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmp_j9p9c__/Top/bug_01.v", line 370, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp_j9p9c__/Top/bug_01.v", line 417, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmp0r21yli7/Top/bug_01.v", line 375, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp0r21yli7/Top/bug_01.v", line 422, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Qed Obligation with Admit Obligations
�[92m
Admitting Qed Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qed Obligations unsuccessful.
No successful changes.

I will now attempt to replace Qeds with Admitteds
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to replace Qeds with admit. Defined.
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmp_j9p9c__/Top/bug_01.v", line 370, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp_j9p9c__/Top/bug_01.v", line 417, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmp0r21yli7/Top/bug_01.v", line 375, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp0r21yli7/Top/bug_01.v", line 422, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmp_j9p9c__/Top/bug_01.v", line 370, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp_j9p9c__/Top/bug_01.v", line 417, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmp0r21yli7/Top/bug_01.v", line 375, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp0r21yli7/Top/bug_01.v", line 422, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpx_f36d88/Top/bug_01.v", line 435, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpx_f36d88/Top/bug_01.v", line 534, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmp0rxfikfn/Top/bug_01.v", line 435, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp0rxfikfn/Top/bug_01.v", line 537, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting successful

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

cc @JasonGross

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 10, 2023

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src/PushButtonSynthesis/Primitives.v (from ci-fiat_crypto) (interrupted by timeout, being automatically continued) (full log on GitHub Actions)

Partially Minimized Coq File (could not inline Rewriter.Util.plugins.RewriterBuildRegistry)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines, then from 4405 lines to 389 lines, then from 402 lines to 615 lines, then from 621 lines to 464 lines, then from 478 lines to 431 lines, then from 444 lines to 700 lines, then from 706 lines to 435 lines, then from 449 lines to 476 lines, then from 482 lines to 549 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Modules that could not be inlined: Rewriter.Util.plugins.RewriterBuildRegistry
   Expected coqc runtime on this file: 10.096 sec *)
Require Coq.Init.Ltac.
Require Crypto.Util.Tactics.SubstEvars.
Require Coq.micromega.Lia.
Require Coq.Arith.Arith.
Require Coq.Lists.List.
Require Coq.Classes.Morphisms.
Require Crypto.Util.GlobalSettings.
Require Crypto.Util.FixCoqMistakes.
Require Crypto.Util.ListUtil.Filter.
Require Coq.ZArith.BinInt.
Require Crypto.Util.Notations.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.FixCoqMistakes.
Require Rewriter.Util.Notations.
Require Ltac2.Init.
Require Coq.Classes.RelationClasses.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.HProp.
Require Rewriter.Util.Equality.
Require Rewriter.Util.PrimitiveProd.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Language.Pre.
Require Coq.Bool.Bool.
Require Rewriter.Util.Bool.
Require Coq.Logic.Eqdep_dec.
Require Coq.NArith.NArith.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Relations.Relation_Definitions.
Require Rewriter.Util.NatUtil.
Require Coq.Lists.SetoidList.
Require Coq.Arith.Peano_dec.
Require Coq.ZArith.ZArith.
Require Coq.Numbers.BinNums.
Require Rewriter.Util.Pointed.
Require Coq.Setoids.Setoid.
Require Rewriter.Util.Prod.
Require Rewriter.Util.Sigma.
Require Coq.ZArith.ZArith_dec.
Require Coq.NArith.BinNat.
Require Rewriter.Util.Decidable.
Require Rewriter.Util.Tactics.Head.
Require Rewriter.Util.Tactics.BreakMatch.
Require Rewriter.Util.Tactics.DestructHyps.
Require Rewriter.Util.Tactics.DestructHead.
Require Rewriter.Util.Option.
Require Rewriter.Util.Tactics.SpecializeBy.
Require Rewriter.Util.Tactics.Test.
Require Rewriter.Util.Tactics.Not.
Require Rewriter.Util.Tactics.DoWithHyp.
Require Rewriter.Util.Tactics.RewriteHyp.
Require Rewriter.Util.Tactics.ConstrFail.
Require Rewriter.Util.Tactics.SplitInContext.
Require Rewriter.Util.ListUtil.
Require Rewriter.Language.PreLemmas.
Require Ltac2.Int.
Require Ltac2.Message.
Require Ltac2.Control.
Require Ltac2.Bool.
Require Ltac2.Array.
Require Ltac2.Char.
Require Ltac2.Constant.
Require Ltac2.Constr.
Require Ltac2.Constructor.
Require Ltac2.Std.
Require Ltac2.Env.
Require Ltac2.Evar.
Require Ltac2.Float.
Require Ltac2.List.
Require Ltac2.Fresh.
Require Ltac2.Ident.
Require Ltac2.Ind.
Require Ltac2.Ltac1.
Require Ltac2.Meta.
Require Ltac2.Option.
Require Ltac2.Pattern.
Require Ltac2.Printf.
Require Ltac2.Proj.
Require Ltac2.String.
Require Ltac2.Uint63.
Require Ltac2.FSet.
Require Ltac2.FMap.
Require Ltac2.Notations.
Require Ltac2.Ltac2.
Require Coq.FSets.FMapPositive.
Require Rewriter.Util.Tactics.GetGoal.
Require Rewriter.Util.LetIn.
Require Rewriter.Util.OptionList.
Require Rewriter.Util.CPSNotations.
Require Coq.Classes.CMorphisms.
Require Coq.Strings.String.
Require Coq.Strings.Ascii.
Require Rewriter.Util.ListUtil.SetoidList.
Require Rewriter.Util.Tactics.Contains.
Require Rewriter.Util.Tactics.SetoidSubst.
Require Rewriter.Util.Sum.
Require Rewriter.Util.Comparison.
Require Rewriter.Util.Bool.Reflect.
Require Rewriter.Language.Language.
Require Rewriter.Language.UnderLets.
Require Rewriter.Language.UnderLetsCacheProofs.
Require Rewriter.Util.Tactics.RunTacticAsConstr.
Require Rewriter.Util.Tactics.DebugPrint.
Require Rewriter.Util.Tactics2.List.
Require Rewriter.Util.Tactics2.Ltac1.
Require Rewriter.Util.Tactics2.Message.
Require Rewriter.Util.Tactics2.Ident.
Require Rewriter.Util.Tactics2.Char.
Require Rewriter.Util.Tactics2.String.
Require Rewriter.Util.Tactics2.Array.
Require Rewriter.Util.plugins.RewriterBuildRegistry.
Import Coq.ZArith.BinInt.
Import Crypto.Util.Notations.

Infix ">>" := Z.shiftr : Z_scope.
Infix "<<" := Z.shiftl : Z_scope.
Infix "&'" := Z.land : Z_scope.
Import Coq.ZArith.BinInt.

Class Decidable (P : Prop) := dec : {P} + {~P}.
Arguments dec _%type_scope {_}.
Notation DecidableRel R := (forall x y, Decidable (R x y)).
Global Instance dec_eq_Z : DecidableRel (@eq Z) | 10.
Admitted.
Local Open Scope Z_scope.

Module Export Z.

  Definition zselect (cond zero_case nonzero_case : Z) :=
    if cond =? 0 then zero_case else nonzero_case.

  Definition add_modulo x y modulus :=
    if (modulus <=? x + y) then (x + y) - modulus else (x + y).
Definition lnot_modulo (v : Z) (modulus : Z) : Z.
Admitted.
Definition bneg (v : Z) : Z.
Admitted.

  Definition cc_m s x := if dec (2 ^ (Z.log2 s) = s) then x >> (Z.log2 s - 1) else x / (s / 2).

  Definition rshi s hi lo n :=
       let k := Z.log2 s in
       if dec (2 ^ k = s)
       then ((lo + (hi << k)) >> n) &' (Z.ones k)
       else ((lo + hi * s) >> n) mod s.

  Definition truncating_shiftl bw x n := (x << n) mod (2^bw).
Definition add_with_carry (c : Z) (x y : Z) : Z.
Admitted.
Definition add_get_carry_full (bound : Z) (x y : Z) : Z * Z.
Admitted.
Definition add_with_get_carry_full (bound : Z) (c x y : Z) : Z * Z.
Admitted.
Definition sub_get_borrow_full (bound : Z) (x y : Z) : Z * Z.
Admitted.
Definition sub_with_get_borrow_full (bound : Z) (c x y : Z) : Z * Z.
Admitted.
Definition mul_split (s x y : Z) : Z * Z.
Admitted.
Definition mul_high (s x y : Z) : Z.
Admitted.
Definition ltz (x y : Z) : Z.
Admitted.
Definition combine_at_bitwidth (bitwidth lo hi : Z) : Z.
Admitted.

  Definition value_barrier (x : Z) := x.
Import Coq.Lists.List.

  Fixpoint update_nth {T} n f (xs:list T) {struct n} :=
        match n with
        | O => match xs with
                                 | nil => nil
                                 | x'::xs' => f x'::xs'
                                 end
        | S n' =>  match xs with
                                 | nil => nil
                                 | x'::xs' => x'::update_nth n' f xs'
                                 end
  end.

Import Coq.Bool.Bool.

Notation reflect_rel P b := (forall x y, reflect (P x y) (b x y)).

Module Export Crypto_DOT_Util_DOT_ZRange_WRAPPED.
Module Export ZRange.

Declare Scope zrange_scope.

Record zrange := { lower : Z ; upper : Z }.
Bind Scope zrange_scope with zrange.
Scheme Minimality for zrange Sort Type.
Definition zrange_beq (x y : zrange) : bool.
Admitted.

Global Instance reflect_zrange_eq : reflect_rel (@eq zrange) zrange_beq | 10.
Admitted.

End ZRange.

End Crypto_DOT_Util_DOT_ZRange_WRAPPED.

Module Export ZRange.
Definition normalize (v : zrange) : zrange.
Admitted.
Definition opp (v : zrange) : zrange.
Admitted.
    Notation "- x" := (opp x) : zrange_scope.
Export Rewriter.Language.Pre.

Module Export ident.
  Section cast.
Definition is_more_pos_than_neg (r : zrange) (v : BinInt.Z) : bool.
Admitted.
Let cast_outside_of_range (r : zrange) (v : BinInt.Z) : BinInt.Z.
Admitted.

    Definition cast (r : zrange) (x : BinInt.Z)
      := let r := ZRange.normalize r in
         if (lower r <=? x) && (x <=? upper r)
         then x
         else if is_more_pos_than_neg r x
              then cast_outside_of_range r x
              else -cast_outside_of_range (-r) (-x).
    Definition cast2 (r : zrange * zrange) (x : BinInt.Z * BinInt.Z)
      := (cast (Datatypes.fst r) (Datatypes.fst x),
          cast (Datatypes.snd r) (Datatypes.snd x)).
  End cast.

  Section comment.
    Definition comment {A} (x : A) := tt.

    Definition comment_no_keep {A} (x : A) := tt.
  End comment.

  Module Export fancy.
    Module Export with_wordmax.
      Section with_wordmax.
        Context (log2wordmax : BinInt.Z).
Definition add (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition addc (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition sub (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition subb (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition mulll : Z * Z -> Z.
Admitted.
Definition mullh : Z * Z -> Z.
Admitted.
Definition mulhl : Z * Z -> Z.
Admitted.
Definition mulhh : Z * Z -> Z.
Admitted.
Definition selm : Z * Z * Z -> Z.
Admitted.
Definition rshi (n : Z) : Z * Z -> Z.
Admitted.
      End with_wordmax.
    End with_wordmax.

    Definition add : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.add] in fun x => with_wordmax.add (fst (fst x)) (snd (fst x)) (snd x).
    Definition addc : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.addc] in fun x => with_wordmax.addc (fst (fst x)) (snd (fst x)) (snd x).
    Definition sub : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.sub] in fun x => with_wordmax.sub (fst (fst x)) (snd (fst x)) (snd x).
    Definition subb : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.subb] in fun x => with_wordmax.subb (fst (fst x)) (snd (fst x)) (snd x).
    Definition mulll : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulll] in fun x => with_wordmax.mulll (fst x) (snd x).
    Definition mullh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mullh] in fun x => with_wordmax.mullh (fst x) (snd x).
    Definition mulhl : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhl] in fun x => with_wordmax.mulhl (fst x) (snd x).
    Definition mulhh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhh] in fun x => with_wordmax.mulhh (fst x) (snd x).
    Definition selm : Z * (Z * Z * Z) -> Z
      := Eval cbv [with_wordmax.selm] in fun x => with_wordmax.selm (fst x) (snd x).
    Definition rshi : (Z * Z) * (Z * Z) -> Z
      := Eval cbv [with_wordmax.rshi] in fun x => with_wordmax.rshi (fst (fst x)) (snd (fst x)) (snd x).
Definition selc : Z * Z * Z -> Z.
Admitted.
Definition sell : Z * Z * Z -> Z.
Admitted.
Definition addm : Z * Z * Z -> Z.
Admitted.

Notation prod_rect_nodep := Rewriter.Util.Prod.prod_rect_nodep (only parsing).
Notation nat_rect_arrow_nodep := Rewriter.Util.NatUtil.nat_rect_arrow_nodep (only parsing).
Notation list_rect_arrow_nodep := Rewriter.Util.ListUtil.list_rect_arrow_nodep (only parsing).
Notation bool_rect_nodep := Rewriter.Util.Bool.bool_rect_nodep (only parsing).

Module Export Thunked.
  Notation bool_rect := Rewriter.Util.Bool.Thunked.bool_rect (only parsing).
  Notation list_rect := Rewriter.Util.ListUtil.Thunked.list_rect (only parsing).
  Notation list_case := Rewriter.Util.ListUtil.Thunked.list_case (only parsing).
  Notation nat_rect := Rewriter.Util.NatUtil.Thunked.nat_rect (only parsing).
  Notation option_rect := Rewriter.Util.Option.Thunked.option_rect (only parsing).
Definition var_like_idents : InductiveHList.hlist.
Admitted.
Definition base_type_list_named : InductiveHList.hlist.
exact ([with_name Z BinInt.Z
      ; with_name bool Datatypes.bool
      ; with_name nat Datatypes.nat
      ; with_name zrange ZRange.zrange
      ; with_name string String.string]%hlist).
Defined.
Definition all_ident_named_interped : InductiveHList.hlist.
exact ([with_name ident_Literal (@ident.literal)
      ; with_name ident_comment (@ident.comment)
      ; with_name ident_comment_no_keep (@ident.comment_no_keep)
      ; with_name ident_value_barrier (@Z.value_barrier)
      ; with_name ident_Nat_succ Nat.succ
      ; with_name ident_Nat_pred Nat.pred
      ; with_name ident_Nat_max Nat.max
      ; with_name ident_Nat_mul Nat.mul
      ; with_name ident_Nat_add Nat.add
      ; with_name ident_Nat_sub Nat.sub
      ; with_name ident_Nat_eqb Nat.eqb
      ; with_name ident_nil (@Datatypes.nil)
      ; with_name ident_cons (@Datatypes.cons)
      ; with_name ident_tt Datatypes.tt
      ; with_name ident_pair (@Datatypes.pair)
      ; with_name ident_fst (@Datatypes.fst)
      ; with_name ident_snd (@Datatypes.snd)
      ; with_name ident_prod_rect (@prod_rect_nodep)
      ; with_name ident_bool_rect (@Thunked.bool_rect)
      ; with_name ident_bool_rect_nodep (@bool_rect_nodep)
      ; with_name ident_nat_rect (@Thunked.nat_rect)
      ; with_name ident_eager_nat_rect (ident.eagerly (@Thunked.nat_rect))
      ; with_name ident_nat_rect_arrow (@nat_rect_arrow_nodep)
      ; with_name ident_eager_nat_rect_arrow (ident.eagerly (@nat_rect_arrow_nodep))
      ; with_name ident_list_rect (@Thunked.list_rect)
      ; with_name ident_eager_list_rect (ident.eagerly (@Thunked.list_rect))
      ; with_name ident_list_rect_arrow (@list_rect_arrow_nodep)
      ; with_name ident_eager_list_rect_arrow (ident.eagerly (@list_rect_arrow_nodep))
      ; with_name ident_list_case (@Thunked.list_case)
      ; with_name ident_List_length (@List.length)
      ; with_name ident_List_seq (@List.seq)
      ; with_name ident_List_firstn (@List.firstn)
      ; with_name ident_List_skipn (@List.skipn)
      ; with_name ident_List_repeat (@repeat)
      ; with_name ident_List_combine (@List.combine)
      ; with_name ident_List_map (@List.map)
      ; with_name ident_List_app (@List.app)
      ; with_name ident_List_rev (@List.rev)
      ; with_name ident_List_flat_map (@List.flat_map)
      ; with_name ident_List_partition (@List.partition)
      ; with_name ident_List_filter (@List.filter)
      ; with_name ident_List_fold_right (@List.fold_right)
      ; with_name ident_List_update_nth (@update_nth)
      ; with_name ident_List_nth_default (@nth_default)
      ; with_name ident_eager_List_nth_default (ident.eagerly (@nth_default))
      ; with_name ident_Z_add Z.add
      ; with_name ident_Z_mul Z.mul
      ; with_name ident_Z_pow Z.pow
      ; with_name ident_Z_sub Z.sub
      ; with_name ident_Z_opp Z.opp
      ; with_name ident_Z_div Z.div
      ; with_name ident_Z_modulo Z.modulo
      ; with_name ident_Z_eqb Z.eqb
      ; with_name ident_Z_leb Z.leb
      ; with_name ident_Z_ltb Z.ltb
      ; with_name ident_Z_geb Z.geb
      ; with_name ident_Z_gtb Z.gtb
      ; with_name ident_Z_log2 Z.log2
      ; with_name ident_Z_log2_up Z.log2_up
      ; with_name ident_Z_of_nat Z.of_nat
      ; with_name ident_Z_to_nat Z.to_nat
      ; with_name ident_Z_shiftr Z.shiftr
      ; with_name ident_Z_shiftl Z.shiftl
      ; with_name ident_Z_land Z.land
      ; with_name ident_Z_lor Z.lor
      ; with_name ident_Z_min Z.min
      ; with_name ident_Z_max Z.max
      ; with_name ident_Z_mul_split Z.mul_split
      ; with_name ident_Z_mul_high Z.mul_high
      ; with_name ident_Z_add_get_carry Z.add_get_carry_full
      ; with_name ident_Z_add_with_carry Z.add_with_carry
      ; with_name ident_Z_add_with_get_carry Z.add_with_get_carry_full
      ; with_name ident_Z_sub_get_borrow Z.sub_get_borrow_full
      ; with_name ident_Z_sub_with_get_borrow Z.sub_with_get_borrow_full
      ; with_name ident_Z_ltz Z.ltz
      ; with_name ident_Z_zselect Z.zselect
      ; with_name ident_Z_add_modulo Z.add_modulo
      ; with_name ident_Z_truncating_shiftl Z.truncating_shiftl
      ; with_name ident_Z_bneg Z.bneg
      ; with_name ident_Z_lnot_modulo Z.lnot_modulo
      ; with_name ident_Z_lxor Z.lxor
      ; with_name ident_Z_rshi Z.rshi
      ; with_name ident_Z_cc_m Z.cc_m
      ; with_name ident_Z_combine_at_bitwidth Z.combine_at_bitwidth
      ; with_name ident_Z_cast ident.cast
      ; with_name ident_Z_cast2 ident.cast2
      ; with_name ident_Some (@Datatypes.Some)
      ; with_name ident_None (@Datatypes.None)
      ; with_name ident_option_rect (@Thunked.option_rect)
      ; with_name ident_Build_zrange ZRange.Build_zrange
      ; with_name ident_zrange_rect (@ZRange.zrange_rect_nodep)
      ; with_name ident_fancy_add ident.fancy.add
      ; with_name ident_fancy_addc ident.fancy.addc
      ; with_name ident_fancy_sub ident.fancy.sub
      ; with_name ident_fancy_subb ident.fancy.subb
      ; with_name ident_fancy_mulll ident.fancy.mulll
      ; with_name ident_fancy_mullh ident.fancy.mullh
      ; with_name ident_fancy_mulhl ident.fancy.mulhl
      ; with_name ident_fancy_mulhh ident.fancy.mulhh
      ; with_name ident_fancy_rshi ident.fancy.rshi
      ; with_name ident_fancy_selc ident.fancy.selc
      ; with_name ident_fancy_selm ident.fancy.selm
      ; with_name ident_fancy_sell ident.fancy.sell
      ; with_name ident_fancy_addm ident.fancy.addm
     ]%hlist).
Defined.
Definition scraped_data : ScrapedData.t.
exact ({| ScrapedData.base_type_list_named := base_type_list_named
        ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}).
Defined.

Declare ML Module "coq-rewriter.rewriter_build".
Import Crypto.Util.ListUtil.Filter.

Module Export Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.
  Rewriter Emit Inductives From Scraped
           {| ScrapedData.base_type_list_named := base_type_list_named ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}
           As base ident raw_ident pattern_ident.

  Definition package : GoalType.package_with_args scraped_data var_like_idents base ident.
  Proof.
Tactic.make_package.
Defined.
Module Export APINotations.
Import Ltac2.Ltac2.
Module Export Compilers.
  Export Reify.Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.Tactic.

  Definition exprInfo : Classes.ExprInfoT := Eval hnf in GoalType.exprInfo package.

  Global Existing Instances
         baseHasNat
         baseHasNatCorrect
         try_make_base_transport_cps_correct
         buildEagerIdent
         buildInterpEagerIdentCorrect
         toRestrictedIdent
         toFromRestrictedIdent
         buildInterpIdentCorrect
         invertIdent
         buildInvertIdentCorrect
         base_default
         exprInfo
  .
  Ltac2 mk_reify_base_type () :=
    let package := reify_package_of_package 'package in
    reify_base_type_via_reify_package package.
  Ltac2 mk_reify_type () :=
    let package := reify_package_of_package 'package in
    reify_type_via_reify_package package.
  Ltac2 mk_reify_ident_opt () :=
    let package := reify_package_of_package 'package in
    reify_ident_via_reify_package_opt package.
  Ltac2 reify_type (ty : constr) : constr := mk_reify_type () ty.
  #[deprecated(since="8.15",note="Use Ltac2 instead.")]
   Ltac reify_type term :=
    let f := ltac2:(term
                    |- Control.refine (fun () => reify_type (Option.get (Ltac1.to_constr term)))) in
    constr:(ltac:(f term)).

  Module Export base.

    Notation type := (@base.type base) (only parsing).
    Notation base_interp := Compilers.base_interp (only parsing).
    Notation interp := (base.interp Compilers.base_interp) (only parsing).
  End base.

  Ltac2 _Reify_rhs () : unit :=
    let reify_base_type := mk_reify_base_type () in
    let reify_ident_opt := mk_reify_ident_opt () in
    expr._Reify_rhs 'base.type 'ident reify_base_type reify_ident_opt '@base.interp '@ident_interp ().
  Ltac Reify_rhs _ :=
    ltac2:(_Reify_rhs ()).

  Module Import invert_expr.

    End invert_expr.

  End Compilers.

End APINotations.

    Notation Expr := (@expr.Expr base.type ident).

    Notation Interp := (@expr.Interp base.type ident base.interp (@ident_interp)).

    Notation reify_type t := (ltac:(let rt := reify_type t in exact rt)) (only parsing).
    Notation reify_type_of e := (reify_type ((fun t (_ : t) => t) _ e)) (only parsing).

Import Coq.Relations.Relation_Definitions.
Import Crypto.Util.Tactics.SubstEvars.
Import Language.Wf.Compilers.

Fixpoint pointwise_equal {t} : relation (type.interp base.interp t)
  := match t with
     | type.base t => Logic.eq
     | type.arrow s d
       => fun (f g : type.interp base.interp s -> type.interp base.interp d)
          => forall x, pointwise_equal (f x) (g x)
     end.
Definition is_reification_of' {t} (e : Expr t) (v : type.interp base.interp t) : Prop.
exact (pointwise_equal (Interp e) v /\ Wf e).
Defined.

Notation is_reification_of rop op
  := (match @is_reification_of' (reify_type_of op) rop op with
      | T
        => ltac:(
             let T := (eval cbv [pointwise_equal is_reification_of' T] in T) in
             let T := (eval cbn [type.interp base.interp base.base_interp] in T) in
             exact T)
      end)
       (only parsing).

Ltac cache_reify _ :=
  split;
  [ intros;
    etransitivity;
    [
    | repeat match goal with |- _ = ?f' ?x => is_var x; apply (f_equal (fun f => f _)) end;
      Reify_rhs ();
      reflexivity ];
    subst_evars;
    reflexivity
  | prove_Wf () ].
Import Coq.ZArith.ZArith.

Derive reified_id_gen
       SuchThat (is_reification_of reified_id_gen (@id (list Z)))
       As reified_id_gen_correct.
Proof.
Time cache_reify ().
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted) (truncated to 8.0KiB; full 28KiB file on GitHub Actions Artifacts under tmp.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines, then from 4405 lines to 389 lines, then from 402 lines to 615 lines, then from 621 lines to 464 lines, then from 478 lines to 431 lines, then from 444 lines to 649 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Expected coqc runtime on this file: 0.000 sec *)
Require Coq.Init.Ltac.
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Crypto.Util.Tactics.SubstEvars.
Require Crypto.Util.ListUtil.Filter.
Require Crypto.Util.ZUtil.Notations.
Require Crypto.Util.Decidable.
Require Coq.Arith.Arith.
Require Coq.Arith.Peano_dec.
Require Coq.Bool.Bool.
Require Coq.Classes.CMorphisms.
Require Coq.Classes.Morphisms.
Require Coq.Classes.RelationClasses.
Require Coq.FSets.FMapPositive.
Require Coq.Lists.List.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.MSets.MSetFacts.
Require Coq.MSets.MSetPositive.
Require Coq.NArith.BinNat.
Require Coq.NArith.NArith.
Require Coq.Numbers.BinNums.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Program.Tactics.
Require Coq.Relations.Relation_Definitions.
Require Coq.Relations.Relations.
Require Coq.Setoids.Setoid.
Require Coq.Strings.Ascii.
Require Coq.Strings.String.
Require Coq.ZArith.BinInt.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.ZArith_dec.
Require Coq.derive.Derive.
Require Coq.micromega.Lia.
Require Ltac2.Init.
Require Rewriter.Util.Comparison.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.HProp.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.Tactics.CPSId.
Require Rewriter.Util.Tactics.ClearFree.
Require Rewriter.Util.Tactics.ConstrFail.
Require Rewriter.Util.Tactics.Contains.
Require Rewriter.Util.Tactics.EvarNormalize.
Require Rewriter.Util.Tactics.GetGoal.
Require Rewriter.Util.Tactics.PrintContext.
Require Rewriter.Util.Tactics.SetEvars.
Require Rewriter.Util.Tactics.SubstEvars.
Require Rewriter.Util.Tactics.Test.
Require Rewriter.Util.Tactics.TransparentAssert.
Require Rewriter.Util.TypeList.
Require Rewriter.Util.plugins.StrategyTactic.
Require Ltac2.Bool.
Require Ltac2.Constant.
Require Ltac2.Constr.
Require Ltac2.Constructor.
Require Ltac2.Evar.
Require Ltac2.FSet.
Require Ltac2.Float.
Require Ltac2.Ident.
Require Ltac2.Ind.
Require Ltac2.Int.
Require Ltac2.Ltac1.
Require Ltac2.Message.
Require Ltac2.Meta.
Require Ltac2.Proj.
Require Ltac2.Std.
Require Ltac2.String.
Require Ltac2.Uint63.
Require Rewriter.Util.Bool.Equality.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Pointed.
Require Rewriter.Util.Tactics.DebugPrint.
Require Rewriter.Util.Tactics.Not.
Require Rewriter.Util.Tactics.PrintGoal.
Require Rewriter.Util.Tactics.SetoidSubst.
Require Ltac2.Char.
Require Ltac2.Control.
Require Ltac2.Env.
Require Ltac2.FMap.
Require Ltac2.Printf.
Require Rewriter.Util.Bool.
Require Rewriter.Util.FixCoqMistakes.
Require Rewriter.Util.Tactics.CacheTerm.
Require Rewriter.Util.Tactics.WarnIfGoalsRemain.
Require Ltac2.Option.
Require Ltac2.Pattern.
Require Rewriter.Util.Equality.
Require Rewriter.Util.Logic.ProdForall.
Require Rewriter.Util.Notations.
Require Rewriter.Util.Sigma.Related.
Require Rewriter.Util.Tactics.DestructHyps.
Require Rewriter.Util.Tactics.FindHyp.
Require Rewriter.Util.Tactics.Head.
Require Rewriter.Util.Tactics.HeadUnderBinders.
Require Rewriter.Util.Tactics.RunTacticAsConstr.
Require Rewriter.Util.Tactics.SpecializeBy.
Require Rewriter.Util.Tactics.SplitInContext.
Require Rewriter.Util.CPSNotations.
Require Rewriter.Util.Tactics.BreakMatch.
Require Rewriter.Util.Tactics.UniquePose.
Require Ltac2.Array.
Require Ltac2.List.
Require Rewriter.Util.Sigma.
Require Rewriter.Util.Tactics.DestructHead.
Require Rewriter.Util.Tactics.DoWithHyp.
Require Rewriter.Util.Tactics.SpecializeAllWays.
Require Ltac2.Fresh.
Require Rewriter.Util.LetIn.
Require Rewriter.Util.Tactics.RewriteHyp.
Require Rewriter.Util.Logic.ExistsEqAnd.
Require Rewriter.Util.NatUtil.
Require Rewriter.Util.PrimitiveProd.
Require Ltac2.Notations.
Require Rewriter.Util.Option.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.PrimitiveSigma.
Require Rewriter.Util.Prod.
Require Rewriter.Util.OptionList.
Require Rewriter.Util.Decidable.
Require Rewriter.Util.ListUtil.SetoidList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Util.ListUtil.Forall.
Require Rewriter.Language.Pre.
Require Rewriter.Util.FMapPositive.Equality.
Require Rewriter.Util.MSetPositive.Equality.
Require Rewriter.Util.MSetPositive.Facts.
Require Rewriter.Util.Sum.
Require Ltac2.Ltac2.
Require Rewriter.Util.plugins.Ltac2Extra.
Require Rewriter.Util.Tactics2.Array.
Require Rewriter.Util.Tactics2.Char.
Require Rewriter.Util.Tactics2.Constr.Unsafe.MakeAbbreviations.
Require Rewriter.Util.Tactics2.DestEvar.
Require Rewriter.Util.Tactics2.FixNotationsForPerformance.
Require Rewriter.Util.Tactics2.Head.
Require Rewriter.Util.Tactics2.Ident.
Require Rewriter.Util.Tactics2.InstantiateEvar.
Require Rewriter.Util.Tactics2.Iterate.
Require Rewriter.Util.Tacti
Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.4MiB file on GitHub Actions Artifacts under build.log)
ZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.SuxOtvQJjc
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.12uCHXtMKW
MINIMIZER_DEBUG: files: 
make --no-print-directory -C bedrock2/bedrock2 noex
Generating Makefile.coq.noex
rm -f .coqdeps.d
make -f Makefile.coq.noex
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.QH7IuI5gl3
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.IrFBCZDaPM
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.W5cgkBoMwP
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.foGOlJ0TAm
MINIMIZER_DEBUG: files: 
rm -f .coqdeps.d
make -f Makefile.coq
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.LbsGRObTws
MINIMIZER_DEBUG: files: 
COQDEP VFILES
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.vGJUhXMFA4
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.Wa2OvJjcRe
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.Gob783zEQx
MINIMIZER_DEBUG: files: 
make[4]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.ydkjZHnWtX
MINIMIZER_DEBUG: files: 
COQC src/PushButtonSynthesis/Primitives.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -w +implicit-core-hint-db\,+implicits-in-term\,+non-reversible-notation\,+deprecated-intros-until-0\,+deprecated-focus\,+unused-intro-pattern\,+variable-collision\,+unexpected-implicit-declaration\,+omega-is-deprecated\,+deprecated-instantiate-syntax\,+non-recursive\,+undeclared-scope\,+deprecated-hint-rewrite-without-locality\,+deprecated-hint-without-locality\,+deprecated-instance-without-locality\,+deprecated-typeclasses-transparency-without-locality\,unsupported-attributes -w -notation-overridden\,-deprecated-hint-constr\,-fragile-hint-constr\,-native-compiler-disabled\,-ambiguous-paths\,-masking-absolute-name -w -deprecated-native-compiler-option -native-compiler ondemand -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil coqutil -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola Rupicola -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2 bedrock2 -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src Crypto src/PushButtonSynthesis/Primitives.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.5oBYo96D4b
MINIMIZER_DEBUG: files:  src/PushButtonSynthesis/Primitives.v
Finished failing transaction in 0.093 secs (0.093u,0.s) (failure)
File "./src/PushButtonSynthesis/Primitives.v", line 93, characters 12-26:
Error: Some unresolved existential variables remain

Command exited with non-zero status 1
src/PushButtonSynthesis/Primitives.vo (real: 3.08, user: 2.57, sys: 0.50, mem: 1019876 ko)
Makefile.coq:809: recipe for target 'src/PushButtonSynthesis/Primitives.vo' failed
make[1]: *** [src/PushButtonSynthesis/Primitives.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto'
Aggregating timing log...
    Time |   Peak Mem | File Name                        
---------------------------------------------------------
0m02.56s | 1019876 ko | Total Time / Peak Mem            
---------------------------------------------------------
0m02.57s | 1019876 ko | PushButtonSynthesis/Primitives.vo
Makefile.ci:151: recipe for target 'ci-fiat_crypto' failed
make: *** [ci-fiat_crypto] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 637KiB file on GitHub Actions Artifacts under bug.log)
, I will attempt to split up [Require] statements...
getting /github/workspace/cwd/bug_01.v
getting /github/workspace/cwd/bug_01.glob
getting /github/workspace/cwd/bug_01.glob

No Requires to split.

In order to efficiently manipulate the file, I have to break it into statements.  I will attempt to do this by matching on periods.
�[92m
Splitting successful.�[0m

I will now attempt to remove any lines after the line which generates the error.

No lines to trim.

In order to efficiently manipulate the file, I have to break it into definitions.  I will now attempt to do this.
Sending statements to coqtop...
Done.  Splitting to definitions...
�[92m
Splitting to definitions successful.�[0m

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmpctrta6hq/Top/bug_01.v", line 235, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpb9coezrn/Top/bug_01.v", line 315, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpb9coezrn/Top/bug_01.v", line 362, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Qed Obligation with Admit Obligations
�[92m
Admitting Qed Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qed Obligations unsuccessful.
No successful changes.

I will now attempt to replace Qeds with Admitteds
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to replace Qeds with admit. Defined.
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmpctrta6hq/Top/bug_01.v", line 235, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpb9coezrn/Top/bug_01.v", line 315, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpb9coezrn/Top/bug_01.v", line 362, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmpctrta6hq/Top/bug_01.v", line 235, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpb9coezrn/Top/bug_01.v", line 315, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpb9coezrn/Top/bug_01.v", line 362, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpl86ciw38/Top/bug_01.v", line 315, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpl86ciw38/Top/bug_01.v", line 414, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmp3qolt_ol/Top/bug_01.v", line 315, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp3qolt_ol/Top/bug_01.v", line 417, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

cc @JasonGross

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 10, 2023

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src/PushButtonSynthesis/Primitives.v (from ci-fiat_crypto) (interrupted by timeout, being automatically continued) (full log on GitHub Actions)

Partially Minimized Coq File (could not inline Rewriter.Util.plugins.RewriterBuildRegistry)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines, then from 4405 lines to 389 lines, then from 402 lines to 615 lines, then from 621 lines to 464 lines, then from 478 lines to 431 lines, then from 444 lines to 700 lines, then from 706 lines to 435 lines, then from 449 lines to 476 lines, then from 482 lines to 549 lines, then from 567 lines to 439 lines, then from 452 lines to 668 lines, then from 674 lines to 440 lines, then from 454 lines to 524 lines, then from 530 lines to 442 lines, then from 456 lines to 475 lines, then from 481 lines to 475 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Modules that could not be inlined: Rewriter.Util.plugins.RewriterBuildRegistry
   Expected coqc runtime on this file: 7.475 sec *)
Require Coq.Init.Ltac.
Require Coq.Classes.Morphisms.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.FixCoqMistakes.
Require Rewriter.Util.Notations.
Require Ltac2.Init.
Require Coq.Lists.List.
Require Coq.Classes.RelationClasses.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.HProp.
Require Rewriter.Util.Equality.
Require Rewriter.Util.PrimitiveProd.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Language.Pre.
Require Coq.Bool.Bool.
Require Rewriter.Util.Bool.
Require Coq.Logic.Eqdep_dec.
Require Coq.NArith.NArith.
Require Coq.Arith.Arith.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Relations.Relation_Definitions.
Require Coq.micromega.Lia.
Require Rewriter.Util.NatUtil.
Require Coq.Lists.SetoidList.
Require Coq.Arith.Peano_dec.
Require Coq.ZArith.ZArith.
Require Coq.Numbers.BinNums.
Require Rewriter.Util.Pointed.
Require Rewriter.Util.plugins.RewriterBuildRegistry.
Ltac subst_evars :=
  repeat match goal with
         | [ e := ?E |- _ ] => is_evar E; subst e
         end.
Import Coq.Lists.List.
Import Coq.Classes.Morphisms.

  #[export] Instance Proper_filter_eq {A} : Proper ((eq ==> eq) ==> eq ==> eq) (@filter A).
Admitted.
Reserved Infix "<<" (at level 30, no associativity).
Reserved Infix ">>" (at level 30, no associativity).
Reserved Infix "&'" (at level 50).
Import Coq.ZArith.BinInt.

Infix ">>" := Z.shiftr : Z_scope.
Infix "<<" := Z.shiftl : Z_scope.
Infix "&'" := Z.land : Z_scope.

Class Decidable (P : Prop) := dec : {P} + {~P}.
Arguments dec _%type_scope {_}.
Notation DecidableRel R := (forall x y, Decidable (R x y)).
Global Instance dec_eq_Z : DecidableRel (@eq Z) | 10.
Admitted.
Local Open Scope Z_scope.

Module Export Z.

  Definition zselect (cond zero_case nonzero_case : Z) :=
    if cond =? 0 then zero_case else nonzero_case.

  Definition add_modulo x y modulus :=
    if (modulus <=? x + y) then (x + y) - modulus else (x + y).
Definition lnot_modulo (v : Z) (modulus : Z) : Z.
Admitted.
Definition bneg (v : Z) : Z.
Admitted.

  Definition cc_m s x := if dec (2 ^ (Z.log2 s) = s) then x >> (Z.log2 s - 1) else x / (s / 2).

  Definition rshi s hi lo n :=
       let k := Z.log2 s in
       if dec (2 ^ k = s)
       then ((lo + (hi << k)) >> n) &' (Z.ones k)
       else ((lo + hi * s) >> n) mod s.

  Definition truncating_shiftl bw x n := (x << n) mod (2^bw).
Definition add_with_carry (c : Z) (x y : Z) : Z.
Admitted.
Definition add_get_carry_full (bound : Z) (x y : Z) : Z * Z.
Admitted.
Definition add_with_get_carry_full (bound : Z) (c x y : Z) : Z * Z.
Admitted.
Definition sub_get_borrow_full (bound : Z) (x y : Z) : Z * Z.
Admitted.
Definition sub_with_get_borrow_full (bound : Z) (c x y : Z) : Z * Z.
Admitted.
Definition mul_split (s x y : Z) : Z * Z.
Admitted.
Definition mul_high (s x y : Z) : Z.
Admitted.
Definition ltz (x y : Z) : Z.
Admitted.
Definition combine_at_bitwidth (bitwidth lo hi : Z) : Z.
Admitted.

  Definition value_barrier (x : Z) := x.

  Fixpoint update_nth {T} n f (xs:list T) {struct n} :=
        match n with
        | O => match xs with
                                 | nil => nil
                                 | x'::xs' => f x'::xs'
                                 end
        | S n' =>  match xs with
                                 | nil => nil
                                 | x'::xs' => x'::update_nth n' f xs'
                                 end
  end.

Import Coq.Bool.Bool.

Notation reflect_rel P b := (forall x y, reflect (P x y) (b x y)).

Module Export Crypto_DOT_Util_DOT_ZRange_WRAPPED.
Module Export ZRange.

Declare Scope zrange_scope.

Record zrange := { lower : Z ; upper : Z }.
Bind Scope zrange_scope with zrange.
Scheme Minimality for zrange Sort Type.
Definition zrange_beq (x y : zrange) : bool.
Admitted.

Global Instance reflect_zrange_eq : reflect_rel (@eq zrange) zrange_beq | 10.
Admitted.

End ZRange.

End Crypto_DOT_Util_DOT_ZRange_WRAPPED.

Module Export ZRange.
Definition normalize (v : zrange) : zrange.
Admitted.
Definition opp (v : zrange) : zrange.
Admitted.
    Notation "- x" := (opp x) : zrange_scope.
Export Rewriter.Language.Pre.

Module Export ident.
  Section cast.
Definition is_more_pos_than_neg (r : zrange) (v : BinInt.Z) : bool.
Admitted.
Let cast_outside_of_range (r : zrange) (v : BinInt.Z) : BinInt.Z.
Admitted.

    Definition cast (r : zrange) (x : BinInt.Z)
      := let r := ZRange.normalize r in
         if (lower r <=? x) && (x <=? upper r)
         then x
         else if is_more_pos_than_neg r x
              then cast_outside_of_range r x
              else -cast_outside_of_range (-r) (-x).
    Definition cast2 (r : zrange * zrange) (x : BinInt.Z * BinInt.Z)
      := (cast (Datatypes.fst r) (Datatypes.fst x),
          cast (Datatypes.snd r) (Datatypes.snd x)).
  End cast.

  Section comment.
    Definition comment {A} (x : A) := tt.

    Definition comment_no_keep {A} (x : A) := tt.
  End comment.

  Module Export fancy.
    Module Export with_wordmax.
      Section with_wordmax.
        Context (log2wordmax : BinInt.Z).
Definition add (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition addc (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition sub (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition subb (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition mulll : Z * Z -> Z.
Admitted.
Definition mullh : Z * Z -> Z.
Admitted.
Definition mulhl : Z * Z -> Z.
Admitted.
Definition mulhh : Z * Z -> Z.
Admitted.
Definition selm : Z * Z * Z -> Z.
Admitted.
Definition rshi (n : Z) : Z * Z -> Z.
Admitted.
      End with_wordmax.
    End with_wordmax.

    Definition add : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.add] in fun x => with_wordmax.add (fst (fst x)) (snd (fst x)) (snd x).
    Definition addc : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.addc] in fun x => with_wordmax.addc (fst (fst x)) (snd (fst x)) (snd x).
    Definition sub : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.sub] in fun x => with_wordmax.sub (fst (fst x)) (snd (fst x)) (snd x).
    Definition subb : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.subb] in fun x => with_wordmax.subb (fst (fst x)) (snd (fst x)) (snd x).
    Definition mulll : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulll] in fun x => with_wordmax.mulll (fst x) (snd x).
    Definition mullh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mullh] in fun x => with_wordmax.mullh (fst x) (snd x).
    Definition mulhl : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhl] in fun x => with_wordmax.mulhl (fst x) (snd x).
    Definition mulhh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhh] in fun x => with_wordmax.mulhh (fst x) (snd x).
    Definition selm : Z * (Z * Z * Z) -> Z
      := Eval cbv [with_wordmax.selm] in fun x => with_wordmax.selm (fst x) (snd x).
    Definition rshi : (Z * Z) * (Z * Z) -> Z
      := Eval cbv [with_wordmax.rshi] in fun x => with_wordmax.rshi (fst (fst x)) (snd (fst x)) (snd x).
Definition selc : Z * Z * Z -> Z.
Admitted.
Definition sell : Z * Z * Z -> Z.
Admitted.
Definition addm : Z * Z * Z -> Z.
Admitted.

Notation prod_rect_nodep := Rewriter.Util.Prod.prod_rect_nodep (only parsing).
Notation nat_rect_arrow_nodep := Rewriter.Util.NatUtil.nat_rect_arrow_nodep (only parsing).
Notation list_rect_arrow_nodep := Rewriter.Util.ListUtil.list_rect_arrow_nodep (only parsing).
Notation bool_rect_nodep := Rewriter.Util.Bool.bool_rect_nodep (only parsing).

Module Export Thunked.
  Notation bool_rect := Rewriter.Util.Bool.Thunked.bool_rect (only parsing).
  Notation list_rect := Rewriter.Util.ListUtil.Thunked.list_rect (only parsing).
  Notation list_case := Rewriter.Util.ListUtil.Thunked.list_case (only parsing).
  Notation nat_rect := Rewriter.Util.NatUtil.Thunked.nat_rect (only parsing).
  Notation option_rect := Rewriter.Util.Option.Thunked.option_rect (only parsing).
Definition var_like_idents : InductiveHList.hlist.
Admitted.
Definition base_type_list_named : InductiveHList.hlist.
exact ([with_name Z BinInt.Z
      ; with_name bool Datatypes.bool
      ; with_name nat Datatypes.nat
      ; with_name zrange ZRange.zrange
      ; with_name string String.string]%hlist).
Defined.
Definition all_ident_named_interped : InductiveHList.hlist.
exact ([with_name ident_Literal (@ident.literal)
      ; with_name ident_comment (@ident.comment)
      ; with_name ident_comment_no_keep (@ident.comment_no_keep)
      ; with_name ident_value_barrier (@Z.value_barrier)
      ; with_name ident_Nat_succ Nat.succ
      ; with_name ident_Nat_pred Nat.pred
      ; with_name ident_Nat_max Nat.max
      ; with_name ident_Nat_mul Nat.mul
      ; with_name ident_Nat_add Nat.add
      ; with_name ident_Nat_sub Nat.sub
      ; with_name ident_Nat_eqb Nat.eqb
      ; with_name ident_nil (@Datatypes.nil)
      ; with_name ident_cons (@Datatypes.cons)
      ; with_name ident_tt Datatypes.tt
      ; with_name ident_pair (@Datatypes.pair)
      ; with_name ident_fst (@Datatypes.fst)
      ; with_name ident_snd (@Datatypes.snd)
      ; with_name ident_prod_rect (@prod_rect_nodep)
      ; with_name ident_bool_rect (@Thunked.bool_rect)
      ; with_name ident_bool_rect_nodep (@bool_rect_nodep)
      ; with_name ident_nat_rect (@Thunked.nat_rect)
      ; with_name ident_eager_nat_rect (ident.eagerly (@Thunked.nat_rect))
      ; with_name ident_nat_rect_arrow (@nat_rect_arrow_nodep)
      ; with_name ident_eager_nat_rect_arrow (ident.eagerly (@nat_rect_arrow_nodep))
      ; with_name ident_list_rect (@Thunked.list_rect)
      ; with_name ident_eager_list_rect (ident.eagerly (@Thunked.list_rect))
      ; with_name ident_list_rect_arrow (@list_rect_arrow_nodep)
      ; with_name ident_eager_list_rect_arrow (ident.eagerly (@list_rect_arrow_nodep))
      ; with_name ident_list_case (@Thunked.list_case)
      ; with_name ident_List_length (@List.length)
      ; with_name ident_List_seq (@List.seq)
      ; with_name ident_List_firstn (@List.firstn)
      ; with_name ident_List_skipn (@List.skipn)
      ; with_name ident_List_repeat (@repeat)
      ; with_name ident_List_combine (@List.combine)
      ; with_name ident_List_map (@List.map)
      ; with_name ident_List_app (@List.app)
      ; with_name ident_List_rev (@List.rev)
      ; with_name ident_List_flat_map (@List.flat_map)
      ; with_name ident_List_partition (@List.partition)
      ; with_name ident_List_filter (@List.filter)
      ; with_name ident_List_fold_right (@List.fold_right)
      ; with_name ident_List_update_nth (@update_nth)
      ; with_name ident_List_nth_default (@nth_default)
      ; with_name ident_eager_List_nth_default (ident.eagerly (@nth_default))
      ; with_name ident_Z_add Z.add
      ; with_name ident_Z_mul Z.mul
      ; with_name ident_Z_pow Z.pow
      ; with_name ident_Z_sub Z.sub
      ; with_name ident_Z_opp Z.opp
      ; with_name ident_Z_div Z.div
      ; with_name ident_Z_modulo Z.modulo
      ; with_name ident_Z_eqb Z.eqb
      ; with_name ident_Z_leb Z.leb
      ; with_name ident_Z_ltb Z.ltb
      ; with_name ident_Z_geb Z.geb
      ; with_name ident_Z_gtb Z.gtb
      ; with_name ident_Z_log2 Z.log2
      ; with_name ident_Z_log2_up Z.log2_up
      ; with_name ident_Z_of_nat Z.of_nat
      ; with_name ident_Z_to_nat Z.to_nat
      ; with_name ident_Z_shiftr Z.shiftr
      ; with_name ident_Z_shiftl Z.shiftl
      ; with_name ident_Z_land Z.land
      ; with_name ident_Z_lor Z.lor
      ; with_name ident_Z_min Z.min
      ; with_name ident_Z_max Z.max
      ; with_name ident_Z_mul_split Z.mul_split
      ; with_name ident_Z_mul_high Z.mul_high
      ; with_name ident_Z_add_get_carry Z.add_get_carry_full
      ; with_name ident_Z_add_with_carry Z.add_with_carry
      ; with_name ident_Z_add_with_get_carry Z.add_with_get_carry_full
      ; with_name ident_Z_sub_get_borrow Z.sub_get_borrow_full
      ; with_name ident_Z_sub_with_get_borrow Z.sub_with_get_borrow_full
      ; with_name ident_Z_ltz Z.ltz
      ; with_name ident_Z_zselect Z.zselect
      ; with_name ident_Z_add_modulo Z.add_modulo
      ; with_name ident_Z_truncating_shiftl Z.truncating_shiftl
      ; with_name ident_Z_bneg Z.bneg
      ; with_name ident_Z_lnot_modulo Z.lnot_modulo
      ; with_name ident_Z_lxor Z.lxor
      ; with_name ident_Z_rshi Z.rshi
      ; with_name ident_Z_cc_m Z.cc_m
      ; with_name ident_Z_combine_at_bitwidth Z.combine_at_bitwidth
      ; with_name ident_Z_cast ident.cast
      ; with_name ident_Z_cast2 ident.cast2
      ; with_name ident_Some (@Datatypes.Some)
      ; with_name ident_None (@Datatypes.None)
      ; with_name ident_option_rect (@Thunked.option_rect)
      ; with_name ident_Build_zrange ZRange.Build_zrange
      ; with_name ident_zrange_rect (@ZRange.zrange_rect_nodep)
      ; with_name ident_fancy_add ident.fancy.add
      ; with_name ident_fancy_addc ident.fancy.addc
      ; with_name ident_fancy_sub ident.fancy.sub
      ; with_name ident_fancy_subb ident.fancy.subb
      ; with_name ident_fancy_mulll ident.fancy.mulll
      ; with_name ident_fancy_mullh ident.fancy.mullh
      ; with_name ident_fancy_mulhl ident.fancy.mulhl
      ; with_name ident_fancy_mulhh ident.fancy.mulhh
      ; with_name ident_fancy_rshi ident.fancy.rshi
      ; with_name ident_fancy_selc ident.fancy.selc
      ; with_name ident_fancy_selm ident.fancy.selm
      ; with_name ident_fancy_sell ident.fancy.sell
      ; with_name ident_fancy_addm ident.fancy.addm
     ]%hlist).
Defined.
Definition scraped_data : ScrapedData.t.
exact ({| ScrapedData.base_type_list_named := base_type_list_named
        ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}).
Defined.

Declare ML Module "coq-rewriter.rewriter_build".

Module Export Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.
  Rewriter Emit Inductives From Scraped
           {| ScrapedData.base_type_list_named := base_type_list_named ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}
           As base ident raw_ident pattern_ident.

  Definition package : GoalType.package_with_args scraped_data var_like_idents base ident.
  Proof.
Tactic.make_package.
Defined.
Module Export APINotations.
Import Ltac2.Ltac2.
Module Export Compilers.
  Export Reify.Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.Tactic.

  Definition exprInfo : Classes.ExprInfoT := Eval hnf in GoalType.exprInfo package.

  Global Existing Instances
         baseHasNat
         baseHasNatCorrect
         try_make_base_transport_cps_correct
         buildEagerIdent
         buildInterpEagerIdentCorrect
         toRestrictedIdent
         toFromRestrictedIdent
         buildInterpIdentCorrect
         invertIdent
         buildInvertIdentCorrect
         base_default
         exprInfo
  .
  Ltac2 mk_reify_base_type () :=
    let package := reify_package_of_package 'package in
    reify_base_type_via_reify_package package.
  Ltac2 mk_reify_type () :=
    let package := reify_package_of_package 'package in
    reify_type_via_reify_package package.
  Ltac2 mk_reify_ident_opt () :=
    let package := reify_package_of_package 'package in
    reify_ident_via_reify_package_opt package.
  Ltac2 reify_type (ty : constr) : constr := mk_reify_type () ty.
  #[deprecated(since="8.15",note="Use Ltac2 instead.")]
   Ltac reify_type term :=
    let f := ltac2:(term
                    |- Control.refine (fun () => reify_type (Option.get (Ltac1.to_constr term)))) in
    constr:(ltac:(f term)).

  Module Export base.

    Notation type := (@base.type base) (only parsing).
    Notation base_interp := Compilers.base_interp (only parsing).
    Notation interp := (base.interp Compilers.base_interp) (only parsing).
  End base.

  Ltac2 _Reify_rhs () : unit :=
    let reify_base_type := mk_reify_base_type () in
    let reify_ident_opt := mk_reify_ident_opt () in
    expr._Reify_rhs 'base.type 'ident reify_base_type reify_ident_opt '@base.interp '@ident_interp ().
  Ltac Reify_rhs _ :=
    ltac2:(_Reify_rhs ()).

  Module Import invert_expr.

    End invert_expr.

  End Compilers.

End APINotations.

    Notation Expr := (@expr.Expr base.type ident).

    Notation Interp := (@expr.Interp base.type ident base.interp (@ident_interp)).

    Notation reify_type t := (ltac:(let rt := reify_type t in exact rt)) (only parsing).
    Notation reify_type_of e := (reify_type ((fun t (_ : t) => t) _ e)) (only parsing).

Import Coq.Relations.Relation_Definitions.
Import Language.Wf.Compilers.

Fixpoint pointwise_equal {t} : relation (type.interp base.interp t)
  := match t with
     | type.base t => Logic.eq
     | type.arrow s d
       => fun (f g : type.interp base.interp s -> type.interp base.interp d)
          => forall x, pointwise_equal (f x) (g x)
     end.
Definition is_reification_of' {t} (e : Expr t) (v : type.interp base.interp t) : Prop.
exact (pointwise_equal (Interp e) v /\ Wf e).
Defined.

Notation is_reification_of rop op
  := (match @is_reification_of' (reify_type_of op) rop op with
      | T
        => ltac:(
             let T := (eval cbv [pointwise_equal is_reification_of' T] in T) in
             let T := (eval cbn [type.interp base.interp base.base_interp] in T) in
             exact T)
      end)
       (only parsing).

Ltac cache_reify _ :=
  split;
  [ intros;
    etransitivity;
    [
    | repeat match goal with |- _ = ?f' ?x => is_var x; apply (f_equal (fun f => f _)) end;
      Reify_rhs ();
      reflexivity ];
    subst_evars;
    reflexivity
  | prove_Wf () ].
Import Coq.ZArith.ZArith.

Derive reified_id_gen
       SuchThat (is_reification_of reified_id_gen (@id (list Z)))
       As reified_id_gen_correct.
Proof.
Time cache_reify ().
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted) (truncated to 8.0KiB; full 28KiB file on GitHub Actions Artifacts under tmp.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines, then from 4405 lines to 389 lines, then from 402 lines to 615 lines, then from 621 lines to 464 lines, then from 478 lines to 431 lines, then from 444 lines to 700 lines, then from 706 lines to 435 lines, then from 449 lines to 476 lines, then from 482 lines to 549 lines, then from 567 lines to 439 lines, then from 452 lines to 657 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Expected coqc runtime on this file: 0.000 sec *)
Require Coq.Init.Ltac.
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Crypto.Util.Tactics.SubstEvars.
Require Crypto.Util.ListUtil.Filter.
Require Crypto.Util.Notations.
Require Coq.Arith.Arith.
Require Coq.Arith.Peano_dec.
Require Coq.Bool.Bool.
Require Coq.Classes.CMorphisms.
Require Coq.Classes.Morphisms.
Require Coq.Classes.RelationClasses.
Require Coq.FSets.FMapPositive.
Require Coq.Lists.List.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.MSets.MSetFacts.
Require Coq.MSets.MSetPositive.
Require Coq.NArith.BinNat.
Require Coq.NArith.NArith.
Require Coq.Numbers.BinNums.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Program.Tactics.
Require Coq.Relations.Relation_Definitions.
Require Coq.Relations.Relations.
Require Coq.Setoids.Setoid.
Require Coq.Strings.Ascii.
Require Coq.Strings.String.
Require Coq.ZArith.BinInt.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.ZArith_dec.
Require Coq.derive.Derive.
Require Coq.micromega.Lia.
Require Ltac2.Init.
Require Rewriter.Util.Comparison.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.HProp.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.Tactics.CPSId.
Require Rewriter.Util.Tactics.ClearFree.
Require Rewriter.Util.Tactics.ConstrFail.
Require Rewriter.Util.Tactics.Contains.
Require Rewriter.Util.Tactics.EvarNormalize.
Require Rewriter.Util.Tactics.GetGoal.
Require Rewriter.Util.Tactics.PrintContext.
Require Rewriter.Util.Tactics.SetEvars.
Require Rewriter.Util.Tactics.SubstEvars.
Require Rewriter.Util.Tactics.Test.
Require Rewriter.Util.Tactics.TransparentAssert.
Require Rewriter.Util.TypeList.
Require Rewriter.Util.plugins.StrategyTactic.
Require Ltac2.Bool.
Require Ltac2.Constant.
Require Ltac2.Constr.
Require Ltac2.Constructor.
Require Ltac2.Evar.
Require Ltac2.FSet.
Require Ltac2.Float.
Require Ltac2.Ident.
Require Ltac2.Ind.
Require Ltac2.Int.
Require Ltac2.Ltac1.
Require Ltac2.Message.
Require Ltac2.Meta.
Require Ltac2.Proj.
Require Ltac2.Std.
Require Ltac2.String.
Require Ltac2.Uint63.
Require Rewriter.Util.Bool.Equality.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Pointed.
Require Rewriter.Util.Tactics.DebugPrint.
Require Rewriter.Util.Tactics.Not.
Require Rewriter.Util.Tactics.PrintGoal.
Require Rewriter.Util.Tactics.SetoidSubst.
Require Ltac2.Char.
Require Ltac2.Control.
Require Ltac2.Env.
Require Ltac2.FMap.
Require Ltac2.Printf.
Require Rewriter.Util.Bool.
Require Rewriter.Util.FixCoqMistakes.
Require Rewriter.Util.Tactics.CacheTerm.
Require Rewriter.Util.Tactics.WarnIfGoalsRemain.
Require Ltac2.Option.
Require Ltac2.Pattern.
Require Rewriter.Util.Equality.
Require Rewriter.Util.Logic.ProdForall.
Require Rewriter.Util.Notations.
Require Rewriter.Util.Sigma.Related.
Require Rewriter.Util.Tactics.DestructHyps.
Require Rewriter.Util.Tactics.FindHyp.
Require Rewriter.Util.Tactics.Head.
Require Rewriter.Util.Tactics.HeadUnderBinders.
Require Rewriter.Util.Tactics.RunTacticAsConstr.
Require Rewriter.Util.Tactics.SpecializeBy.
Require Rewriter.Util.Tactics.SplitInContext.
Require Rewriter.Util.CPSNotations.
Require Rewriter.Util.Tactics.BreakMatch.
Require Rewriter.Util.Tactics.UniquePose.
Require Ltac2.Array.
Require Ltac2.List.
Require Rewriter.Util.Sigma.
Require Rewriter.Util.Tactics.DestructHead.
Require Rewriter.Util.Tactics.DoWithHyp.
Require Rewriter.Util.Tactics.SpecializeAllWays.
Require Ltac2.Fresh.
Require Rewriter.Util.LetIn.
Require Rewriter.Util.Tactics.RewriteHyp.
Require Rewriter.Util.Logic.ExistsEqAnd.
Require Rewriter.Util.NatUtil.
Require Rewriter.Util.PrimitiveProd.
Require Ltac2.Notations.
Require Rewriter.Util.Option.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.PrimitiveSigma.
Require Rewriter.Util.Prod.
Require Rewriter.Util.OptionList.
Require Rewriter.Util.Decidable.
Require Rewriter.Util.ListUtil.SetoidList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Util.ListUtil.Forall.
Require Rewriter.Language.Pre.
Require Rewriter.Util.FMapPositive.Equality.
Require Rewriter.Util.MSetPositive.Equality.
Require Rewriter.Util.MSetPositive.Facts.
Require Rewriter.Util.Sum.
Require Ltac2.Ltac2.
Require Rewriter.Util.plugins.Ltac2Extra.
Require Rewriter.Util.Tactics2.Array.
Require Rewriter.Util.Tactics2.Char.
Require Rewriter.Util.Tactics2.Constr.Unsafe.MakeAbbreviations.
Require Rewriter.Util.Tactics2.DestEvar.
Require Rewriter.Util.Tactics2.FixNotationsForPerformance.
Require Rewriter.Util.Tactics2.Head.
Require Rewriter.Uti
Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.4MiB file on GitHub Actions Artifacts under build.log)
_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.qA1ypMWEt0
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.GBS6NLtw38
MINIMIZER_DEBUG: files: 
make --no-print-directory -C bedrock2/bedrock2 noex
Generating Makefile.coq.noex
rm -f .coqdeps.d
make -f Makefile.coq.noex
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.XCYPS4uYkQ
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.e5wiitzBuP
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.vilZdaqgci
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.97FFqUtyUa
MINIMIZER_DEBUG: files: 
rm -f .coqdeps.d
make -f Makefile.coq
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.BMm1GDcn05
MINIMIZER_DEBUG: files: 
COQDEP VFILES
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.xu75x9hiyX
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.EB3722fQ8b
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.DvuJzGr0Im
MINIMIZER_DEBUG: files: 
make[4]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.6TV9kjT6Gm
MINIMIZER_DEBUG: files: 
COQC src/PushButtonSynthesis/Primitives.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -w +implicit-core-hint-db\,+implicits-in-term\,+non-reversible-notation\,+deprecated-intros-until-0\,+deprecated-focus\,+unused-intro-pattern\,+variable-collision\,+unexpected-implicit-declaration\,+omega-is-deprecated\,+deprecated-instantiate-syntax\,+non-recursive\,+undeclared-scope\,+deprecated-hint-rewrite-without-locality\,+deprecated-hint-without-locality\,+deprecated-instance-without-locality\,+deprecated-typeclasses-transparency-without-locality\,unsupported-attributes -w -notation-overridden\,-deprecated-hint-constr\,-fragile-hint-constr\,-native-compiler-disabled\,-ambiguous-paths\,-masking-absolute-name -w -deprecated-native-compiler-option -native-compiler ondemand -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil coqutil -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola Rupicola -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2 bedrock2 -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src Crypto src/PushButtonSynthesis/Primitives.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.ViDUzhqoGr
MINIMIZER_DEBUG: files:  src/PushButtonSynthesis/Primitives.v
Finished failing transaction in 0.065 secs (0.061u,0.003s) (failure)
File "./src/PushButtonSynthesis/Primitives.v", line 93, characters 12-26:
Error: Some unresolved existential variables remain

Command exited with non-zero status 1
src/PushButtonSynthesis/Primitives.vo (real: 2.26, user: 1.95, sys: 0.30, mem: 1021020 ko)
Makefile.coq:809: recipe for target 'src/PushButtonSynthesis/Primitives.vo' failed
make[1]: *** [src/PushButtonSynthesis/Primitives.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto'
Aggregating timing log...
    Time |   Peak Mem | File Name                        
---------------------------------------------------------
0m01.95s | 1021020 ko | Total Time / Peak Mem            
---------------------------------------------------------
0m01.95s | 1021020 ko | PushButtonSynthesis/Primitives.vo
Makefile.ci:151: recipe for target 'ci-fiat_crypto' failed
make: *** [ci-fiat_crypto] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 660KiB file on GitHub Actions Artifacts under bug.log)
, I will attempt to split up [Require] statements...
getting /github/workspace/cwd/bug_01.v
getting /github/workspace/cwd/bug_01.glob
getting /github/workspace/cwd/bug_01.glob

No Requires to split.

In order to efficiently manipulate the file, I have to break it into statements.  I will attempt to do this by matching on periods.
�[92m
Splitting successful.�[0m

I will now attempt to remove any lines after the line which generates the error.

No lines to trim.

In order to efficiently manipulate the file, I have to break it into definitions.  I will now attempt to do this.
Sending statements to coqtop...
Done.  Splitting to definitions...
�[92m
Splitting to definitions successful.�[0m

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmp9sbefuam/Top/bug_01.v", line 235, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpudghhc46/Top/bug_01.v", line 317, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpudghhc46/Top/bug_01.v", line 364, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Qed Obligation with Admit Obligations
�[92m
Admitting Qed Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qed Obligations unsuccessful.
No successful changes.

I will now attempt to replace Qeds with Admitteds
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to replace Qeds with admit. Defined.
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmp9sbefuam/Top/bug_01.v", line 235, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpudghhc46/Top/bug_01.v", line 317, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpudghhc46/Top/bug_01.v", line 364, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmp9sbefuam/Top/bug_01.v", line 235, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpudghhc46/Top/bug_01.v", line 317, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpudghhc46/Top/bug_01.v", line 364, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpw8mywloq/Top/bug_01.v", line 317, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpw8mywloq/Top/bug_01.v", line 415, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmp3cc2dluu/Top/bug_01.v", line 317, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp3cc2dluu/Top/bug_01.v", line 418, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

cc @JasonGross

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 10, 2023

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src/PushButtonSynthesis/Primitives.v (from ci-fiat_crypto) (full log on GitHub Actions)

We are collecting data on the user experience of the Coq Bug Minimizer.
If you haven't already filled the survey for this PR, please fill out our short survey!

Partially Minimized Coq File (could not inline Rewriter.Util.plugins.RewriterBuildRegistry)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines, then from 4405 lines to 389 lines, then from 402 lines to 615 lines, then from 621 lines to 464 lines, then from 478 lines to 431 lines, then from 444 lines to 700 lines, then from 706 lines to 435 lines, then from 449 lines to 476 lines, then from 482 lines to 549 lines, then from 567 lines to 439 lines, then from 452 lines to 668 lines, then from 674 lines to 440 lines, then from 454 lines to 524 lines, then from 530 lines to 442 lines, then from 456 lines to 475 lines, then from 481 lines to 475 lines, then from 493 lines to 444 lines, then from 450 lines to 445 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Modules that could not be inlined: Rewriter.Util.plugins.RewriterBuildRegistry
   Expected coqc runtime on this file: 7.714 sec *)
Require Rewriter.Util.plugins.RewriterBuildRegistry.

Ltac subst_evars :=
  repeat match goal with
         | [ e := ?E |- _ ] => is_evar E; subst e
         end.
Import Coq.Lists.List.
Import Coq.Classes.Morphisms.

  #[export] Instance Proper_filter_eq {A} : Proper ((eq ==> eq) ==> eq ==> eq) (@filter A).
Admitted.
Reserved Infix "<<" (at level 30, no associativity).
Reserved Infix ">>" (at level 30, no associativity).
Reserved Infix "&'" (at level 50).
Import Coq.ZArith.BinInt.

Infix ">>" := Z.shiftr : Z_scope.
Infix "<<" := Z.shiftl : Z_scope.
Infix "&'" := Z.land : Z_scope.

Class Decidable (P : Prop) := dec : {P} + {~P}.
Arguments dec _%type_scope {_}.
Notation DecidableRel R := (forall x y, Decidable (R x y)).
Global Instance dec_eq_Z : DecidableRel (@eq Z) | 10.
Admitted.
Local Open Scope Z_scope.

Module Export Z.

  Definition zselect (cond zero_case nonzero_case : Z) :=
    if cond =? 0 then zero_case else nonzero_case.

  Definition add_modulo x y modulus :=
    if (modulus <=? x + y) then (x + y) - modulus else (x + y).
Definition lnot_modulo (v : Z) (modulus : Z) : Z.
Admitted.
Definition bneg (v : Z) : Z.
Admitted.

  Definition cc_m s x := if dec (2 ^ (Z.log2 s) = s) then x >> (Z.log2 s - 1) else x / (s / 2).

  Definition rshi s hi lo n :=
       let k := Z.log2 s in
       if dec (2 ^ k = s)
       then ((lo + (hi << k)) >> n) &' (Z.ones k)
       else ((lo + hi * s) >> n) mod s.

  Definition truncating_shiftl bw x n := (x << n) mod (2^bw).
Definition add_with_carry (c : Z) (x y : Z) : Z.
Admitted.
Definition add_get_carry_full (bound : Z) (x y : Z) : Z * Z.
Admitted.
Definition add_with_get_carry_full (bound : Z) (c x y : Z) : Z * Z.
Admitted.
Definition sub_get_borrow_full (bound : Z) (x y : Z) : Z * Z.
Admitted.
Definition sub_with_get_borrow_full (bound : Z) (c x y : Z) : Z * Z.
Admitted.
Definition mul_split (s x y : Z) : Z * Z.
Admitted.
Definition mul_high (s x y : Z) : Z.
Admitted.
Definition ltz (x y : Z) : Z.
Admitted.
Definition combine_at_bitwidth (bitwidth lo hi : Z) : Z.
Admitted.

  Definition value_barrier (x : Z) := x.

  Fixpoint update_nth {T} n f (xs:list T) {struct n} :=
        match n with
        | O => match xs with
                                 | nil => nil
                                 | x'::xs' => f x'::xs'
                                 end
        | S n' =>  match xs with
                                 | nil => nil
                                 | x'::xs' => x'::update_nth n' f xs'
                                 end
  end.

Import Coq.Bool.Bool.

Notation reflect_rel P b := (forall x y, reflect (P x y) (b x y)).

Module Export Crypto_DOT_Util_DOT_ZRange_WRAPPED.
Module Export ZRange.

Declare Scope zrange_scope.

Record zrange := { lower : Z ; upper : Z }.
Bind Scope zrange_scope with zrange.
Scheme Minimality for zrange Sort Type.
Definition zrange_beq (x y : zrange) : bool.
Admitted.

Global Instance reflect_zrange_eq : reflect_rel (@eq zrange) zrange_beq | 10.
Admitted.

End ZRange.

End Crypto_DOT_Util_DOT_ZRange_WRAPPED.

Module Export ZRange.
Definition normalize (v : zrange) : zrange.
Admitted.
Definition opp (v : zrange) : zrange.
Admitted.
    Notation "- x" := (opp x) : zrange_scope.
Export Rewriter.Language.Pre.

Module Export ident.
  Section cast.
Definition is_more_pos_than_neg (r : zrange) (v : BinInt.Z) : bool.
Admitted.
Let cast_outside_of_range (r : zrange) (v : BinInt.Z) : BinInt.Z.
Admitted.

    Definition cast (r : zrange) (x : BinInt.Z)
      := let r := ZRange.normalize r in
         if (lower r <=? x) && (x <=? upper r)
         then x
         else if is_more_pos_than_neg r x
              then cast_outside_of_range r x
              else -cast_outside_of_range (-r) (-x).
    Definition cast2 (r : zrange * zrange) (x : BinInt.Z * BinInt.Z)
      := (cast (Datatypes.fst r) (Datatypes.fst x),
          cast (Datatypes.snd r) (Datatypes.snd x)).
  End cast.

  Section comment.
    Definition comment {A} (x : A) := tt.

    Definition comment_no_keep {A} (x : A) := tt.
  End comment.

  Module Export fancy.
    Module Export with_wordmax.
      Section with_wordmax.
        Context (log2wordmax : BinInt.Z).
Definition add (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition addc (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition sub (imm : Z) : Z * Z -> Z * Z.
Admitted.
Definition subb (imm : Z) : Z * Z * Z -> Z * Z.
Admitted.
Definition mulll : Z * Z -> Z.
Admitted.
Definition mullh : Z * Z -> Z.
Admitted.
Definition mulhl : Z * Z -> Z.
Admitted.
Definition mulhh : Z * Z -> Z.
Admitted.
Definition selm : Z * Z * Z -> Z.
Admitted.
Definition rshi (n : Z) : Z * Z -> Z.
Admitted.
      End with_wordmax.
    End with_wordmax.

    Definition add : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.add] in fun x => with_wordmax.add (fst (fst x)) (snd (fst x)) (snd x).
    Definition addc : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.addc] in fun x => with_wordmax.addc (fst (fst x)) (snd (fst x)) (snd x).
    Definition sub : (Z * Z) * (Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.sub] in fun x => with_wordmax.sub (fst (fst x)) (snd (fst x)) (snd x).
    Definition subb : (Z * Z) * (Z * Z * Z) -> Z * Z
      := Eval cbv [with_wordmax.subb] in fun x => with_wordmax.subb (fst (fst x)) (snd (fst x)) (snd x).
    Definition mulll : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulll] in fun x => with_wordmax.mulll (fst x) (snd x).
    Definition mullh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mullh] in fun x => with_wordmax.mullh (fst x) (snd x).
    Definition mulhl : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhl] in fun x => with_wordmax.mulhl (fst x) (snd x).
    Definition mulhh : Z * (Z * Z) -> Z
      := Eval cbv [with_wordmax.mulhh] in fun x => with_wordmax.mulhh (fst x) (snd x).
    Definition selm : Z * (Z * Z * Z) -> Z
      := Eval cbv [with_wordmax.selm] in fun x => with_wordmax.selm (fst x) (snd x).
    Definition rshi : (Z * Z) * (Z * Z) -> Z
      := Eval cbv [with_wordmax.rshi] in fun x => with_wordmax.rshi (fst (fst x)) (snd (fst x)) (snd x).
Definition selc : Z * Z * Z -> Z.
Admitted.
Definition sell : Z * Z * Z -> Z.
Admitted.
Definition addm : Z * Z * Z -> Z.
Admitted.

Notation prod_rect_nodep := Rewriter.Util.Prod.prod_rect_nodep (only parsing).
Notation nat_rect_arrow_nodep := Rewriter.Util.NatUtil.nat_rect_arrow_nodep (only parsing).
Notation list_rect_arrow_nodep := Rewriter.Util.ListUtil.list_rect_arrow_nodep (only parsing).
Notation bool_rect_nodep := Rewriter.Util.Bool.bool_rect_nodep (only parsing).

Module Export Thunked.
  Notation bool_rect := Rewriter.Util.Bool.Thunked.bool_rect (only parsing).
  Notation list_rect := Rewriter.Util.ListUtil.Thunked.list_rect (only parsing).
  Notation list_case := Rewriter.Util.ListUtil.Thunked.list_case (only parsing).
  Notation nat_rect := Rewriter.Util.NatUtil.Thunked.nat_rect (only parsing).
  Notation option_rect := Rewriter.Util.Option.Thunked.option_rect (only parsing).
Definition var_like_idents : InductiveHList.hlist.
Admitted.
Definition base_type_list_named : InductiveHList.hlist.
exact ([with_name Z BinInt.Z
      ; with_name bool Datatypes.bool
      ; with_name nat Datatypes.nat
      ; with_name zrange ZRange.zrange
      ; with_name string String.string]%hlist).
Defined.
Definition all_ident_named_interped : InductiveHList.hlist.
exact ([with_name ident_Literal (@ident.literal)
      ; with_name ident_comment (@ident.comment)
      ; with_name ident_comment_no_keep (@ident.comment_no_keep)
      ; with_name ident_value_barrier (@Z.value_barrier)
      ; with_name ident_Nat_succ Nat.succ
      ; with_name ident_Nat_pred Nat.pred
      ; with_name ident_Nat_max Nat.max
      ; with_name ident_Nat_mul Nat.mul
      ; with_name ident_Nat_add Nat.add
      ; with_name ident_Nat_sub Nat.sub
      ; with_name ident_Nat_eqb Nat.eqb
      ; with_name ident_nil (@Datatypes.nil)
      ; with_name ident_cons (@Datatypes.cons)
      ; with_name ident_tt Datatypes.tt
      ; with_name ident_pair (@Datatypes.pair)
      ; with_name ident_fst (@Datatypes.fst)
      ; with_name ident_snd (@Datatypes.snd)
      ; with_name ident_prod_rect (@prod_rect_nodep)
      ; with_name ident_bool_rect (@Thunked.bool_rect)
      ; with_name ident_bool_rect_nodep (@bool_rect_nodep)
      ; with_name ident_nat_rect (@Thunked.nat_rect)
      ; with_name ident_eager_nat_rect (ident.eagerly (@Thunked.nat_rect))
      ; with_name ident_nat_rect_arrow (@nat_rect_arrow_nodep)
      ; with_name ident_eager_nat_rect_arrow (ident.eagerly (@nat_rect_arrow_nodep))
      ; with_name ident_list_rect (@Thunked.list_rect)
      ; with_name ident_eager_list_rect (ident.eagerly (@Thunked.list_rect))
      ; with_name ident_list_rect_arrow (@list_rect_arrow_nodep)
      ; with_name ident_eager_list_rect_arrow (ident.eagerly (@list_rect_arrow_nodep))
      ; with_name ident_list_case (@Thunked.list_case)
      ; with_name ident_List_length (@List.length)
      ; with_name ident_List_seq (@List.seq)
      ; with_name ident_List_firstn (@List.firstn)
      ; with_name ident_List_skipn (@List.skipn)
      ; with_name ident_List_repeat (@repeat)
      ; with_name ident_List_combine (@List.combine)
      ; with_name ident_List_map (@List.map)
      ; with_name ident_List_app (@List.app)
      ; with_name ident_List_rev (@List.rev)
      ; with_name ident_List_flat_map (@List.flat_map)
      ; with_name ident_List_partition (@List.partition)
      ; with_name ident_List_filter (@List.filter)
      ; with_name ident_List_fold_right (@List.fold_right)
      ; with_name ident_List_update_nth (@update_nth)
      ; with_name ident_List_nth_default (@nth_default)
      ; with_name ident_eager_List_nth_default (ident.eagerly (@nth_default))
      ; with_name ident_Z_add Z.add
      ; with_name ident_Z_mul Z.mul
      ; with_name ident_Z_pow Z.pow
      ; with_name ident_Z_sub Z.sub
      ; with_name ident_Z_opp Z.opp
      ; with_name ident_Z_div Z.div
      ; with_name ident_Z_modulo Z.modulo
      ; with_name ident_Z_eqb Z.eqb
      ; with_name ident_Z_leb Z.leb
      ; with_name ident_Z_ltb Z.ltb
      ; with_name ident_Z_geb Z.geb
      ; with_name ident_Z_gtb Z.gtb
      ; with_name ident_Z_log2 Z.log2
      ; with_name ident_Z_log2_up Z.log2_up
      ; with_name ident_Z_of_nat Z.of_nat
      ; with_name ident_Z_to_nat Z.to_nat
      ; with_name ident_Z_shiftr Z.shiftr
      ; with_name ident_Z_shiftl Z.shiftl
      ; with_name ident_Z_land Z.land
      ; with_name ident_Z_lor Z.lor
      ; with_name ident_Z_min Z.min
      ; with_name ident_Z_max Z.max
      ; with_name ident_Z_mul_split Z.mul_split
      ; with_name ident_Z_mul_high Z.mul_high
      ; with_name ident_Z_add_get_carry Z.add_get_carry_full
      ; with_name ident_Z_add_with_carry Z.add_with_carry
      ; with_name ident_Z_add_with_get_carry Z.add_with_get_carry_full
      ; with_name ident_Z_sub_get_borrow Z.sub_get_borrow_full
      ; with_name ident_Z_sub_with_get_borrow Z.sub_with_get_borrow_full
      ; with_name ident_Z_ltz Z.ltz
      ; with_name ident_Z_zselect Z.zselect
      ; with_name ident_Z_add_modulo Z.add_modulo
      ; with_name ident_Z_truncating_shiftl Z.truncating_shiftl
      ; with_name ident_Z_bneg Z.bneg
      ; with_name ident_Z_lnot_modulo Z.lnot_modulo
      ; with_name ident_Z_lxor Z.lxor
      ; with_name ident_Z_rshi Z.rshi
      ; with_name ident_Z_cc_m Z.cc_m
      ; with_name ident_Z_combine_at_bitwidth Z.combine_at_bitwidth
      ; with_name ident_Z_cast ident.cast
      ; with_name ident_Z_cast2 ident.cast2
      ; with_name ident_Some (@Datatypes.Some)
      ; with_name ident_None (@Datatypes.None)
      ; with_name ident_option_rect (@Thunked.option_rect)
      ; with_name ident_Build_zrange ZRange.Build_zrange
      ; with_name ident_zrange_rect (@ZRange.zrange_rect_nodep)
      ; with_name ident_fancy_add ident.fancy.add
      ; with_name ident_fancy_addc ident.fancy.addc
      ; with_name ident_fancy_sub ident.fancy.sub
      ; with_name ident_fancy_subb ident.fancy.subb
      ; with_name ident_fancy_mulll ident.fancy.mulll
      ; with_name ident_fancy_mullh ident.fancy.mullh
      ; with_name ident_fancy_mulhl ident.fancy.mulhl
      ; with_name ident_fancy_mulhh ident.fancy.mulhh
      ; with_name ident_fancy_rshi ident.fancy.rshi
      ; with_name ident_fancy_selc ident.fancy.selc
      ; with_name ident_fancy_selm ident.fancy.selm
      ; with_name ident_fancy_sell ident.fancy.sell
      ; with_name ident_fancy_addm ident.fancy.addm
     ]%hlist).
Defined.
Definition scraped_data : ScrapedData.t.
exact ({| ScrapedData.base_type_list_named := base_type_list_named
        ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}).
Defined.

Declare ML Module "coq-rewriter.rewriter_build".

Module Export Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.
  Rewriter Emit Inductives From Scraped
           {| ScrapedData.base_type_list_named := base_type_list_named ; ScrapedData.all_ident_named_interped := all_ident_named_interped |}
           As base ident raw_ident pattern_ident.

  Definition package : GoalType.package_with_args scraped_data var_like_idents base ident.
  Proof.
Tactic.make_package.
Defined.
Module Export APINotations.
Import Ltac2.Ltac2.
Module Export Compilers.
  Export Reify.Compilers.
  Import IdentifiersBasicGenerate.Compilers.Basic.Tactic.

  Definition exprInfo : Classes.ExprInfoT := Eval hnf in GoalType.exprInfo package.

  Global Existing Instances
         baseHasNat
         baseHasNatCorrect
         try_make_base_transport_cps_correct
         buildEagerIdent
         buildInterpEagerIdentCorrect
         toRestrictedIdent
         toFromRestrictedIdent
         buildInterpIdentCorrect
         invertIdent
         buildInvertIdentCorrect
         base_default
         exprInfo
  .
  Ltac2 mk_reify_base_type () :=
    let package := reify_package_of_package 'package in
    reify_base_type_via_reify_package package.
  Ltac2 mk_reify_type () :=
    let package := reify_package_of_package 'package in
    reify_type_via_reify_package package.
  Ltac2 mk_reify_ident_opt () :=
    let package := reify_package_of_package 'package in
    reify_ident_via_reify_package_opt package.
  Ltac2 reify_type (ty : constr) : constr := mk_reify_type () ty.
  #[deprecated(since="8.15",note="Use Ltac2 instead.")]
   Ltac reify_type term :=
    let f := ltac2:(term
                    |- Control.refine (fun () => reify_type (Option.get (Ltac1.to_constr term)))) in
    constr:(ltac:(f term)).

  Module Export base.

    Notation type := (@base.type base) (only parsing).
    Notation base_interp := Compilers.base_interp (only parsing).
    Notation interp := (base.interp Compilers.base_interp) (only parsing).
  End base.

  Ltac2 _Reify_rhs () : unit :=
    let reify_base_type := mk_reify_base_type () in
    let reify_ident_opt := mk_reify_ident_opt () in
    expr._Reify_rhs 'base.type 'ident reify_base_type reify_ident_opt '@base.interp '@ident_interp ().
  Ltac Reify_rhs _ :=
    ltac2:(_Reify_rhs ()).

  Module Import invert_expr.

    End invert_expr.

  End Compilers.

End APINotations.

    Notation Expr := (@expr.Expr base.type ident).

    Notation Interp := (@expr.Interp base.type ident base.interp (@ident_interp)).

    Notation reify_type t := (ltac:(let rt := reify_type t in exact rt)) (only parsing).
    Notation reify_type_of e := (reify_type ((fun t (_ : t) => t) _ e)) (only parsing).

Import Coq.Relations.Relation_Definitions.
Import Language.Wf.Compilers.

Fixpoint pointwise_equal {t} : relation (type.interp base.interp t)
  := match t with
     | type.base t => Logic.eq
     | type.arrow s d
       => fun (f g : type.interp base.interp s -> type.interp base.interp d)
          => forall x, pointwise_equal (f x) (g x)
     end.
Definition is_reification_of' {t} (e : Expr t) (v : type.interp base.interp t) : Prop.
exact (pointwise_equal (Interp e) v /\ Wf e).
Defined.

Notation is_reification_of rop op
  := (match @is_reification_of' (reify_type_of op) rop op with
      | T
        => ltac:(
             let T := (eval cbv [pointwise_equal is_reification_of' T] in T) in
             let T := (eval cbn [type.interp base.interp base.base_interp] in T) in
             exact T)
      end)
       (only parsing).

Ltac cache_reify _ :=
  split;
  [ intros;
    etransitivity;
    [
    | repeat match goal with |- _ = ?f' ?x => is_var x; apply (f_equal (fun f => f _)) end;
      Reify_rhs ();
      reflexivity ];
    subst_evars;
    reflexivity
  | prove_Wf () ].
Import Coq.ZArith.ZArith.

Derive reified_id_gen
       SuchThat (is_reification_of reified_id_gen (@id (list Z)))
       As reified_id_gen_correct.
Proof.
Time cache_reify ().
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted) (truncated to 8.0KiB; full 28KiB file on GitHub Actions Artifacts under tmp.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "+implicit-core-hint-db,+implicits-in-term,+non-reversible-notation,+deprecated-intros-until-0,+deprecated-focus,+unused-intro-pattern,+variable-collision,+unexpected-implicit-declaration,+omega-is-deprecated,+deprecated-instantiate-syntax,+non-recursive,+undeclared-scope,+deprecated-hint-rewrite-without-locality,+deprecated-hint-without-locality,+deprecated-instance-without-locality,+deprecated-typeclasses-transparency-without-locality,unsupported-attributes" "-w" "-notation-overridden,-deprecated-hint-constr,-fragile-hint-constr,-native-compiler-disabled,-ambiguous-paths,-masking-absolute-name" "-w" "-deprecated-native-compiler-option" "-native-compiler" "ondemand" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src" "Crypto" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil" "coqutil" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola" "Rupicola" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2" "bedrock2" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples" "bedrock2Examples" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler" "compiler" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv" "riscv" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Coqprime" "Coqprime" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Rewriter" "Rewriter" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 1498 lines to 11 lines, then from 24 lines to 324 lines, then from 329 lines to 52 lines, then from 65 lines to 384 lines, then from 389 lines to 57 lines, then from 70 lines to 840 lines, then from 845 lines to 118 lines, then from 131 lines to 380 lines, then from 385 lines to 130 lines, then from 143 lines to 339 lines, then from 344 lines to 132 lines, then from 150 lines to 132 lines, then from 145 lines to 478 lines, then from 484 lines to 255 lines, then from 269 lines to 501 lines, then from 506 lines to 351 lines, then from 365 lines to 694 lines, then from 699 lines to 825 lines, then from 833 lines to 357 lines, then from 370 lines to 564 lines, then from 570 lines to 377 lines, then from 391 lines to 987 lines, then from 992 lines to 377 lines, then from 391 lines to 3948 lines, then from 3948 lines to 4401 lines, then from 4405 lines to 389 lines, then from 402 lines to 615 lines, then from 621 lines to 464 lines, then from 478 lines to 431 lines, then from 444 lines to 700 lines, then from 706 lines to 435 lines, then from 449 lines to 476 lines, then from 482 lines to 549 lines, then from 567 lines to 439 lines, then from 452 lines to 668 lines, then from 674 lines to 440 lines, then from 454 lines to 524 lines, then from 530 lines to 442 lines, then from 456 lines to 475 lines, then from 481 lines to 475 lines, then from 493 lines to 444 lines, then from 457 lines to 662 lines *)
(* coqc version 8.18+alpha compiled with OCaml 4.14.1
   coqtop version runner-vxtc-u6t-project-6138686-concurrent-0:/builds/coq/coq/_build/default,(HEAD detached at d7ce6d9) (d7ce6d9deac92848bd8420d857a18a96a87da88b)
   Expected coqc runtime on this file: 0.000 sec *)
Require Coq.Init.Ltac.
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Coq.Arith.Arith.
Require Coq.Arith.Peano_dec.
Require Coq.Bool.Bool.
Require Coq.Classes.CMorphisms.
Require Coq.Classes.Morphisms.
Require Coq.Classes.RelationClasses.
Require Coq.FSets.FMapPositive.
Require Coq.Lists.List.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.MSets.MSetFacts.
Require Coq.MSets.MSetPositive.
Require Coq.NArith.BinNat.
Require Coq.NArith.NArith.
Require Coq.Numbers.BinNums.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Program.Tactics.
Require Coq.Relations.Relation_Definitions.
Require Coq.Relations.Relations.
Require Coq.Setoids.Setoid.
Require Coq.Strings.Ascii.
Require Coq.Strings.String.
Require Coq.ZArith.BinInt.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.ZArith_dec.
Require Coq.derive.Derive.
Require Coq.micromega.Lia.
Require Ltac2.Init.
Require Rewriter.Util.Comparison.
Require Rewriter.Util.GlobalSettings.
Require Rewriter.Util.HProp.
Require Rewriter.Util.InductiveHList.
Require Rewriter.Util.Isomorphism.
Require Rewriter.Util.Tactics.CPSId.
Require Rewriter.Util.Tactics.ClearFree.
Require Rewriter.Util.Tactics.ConstrFail.
Require Rewriter.Util.Tactics.Contains.
Require Rewriter.Util.Tactics.EvarNormalize.
Require Rewriter.Util.Tactics.GetGoal.
Require Rewriter.Util.Tactics.PrintContext.
Require Rewriter.Util.Tactics.SetEvars.
Require Rewriter.Util.Tactics.SubstEvars.
Require Rewriter.Util.Tactics.Test.
Require Rewriter.Util.Tactics.TransparentAssert.
Require Rewriter.Util.TypeList.
Require Rewriter.Util.plugins.StrategyTactic.
Require Ltac2.Bool.
Require Ltac2.Constant.
Require Ltac2.Constr.
Require Ltac2.Constructor.
Require Ltac2.Evar.
Require Ltac2.FSet.
Require Ltac2.Float.
Require Ltac2.Ident.
Require Ltac2.Ind.
Require Ltac2.Int.
Require Ltac2.Ltac1.
Require Ltac2.Message.
Require Ltac2.Meta.
Require Ltac2.Proj.
Require Ltac2.Std.
Require Ltac2.String.
Require Ltac2.Uint63.
Require Rewriter.Util.Bool.Equality.
Require Rewriter.Util.IffT.
Require Rewriter.Util.Pointed.
Require Rewriter.Util.Tactics.DebugPrint.
Require Rewriter.Util.Tactics.Not.
Require Rewriter.Util.Tactics.PrintGoal.
Require Rewriter.Util.Tactics.SetoidSubst.
Require Ltac2.Char.
Require Ltac2.Control.
Require Ltac2.Env.
Require Ltac2.FMap.
Require Ltac2.Printf.
Require Rewriter.Util.Bool.
Require Rewriter.Util.FixCoqMistakes.
Require Rewriter.Util.Tactics.CacheTerm.
Require Rewriter.Util.Tactics.WarnIfGoalsRemain.
Require Ltac2.Option.
Require Ltac2.Pattern.
Require Rewriter.Util.Equality.
Require Rewriter.Util.Logic.ProdForall.
Require Rewriter.Util.Notations.
Require Rewriter.Util.Sigma.Related.
Require Rewriter.Util.Tactics.DestructHyps.
Require Rewriter.Util.Tactics.FindHyp.
Require Rewriter.Util.Tactics.Head.
Require Rewriter.Util.Tactics.HeadUnderBinders.
Require Rewriter.Util.Tactics.RunTacticAsConstr.
Require Rewriter.Util.Tactics.SpecializeBy.
Require Rewriter.Util.Tactics.SplitInContext.
Require Rewriter.Util.CPSNotations.
Require Rewriter.Util.Tactics.BreakMatch.
Require Rewriter.Util.Tactics.UniquePose.
Require Ltac2.Array.
Require Ltac2.List.
Require Rewriter.Util.Sigma.
Require Rewriter.Util.Tactics.DestructHead.
Require Rewriter.Util.Tactics.DoWithHyp.
Require Rewriter.Util.Tactics.SpecializeAllWays.
Require Ltac2.Fresh.
Require Rewriter.Util.LetIn.
Require Rewriter.Util.Tactics.RewriteHyp.
Require Rewriter.Util.Logic.ExistsEqAnd.
Require Rewriter.Util.NatUtil.
Require Rewriter.Util.PrimitiveProd.
Require Ltac2.Notations.
Require Rewriter.Util.Option.
Require Rewriter.Util.PrimitiveHList.
Require Rewriter.Util.PrimitiveSigma.
Require Rewriter.Util.Prod.
Require Rewriter.Util.OptionList.
Require Rewriter.Util.Decidable.
Require Rewriter.Util.ListUtil.SetoidList.
Require Rewriter.Language.PreCommon.
Require Rewriter.Util.ListUtil.Forall.
Require Rewriter.Language.Pre.
Require Rewriter.Util.FMapPositive.Equality.
Require Rewriter.Util.MSetPositive.Equality.
Require Rewriter.Util.MSetPositive.Facts.
Require Rewriter.Util.Sum.
Require Ltac2.Ltac2.
Require Rewriter.Util.plugins.Ltac2Extra.
Require Rewriter.Util.Tactics2.Array.
Require Rewriter.Util.Tactics2.Char.
Require Rewriter.Util.Tactics2.Constr.Unsafe.MakeAbbreviations.
Require Rewriter.Util.Tacti
Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.4MiB file on GitHub Actions Artifacts under build.log)
ZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.mxnIYMbUBx
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.hGCrVQOEnH
MINIMIZER_DEBUG: files: 
make --no-print-directory -C bedrock2/bedrock2 noex
Generating Makefile.coq.noex
rm -f .coqdeps.d
make -f Makefile.coq.noex
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.5uVFXI0qLb
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.q4hJNo6Eft
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.scNkR7fLq9
MINIMIZER_DEBUG: files: 
make[5]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.CyLWjkJKpI
MINIMIZER_DEBUG: files: 
rm -f .coqdeps.d
make -f Makefile.coq
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.NxbYzbuqCN
MINIMIZER_DEBUG: files: 
COQDEP VFILES
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.1LvV6DUF2W
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.8oS4KJRwVA
MINIMIZER_DEBUG: files: 
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.4pRxZoMlMy
MINIMIZER_DEBUG: files: 
make[4]: Nothing to be done for 'real-all'.
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///////coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig --print-version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.07Jfdx6yKC
MINIMIZER_DEBUG: files: 
COQC src/PushButtonSynthesis/Primitives.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin///coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -w +implicit-core-hint-db\,+implicits-in-term\,+non-reversible-notation\,+deprecated-intros-until-0\,+deprecated-focus\,+unused-intro-pattern\,+variable-collision\,+unexpected-implicit-declaration\,+omega-is-deprecated\,+deprecated-instantiate-syntax\,+non-recursive\,+undeclared-scope\,+deprecated-hint-rewrite-without-locality\,+deprecated-hint-without-locality\,+deprecated-instance-without-locality\,+deprecated-typeclasses-transparency-without-locality\,unsupported-attributes -w -notation-overridden\,-deprecated-hint-constr\,-fragile-hint-constr\,-native-compiler-disabled\,-ambiguous-paths\,-masking-absolute-name -w -deprecated-native-compiler-option -native-compiler ondemand -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/coqutil/src/coqutil coqutil -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/src/Rupicola Rupicola -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2 bedrock2 -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/bedrock2/src/bedrock2Examples bedrock2Examples -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/compiler/src/compiler compiler -Q /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/rupicola/bedrock2/deps/riscv-coq/src/riscv riscv -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto/src Crypto src/PushButtonSynthesis/Primitives.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.13OdU3UImq
MINIMIZER_DEBUG: files:  src/PushButtonSynthesis/Primitives.v
Finished failing transaction in 0.073 secs (0.073u,0.s) (failure)
File "./src/PushButtonSynthesis/Primitives.v", line 93, characters 12-26:
Error: Some unresolved existential variables remain

Command exited with non-zero status 1
src/PushButtonSynthesis/Primitives.vo (real: 2.56, user: 2.18, sys: 0.37, mem: 1021376 ko)
Makefile.coq:809: recipe for target 'src/PushButtonSynthesis/Primitives.vo' failed
make[1]: *** [src/PushButtonSynthesis/Primitives.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_crypto'
Aggregating timing log...
    Time |   Peak Mem | File Name                        
---------------------------------------------------------
0m02.18s | 1021376 ko | Total Time / Peak Mem            
---------------------------------------------------------
0m02.18s | 1021376 ko | PushButtonSynthesis/Primitives.vo
Makefile.ci:151: recipe for target 'ci-fiat_crypto' failed
make: *** [ci-fiat_crypto] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 615KiB file on GitHub Actions Artifacts under bug.log)
haracters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Qed Obligation with Admit Obligations
�[92m
Admitting Qed Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qed Obligations unsuccessful.
No successful changes.

I will now attempt to replace Qeds with Admitteds
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to replace Qeds with admit. Defined.
�[92m
Admitting Qeds successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmpp4qynqs4/Top/bug_01.v", line 35, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpwdgn2lg7/Top/bug_01.v", line 117, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpwdgn2lg7/Top/bug_01.v", line 164, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmpp4qynqs4/Top/bug_01.v", line 35, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpwdgn2lg7/Top/bug_01.v", line 117, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpwdgn2lg7/Top/bug_01.v", line 164, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpz3jucfbr/Top/bug_01.v", line 117, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpz3jucfbr/Top/bug_01.v", line 215, characters 2-230:
Error: No matching clauses for match.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined
�[92m
Admitting lemmas successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpbnsidy1k/Top/bug_01.v", line 117, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpbnsidy1k/Top/bug_01.v", line 206, characters 0-8:
Error:  (in proof base_type_list_named): Attempt to save a proof with given
up goals. If this is really what you want to do, use Admitted in place of
Qed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation unsuccessful.

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to remove all lines, one at a time
Line removal unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions

Non-fatal error: Failed to remove definitions and preserve the error.  
The new error was:
File "/tmp/tmpp4qynqs4/Top/bug_01.v", line 35, characters 2-95:
Error:
The following term contains unresolved implicit arguments:
  (fun s x : Z =>
   if dec (2 ^ Z.log2 s = s) then x >> (Z.log2 s - 1) else x / (s / 2))
More precisely: 
- ?Decidable: Cannot infer the implicit parameter Decidable of dec whose type
  is "Decidable (2 ^ Z.log2 s = s)" (no type class instance found) in
  environment:
  s, x : Z


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions

Non-fatal error: Failed to remove non-instance definitions and preserve the error.  
The new error was:
File "/tmp/tmpwdgn2lg7/Top/bug_01.v", line 117, characters 0-9:
Warning: Let definition cast_outside_of_range declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpwdgn2lg7/Top/bug_01.v", line 164, characters 81-92:
Error:
In environment
x : Z * Z * (Z * Z)
The term "snd (fst x)" has type "Z" while it is expected to have type
 "(Z * Z)%type".


�[93mIntermediate code not saved.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to remove empty sections

No empty sections to remove.

Now, I will attempt to strip repeated newlines and trailing spaces from this file...

No strippable newlines or spaces.

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

cc @JasonGross

@SkySkimmer
Copy link
Contributor Author

Further reduced I think it looks like

Require Import Ltac2.Ltac2.

Goal tt = tt.
  (* ' is open_constr *)
  let x := '(eq_refl : tt = tt) in
  abstract (Std.exact_no_check x).

abstract drops the evar map so gets confused

Similarly

Goal tt = tt.
  let x := '(eq_refl : tt = tt) in
  abstract (exact $x).

produces anomaly evar not declared in this PR, and

Require Import Ltac2.Ltac2.

Goal tt = tt.
  let x := '_ in
  let _ := '(eq_refl : $x = tt) in
  abstract (exact $x).

produces anomaly evar not declared in master.

@SkySkimmer
Copy link
Contributor Author

Ltac1 abstract runs

let flush_value_evars sigma v =
if has_type v (topwit wit_constr) then
let c = out_gen (topwit wit_constr) v in
let c =
try EConstr.of_constr (Evarutil.flush_and_check_evars sigma c)
with Evarutil.Uninstantiated_evar _ ->
(* How to tell to not use this binding anymore? *)
(* If it is used it might fail because of the evar *)
(* But this has to work if it is not used *)
c
in
in_gen (topwit wit_constr) c
else v
let flush_ist_evars sigma ist =
{ ist with lfun = Id.Map.map (flush_value_evars sigma) ist.lfun }
evar normalizing terms in the ltac1 environment, but I don't know if we want that for ltac2.

I guess we could have a notation abstract (x y |- tac) which normalizes x and y and purges the rest of the environment? OTOH something like let b : bool := some stuff in abstract (tac b) should be fine so I don't know.

It seems rewriter has only 1 use of abstract with non-closed tactic https://github.com/mit-plv/rewriter/blob/30653754f74caaa94e23d2e51ed9d839753f9d20/src/Rewriter/Language/Reify.v#L1034
so it could explicitly use evar normalization let pf := constr:(pf) in abstract (Std.exact_no_check pf)

If we consider that non-closed tactics in abstract are uncommon we could have abstract accept only closed tactics and some unsafe_abstract leaving environment normalization cleanup to the caller.

cc @JasonGross

@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 Jun 12, 2023
@JasonGross
Copy link
Member

abstract must evar-normalize the proof term; is there no way to defer evar-normalization and purging of the environment to a late enough point that this all becomes a moot point?

What does "non-closed tactic" mean? Does this mean anything that references any Ltac2 variable? It seems unfriendly to not support this use case by default.

I guess we could have a notation abstract (x y |- tac) which normalizes x and y and purges the rest of the environment? OTOH something like let b : bool := some stuff in abstract (tac b) should be fine so I don't know.

This seems okay to me if need be: AIUI, you only have to purge the bits of the environment that hold constr, and bool is fine to not purge. What happens to higher order tactics that are typed as, e.g., constr -> constr though?

@SkySkimmer
Copy link
Contributor Author

The tactic given to abstract is executed with an evar map that does not have the evar information from the calling tactic.

What does "non-closed tactic" mean? Does this mean anything that references any Ltac2 variable? It seems unfriendly to not support this use case by default.

It may be unfriendly but supporting it is broken.

AIUI, you only have to purge the bits of the environment that hold constr, and bool is fine to not purge.

It's hard to tell which bits that is though. And the only safe solution would be to purge everything we don't know about (by purge I mean remove from the environment btw).

@JasonGross
Copy link
Member

The tactic given to abstract is executed with an evar map that does not have the evar information from the calling tactic.

Why? Why is abstract tac different from let g := the goal in let pf := '(ltac2:(tac ()) : $g) in abstract (fun () => Std.exact pf) (except with less redundant checking)?

AIUI, you only have to purge the bits of the environment that hold constr, and bool is fine to not purge.

It's hard to tell which bits that is though. And the only safe solution would be to purge everything we don't know about (by purge I mean remove from the environment btw).

I guess it's okay to say that any Ltac2 variable you want to reference must be mentioned to the left of |-. It might be nice to do a little bit of magic for the user, and automatically add any variable that occurs syntactically in the expression? (Ideally this magic would not be specific to abstract, and you could just add an interpretation scope that's like ltac2_var_list_with_default_from_expr(opt(varlist, sep="|-"), constr) that gives you both the varlist and the expression or something?)

@SkySkimmer
Copy link
Contributor Author

I guess it's okay to say that any Ltac2 variable you want to reference must be mentioned to the left of |-.

The point of the |- is to evar normalize, if it doesn't do that on some variables it's useless IMO.
Let's forget the |- idea, I'm now convinced it was bad.

@SkySkimmer
Copy link
Contributor Author

Why? Why is abstract tac different from ...

I don't know. There may be perf consequences, or maybe it's just historical accident.

@JasonGross
Copy link
Member

Why? Why is abstract tac different from ...

I don't know. There may be perf consequences, or maybe it's just historical accident.

I would guess historical accident, given that abstract long predates tactics in terms and I doubt this design choice was ever profiled. (Though it's possible that it would be hard to make performant with a different design?)

@JasonGross
Copy link
Member

What's the design of abstract currently such that we need a new evarmap and can't reuse the existing one? Is it that the proof closing machinery expects all evars to be resolved and does not permit dangling evars to be reused? Or is it about proof opening time?

@SkySkimmer
Copy link
Contributor Author

It's relatively easy to make abstract support evars:

modified   vernac/declare.ml
@@ -1859,46 +1859,40 @@ let next = let n = ref 0 in fun () -> incr n; !n
 
 let by tac = map_fold ~f:(Proof.solve (Goal_select.SelectNth 1) None tac)
 
-let build_constant_by_tactic ~name ?(opaque=Vernacexpr.Transparent) ~uctx ~sign ~poly (typ : EConstr.t) tac =
-  let evd = Evd.from_ctx uctx in
+let build_constant_by_tactic ~name ?(opaque=Vernacexpr.Transparent) ~sigma ~sign ~poly (typ : EConstr.t) tac =
   let typ_ = EConstr.Unsafe.to_constr typ in
   let cinfo = [CInfo.make ~name ~typ:typ_ ()] in
   let info = Info.make ~poly () in
   let pinfo = Proof_info.make ~cinfo ~info () in
-  let pf = start_proof_core ~name ~typ ~pinfo ~sign evd in
+  let pf = start_proof_core ~name ~typ ~pinfo ~sign sigma in
   let pf, status = by tac pf in
   let { entries; uctx } = close_proof ~opaque ~keep_body_ucst_separate:false pf in
+  let { Proof.sigma } = Proof.data pf.proof in
+  let sigma = Evd.set_universe_context sigma uctx in
   match entries with
   | [entry] ->
     let entry = Internal.pmap_entry_body ~f:Future.force entry in
-    entry, status, uctx
+    entry, status, sigma
   | _ ->
     CErrors.anomaly Pp.(str "[build_constant_by_tactic] close_proof returned more than one proof term")
 
 let build_by_tactic env ~uctx ~poly ~typ tac =
   let name = Id.of_string ("temporary_proof"^string_of_int (next())) in
   let sign = Environ.(val_of_named_context (named_context env)) in
-  let ce, status, uctx = build_constant_by_tactic ~name ~uctx ~sign ~poly typ tac in
+  let sigma = Evd.from_ctx uctx in
+  let ce, status, sigma = build_constant_by_tactic ~name ~sigma ~sign ~poly typ tac in
+  let uctx = Evd.evar_universe_context sigma in
   let cb, uctx = inline_private_constants ~uctx env ce in
   cb, ce.proof_entry_type, ce.proof_entry_universes, status, uctx
 
 let declare_abstract ~name ~poly ~kind ~sign ~secsign ~opaque ~solve_tac sigma concl =
-  (* EJGA: flush_and_check_evars is only used in abstract, could we
-     use a different API? *)
-  let concl =
-    try Evarutil.flush_and_check_evars sigma concl
-    with Evarutil.Uninstantiated_evar _ ->
-      CErrors.user_err Pp.(str "\"abstract\" cannot handle existentials.")
-  in
   let sigma, concl =
     (* FIXME: should be done only if the tactic succeeds *)
     let sigma = Evd.minimize_universes sigma in
-    sigma, Evarutil.nf_evars_universes sigma concl
+    sigma, Evarutil.nf_evar sigma concl
   in
-  let concl = EConstr.of_constr concl in
-  let uctx = Evd.evar_universe_context sigma in
-  let (const, safe, uctx) =
-    try build_constant_by_tactic ~name ~opaque:Vernacexpr.Transparent ~poly ~uctx ~sign:secsign concl solve_tac
+  let (const, safe, sigma) =
+    try build_constant_by_tactic ~name ~opaque:Vernacexpr.Transparent ~poly ~sigma ~sign:secsign concl solve_tac
     with Logic_monad.TacticFailure e as src ->
     (* if the tactic [tac] fails, it reports a [TacticFailure e],
        which is an error irrelevant to the proof system (in fact it
@@ -1907,7 +1901,6 @@ let declare_abstract ~name ~poly ~kind ~sign ~secsign ~opaque ~solve_tac sigma c
     let (_, info) = Exninfo.capture src in
     Exninfo.iraise (e, info)
   in
-  let sigma = Evd.set_universe_context sigma uctx in
   let body, effs = const.proof_entry_body in
   (* We drop the side-effects from the entry, they already exist in the ambient environment *)
   let const = Internal.pmap_entry_body const ~f:(fun _ -> body, ()) in

(although this patch causes it to warn that there are remaining goals (the surrounding proof) and error if a previous goal was admitted)

The overall consequences are unclear.

We could expose a primitive like Ltac2 declare_private_constant : bool (* opaque *) -> constr -> constr (* returns the constant applied to the used goal variables *)
Then

Ltac2 abstract2 tac :=
  let g := Control.goal() in
  let c := constr:(ltac2:(tac) : $g) in
  (* maybe a bit of Constr.Unsafe to remove the cast node? *)
  let c := declare_private_constant true c in
  exact_no_check c

should work

@SkySkimmer SkySkimmer added the needs: discussion Further discussion is needed. label Jun 16, 2023
@SkySkimmer SkySkimmer added the request: full CI Use this label when you want your next push to trigger a full CI. label Oct 10, 2023
@coqbot-app coqbot-app bot removed request: full CI Use this label when you want your next push to trigger a full CI. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. labels Oct 10, 2023
@SkySkimmer
Copy link
Contributor Author

@coqbot bench

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Oct 11, 2023

🏁 Bench results:

┌──────────────────────────────┬─────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┬─────────────────────────┐
│                              │      user time [s]      │              CPU cycles               │           CPU instructions            │  max resident mem [KB]  │
│                              │                         │                                       │                                       │                         │
│         package_name         │   NEW      OLD    PDIFF │      NEW             OLD        PDIFF │      NEW             OLD        PDIFF │   NEW      OLD    PDIFF │
├──────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┤
│                   coq-stdlib │  379.02   384.57  -1.44 │  1609770889938   1626768401703  -1.04 │  1389265389591   1388163189477   0.08 │  761480   760356   0.15 │
│                  coq-coqutil │   41.46    42.00  -1.29 │   183940652754    184421914436  -0.26 │   265068184117    265129022206  -0.02 │  561512   561520  -0.00 │
│        coq-mathcomp-solvable │  145.11   146.63  -1.04 │   657638700550    664293218535  -1.00 │  1057914349236   1058096292712  -0.02 │  929668   931748  -0.22 │
│        coq-mathcomp-fingroup │   38.81    39.15  -0.87 │   175808773062    177660892682  -1.04 │   265568621728    265552114660   0.01 │  560192   561300  -0.20 │
│                     coq-core │  117.97   118.89  -0.77 │   468431189832    463492692937   1.07 │   493747645932    493293642031   0.09 │  368208   368032   0.05 │
│           coq-mathcomp-field │  217.56   219.18  -0.74 │   980755320473    986858370467  -0.62 │  1750161949783   1752339368926  -0.12 │ 1357712  1396620  -2.79 │
│            coq-metacoq-pcuic │  620.73   624.31  -0.57 │  2790208903612   2806061560322  -0.56 │  4130208513365   4124360490008   0.14 │ 1993348  1994076  -0.04 │
│                coq-equations │   11.31    11.36  -0.44 │    48427816160     48487918351  -0.12 │    76589683918     76555804945   0.04 │  419060   420992  -0.46 │
│               coq-verdi-raft │  606.00   608.21  -0.36 │  2747157589631   2757773795728  -0.38 │  4214759081220   4215650115922  -0.02 │  811476   820060  -1.05 │
│       coq-mathcomp-ssreflect │  185.52   186.18  -0.35 │   836726535100    840124082031  -0.40 │  1476966333511   1478036367625  -0.07 │ 1286724  1288876  -0.17 │
│     coq-metacoq-translations │   18.52    18.58  -0.32 │    81124353629     81275981779  -0.19 │   131852556899    131873494202  -0.02 │  907380   905480   0.21 │
│            coq-iris-examples │  494.25   495.59  -0.27 │  2226948062877   2233076443710  -0.27 │  3387504955009   3388876515105  -0.04 │ 1075012  1084880  -0.91 │
│ coq-fiat-crypto-with-bedrock │ 6485.35  6502.93  -0.27 │ 29200856328055  29281038670232  -0.27 │ 53637173640537  53622484533806   0.03 │ 2419816  2421228  -0.06 │
│       coq-mathcomp-character │  136.86   137.21  -0.26 │   620192786705    621231653596  -0.17 │  1000966521038   1001321787315  -0.04 │ 1257228  1217388   3.27 │
│                    coq-color │  237.00   237.60  -0.25 │  1058000753264   1059933108035  -0.18 │  1545815044200   1544421328329   0.09 │ 1128080  1132788  -0.42 │
│                  coq-unimath │ 1655.98  1660.13  -0.25 │  7491750857438   7508364967829  -0.22 │ 14033176539691  14032203791128   0.01 │ 1324116  1322876   0.09 │
│             coq-math-classes │   88.30    88.49  -0.21 │   394799397141    395982255207  -0.30 │   554346651401    553767010163   0.10 │  524696   524044   0.12 │
│                     coq-corn │  805.11   806.58  -0.18 │  3629203794846   3636579068117  -0.20 │  5633746202106   5624512655246   0.16 │  778364   777836   0.07 │
│                     coq-hott │  158.92   159.07  -0.09 │   711173335161    709468119527   0.24 │  1123033346696   1121404012453   0.15 │  590024   590320  -0.05 │
│                 coq-rewriter │  377.80   378.13  -0.09 │  1700020621202   1700088838840  -0.00 │  2781462802907   2781298597913   0.01 │ 1276488  1279912  -0.27 │
│                      coq-vst │  860.82   860.30   0.06 │  3871822493359   3870953741714   0.02 │  6389735333692   6387374280025   0.04 │ 1941276  1943784  -0.13 │
│       coq-mathcomp-odd-order │  884.28   883.67   0.07 │  4026303819163   4024460289441   0.05 │  6740403457727   6741686276237  -0.02 │ 1631092  1630292   0.05 │
│         coq-mathcomp-algebra │  476.32   475.94   0.08 │  2148115087682   2145689359222   0.11 │  3978962052399   3979451820563  -0.01 │ 1413940  1405024   0.63 │
│                coq-fourcolor │ 1561.51  1557.05   0.29 │  6902693896281   6884313506459   0.27 │ 12481825494067  12482265110012  -0.00 │ 2329980  2330184  -0.01 │
│  coq-rewriter-perf-SuperFast │  765.98   763.76   0.29 │  3409237362541   3400522788858   0.26 │  5769840693740   5771566163818  -0.03 │ 1375876  1370396   0.40 │
│                    coq-verdi │   50.30    50.15   0.30 │   224726998336    224399802050   0.15 │   338888543679    339056836660  -0.05 │  528452   529760  -0.25 │
│             coq-fiat-parsers │  337.44   336.33   0.33 │  1487306011076   1482822570962   0.30 │  2468707667505   2460588290486   0.33 │ 2437540  2437908  -0.02 │
│   coq-performance-tests-lite │  734.73   732.16   0.35 │  3282052194407   3267915168266   0.43 │  5790180588456   5786649643682   0.06 │ 1691184  1690884   0.02 │
│          coq-metacoq-erasure │  314.06   312.86   0.38 │  1411425627421   1405771639457   0.40 │  2235894270429   2235468099645   0.02 │ 2030048  2028624   0.07 │
│      coq-metacoq-safechecker │  379.74   377.95   0.47 │  1727543039352   1719610619051   0.46 │  2873079407926   2872777805552   0.01 │ 1962448  1959116   0.17 │
│                coq-perennial │ 6503.04  6471.42   0.49 │ 29414833206878  29289939721509   0.43 │ 48925431230588  48935774344933  -0.02 │ 2186056  2205004  -0.86 │
│                 coq-coqprime │   48.66    48.41   0.52 │   216913030306    215568022492   0.62 │   330485911247    330128645988   0.11 │  780720   780684   0.00 │
│                 coq-bedrock2 │  360.10   358.16   0.54 │  1625853767668   1616300260402   0.59 │  3162787557981   3163444652900  -0.02 │  870992   870756   0.03 │
│                coq-fiat-core │   61.09    60.72   0.61 │   259109711111    259077405051   0.01 │   381123839776    380997345012   0.03 │  494460   495416  -0.19 │
│         coq-metacoq-template │  166.58   165.52   0.64 │   735156978711    729877420150   0.72 │  1158652518772   1156187355849   0.21 │ 1279820  1277972   0.14 │
│          coq-category-theory │  758.78   753.86   0.65 │  3442030411586   3421615927964   0.60 │  5874715615927   5872492358158   0.04 │  987236   879688  12.23 │
│                 coq-compcert │  288.24   286.35   0.66 │  1289785214020   1278364891073   0.89 │  1961065169781   1960707754786   0.02 │ 1144840  1142324   0.22 │
│        coq-engine-bench-lite │  161.86   160.66   0.75 │   686986583730    682707666692   0.63 │  1273801130477   1278378401326  -0.36 │ 1323208  1323216  -0.00 │
│               coq-coquelicot │   39.12    38.80   0.82 │   172193828852    171947490508   0.14 │   239949301867    239931884068   0.01 │  819796   820628  -0.10 │
│                  coq-bignums │   29.54    29.24   1.03 │   133298226766    131876750861   1.08 │   188941177690    189128465161  -0.10 │  490280   490580  -0.06 │
└──────────────────────────────┴─────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┴─────────────────────────┘

🐢 Top 25 slow downs
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                  TOP 25 SLOW DOWNS                                                                   │
│                                                                                                                                                      │
│   OLD       NEW      DIFF     %DIFF     Ln                      FILE                                                                                 │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  54.3770   55.1980  0.8210      1.51%   609  coq-bedrock2/bedrock2/src/bedrock2Examples/lightbulb.v.html                                             │
│  64.6620   65.4120  0.7500      1.16%   361  coq-perennial/src/program_proof/buf/buf_proof.v.html                                                    │
│   4.0530    4.7790  0.7260     17.91%    22  coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html                                  │
│ 112.6450  113.3470  0.7020      0.62%   999  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html                         │
│  26.1180   26.7800  0.6620      2.53%    12  coq-fourcolor/theories/job554to562.v.html                                                               │
│   8.3090    8.9580  0.6490      7.81%  1510  coq-perennial/src/program_proof/vrsm/configservice/config_proof.v.html                                  │
│  44.8660   45.5090  0.6430      1.43%   110  coq-bedrock2/bedrock2/src/bedrock2Examples/full_mul.v.html                                              │
│  17.5410   18.1630  0.6220      3.55%    32  coq-performance-tests-lite/src/pattern.v.html                                                           │
│   3.9410    4.5480  0.6070     15.40%   128  coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html                                            │
│   0.0040    0.4670  0.4630  11575.00%   753  coq-metacoq-pcuic/pcuic/theories/PCUICTyping.v.html                                                     │
│   0.0030    0.4290  0.4260  14200.00%  1275  coq-metacoq-template/template-coq/theories/Typing.v.html                                                │
│   2.4360    2.8560  0.4200     17.24%    34  coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html                                  │
│  28.2930   28.7050  0.4120      1.46%    12  coq-fourcolor/theories/job499to502.v.html                                                               │
│ 113.0660  113.4720  0.4060      0.36%   968  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html                         │
│  29.6520   30.0470  0.3950      1.33%    12  coq-fourcolor/theories/job611to617.v.html                                                               │
│   4.1880    4.5810  0.3930      9.38%   130  coq-category-theory/Functor/Strong/Product.v.html                                                       │
│ 160.0180  160.4090  0.3910      0.24%   233  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/deps/riscv-coq/src/riscv/Proofs/DecodeByExtension.v.html │
│   0.0980    0.4710  0.3730    380.61%  1011  coq-perennial/src/program_proof/vrsm/storage/proof.v.html                                               │
│  24.9930   25.3580  0.3650      1.46%    12  coq-fourcolor/theories/job384to398.v.html                                                               │
│   1.0210    1.3780  0.3570     34.97%   853  coq-stdlib/FSets/FMapAVL.v.html                                                                         │
│   0.2000    0.5490  0.3490    174.50%  1732  coq-perennial/src/program_proof/vrsm/apps/exactlyonce/proof.v.html                                      │
│   2.4790    2.8270  0.3480     14.04%   487  coq-stdlib/Numbers/HexadecimalFacts.v.html                                                              │
│   4.4890    4.8140  0.3250      7.24%   102  coq-engine-bench-lite/coq/PerformanceDemos/rewrite_strat_repeated_app.v.html                            │
│  54.6600   54.9820  0.3220      0.59%   609  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/bedrock2/src/bedrock2Examples/lightbulb.v.html           │
│   2.8280    3.1480  0.3200     11.32%   475  coq-vst/veric/binop_lemmas3.v.html                                                                      │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
🐇 Top 25 speed ups
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                             TOP 25 SPEED UPS                                                              │
│                                                                                                                                           │
│   OLD       NEW      DIFF     %DIFF    Ln                    FILE                                                                         │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  19.2550   17.5520  -1.7030   -8.84%   376  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/compiler/src/compiler/FlatToRiscvMetric.v.html │
│  23.7900   22.2060  -1.5840   -6.66%   660  coq-perennial/src/program_proof/vrsm/replica/roapply_proof.v.html                             │
│  91.7580   91.0930  -0.6650   -0.72%   103  coq-fiat-crypto-with-bedrock/src/Arithmetic/BarrettReduction.v.html                           │
│   2.3810    1.7470  -0.6340  -26.63%   209  coq-stdlib/setoid_ring/Ncring_tac.v.html                                                      │
│ 127.6120  127.0230  -0.5890   -0.46%    22  coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html                        │
│  61.0310   60.4640  -0.5670   -0.93%    27  coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ToFancyWithCasts.v.html                      │
│   7.8500    7.2890  -0.5610   -7.15%   288  coq-perennial/src/program_proof/vrsm/paxos/becomeleader_proof.v.html                          │
│  32.7270   32.2150  -0.5120   -1.56%    12  coq-fourcolor/theories/job107to164.v.html                                                     │
│ 142.4220  141.9130  -0.5090   -0.36%  1190  coq-unimath/UniMath/CategoryTheory/GrothendieckConstruction/IsPullback.v.html                 │
│ 113.9300  113.4430  -0.4870   -0.43%    48  coq-fiat-crypto-with-bedrock/src/Curves/Weierstrass/AffineProofs.v.html                       │
│  27.4700   27.0050  -0.4650   -1.69%   823  coq-perennial/src/program_proof/aof/proof.v.html                                              │
│  16.8190   16.3850  -0.4340   -2.58%   483  coq-verdi-raft/raft-proofs/EndToEndLinearizability.v.html                                     │
│  24.1370   23.7190  -0.4180   -1.73%  1449  coq-unimath/UniMath/CategoryTheory/EnrichedCats/Examples/KleisliEnriched.v.html               │
│  18.0330   17.6220  -0.4110   -2.28%    31  coq-engine-bench-lite/coq/PerformanceDemos/pattern.v.html                                     │
│  31.7300   31.3200  -0.4100   -1.29%   839  coq-unimath/UniMath/CategoryTheory/GrothendieckConstruction/IsPullback.v.html                 │
│  53.3350   52.9580  -0.3770   -0.71%    50  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html          │
│   0.4710    0.0970  -0.3740  -79.41%  1699  coq-perennial/src/program_proof/vrsm/configservice/config_proof.v.html                        │
│   0.6250    0.2550  -0.3700  -59.20%  1009  coq-perennial/src/program_proof/vrsm/storage/proof.v.html                                     │
│  22.8060   22.4400  -0.3660   -1.60%   233  coq-fiat-crypto-with-bedrock/src/Curves/EdwardsMontgomery.v.html                              │
│  21.2160   20.8500  -0.3660   -1.73%    12  coq-fourcolor/theories/job311to314.v.html                                                     │
│   0.4930    0.1400  -0.3530  -71.60%  1734  coq-perennial/src/program_proof/vrsm/apps/exactlyonce/proof.v.html                            │
│   0.9450    0.5950  -0.3500  -37.04%   170  coq-stdlib/Numbers/HexadecimalNat.v.html                                                      │
│  30.4190   30.0920  -0.3270   -1.07%    12  coq-fourcolor/theories/job190to206.v.html                                                     │
│   0.9190    0.5950  -0.3240  -35.26%   877  coq-metacoq-pcuic/pcuic/theories/PCUICTyping.v.html                                           │
│  20.8860   20.5840  -0.3020   -1.45%    12  coq-fourcolor/theories/job271to278.v.html                                                     │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@SkySkimmer SkySkimmer added kind: performance Improvements to performance and efficiency. needs: changelog entry This should be documented in doc/changelog. and removed needs: discussion Further discussion is needed. labels Oct 11, 2023
@SkySkimmer SkySkimmer added this to the 8.19+rc1 milestone Oct 11, 2023
Close? coq#13977

Unlike coq#17346 we still expand in `constr:()`, hopefully we trigger
less bugs this way.
@SkySkimmer SkySkimmer removed the needs: changelog entry This should be documented in doc/changelog. label Oct 16, 2023
@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 Oct 16, 2023
@SkySkimmer
Copy link
Contributor 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 Oct 30, 2023
@coqbot-app

This comment was marked as off-topic.

@ppedrot ppedrot self-assigned this Nov 6, 2023
@ppedrot
Copy link
Member

ppedrot commented Nov 8, 2023

@coqbot merge now

@coqbot-app coqbot-app bot merged commit aaa8c94 into coq:master Nov 8, 2023
12 of 15 checks passed
@SkySkimmer SkySkimmer deleted the open-constr-no-expand branch November 8, 2023 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: performance Improvements to performance and efficiency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants