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

Store the closedness of a term on its leave in unification matchrec. #14253

Merged

Conversation

ppedrot
Copy link
Member

@ppedrot ppedrot commented May 5, 2021

We introduce a new internal type of annotated terms which are essentially a pair of a term and an annotation, in a recursive way. The annotation is a boolean standing for the closedness of the term. This guarantees a O(1) access to the underlying term, as well as a O(1) access to closedness. Building the annotation is O(n) in the term and is an upfront cost payed before entering the recursion.

This trick could be generalized to any annotation which is local, i.e. only depends on the data of the direct subterms of a term. There are various places that could benefit from it, but for the time being I do not want to introduce yet another generic term API.

Fixes #12600.

@ppedrot
Copy link
Member Author

ppedrot commented May 5, 2021

Bench https://gitlab.com/coq/coq/-/jobs/1237769695

┌─────────────────────────────┬─────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────┬─────────────────────────┬─────────────────┐
│                             │      user time [s]      │              CPU cycles               │           CPU instructions            │  max resident mem [KB]  │   mem faults    │
│                             │                         │                                       │                                       │                         │                 │
│                package_name │     NEW      OLD  PDIFF │            NEW             OLD  PDIFF │            NEW             OLD  PDIFF │     NEW      OLD  PDIFF │ NEW  OLD  PDIFF │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│  coq-performance-tests-lite │ 1653.78  1670.08  -0.98 │  4627820986455   4672515100623  -0.96 │  6996769262302   7199069401722  -2.81 │ 2154040  2154004   0.00 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                coq-bedrock2 │  341.29   344.08  -0.81 │   951291280852    959076585525  -0.81 │  1529688256221   1534909632657  -0.34 │  773924   774152  -0.03 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                 coq-bignums │   60.93    61.24  -0.51 │   170243311221    170865734265  -0.36 │   209120486427    211723733393  -1.23 │  461528   464796  -0.70 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│       coq-engine-bench-lite │  342.18   343.50  -0.38 │   966001079808    970081026144  -0.42 │  1637760953792   1650412681324  -0.77 │ 3119168  3118920   0.01 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                  coq-stdlib │  426.07   427.44  -0.32 │  1193112869733   1196307263679  -0.27 │  1464921867102   1470225934247  -0.36 │  568576   568940  -0.06 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                 coq-unimath │ 4290.70  4296.70  -0.14 │ 11962637491497  11978135448323  -0.13 │ 21188556388328  21231249981964  -0.20 │ 1121276  1083924   3.45 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│             coq-fiat-crypto │ 5185.93  5190.51  -0.09 │ 14457411808721  14456043312094   0.01 │ 23547720039812  23676016193791  -0.54 │ 2206796  2211028  -0.19 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│               coq-fourcolor │ 2796.70  2798.90  -0.08 │  7791195752225   7796407404297  -0.07 │ 12247346688877  12246140583359   0.01 │  730800   730772   0.00 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                    coq-hott │  296.37   296.59  -0.07 │   835689287408    837747771499  -0.25 │  1177236093135   1189876198032  -1.06 │  583532   583860  -0.06 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                coq-coqprime │ 1524.36  1523.95   0.03 │  4237305643465   4244419609564  -0.17 │  6590559090830   6588613382892   0.03 │ 1056320  1056224   0.01 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│               coq-fiat-core │  119.10   119.01   0.08 │   343392326033    342038209589   0.40 │   409390317684    408782344600   0.15 │  479236   478964   0.06 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                coq-rewriter │  742.14   740.71   0.19 │  2070133385720   2065285496033   0.23 │  2928447601312   2932728267254  -0.15 │ 1100628  1100572   0.01 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│ coq-rewriter-perf-SuperFast │  819.46   817.05   0.29 │  2285800166281   2278927996154   0.30 │  3288700894465   3295219335245  -0.20 │ 1100620  1100532   0.01 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                   coq-flocq │  164.01   163.45   0.34 │   458139900415    456510650450   0.36 │   507811781303    508253563047  -0.09 │  818440   818668  -0.03 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│          coq-mathcomp-field │  247.60   246.64   0.39 │   690216076490    687489027694   0.40 │   951408422735    951455118161  -0.00 │  667636   667556   0.01 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│        coq-mathcomp-algebra │  156.89   156.24   0.42 │   437547777995    435503599988   0.47 │   507116480693    507173399023  -0.01 │  555456   555436   0.00 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│      coq-mathcomp-character │  169.78   169.03   0.44 │   472975939040    471485459682   0.32 │   595799712233    595774321704   0.00 │  745000   744968   0.00 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│              coq-verdi-raft │ 1284.37  1278.51   0.46 │  3583195885057   3566042593347   0.48 │  4596074852345   4622799795146  -0.58 │  900364   900664  -0.03 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│            coq-math-classes │  191.58   190.68   0.47 │   538700273680    535283707672   0.64 │   653100473034    653261632786  -0.02 │  479756   479520   0.05 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│       coq-mathcomp-solvable │  192.08   191.11   0.51 │   535660050970    533133685254   0.47 │   679700467388    679749690192  -0.01 │  683676   689492  -0.84 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                 coq-coqutil │   62.56    62.22   0.55 │   175299010976    174999487426   0.17 │   209966073453    210207253112  -0.11 │  523256   523240   0.00 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│               coq-perennial │ 7516.02  7474.37   0.56 │ 20945988552644  20831178476914   0.55 │ 28855244144765  28910060254775  -0.19 │ 3105696  3114560  -0.28 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│       coq-mathcomp-fingroup │   54.12    53.82   0.56 │   150833542529    150373178400   0.31 │   188509474583    188529152284  -0.01 │  481836   481804   0.01 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│             coq-lambda-rust │ 1400.52  1392.34   0.59 │  3902904957455   3880141069643   0.59 │  5046033849935   5053554550018  -0.15 │ 1110328  1109572   0.07 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                  coq-geocoq │ 1500.50  1491.58   0.60 │  4184945859552   4160435675092   0.59 │  5638106978075   5637260263584   0.02 │  992352   992200   0.02 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                   coq-verdi │  109.00   108.31   0.64 │   303162069332    301240674303   0.64 │   386387954719    386230879638   0.04 │  544348   544372  -0.00 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                    coq-corn │ 1626.35  1615.92   0.65 │  4541778411906   4513270571723   0.63 │  5987540896366   5991746970924  -0.07 │  790336   790280   0.01 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│      coq-mathcomp-odd-order │ 1176.38  1168.46   0.68 │  3275977864758   3254818648712   0.65 │  4696363457463   4696661009104  -0.01 │  910388   910604  -0.02 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                   coq-color │  545.85   542.08   0.70 │  1526619486507   1516707234009   0.65 │  1725722593948   1728316972272  -0.15 │ 1146028  1146304  -0.02 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│              coq-coquelicot │   77.02    76.46   0.73 │   214216327741    213069929285   0.54 │   241401846196    241043404906   0.15 │  559368   559860  -0.09 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                    coq-core │  111.30   110.44   0.78 │   312114602403    310672017477   0.46 │   452234650372    451963946643   0.06 │  293380   293424  -0.01 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                         coq │    4.60     4.56   0.88 │    12914013810     12769764916   1.13 │    23041718202     23052273113  -0.05 │  282000   281992   0.00 │   0    0    nan │
├─────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│      coq-mathcomp-ssreflect │   59.81    59.27   0.91 │   166267540198    165449061930   0.49 │   188410885399    188402162826   0.00 │  520856   520936  -0.02 │   0    0    nan │
└─────────────────────────────┴─────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────┴─────────────────────────┴─────────────────┘

@ppedrot
Copy link
Member Author

ppedrot commented May 6, 2021

Funny experiment but not really conclusive. Some single lines show important differences but it doesn't stand out it the whole bench, and they are rather small in absolute values.

@ppedrot
Copy link
Member Author

ppedrot commented Jun 16, 2021

Reopening because it actually fixes a reported bug.

@ppedrot ppedrot added the kind: performance Improvements to performance and efficiency. label Jun 16, 2021
@ppedrot ppedrot added this to the 8.15+rc1 milestone Jun 16, 2021
@ppedrot ppedrot marked this pull request as ready for review June 16, 2021 07:30
@ppedrot ppedrot requested a review from a team as a code owner June 16, 2021 07:30
@ppedrot ppedrot force-pushed the cache-constr-annotation-unfication-matchrec branch from 830a5c7 to ec55829 Compare June 16, 2021 07:39
@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 16, 2021

Hey, I have detected that there were CI failures at commit ec55829 without any failure in the test-suite.
I checked that the corresponding jobs for the base commit a1fac38 succeeded. You can ask me to try to extract a minimal test case from this so that it can be added to the test-suite.
If you tag me saying @coqbot ci minimize, I will minimize the following target: ci-fiat_parsers.

2 similar comments
@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 16, 2021

Hey, I have detected that there were CI failures at commit ec55829 without any failure in the test-suite.
I checked that the corresponding jobs for the base commit a1fac38 succeeded. You can ask me to try to extract a minimal test case from this so that it can be added to the test-suite.
If you tag me saying @coqbot ci minimize, I will minimize the following target: ci-fiat_parsers.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 16, 2021

Hey, I have detected that there were CI failures at commit ec55829 without any failure in the test-suite.
I checked that the corresponding jobs for the base commit a1fac38 succeeded. You can ask me to try to extract a minimal test case from this so that it can be added to the test-suite.
If you tag me saying @coqbot ci minimize, I will minimize the following target: ci-fiat_parsers.

@JasonGross
Copy link
Member

@coqbot ci minimize

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 16, 2021

I have initiated minimization at commit ec55829 for the suggested target ci-fiat_parsers as requested.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 16, 2021

Hey, I have detected that there were CI failures at commit ec55829 without any failure in the test-suite.
I checked that the corresponding jobs for the base commit a1fac38 succeeded. You can ask me to try to extract a minimal test case from this so that it can be added to the test-suite.
If you tag me saying @coqbot ci minimize, I will minimize the following target: ci-fiat_parsers.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 16, 2021

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/PossibleTerminalsSets.v (from ci-fiat_parsers) (interrupted by timeout) (full log on GitHub Actions)

Minimized Coq File (truncated to 32KiB; full 60KiB file on GitHub Actions Artifacts under bug.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-w" "-deprecated-appcontext -notation-overridden" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src" "Fiat" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock" "Bedrock" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-I" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics" "-top" "PossibleTerminalsSets" "-native-compiler" "no" "-require-import" "Coq.Compat.AdmitAxiom" "-native-compiler" "no") -*- *)
(* File reduced by coq-bug-finder from original input, then from 916 lines to 386 lines, then from 507 lines to 948 lines, then from 951 lines to 417 lines, then from 538 lines to 916 lines, then from 919 lines to 447 lines, then from 567 lines to 917 lines, then from 921 lines to 475 lines, then from 595 lines to 831 lines, then from 834 lines to 516 lines, then from 634 lines to 1027 lines, then from 1031 lines to 795 lines, then from 910 lines to 2027 lines, then from 2031 lines to 1661 lines *)
(* coqc version 8.15+alpha compiled with OCaml 4.05.0
   coqtop version 8.15+alpha *)
Declare ML Module "ltac_plugin".
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False := .
End LocalFalse.
Axiom proof_admitted : False.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Coq.Strings.Ascii.
Require Coq.MSets.MSetPositive.
Require Coq.PArith.BinPos.
Require Coq.PArith.Pnat.
Require Coq.Arith.Arith.
Require Coq.Classes.RelationClasses.
Require Coq.Classes.Morphisms.
Require Coq.Compat.Coq814.
Require Coq.Strings.String.
Require Coq.ZArith.BinIntDef.
Require Coq.PArith.BinPosDef.
Require Coq.NArith.BinNatDef.
Require Coq.Reals.Rdefinitions.
Require Coq.Numbers.Cyclic.Int63.Int63.
Require Coq.Numbers.Cyclic.Int31.Int31.
Require Coq.micromega.Lia.
Require Coq.Lists.List.
Require Coq.Vectors.Vector.
Require Coq.funind.FunInd.
Require Fiat.Common.Coq__8_4__8_5__Compat.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.BinInt.
Require Coq.NArith.BinNat.
Require Coq.Bool.Bool.
Require Fiat.Common.BoolFacts.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Setoids.Setoid.
Require Coq.Program.Program.
Require Fiat.Common.Tactics.SplitInContext.
Require Fiat.Common.Tactics.Combinators.
Require Fiat.Common.Tactics.FreeIn.
Require Fiat.Common.Tactics.SetoidSubst.
Require Fiat.Common.Tactics.Head.
Require Fiat.Common.Tactics.BreakMatch.
Require Fiat.Common.Tactics.FoldIsTrue.
Require Fiat.Common.Tactics.SpecializeBy.
Require Fiat.Common.Tactics.DestructHyps.
Require Fiat.Common.Tactics.DestructSig.
Require Fiat.Common.Tactics.DestructHead.
Require Fiat.Common.
Require Fiat.Common.Equality.
Require Fiat.Common.List.Operations.
Require Fiat.Common.List.FlattenList.
Require Coq.Program.Basics.
Require Fiat.Common.LogicFacts.
Require Fiat.Common.List.ListFacts.
Require Fiat.Common.StringOperations.
Require Fiat.Common.StringFacts.
Require Fiat.Common.Enumerable.
Require Coq.Arith.Compare_dec.
Require Coq.Logic.EqdepFacts.
Require Fiat.Common.UIP.
Require Fiat.Common.Enumerable.BoolProp.
Require Coq.Relations.Relation_Definitions.
Require Fiat.Parsers.StringLike.Core.
Require Fiat.Parsers.ContextFreeGrammar.Core.
Require Fiat.Parsers.ContextFreeGrammar.Reflective.
Require Fiat.Common.Gensym.
Require Fiat.Parsers.ContextFreeGrammar.PreNotations.
Require Fiat.Parsers.ContextFreeGrammar.Carriers.
Require Fiat.Common.Notations.
Require Fiat.Parsers.ContextFreeGrammar.Fix.Definitions.
Require Coq.MSets.MSetInterface.
Require Coq.MSets.MSetFacts.
Require Coq.MSets.MSetProperties.
Require Coq.Program.Wf.
Require Coq.Arith.Wf_nat.
Require Coq.Init.Wf.
Require Fiat.Common.Wf.
Require Fiat.Common.Instances.
Require Fiat.Common.NatFacts.
Require Coq.MSets.MSetDecide.
Require Fiat.Common.MSetExtensions.
Require Fiat.Common.MSetBoundedLattice.
Require Fiat.Parsers.ContextFreeGrammar.Fix.AsciiLattice.
Require Coq.Numbers.BinNums.
Require Coq.FSets.FMapPositive.
Require Fiat.Parsers.BaseTypes.
Require Fiat.Parsers.Splitters.RDPList.
Require Fiat.Parsers.ContextFreeGrammar.Fix.Properties.
Require Coq.FSets.FMapInterface.
Require Coq.FSets.FMapFacts.
Require Coq.Structures.OrderedTypeEx.
Require Coq.Structures.OrderedType.
Require Fiat.Common.SetEq.
Require Coq.Sorting.Permutation.
Require Fiat.Common.SetEqProperties.
Require Coq.Sets.Ensembles.
Require Fiat.Common.List.PermutationFacts.
Require Fiat.Common.Ensembles.EnsembleListEquivalence.
Require Fiat.Common.List.ListMorphisms.
Require Fiat.Common.SetoidClassInstances.
Require Fiat.Common.FMapExtensions.
Require Fiat.Common.LogicMorphisms.
Require Fiat.Common.FMapExtensions.LiftRelationInstances.
Require Fiat.Common.FMapExtensions.Wf.
Require Fiat.Common.OptionFacts.
Require Fiat.Common.SetoidInstances.
Require Fiat.Parsers.ContextFreeGrammar.Fix.Fix.
Require Fiat.Parsers.ContextFreeGrammar.Precompute.
Require Fiat.Parsers.ContextFreeGrammar.Fix.FromAbstractInterpretationDefinitions.
Require Fiat.Parsers.ContextFreeGrammar.Fix.Prod.
Require Coq.Arith.Le.
Require Fiat.Common.Le.
Require Fiat.Common.Tactics.IsClosed.
Module Export Fiat_DOT_Parsers_DOT_StringLike_DOT_Properties.
Module Export Fiat.
Module Export Parsers.
Module Export StringLike.
Module Properties.
Export Fiat.Common.Coq__8_4__8_5__Compat.
 
Import Coq.Numbers.Natural.Peano.NPeano.
Import Coq.ZArith.ZArith.
Import Fiat.Common.
Import Fiat.Common.List.Operations.
Import Fiat.Common.List.ListFacts.
Import Fiat.Common.Le.
Import Fiat.Common.Tactics.SetoidSubst.
Import Fiat.Common.Tactics.IsClosed.
Import Fiat.Parsers.StringLike.Core Fiat.Common.UIP.

Local Open Scope list_scope.

Set Implicit Arguments.

Section String.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}.

  
  Definition String_rect (P : String -> Type)
    : (forall str, length str = 0 -> P str)
      -> (forall n str (Hlen : length str = S n)
                 (IHstr : forall str', length str' = n -> P str'),
             P str)
      -> forall str, P str.
  Proof.
    intros Zcase Scase str.
    pose (length str) as len.
    pose proof (eq_refl : length str = len) as Hlen.
    clearbody len.
    revert str Hlen.
    induction len; intros.
    {
 eapply Zcase; assumption.
}
    {
 eapply Scase; eassumption.
}
  Defined.

  Definition bool_eq_refl {x : String} : x =s x.
  Proof.
    reflexivity.
  Defined.

  Definition bool_eq_sym {x y : String} : ((x =s y) = (y =s x) :> bool)%string_like.
  Proof.
    case_eq (y =s x)%string_like; intro H';
    [
    | case_eq (x =s y)%string_like; intro H'' ].
    {
 apply (symmetry (R := (fun x y => x =s y))) in H'; assumption.
}
    {
 apply (symmetry (R := (fun x y => x =s y))) in H''; hnf in H''.
      etransitivity; [ exact (eq_sym H'') | exact H' ].
}
    {
 reflexivity.
}
  Defined.

  Definition bool_eq_trans {x y z : String} : (x =s y) -> (y =s z) -> (x =s z).
  Proof.
    apply (transitivity (R := (fun x y => x =s y))).
  Defined.

  Global Instance str_le_Proper_iff : Proper (beq ==> beq ==> iff) str_le | 1000.
  Proof.
    repeat match goal with
             | _ => intro
             | _ => split
             | [ H : _ ≤s _ |- _ ] => destruct H
             | _ => left; assumption
             | _ => right; assumption
             | _ => right; symmetry; assumption
             | [ H : ?x =s _ |- _ ] => rewrite H in *; clear x H
             | [ H : _ =s ?x |- _ ] => rewrite <- H in *; clear x H
           end.
  Qed.

  Global Instance str_le_Proper : Proper (beq ==> beq ==> impl) str_le.
  Proof.
    intros x y H' x' y' H'' H'''.
    apply (@str_le_Proper_iff x y H' x' y' H''); assumption.
  Qed.

  Global Instance str_le_Proper' : Proper (beq ==> beq ==> Basics.flip impl) str_le.
  Proof.
    intros x y H' x' y' H'' H'''.
    apply (@str_le_Proper_iff _ _ H' _ _ H''); assumption.
  Qed.

  Global Instance str_le_refl : Reflexive str_le.
  Proof.
    repeat intro; right; reflexivity.
  Qed.

  Global Instance str_le_antisym : @Antisymmetric _ beq _ str_le.
  Proof.
    intros ? ? [H'|H']; repeat subst; intros [H1|H1]; repeat subst; try reflexivity;
    solve [ reflexivity
          | exfalso; omega
          | assumption
          | symmetry; assumption ].
  Qed.

  Global Instance str_le_trans : Transitive str_le.
  Proof.
    intros ? ? ? [H'|H']; repeat subst; intros [H1|H1]; repeat subst;
    try (rewrite H1 in *; clear H1);
    try (rewrite H' in *; clear H');
    first [ reflexivity
          | left; assumption
          | left; etransitivity; eassumption ].
  Qed.

  Local Open Scope string_like_scope.

  Global Instance str_le_length_le_Proper : Proper (str_le ==> le) length.
  Proof.
    intros x y [H'|H']; auto with arith.
    rewrite H'; reflexivity.
  Qed.

  Global Instance str_le_length_le_Proper' : Proper (Basics.flip str_le ==> Basics.flip le) length.
  Proof.
    intros x y [H'|H']; unfold Basics.flip in *; auto with arith.
    rewrite H'; reflexivity.
  Qed.

  Lemma str_le_take {str n}
  : take n str ≤s str.
  Proof.
    destruct (le_gt_dec (length str) n).
    {
 right; apply take_long; assumption.
}
    {
 left; rewrite take_short_length; omega.
}
  Qed.

  Lemma str_le_drop {str n}
  : drop n str ≤s str.
  Proof.
    destruct n.
    {
 rewrite drop_0; reflexivity.
}
    {
 hnf; rewrite drop_length.
      case_eq (length str); intro H'.
      {
 right; apply bool_eq_empty.
        {
 rewrite drop_length, H'; reflexivity.
}
        {
 assumption.
}
 }
      {
 intro; left; omega.
}
 }
  Qed.

  Lemma take_length {str n}
  : length (take n str) = min n (length str).
  Proof.
    destruct (le_ge_dec (length str) n).
    {
 rewrite take_long by assumption.
      rewrite Min.min_r by assumption.
      reflexivity.
}
    {
 rewrite take_short_length by assumption.
      rewrite Min.min_l by assumption.
      reflexivity.
}
  Qed.

  Lemma length_le_trans
        {a b c : String} (H0' : length a < length b) (H1' : b ≤s c)
  : length a < length c.
  Proof.
    destruct H1'; setoid_subst.
    {
 etransitivity; eassumption.
}
    {
 assumption.
}
  Qed.

  Lemma strle_to_sumbool
        (s1 s2 : String) (f : String -> nat)
        (H' : f s1 < f s2 \/ s1 =s s2)
  : {f s1 < f s2} + {s1 =s s2}.
  Proof.
    unfold beq in *.
    case_eq (s1 =s s2).
    {
 intro H''; right; reflexivity.
}
    {
 intro H''; left.
      destruct H' as [H' | H']; trivial.
      hnf in *.
      abstract congruence.
}
  Defined.

  Section strle_choose.
    Context (s1 s2 : String) (f : String -> nat)
            (f_Proper : Proper (beq ==> eq) f)
            (H0' : f s1 < f s2 \/ s1 =s s2).

    Definition strle_left (H' : f s1 < f s2)
    : H0' = or_introl H'.
    Proof.
      destruct H0' as [H''|H'']; try clear H0'; [ apply f_equal | exfalso ].
      {
 apply le_proof_irrelevance.
}
      {
 setoid_subst s1.
        eapply lt_irrefl; eassumption.
}
    Qed.

    Definition strle_right (H' : s1 =s s2)
    : H0' = or_intror H'.
    Proof.
      destruct H0' as [H''|H'']; try clear H0'; [ exfalso | apply f_equal ].
      {
 setoid_subst s1; eapply lt_irrefl; eassumption.
}
      {
 apply dec_eq_uip.
        decide equality.
}
    Qed.
  End strle_choose.

  Lemma str_seq_lt_false
        {a b : String}
        (H0' : length a < length b)
        (H' : a =s b)
  : False.
  Proof.
    rewrite H' in H0'.
    eapply lt_irrefl; eassumption.
  Qed.

  Lemma singleton_exists_unique : forall s, length s = 1 -> exists !ch, s ~= [ ch ].
  Proof.
    intros s H'.
    destruct (singleton_exists s H') as [ch H''].
    exists ch.
    split; [ apply H'' | ].
    intro; apply singleton_unique; assumption.
  Qed.

  Lemma singleton_take {str ch} (H' : str ~= [ ch ]) n
  : take (S n) str =s str.
  Proof.
    eapply bool_eq_char; try eassumption.
    rewrite take_long; try assumption.
    apply length_singleton in H'; omega.
  Qed.

  Lemma drop_empty {str n} (H' : length str = 0) : drop n str =s str.
admit.
Defined.

  Lemma take_empty {str n} (H' : length str = 0) : take n str =s str.
admit.
Defined.

  Definition get_first_char_nonempty' str (H' : length str <> 0) : Char.
  Proof.
    let ret := constr:(get 0 str) in
    refine (match get 0 str as ch return ret = ch -> Char with
              | Some ch => fun _ => ch
              | None => fun H'' => match _ : False with end
            end eq_refl).
    abstract (
        pose proof (singleton_exists (take 1 str)) as H''';
        rewrite take_length in H'''; destruct (length str); try omega;
        specialize (H''' eq_refl);
        destruct H''' as [ch H'''];
        apply get_0 in H'''; congruence
      ).
  Defined.

  Definition get_first_char_nonempty str n (H' : length str = S n) : Char.
  Proof.
    apply (get_first_char_nonempty' str);
    generalize dependent (length str); clear; intros; abstract omega.
  Defined.

  Lemma no_first_char_empty str (H' : get 0 str = None) : length str = 0.
admit.
Defined.

  Lemma has_first_char_nonempty str (H' : length str = 0) : get 0 str = None.
admit.
Defined.

  Global Instance get_Proper {n}
  : Proper (beq ==> eq) (get n).
admit.
Defined.

  Global Instance get_Proper'
    : Proper (eq ==> beq ==> eq) get.
admit.
Defined.

  Lemma get_drop {n str} : get n str = get 0 (drop n str).
admit.
Defined.

  Lemma get_drop' {n m str} : get m (drop n str) = get (m + n) str.
admit.
Defined.

  Lemma fold'_nil
        {A} (f : Char -> A -> A) (init : A) (str : String)
  : fold' f init str 0 = init.
admit.
Defined.

  Lemma fold'_cons
        {A} (f : Char -> A -> A) (init : A) (str : String) len
  : fold' f init str (S len)
    = match get (length str - S len) str with
        | Some ch => f ch (fold' f init str len)
        | None => init
      end.
admit.
Defined.

  Global Instance fold'_Proper
         {A} (f : Char -> A -> A) (init : A)
  : Proper (beq ==> eq ==> eq) (fold' f init).
admit.
Defined.

  Lemma fold'_drop
        {A} (f : Char -> A -> A) (init : A) (str : String) len m
        (H' : m + len <= length str)
  : fold' f init str len = fold' f init (drop m str) len.
admit.
Defined.

  Definition fold_nil
             {A} (f : Char -> A -> A) (init : A) (str : String)
             (H' : length str = 0)
  : fold f init str = init.
admit.
Defined.

  Lemma fold_recr
        {A} (f : Char -> A -> A) (init : A) (str : String)
  : fold f init str
    = match get 0 str with
        | Some ch => f ch (fold f init (drop 1 str))
        | None => init
      end.
admit.
Defined.

  Global Instance fold_Proper
         {A} (f : Char -> A -> A) (init : A)
  : Proper (beq ==> eq) (fold f init).
admit.
Defined.

  Lemma fold_lookahead'_nil
        {A} (f : Char -> option Char -> A -> A) (init : A) (str : String)
  : fold_lookahead' f init str 0 = init.
admit.
Defined.

  Lemma fold_lookahead'_cons
        {A} (f : Char -> option Char -> A -> A) (init : A) (str : String) len
  : fold_lookahead' f init str (S len)
    = match get (length str - S len) str with
        | Some ch => f ch (get (length str - len) str) (fold_lookahead' f init str len)
        | None => init
      end.
admit.
Defined.

  Global Instance fold_lookahead'_Proper
         {A} (f : Char -> option Char -> A -> A) (init : A)
  : Proper (beq ==> eq ==> eq) (fold_lookahead' f init).
admit.
Defined.

  Lemma fold_lookahead'_drop
        {A} (f : Char -> option Char -> A -> A) (init : A) (str : String) len m
        (H' : m + len <= length str)
  : fold_lookahead' f init str len = fold_lookahead' f init (drop m str) len.
admit.
Defined.

  Definition fold_lookahead_nil
             {A} (f : Char -> option Char -> A -> A) (init : A) (str : String)
             (H' : length str = 0)
  : fold_lookahead f init str = init.
admit.
Defined.

  Lemma fold_lookahead_recr
        {A} (f : Char -> option Char -> A -> A) (init : A) (str : String)
  : fold_lookahead f init str
    = match get 0 str with
        | Some ch => f ch (get 1 str) (fold_lookahead f init (drop 1 str))
        | None => init
      end.
admit.
Defined.

  Global Instance fold_lookahead_Proper
         {A} (f : Char -> option Char -> A -> A) (init : A)
  : Proper (beq ==> eq) (fold_lookahead f init).
admit.
Defined.

  Lemma add_take_1_singleton (str : String) ch (H : str ~= [ ch ])
  : take 1 str ~= [ ch ].
admit.
Defined.

  Lemma take_n_1_singleton (str : String) n ch (H : take n str ~= [ ch ])
  : take 1 str ~= [ ch ].
admit.
Defined.

  Lemma get_take_lt (str : String) n m (Hle : n < m)
  : get n (take m str) = get n str.
admit.
Defined.

  Lemma take_min_length (str : String) n
  : take n str =s take (min (length str) n) str.
admit.
Defined.

  Lemma drop_min_length (str : String) n
  : drop n str =s drop (min (length str) n) str.
admit.
Defined.

  Lemma not_is_char_options str ch
  : (is_char str ch = false) <-> (length str <> 1 \/ get 0 str <> Some ch).
admit.
Defined.

  Lemma is_char_parts str ch
  : (is_true (is_char str ch)) <-> (length str = 1 /\ get 0 str = Some ch).
admit.
Defined.

  Local Ltac induction_to_string str IHlen :=
    let H := fresh "H" in
    let len := fresh "len" in
    unfold fold;
      generalize dependent str; intro str;
      remember (length str) as len eqn:H;
      revert str H;
      induction len as [|len IHlen]; simpl; intros;
      [
      | specialize (IHlen (drop 1 str));
        rewrite drop_length in IHlen;
        specialize_by omega;
        try rewrite <- !H, !minus_diag;
        try rewrite <- fold'_drop in IHlen by omega ].

  Lemma to_string_length str
  : List.length (to_string str) = length str.
admit.
Defined.

  Local Ltac take_drop_to_string_t0 :=
    repeat match goal with
             | _ => progress specialize_by omega
             | _ => reflexivity
             | _ => omega
             | _ => progress subst
             | [ H : context[S _ - S _] |- _ ] => rewrite Nat.sub_succ in H
             | [ H : context[S ?x - ?x] |- _ ] => replace (S x - x) with 1 in H by omega
             | [ H : cons _ _ = cons _ _ |- _ ] => inversion H; clear H
             | _ => discriminate
             | [ H : context[_ + 1] |- _ ] => rewrite Nat.add_1_r in H
             | [ |- context[match get 0 ?s with _ => _ end] ] => destruct (get 0 s) eqn:?
             | [ H : get 0 ?str = None |- _ ] => apply no_first_char_empty in H
             | [ H : _ = ?x |- _ = ?x ] => rewrite <- H; clear H
             | [ H : ?x = _ |- ?x = _ ] => rewrite H; clear H
             | [ H : context[length (drop _ _)] |- _ ] => rewrite drop_length in H
             | [ |- context[length (drop _ _)] ] => rewrite drop_length
             | [ H : context[length (take _ _)] |- _ ] => rewrite take_length in H
             | [ |- context[length (take _ _)] ] => rewrite take_length
             | [ |- context[_ - 0] ] => rewrite Nat.sub_0_r
             | [ H : context[_ - 0] |- _ ] => rewrite Nat.sub_0_r in H
             | [ |- context[fold' _ _ (drop _ _) _] ] => rewrite <- fold'_drop by (rewrite ?take_length; try apply Min.min_case_strong; omega)
             | [ H : context[fold' _ _ (drop _ _) _] |- _ ] => rewrite <- fold'_drop in H by omega
             | [ H : ?x = ?y |- context[?x - ?y] ] => replace (x - y) with 0 by omega
             | [ H : ?y = ?x |- context[?x - ?y] ] => replace (x - y) with 0 by omega
             | [ |- cons _ _ = cons _ _ ] => apply f_equal2
             | [ H : context[get _ (drop 0 ?str)] |- _ ] => rewrite (drop_0 str) in H
             | [ H : ?x = Some ?c, H' : ?y = Some ?c' |- _ ]
               => not constr_eq c c'; is_var c; is_var c';
                  assert (c = c') by congruence; subst
             | _ => progress simpl in *
             | [ |- context[fold' _ _ (drop _ (drop _ _)) _] ] => rewrite drop_drop
             | [ |- context[?x + 1] ] => rewrite Nat.add_1_r
             | [ H : S _ = ?x |- context[match ?x with _ => _ end] ] => rewrite <- H
             | [ H : S _ = ?x, H' : context[match ?x with _ => _ end] |- _ ] => rewrite <- H in H'
             | [ H : context[?x - ?x] |- _ ] => rewrite minus_diag in H
             | [ |- context[?x - ?x] ] => rewrite minus_diag
             | [ H : context[get _ (take _ _)] |- _ ] => rewrite get_take_lt in H by omega
             | [ H : context[min (pred ?x) ?x] |- _ ] => rewrite (Min.min_l (pred x) x) in H by omega
             | [ |- context[take _ (drop _ _)] ] => rewrite take_drop
             | [ |- context[min ?x ?y] ] => rewrite (Min.min_l x y) by omega
             | [ |- context[get _ (drop 0 ?s)] ] => rewrite (drop_0 s)
             | [ |- context[get _ (drop _ (drop _ _))] ] => rewrite drop_drop
             | [ H : S ?x = ?y, H' : S ?z = ?y |- _ ]
               => is_var x; not constr_eq x z; assert (x = z) by omega; subst
             | [ H : S ?x = ?y, H' : ?y = S ?z |- _ ]
               => is_var x; not constr_eq x z; assert (x = z) by omega; subst
             | [ H : get ?n ?s = None |- _ ] => not constr_eq n 0; rewrite get_drop in H
           end.

  Local Ltac take_drop_to_string_t s n :=
    unfold fold; rewrite ?drop_length, ?take_length;
    revert n;
    let IHlen := fresh "IHlen" in
    induction_to_string s IHlen;
      destruct n as [|n];
      try specialize (IHlen n);
      take_drop_to_string_t0.

  Lemma drop_to_string s n
  : List.drop n (to_string s) = to_string (drop n s).
admit.
Defined.

  Lemma take_to_string s n
  : List.take n (to_string s) = to_string (take n s).
admit.
Defined.

  Lemma nth_to_string s n
  : List.nth_error (to_string s) n = get n s.
admit.
Defined.

  Lemma beq_to_string {s s'}
  : to_string s = to_string s' <-> s =s s'.
admit.
Defined.

  Lemma is_char_to_string s ch
  : is_char s ch <-> to_string s = (ch::nil)%list.
admit.
Defined.

  Section substring.
    Local Ltac substring_t' :=
      idtac;
      match goal with
        | [ |- beq _ _ ] => reflexivity
        | [ |- _ = _ ] => reflexivity
        | _ => assumption
        | [ H : length ?s = 0 |- beq _ ?s ] => apply bool_eq_empty
        | [ H : length ?s = 0 |- beq ?s _ ] => apply bool_eq_empty
        | _ => progress rewrite ?drop_0, ?take_long, ?take_length, ?drop_length by trivial
        | _ => progress rewrite <- ?Nat.sub_min_distr_r, ?Nat.add_sub by trivial
        | _ => rewrite !take_long by (rewrite drop_length; omega)
        | [ |- context[min ?x ?y] ]
          => match goal with
               | [ |- context[min y x] ]
                 => rewrite (Min.min_comm x y)
             end
        | _ => repeat apply Min.min_case_strong; omega
      end.

    Local Ltac substring_t := repeat substring_t'.

    Lemma substring_correct3 {s : String} m (H : length s <= m)
    : substring 0 m s =s s.
admit.
Defined.

    Lemma substring_correct3' {s : String}
    : substring 0 (length s) s =s s.
admit.
Defined.

    Lemma substring_length {s n m}
    : length (substring n m s) = (min (length s) (m + n)) - n.
admit.
Defined.

    Lemma substring_correct0_length {s : String} {n}
    : length (substring n 0 s) = 0.
admit.
Defined.

    Lemma substring_correct0 {s s' : String} {n} (H : length s' = 0)
    : substring n 0 s =s s'.
admit.
Defined.

    Lemma substring_correct0'_length {s : String} {n m} (H : length s <= n)
    : length (substring n m s) = 0.
admit.
Defined.

    Lemma substring_correct0' {s s' : String} {n m} (H : length s <= n) (H' : length s' = 0)
    : substring n m s =s s'.
admit.
Defined.

    Lemma substring_correct4 {s : String} {n m m'}
          (H : length s <= n + m) (H' : length s <= n + m')
    : substring n m s =s substring n m' s.
admit.
Defined.

    Lemma substring_substring {s n m n' m'}
    : substring n m (substring n' m' s) =s substring (n + n') (min m (m' - n)) s.
admit.
Defined.

    Lemma substring_min {x x' y y' z str} (H : substring x y str =s substring x' y' str)
    : substring x (min y z) str =s substring x' (min y' z) str.
admit.
Defined.

    Lemma substring_min_length str x y
    : substring x (min y (length str)) str =s substring x y str.
admit.
Defined.

    Lemma substring_length_no_min {offset len s} (Hshort : len = 0 \/ offset + len <= length s)
    : length (substring offset len s) = len.
admit.
Defined.
  End substring.

  Lemma char_at_matches_is_char_no_ex offset len str P
        (Hlen : offset + len <= length str)
  : (EqNat.beq_nat len 1 && char_at_matches offset str P)%bool = true
    <-> match get offset str with
          | Some ch => (P ch /\ substring offset len str ~= [ch])%string_like
          | None => False
        end.
admit.
Defined.

  Lemma char_at_matches_is_char offset len str P
        (Hlen : offset + len <= length str)
  : (EqNat.beq_nat len 1 && char_at_matches offset str P)%bool = true
    <-> (exists ch, P ch /\ substring offset len str ~= [ch])%string_like.
admit.
Defined.

  Lemma not_all_lengths n : ~ forall str, length str = n.
admit.
Defined.

  Lemma not_not_string : ~ (String -> False).
admit.
Defined.

  Global Instance beq_subrelation_pointwise_iff {A} {R : relation A}
    : subrelation (beq ==> R)%signature (pointwise_relation String R).
  Proof.
    intros f g H x.
    specialize (H x x (reflexivity _)); assumption.
  Qed.
End String.

Section Iso.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSI : StringIso Char}
          {HSLP : StringLikeProperties Char} {HSIP : StringIsoProperties Char}.

  Lemma length_of_string_nil
  : length (of_string nil) = 0.
admit.
Defined.

  Lemma drop_of_string (n : nat) str
  : drop n (of_string str) =s of_string (List.drop n str).
admit.
Defined.

  Lemma take_of_string (n : nat) str
  : take n (of_string str) =s of_string (List.take n str).
admit.
Defined.

  Lemma of_string_length str
  : length (of_string str) = List.length str.
admit.
Defined.

  Lemma is_char_of_string str ch
  : is_true (is_char (of_string str) ch) <-> str = (ch::nil).
admit.
Defined.

  Lemma substring_of_string {n m str}
  : substring n m (of_string str) =s of_string (List.take m (List.drop n str)).
admit.
Defined.

  Lemma to_of_string str
  : to_string (of_string str) = str.
admit.
Defined.

  Lemma of_to_string str
  : of_string (to_string str) =s str.
admit.
Defined.

  Lemma beq_of_string {s s'}
  : of_string s =s of_string s' <-> s = s'.
admit.
Defined.
End Iso.

End Properties.

End StringLike.

End Parsers.

End Fiat.

End Fiat_DOT_Parsers_DOT_StringLike_DOT_Properties.

Module Export ProdAbstractInterpretationDefinitions.
Import Coq.Sets.Ensembles.
Import Fiat.Parsers.StringLike.Core.
Import Fiat.Parsers.ContextFreeGrammar.Fix.Properties.
Import Fiat.Parsers.ContextFreeGrammar.Fix.Prod.
Import Fiat.Parsers.ContextFreeGrammar.Fix.FromAbstractInterpretationDefinitions.
Import Fiat.Common.
Import Fiat.Common.Instances.
Import Fiat.Common.BoolFacts.

Lemma simplify_bool_expr a b (Himpl : is_true a -> is_true b)
  : (a || (b && negb a))%bool = b.
admit.
Defined.

Lemma simplify_bool_expr' a b (Himpl : is_true a -> is_true b)
  : (a || (b && negb a))%bool -> b.
admit.
Defined.

Section aidata.
  Context {Char : Type} {T T0 T1}
          {fpldata : grammar_fixedpoint_lattice_data T}
          {fpldata0 : grammar_fixedpoint_lattice_data T0}
          {fpldata1 : grammar_fixedpoint_lattice_data T1}.

  Definition prod_on_terminal
             (on_terminal0 : (Char -> bool) -> lattice_for T0)
             (on_terminal1 : (Char -> bool) -> lattice_for T1)
    : (Char -> bool) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun P => constant (on_terminal0 P, on_terminal1 P).

  Definition prod_on_nil_production
             (on_nil_production0 : lattice_for T0)
             (on_nil_production1 : lattice_for T1)
    : lattice_for (lattice_for T0 * lattice_for T1)
    := constant (on_nil_production0, on_nil_production1).

  Definition prod_precombine_production_dep
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1)
    : (lattice_for T0 * lattice_for T1) -> (lattice_for T0 * lattice_for T1) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun x y => constant (lattice_for_combine_production precombine_production0 (fst x) (fst y),
                            lattice_for_combine_production (precombine_production1 (fst x) (fst y)) (snd x) (snd y)).

  Definition prod_precombine_production_nondep
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (precombine_production1 : T1 -> T1 -> lattice_for T1)
    : (lattice_for T0 * lattice_for T1) -> (lattice_for T0 * lattice_for T1) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun x y => constant (lattice_for_combine_production precombine_production0 (fst x) (fst y),
                            lattice_for_combine_production precombine_production1 (snd x) (snd y)).

  Global Instance prod_precombine_production_dep_Proper
         {precombine_production0 : T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (prestate_beq ==> prestate_beq ==> state_beq) precombine_production0}
         {HP1 : Proper (state_beq ==> state_beq ==> prestate_beq ==> prestate_beq ==> state_beq) precombine_production1}
    : Proper (prestate_beq ==> prestate_beq ==> state_beq) (prod_precombine_production_dep precombine_production0 precombine_production1).
admit.
Defined.

  Definition prod_aidata_dep
             (on_terminal0 : (Char -> bool) -> lattice_for T0)
             (on_nil_production0 : lattice_for T0)
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (on_terminal1 : (Char -> bool) -> lattice_for T1)
             (on_nil_production1 : lattice_for T1)
             (precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1)
             (precombine_production0_Proper
              : Proper (prestate_beq ==> prestate_beq ==> state_beq) precombine_production0)
             (precombine_production1_Proper
              : Proper (state_beq ==> state_beq ==> prestate_beq ==> prestate_beq ==> state_beq) precombine_production1)
    : @AbstractInterpretation Char (lattice_for T0 * lattice_for T1) prod_fixedpoint_lattice'.
  Proof.
    refine {| on_terminal := prod_on_terminal on_terminal0 on_terminal1;
              on_nil_production := prod_on_nil_production on_nil_production0 on_nil_production1;
              precombine_production := prod_precombine_production_dep precombine_production0 precombine_production1 |}.
  Defined.

  Global Instance prod_precombine_production_dep_Proper_le
         {precombine_production0 : T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (prestate_le ==> prestate_le ==> state_le) precombine_production0}
         {HP1 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production1}
    : Proper (prestate_le ==> prestate_le ==> state_le) (prod_precombine_production_dep precombine_production0 precombine_production1).
admit.
Defined.

  Global Instance prod_precombine_production_nondep_dep_Proper_le
         {precombine_production0 : lattice_for T -> lattice_for T -> T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T -> lattice_for T -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production0}
         {HP1 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production1}
    : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) (fun x y => prod_precombine_production_nondep (precombine_production0 x y) (precombine_production1 x y)).
admit.
Defined.
End aidata.

Section aicdata.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}
          {T0 T1}
          {fpldata0 : grammar_fixedpoint_lattice_data T0}
          {fpldata1 : grammar_fixedpoint_lattice_data T1}
          (prerelated0 : Ensemble String -> T0 -> Prop)
          (prerelated1 : Ensemble String -> T1 -> Prop).

  Definition prod_prerelated : Ensemble String -> (lattice_for T0 * lattice_for T1) -> Prop
    := fun P st
       => lattice_for_related prerelated0 P (fst st)
          /\ lattice_for_related prerelated1 P (snd st).

  Local Ltac t_step :=
    idtac;
    match goal with
    | _ => intro
    | _ => progress unfold prod_prerelated, ensemble_least_upper_bound, ensemble_combine_production in *
    | _ => progress simpl in *
    | [ |- and _ True ] => split; [ | tauto ]
    | [ |- and True _ ] => split; [ tauto | ]
  
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted) (truncated to 8.0KiB; full 71KiB file on GitHub Actions Artifacts under cwd/tmp.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-w" "-deprecated-appcontext -notation-overridden" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src" "Fiat" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock" "Bedrock" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-I" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics" "-top" "PossibleTerminalsSets" "-native-compiler" "no" "-require-import" "Coq.Compat.AdmitAxiom" "-native-compiler" "no") -*- *)
(* File reduced by coq-bug-finder from original input, then from 916 lines to 386 lines, then from 507 lines to 948 lines, then from 951 lines to 417 lines, then from 538 lines to 916 lines, then from 919 lines to 447 lines, then from 567 lines to 917 lines, then from 921 lines to 475 lines, then from 595 lines to 831 lines, then from 834 lines to 516 lines, then from 634 lines to 1027 lines, then from 1031 lines to 795 lines, then from 910 lines to 2027 lines, then from 2031 lines to 2077 lines *)
(* coqc version 8.15+alpha compiled with OCaml 4.05.0
   coqtop version 8.15+alpha *)
Declare ML Module "ltac_plugin".
Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False := .
End LocalFalse.
Axiom proof_admitted : False.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.
Require Coq.Strings.Ascii.
Require Coq.MSets.MSetPositive.
Require Coq.PArith.BinPos.
Require Coq.PArith.Pnat.
Require Coq.Arith.Arith.
Require Coq.Classes.RelationClasses.
Require Coq.Classes.Morphisms.
Require Coq.Compat.Coq814.
Require Coq.Strings.String.
Require Coq.ZArith.BinIntDef.
Require Coq.PArith.BinPosDef.
Require Coq.NArith.BinNatDef.
Require Coq.Reals.Rdefinitions.
Require Coq.Numbers.Cyclic.Int63.Int63.
Require Coq.Numbers.Cyclic.Int31.Int31.
Require Coq.micromega.Lia.
Require Coq.Lists.List.
Require Coq.Vectors.Vector.
Require Coq.funind.FunInd.
Require Fiat.Common.Coq__8_4__8_5__Compat.
Require Coq.ZArith.ZArith.
Require Coq.ZArith.BinInt.
Require Coq.NArith.BinNat.
Require Coq.Bool.Bool.
Require Fiat.Common.BoolFacts.
Require Coq.Lists.SetoidList.
Require Coq.Logic.Eqdep_dec.
Require Coq.Numbers.Natural.Peano.NPeano.
Require Coq.Setoids.Setoid.
Require Coq.Program.Program.
Require Fiat.Common.Tactics.SplitInContext.
Require Fiat.Common.Tactics.Combinators.
Require Fiat.Common.Tactics.FreeIn.
Require Fiat.Common.Tactics.SetoidSubst.
Require Fiat.Common.Tactics.Head.
Require Fiat.Common.Tactics.BreakMatch.
Require Fiat.Common.Tactics.FoldIsTrue.
Require Fiat.Common.Tactics.SpecializeBy.
Require Fiat.Common.Tactics.DestructHyps.
Require Fiat.Common.Tactics.DestructSig.
Require Fiat.Common.Tactics.DestructHead.
Require Fiat.Common.
Require Fiat.Common.Equality.
Require Fiat.Common.List.Operations.
Require Fiat.Common.List.FlattenList.
Require Coq.Program.Basics.
Require Fiat.Common.LogicFacts.
Require Fiat.Common.List.ListFacts.
Require Fiat.Common.StringOperations.
Require Fiat.Common.StringFacts.
Require Fiat.Common.Enumerable.
Require Coq.Arith.Compare_dec.
Require Coq.Logic.EqdepFacts.
Require Fiat.Common.UIP.
Require Fiat.Common.Enumerable.BoolProp.
Require Coq.Relations.Relation_Definitions.
Require Fiat.Parsers.StringLike.Core.
Require Fiat.Parsers.ContextFreeGrammar.Core.
Require Fiat.Parsers.ContextFreeGrammar.Reflective.
Require Fiat.Common.Gensym.
Require Fiat.Parsers.ContextFreeGrammar.PreNotations.
Require Fiat.Parsers.ContextFreeGrammar.Carriers.
Require Fiat.Common.Notations.
Require Fiat.Parsers.ContextFreeGrammar.Fix.Definitions.
Require Coq.MSets.MSetInterface.
Require Coq.MSets.MSetFacts.
Require Coq.MSets.MSetProperties.
Require Coq.Program.Wf.
Require Coq.Arith.Wf_nat.
Require Coq.Init.Wf.
Require Fiat.Common.Wf.
Require Fiat.Common.Instances.
Require Fiat.Common.NatFacts.
Require Coq.MSets.MSetDecide.
Require Fiat.Common.MSetExtensions.
Require Fiat.Common.MSetBoundedLattice.
Require Fiat.Parsers.ContextFreeGrammar.Fix.AsciiLattice.
Require Coq.Numbers.BinNums.
Require Coq.FSets.FMapPositive.
Require Fiat.Parsers.BaseTypes.
Require Fiat.Parsers.Splitters.RDPList.
Require Fiat.Parsers.ContextFreeGrammar.Fix.Properties.
Require Coq.FSets.FMapInterface.
Require Coq.FSets.FMapFacts.
Require Coq.Structures.OrderedTypeEx.
Require Coq.Structures.OrderedType.
Require Fiat.Common.SetEq.
Require Coq.Sorting.Permutation.
Require Fiat.Common.SetEqProperties.
Require Coq.Sets.Ensembles.
Require Fiat.Common.List.PermutationFacts.
Require Fiat.Common.Ensembles.EnsembleListEquivalence.
Require Fiat.Common.List.ListMorphisms.
Require Fiat.Common.SetoidClassInstances.
Require Fiat.Common.FMapExtensions.
Require Fiat.Common.LogicMorphisms.
Require Fiat.Common.FMapExtensions.LiftRelationInstances.
Require Fiat.Common.FMapExtensions.Wf.
Require Fiat.Common.OptionFacts.
Require Fiat.Common.SetoidInstances.
Require Fiat.Parsers.ContextFreeGrammar.Fix.Fix.
Require Fiat.Parsers.ContextFreeGrammar.Precompute.
Require Fiat.Parsers.ContextFreeGrammar.Fix.FromAbstractInterpretationDefinitions.
Require Fiat.Parsers.ContextFreeGrammar.Fix.Prod.
Require Coq.Arith.Le.
Require Fiat.Common.Le.
Require Fiat.Common.Tactics.IsClosed.
Module Export Fiat_DOT_Parsers_DOT_StringLike_DOT_Properties.
Module Export Fiat.
Module Export Parsers.
Module Export StringLike.
Module Properties.
Export Fiat.Common.Coq__8_4__8_5__Compat.
 
Import Coq.Numbers.Natural.Peano.NPeano.
Import Coq.ZArith.ZArith.
Import Fiat.Common.
Import Fiat.Common.List.Operations.
Import Fiat.Common.List.ListFacts.
Import Fiat.Common.Le.
Import Fiat.Common.Tactics.SetoidSubst.
Import Fiat.Common.Tactics.IsClosed.
Import Fiat.Parsers.StringLike.Core Fiat.Common.UIP.

Local Open Scope list_scope.

Set Implicit Arguments.

Section String.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}.

  
  Definition String_rect (P : String -> Type)
    : (forall str, length str = 0 -> P str)
      -> (forall n str (Hlen : length str = S n)
                 (IHstr : forall str', length str' = n -> P str'),
             P str)
      -> forall str, P str.
  Proof.
    intros Zcase Scase str.
    pose (length str) as len.
    pose proof (eq_refl : length str = len) as Hlen.
    clearbody len.
    revert str Hlen.
    induction len; intros.
    {
 eapply Zcase; assumption.
}
    {
 eapply Scase; eassumption.
}
  Defined.

  Definition bool_eq_refl {x : String} : x =s x.
  Proof.
    reflexivity.
  Defined.

  Definition bool_eq_sym {x y : String} : ((x =s y) = (y =s x) :> bool)%string_like.
  Proof.
    case_eq (y =s x)%string_like; intro H';
    [
    | case_eq (x =s y)%string_like; intro H'' ].
    {
 apply (symmetry (R := (fun x y => x =s y))) in H'; assumption.
}
    {
 apply (symmetry (R := (fun x y => x =s y))) in H''; hnf in H''.
      etransitivity; [ exact (eq_sym H'') | exact H' ].
}
    {
 reflexivity.
}
  Defined.

  Definition bool_eq_trans {x y z : String} : (x =s y) -> (y =s z) -> (x =s z).
  Proof.
    apply (transitivity (R := (fun x y => x =s y))).
  Defined.

  Global Instance str_le_Proper_iff : Proper (beq ==> beq ==> iff) str_le | 1000.
  Proof.
    repeat match goal with
             | _ => intro
             | _ => split
             | [ H : _ ≤s _ |- _ ] => destruct H
             | _ => left; assumption
             | _ => right; assumption
             | _ => right; symmetry; assumption
             | [ H : ?x =s _ |- _ ] => rewrite H in *; clear x H
             | [ H : _ =s ?x |- _ ] => rewrite <- H in *; clear x H
           end.
  Qed.

  Global Instance str_le_Proper : Proper (beq ==> beq ==> impl) str_le.
  Proof.
    intros x y H' x' y' H'' H'''.
    apply (@str_le_Proper_iff x y H' x' y' H''); assumption.
  Qed.

  Global Instance str_le_Proper' : Proper (beq ==> beq ==> Basics.flip impl) str_le.
  Proof.
    intros x y H' x' y' H'' H'''.
    apply (@str_le_Proper_iff _ _ H' _ _ H''); assumption.
  Qed.

  Global Instance str_le_refl : Reflexive str_le.
  Proof.
    repeat intro; right; reflexivity.
  Qed.

  Global Instance str_le_antisym : @Antisymmetric
Build Log (truncated to last 8.0KiB; full 3.1MiB file on GitHub Actions Artifacts under build.log)
ated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/IndexedAndAtMostOneNonTerminalReflectiveOpt.v", line 36, characters 0-4:
Warning: The default value for instance locality is currently "local" in a
section and "global" otherwise, but is scheduled to change in a future
release. For the time being, adding instances outside of sections without
specifying an explicit locality is therefore deprecated. It is recommended to
use "export" whenever possible.
[deprecated-instance-without-locality,deprecated]
COQC src/Parsers/Refinement/FinishingLemma.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/FinishingLemma.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
COQC src/Parsers/Refinement/ReductionTactics.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/ReductionTactics.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/ReductionTactics.v", line 3, characters 0-57:
Warning:
New coercion path [Start_symbol; rproduction_of_string;
                   magic_juxta_append_rproduction] : grammar >-> Funclass is ambiguous with existing 
[Lookup] : grammar >-> Funclass. [ambiguous-paths,typechecker]
COQC src/Parsers/Refinement/Tactics.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/Tactics.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/Tactics.v", line 12, characters 0-57:
Warning:
New coercion path [Start_symbol; rproduction_of_string;
                   magic_juxta_append_rproduction] : grammar >-> Funclass is ambiguous with existing 
[Lookup] : grammar >-> Funclass. [ambiguous-paths,typechecker]
COQC src/Parsers/ExtrOcamlParsers.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/ExtrOcamlParsers.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/ExtrOcamlParsers.v", line 3, characters 0-47:
Warning:
New coercion path [Start_symbol; rproduction_of_string;
                   magic_juxta_append_rproduction] : grammar >-> Funclass is ambiguous with existing 
[Lookup] : grammar >-> Funclass. [ambiguous-paths,typechecker]
COQC src/Parsers/Refinement/PossibleTerminalsSets.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/PossibleTerminalsSets.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/PossibleTerminalsSets.v", line 384, characters 21-30:
Error:
Unbound reference: In environment
HSLM : StringLikeMin Ascii.ascii
HSL : StringLike Ascii.ascii
HSLP : StringLikeProperties Ascii.ascii
P1 : Ensembles.Ensemble String
st10 : lattice_for nonemptyT
R10 : match st10 with
      | ⊤ => True
      | constant n =>
          n = nonempty -> forall str : String, P1 str -> length str <> 0
      | ⊥ => forall str : String, ~ P1 str
      end
l2 : lattice_for PositiveSet.t
H4 : match l2 with
     | ⊤ => True
     | constant n =>
         forall str : String,
         P1 str ->
         for_last_char str
           (fun ch : Ascii.ascii => ~ PositiveSet.In (pos_of_ascii ch) n)
     | ⊥ => forall str : String, ~ P1 str
     end
P2 : Ensembles.Ensemble String
st20 : lattice_for nonemptyT
R20 : match st20 with
      | ⊤ => True
      | constant n =>
          n = nonempty -> forall str : String, P2 str -> length str <> 0
      | ⊥ => forall str : String, ~ P2 str
      end
l0 : lattice_for PositiveSet.t
H1 : match l0 with
     | ⊤ => True
     | constant n =>
         forall str : String,
         P2 str ->
         for_last_char str
           (fun ch : Ascii.ascii => ~ PositiveSet.In (pos_of_ascii ch) n)
     | ⊥ => forall str : String, ~ P2 str
     end
x : PositiveSet.t
x0 : PositiveSet.t
The reference 3 is free.

Makefile.coq:762: recipe for target 'src/Parsers/Refinement/PossibleTerminalsSets.vo' failed
make[1]: *** [src/Parsers/Refinement/PossibleTerminalsSets.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers'
Makefile.ci:108: recipe for target 'ci-fiat_parsers' failed
make: *** [ci-fiat_parsers] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 137KiB file on GitHub Actions Artifacts under bug.log)
passing/_build_ci/fiat_parsers/Bedrock Bedrock -Q /github/workspace/cwd Top -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Ltac2 Ltac2 -I /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/Bedrock Bedrock -Q /github/workspace/cwd Top -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Ltac2 Ltac2 -I /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/src/Common/Tactics -arg -q -arg -w -arg -deprecated-native-compiler-option -arg -w -arg -deprecated-appcontext -notation-overridden -arg -top -arg PossibleTerminalsSets -arg -native-compiler -arg no -arg -require-import -arg Coq.Compat.AdmitAxiom -arg -native-compiler -arg no bug_01.v
make -k -f Makefilexojqrsz5.coq bug_01.glob
/github/workspace/builds/coq/coq-failing/_install_ci/bin/coq_makefile COQC = /github/workspace/builds/coq/coq-passing/_install_ci/bin/coqc.orig -o Makefileflznrhm2.coq -R /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/Bedrock Bedrock -Q /github/workspace/cwd Top -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Ltac2 Ltac2 -I /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/Bedrock Bedrock -Q /github/workspace/cwd Top -Q /github/workspace/builds/coq/coq-passing/_install_ci/lib/coq/user-contrib/Ltac2 Ltac2 -I /github/workspace/builds/coq/coq-passing/_build_ci/fiat_parsers/src/Common/Tactics -arg -q -arg -w -arg -deprecated-native-compiler-option -arg -w -arg -deprecated-appcontext -notation-overridden -arg -top -arg PossibleTerminalsSets -arg -native-compiler -arg no -arg -require-import -arg Coq.Compat.AdmitAxiom -arg -native-compiler -arg no bug_01.v
make -k -f Makefileflznrhm2.coq bug_01.glob
getting ../builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/StringLike/Properties.v (/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/StringLike/Properties.v)
getting ../builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/StringLike/Properties.glob (/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/StringLike/Properties.glob)

Inlining Fiat.Parsers.StringLike.Properties succeeded.

Sanity check passed.

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

No strippable newlines or spaces.

Now, I will attempt to strip the comments from this file...

Succeeded in stripping comments.

In order to efficiently manipulate the file, I have to break it into statements.  I will attempt to do this by matching on periods.

Splitting successful.

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...

Splitting to definitions successful.

I will now attempt to remove goals ending in [Abort.]

Aborted removal successful.

I will now attempt to remove unused Ltacs

Ltac removal successful.

I will now attempt to remove unused definitions

Definition removal successful.

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

Non-instance definition removal successful.

I will now attempt to remove unused variables

Variable removal successful.

I will now attempt to remove unused contexts

Context removal successful.

I will now attempt to replace Qed Obligation with Admit Obligations

Admitting Qed Obligations successful.
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

Non-fatal error: Failed to admit Qeds and preserve the error.  
Writing intermediate code to /github/workspace/cwd/tmp.v.
The new error was:
File "/tmp/tmpox85mk8l.v", line 312, characters 64-69:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 322, characters 63-68:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 501, characters 22-27:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 503, characters 46-51:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 556, characters 65-70:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 554, characters 65-70:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 550, characters 71-76:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 548, characters 96-101:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 547, characters 85-90:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 534, characters 80-85:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 533, characters 80-85:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 532, characters 93-98:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 531, characters 136-141:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 517, characters 83-88:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 514, characters 20-25:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 512, characters 43-48:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 611, characters 49-54:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 605, characters 59-64:
Warning: Tactic omega is deprecated since 8.12.
The omega tactic was removed in v8.14.  You're now relying on the lia tactic.
[deprecated-tactic,deprecated]
File "/tmp/tmpox85mk8l.v", line 1035, characters 0-97:
Error: Extra arguments: _.


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.

@ppedrot
Copy link
Member Author

ppedrot commented Jun 16, 2021

@JasonGross minimization is incomplete, is there an easy way to relaunch it?

@JasonGross
Copy link
Member

Not yet. I'm hopeful @Zimmi48 will manage to implement the coqbot side of relaunching as per coq/bot#143 (comment) within the next couple of days, and then minimization will automatically be relaunched when interrupted by timeout. @Zimmi48, if you don't have time, I can try to implement it. Alternatively, @ppedrot , if you want to do it manually, there's a printout of a curl request in the log that contains the relevant information for making a new branch on the minimizer as per the instructions at coq/bot#143 (comment), and if you're really in a hurry you could create that branch manually. Otherwise I'd suggest just waiting a couple of days until we have the coqbot side implemented and then we can relaunch minimization here.

@Zimmi48
Copy link
Member

Zimmi48 commented Jun 17, 2021

@JasonGross Unfortunately, I've underestimated the time that some other tasks would take and now I need to delay work on the bot to after the Coq workshop 😖 So if you do have time to implement this feature in the next couple of days, feel free to go ahead.

@JasonGross
Copy link
Member

Resumption should now work, I'm testing it at #14328 (comment)

@JasonGross
Copy link
Member

Now that resumption works and I've adjusted fiat to be a bit more minimizable and with some help from manual minimization to work around #14529, minimization has finished! I'll post the full bug file in the next comment.

Minimized File /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/PossibleTerminalsSets.v (from ci-fiat_parsers) (full log on GitHub Actions)

Minimized Coq File (truncated to 32KiB; full 45KiB file on GitHub Actions Artifacts under bug.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-w" "-deprecated-appcontext -notation-overridden" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src" "Fiat" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock" "Bedrock" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-I" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics" "-top" "bug_01" "-native-compiler" "no" "-require-import" "Coq.Compat.AdmitAxiom" "-native-compiler" "no") -*- *)
(* File reduced by coq-bug-finder from original input, then from 916 lines to 386 lines, then from 507 lines to 948 lines, then from 951 lines to 417 lines, then from 538 lines to 916 lines, then from 919 lines to 447 lines, then from 567 lines to 917 lines, then from 921 lines to 475 lines, then from 595 lines to 831 lines, then from 834 lines to 516 lines, then from 634 lines to 1027 lines, then from 1031 lines to 795 lines, then from 910 lines to 2027 lines, then from 2031 lines to 1799 lines, then from 1801 lines to 806 lines, then from 918 lines to 1029 lines, then from 1033 lines to 887 lines, then from 999 lines to 1506 lines, then from 1510 lines to 1022 lines, then from 1110 lines to 1322 lines, then from 1325 lines to 1054 lines, then from 1142 lines to 1195 lines, then from 1199 lines to 1173 lines, then from 1176 lines to 1076 lines, then from 1161 lines to 1456 lines, then from 1459 lines to 1237 lines, then from 1310 lines to 1462 lines, then from 1466 lines to 1257 lines, then from 1325 lines to 1458 lines, then from 1462 lines to 1287 lines, then from 1353 lines to 1483 lines, then from 1487 lines to 1294 lines, then from 1360 lines to 1530 lines, then from 1534 lines to 1530 lines, then from 1530 lines to 1370 lines, then from 1435 lines to 1479 lines, then from 1483 lines to 1382 lines, then from 1447 lines to 1598 lines, then from 1602 lines to 1400 lines, then from 1461 lines to 2272 lines, then from 2275 lines to 1688 lines, then from 1691 lines to 1498 lines, then from 1556 lines to 1843 lines, then from 1847 lines to 1527 lines, then from 1585 lines to 1869 lines, then from 1873 lines to 1659 lines, then from 1712 lines to 1965 lines, then from 1969 lines to 1785 lines, then from 1807 lines to 1755 lines, then from 1808 lines to 2104 lines, then from 2108 lines to 1790 lines, then from 1841 lines to 2002 lines, then from 2006 lines to 1809 lines, then from 1859 lines to 2559 lines, then from 2563 lines to 2189 lines, then from 2192 lines to 1844 lines, then from 1892 lines to 1929 lines, then from 1932 lines to 1845 lines, then from 1892 lines to 1916 lines, then from 1920 lines to 1845 lines, then from 1892 lines to 1949 lines, then from 1953 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1942 lines, then from 1944 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1877 lines, then from 1924 lines to 1861 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1878 lines, then from 1925 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1942 lines, then from 1944 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1879 lines, then from 1925 lines to 1860 lines, then from 1864 lines to 1860 lines, then from 1840 lines to 1179 lines, then from 2974 lines to 1443 lines, then from 1438 lines to 1065 lines, then from 1090 lines to 1150 lines, then from 1154 lines to 1077 lines, then from 1081 lines to 1077 lines *)
(* coqc version 8.15+alpha compiled with OCaml 4.05.0
   coqtop version 8.15+alpha *)
Require Coq.MSets.MSetPositive.
Require Coq.Sets.Ensembles.
Module Export Fiat_DOT_Common_DOT_Coq__8_4__8_5__Compat.
Module Export Fiat.
Module Export Common.
Module Export Coq__8_4__8_5__Compat.
Global Set Instance Generalized Output.
End Coq__8_4__8_5__Compat.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Coq__8_4__8_5__Compat.

Module Export Fiat_DOT_Common.
Module Export Fiat.
Module Common.

Global Set Implicit Arguments.
Global Generalizable All Variables.

Global Coercion is_true : bool >-> Sortclass.

End Common.
End Fiat.
End Fiat_DOT_Common.

Module Export Fiat_DOT_Common_DOT_Equality.
Module Export Fiat.
Module Export Common.
Module Export Equality.
Import Coq.Lists.List.
Import Coq.Strings.String.

Scheme Equality for string.

Section In.
  Section list_bin.
    Context {A} (eq_A : A -> A -> bool) (a : A).

    Fixpoint list_bin (ls : list A) : bool
      := match ls with
           | nil => false
           | x::xs => orb (list_bin xs) (eq_A x a)
         end.
  End list_bin.
End In.

End Equality.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Equality.

Module Export Fiat_DOT_Common_DOT_Instances.
Module Export Fiat.
Module Export Common.
Module Export Instances.
Import Coq.Classes.Morphisms.
Global Instance drop_0_Proper {A B RA RB} {f : B}
       {H : Proper RB f}
: Proper (RA ==> RB) (fun _ : A => f).
admit.
Defined.

End Instances.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Instances.

Module Export Fiat_DOT_Common_DOT_List_DOT_Operations.
Module Export Fiat.
Module Export Common.
Module Export List.
Module Export Operations.

Import Coq.Lists.List.

Module Export List.

 Definition uniquize {A} (beq : A -> A -> bool) (ls : list A) : list A
    := fold_right
         (fun x xs => if list_bin beq x xs then xs else x::xs)
         nil
         ls.

  Fixpoint up_to (n : nat) : list nat :=
    match n with
      | 0 => nil
      | S n' => n'::up_to n'
    end.

  End List.

End Operations.

End List.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_List_DOT_Operations.

Module Export Fiat_DOT_Common_DOT_MSetExtensions.
Module Export Fiat.
Module Export Common.
Module Export MSetExtensions.
Export Coq.MSets.MSetInterface.

End MSetExtensions.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_MSetExtensions.

Module Export Fiat_DOT_Common_DOT_Notations.
Module Export Fiat.
Module Export Common.
Module Export Notations.
Reserved Infix "⊔" (at level 80).

End Notations.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Notations.

Module Export Fiat_DOT_Parsers_DOT_StringLike_DOT_Core.
Module Export Fiat.
Module Export Parsers.
Module Export StringLike.
Module Export Core.

Local Coercion is_true : bool >-> Sortclass.

Module Export StringLike.
  Class StringLikeMin {Char : Type} :=
    {
      String :> Type;
      char_at_matches : nat -> String -> (Char -> bool) -> bool;
      unsafe_get : nat -> String -> Char;
      length : String -> nat
    }.

  Class StringLike {Char : Type} {HSLM : @StringLikeMin Char} :=
    {
      is_char : String -> Char -> bool;
      take : nat -> String -> String;
      drop : nat -> String -> String;
      get : nat -> String -> option Char;
      bool_eq : String -> String -> bool;
      beq : relation String := fun x y => bool_eq x y
    }.

  Arguments StringLikeMin : clear implicits.
  Arguments StringLike Char {HSLM}.
  Delimit Scope string_like_scope with string_like.
  Infix "=s" := (@beq _ _ _) (at level 70, no associativity) : type_scope.
  Notation "s ~= [ ch ]" := (is_char s ch) (at level 70, no associativity) : string_like_scope.
  Local Open Scope string_like_scope.

  Class StringLikeProperties (Char : Type) `{StringLike Char} :=
    {
      singleton_unique : forall s ch ch', s ~= [ ch ] -> s ~= [ ch' ] -> ch = ch';
      singleton_exists : forall s, length s = 1 -> exists ch, s ~= [ ch ];
      char_at_matches_correct : forall s n P ch, get n s = Some ch -> (char_at_matches n s P = P ch);
      get_0 : forall s ch, take 1 s ~= [ ch ] <-> get 0 s = Some ch;
      get_S : forall n s, get (S n) s = get n (drop 1 s);
      unsafe_get_correct : forall n s ch, get n s = Some ch -> unsafe_get n s = ch;
      length_singleton : forall s ch, s ~= [ ch ] -> length s = 1;
      bool_eq_char : forall s s' ch, s ~= [ ch ] -> s' ~= [ ch ] -> s =s s';
      is_char_Proper :> Proper (beq ==> eq ==> eq) is_char;
      length_Proper :> Proper (beq ==> eq) length;
      take_Proper :> Proper (eq ==> beq ==> beq) take;
      drop_Proper :> Proper (eq ==> beq ==> beq) drop;
      bool_eq_Equivalence :> Equivalence beq;
      bool_eq_empty : forall str str', length str = 0 -> length str' = 0 -> str =s str';
      take_short_length : forall str n, n <= length str -> length (take n str) = n;
      take_long : forall str n, length str <= n -> take n str =s str;
      take_take : forall str n m, take n (take m str) =s take (min n m) str;
      drop_length : forall str n, length (drop n str) = length str - n;
      drop_0 : forall str, drop 0 str =s str;
      drop_drop : forall str n m, drop n (drop m str) =s drop (n + m) str;
      drop_take : forall str n m, drop n (take m str) =s take (m - n) (drop n str);
      take_drop : forall str n m, take n (drop m str) =s drop m (take (n + m) str);
      bool_eq_from_get : forall str str', (forall n, get n str = get n str') -> str =s str';
      strings_nontrivial : forall n, exists str, length str = n
    }.

  Arguments StringLikeProperties Char {_ _}.
End StringLike.

End Core.

End StringLike.

End Parsers.

End Fiat.

End Fiat_DOT_Parsers_DOT_StringLike_DOT_Core.

Module Export Fiat.
Module Export Parsers.
Module Export ContextFreeGrammar.
Module Export Core.
Export Fiat.Parsers.StringLike.Core.

End Core.

Section syntax.
  Context {Char : Type}.

  Inductive RCharExpr :=
  | rbeq (ch : Char)
  | ror (_ _ : RCharExpr)
  | rand (_ _ : RCharExpr)
  | rneg (_ : RCharExpr)
  | rcode_le_than (code : BinNums.N)
  | rcode_ge_than (code : BinNums.N).

  Inductive ritem :=
  | RTerminal (_ : RCharExpr)
  | RNonTerminal (_ : String.string).

  Definition rproduction := list ritem.
  Definition rproductions := list rproduction.
End syntax.
Global Arguments rproductions : clear implicits.

Section semantics.
  Context {Char : Type}.

  Class interp_RCharExpr_data :=
    { irbeq : Char -> Char -> bool;
      irN_of : Char -> BinNums.N }.
End semantics.

Global Arguments interp_RCharExpr_data : clear implicits.

Import Coq.Strings.String.

Class NoDupR {T} beq (ls : list T) := nodupr : uniquize beq ls = ls.

Record pregrammar Char :=
  {
    pregrammar_rproductions : list (string * rproductions Char);
    pregrammar_idata : interp_RCharExpr_data Char;
    pregrammar_rnonterminals : list string
    := map fst pregrammar_rproductions;
    rnonterminals_unique
    : NoDupR string_beq pregrammar_rnonterminals;
    RLookup_idx : nat -> rproductions Char
    := fun n => nth n (map snd pregrammar_rproductions) nil
  }.

Module Export Definitions.

Local Coercion is_true : bool >-> Sortclass.
Delimit Scope grammar_fixedpoint_scope with fixedpoint.
Local Open Scope grammar_fixedpoint_scope.

Inductive lattice_for T := top | constant (_ : T) | bottom.
Scheme Equality for lattice_for.

Arguments bottom {_}.
Arguments top {_}.
Notation "'⊥'" := bottom : grammar_fixedpoint_scope.
Notation "'⊤'" := top : grammar_fixedpoint_scope.

Global Instance lattice_for_Equivalence {T} {beq : T -> T -> bool}
       {H : Equivalence beq}
  : Equivalence (lattice_for_beq beq).
admit.
Defined.

Definition lattice_for_lt {T} (lt : T -> T -> bool) (x y : lattice_for T)
  := match x, y with
     | ⊤, ⊤ => false
     | constant x', constant y' => lt x' y'
     | ⊥, ⊥ => false
     | _, ⊤ => true
     | ⊤, _ => false
     | _, constant _ => true
     | constant _, _ => false
     end.

Global Instance lattice_for_lt_Proper {T} {beq lt : T -> T -> bool}
       {H : Proper (beq ==> beq ==> eq) lt}
  : Proper (lattice_for_beq beq ==> lattice_for_beq beq ==> eq) (lattice_for_lt lt).
admit.
Defined.

Definition lattice_for_lub {T} (lub : T -> T -> lattice_for T) (x y : lattice_for T)
  := match x, y with
     | ⊤, ⊤ => ⊤
     | constant x', constant y' => lub x' y'
     | ⊥, ⊥ => ⊥
     | ⊤, _
     | _, ⊤
       => ⊤
     | ⊥, v
     | v, ⊥
       => v
     end.

Section lub_correct.
  Context {T} (beq : T -> T -> bool) (lt : T -> T -> bool) (lub : T -> T -> lattice_for T).

  Local Notation "x <= y" := (orb (lattice_for_beq beq x y) (lattice_for_lt lt x y)).

  Context (lub_correct_l : forall x y, constant x <= lub x y)
          (lub_correct_r : forall x y, constant y <= lub x y)
          (beq_Reflexive : Reflexive beq).
  Lemma lattice_for_lub_correct_l x y
    : x <= lattice_for_lub lub x y.
  Proof using beq_Reflexive lub_correct_l.
    admit.
  Qed.

  Lemma lattice_for_lub_correct_r x y
    : y <= lattice_for_lub lub x y.
  Proof using beq_Reflexive lub_correct_r.
    admit.
  Qed.

  Global Instance lattice_for_lub_Proper
         {lub_Proper : Proper (beq ==> beq ==> lattice_for_beq beq) lub}
    : Proper (lattice_for_beq beq ==> lattice_for_beq beq ==> lattice_for_beq beq) (lattice_for_lub lub).
admit.
Defined.
End lub_correct.

Definition lattice_for_gt_well_founded {T} {lt : T -> T -> bool}
           (gt_wf : well_founded (Basics.flip lt))
  : well_founded (Basics.flip (lattice_for_lt lt)).
admit.
Defined.

Global Instance lattice_for_lt_Transitive {T} {lt : T -> T -> bool} {_ : Transitive lt}
  : Transitive (lattice_for_lt lt).
admit.
Defined.

Class grammar_fixedpoint_lattice_data prestate :=
  { state :> _ := lattice_for prestate;
    prestate_lt : prestate -> prestate -> bool;
    state_lt : state -> state -> bool
    := lattice_for_lt prestate_lt;
    prestate_beq : prestate -> prestate -> bool;
    state_beq : state -> state -> bool
    := lattice_for_beq prestate_beq;
    prestate_le s1 s2 := (prestate_beq s1 s2 || prestate_lt s1 s2)%bool;
    state_le s1 s2 := (state_beq s1 s2 || state_lt s1 s2)%bool;
    prestate_beq_Equivalence : Equivalence prestate_beq;
    state_beq_Equivalence : Equivalence state_beq
    := lattice_for_Equivalence;
    preleast_upper_bound : prestate -> prestate -> state;
    least_upper_bound : state -> state -> state
    := lattice_for_lub preleast_upper_bound;
    preleast_upper_bound_correct_l
    : forall a b, state_le (constant a) (preleast_upper_bound a b);
    preleast_upper_bound_correct_r
    : forall a b, state_le (constant b) (preleast_upper_bound a b);
    least_upper_bound_correct_l
    : forall a b, state_le a (least_upper_bound a b)
    := lattice_for_lub_correct_l prestate_beq prestate_lt preleast_upper_bound preleast_upper_bound_correct_l _;
    least_upper_bound_correct_r
    : forall a b, state_le b (least_upper_bound a b)
    := lattice_for_lub_correct_r prestate_beq prestate_lt preleast_upper_bound preleast_upper_bound_correct_r _;
    prestate_gt_wf : well_founded (Basics.flip prestate_lt);
    state_gt_wf : well_founded (Basics.flip state_lt)
    := lattice_for_gt_well_founded prestate_gt_wf;
    preleast_upper_bound_Proper : Proper (prestate_beq ==> prestate_beq ==> state_beq) preleast_upper_bound;
    least_upper_bound_Proper : Proper (state_beq ==> state_beq ==> state_beq) least_upper_bound
    := @lattice_for_lub_Proper _ _ _ _;
    prestate_lt_Proper : Proper (prestate_beq ==> prestate_beq ==> eq) prestate_lt;
    state_lt_Proper : Proper (state_beq ==> state_beq ==> eq) state_lt
    := lattice_for_lt_Proper;
    prestate_lt_Transitive : Transitive prestate_lt;
    state_lt_Transitive : Transitive state_lt
    := lattice_for_lt_Transitive }.

Infix "<=" := (@state_le _ _) : grammar_fixedpoint_scope.
Infix "⊔" := (@least_upper_bound _ _) : grammar_fixedpoint_scope.

Global Instance lattice_for_rect_Proper_85 {A}
  : Proper (eq ==> forall_relation (fun _ => eq) ==> eq ==> eq ==> Basics.flip Basics.impl)
           (@lattice_for_rect A (fun _ => Prop)) | 3.
admit.
Defined.

Lemma lattice_for_rect_pull {A B C} f t c b v
  : f (@lattice_for_rect A (fun _ => B) t c b v)
    = @lattice_for_rect A (fun _ => C) (f t) (fun x => f (c x)) (f b) v.
admit.
Defined.

End Definitions.

Module Export AsciiLattice.
Import Coq.Strings.Ascii.
Import Coq.MSets.MSetPositive.

Section gen.
  Global Instance positive_set_fpdata
    : grammar_fixedpoint_lattice_data PositiveSet.t.
admit.
Defined.
End gen.

Definition max_ascii := Eval compute in BinPos.Pos.of_nat (S (nat_of_ascii (Ascii true true true true true true true true))).

End AsciiLattice.

Module Export FromAbstractInterpretationDefinitions.
Import Coq.Sets.Ensembles.
Import Fiat.Parsers.ContextFreeGrammar.Core.
Local Coercion is_true : bool >-> Sortclass.
Local Open Scope grammar_fixedpoint_scope.

Section general_fold.
  Context {Char : Type}
          {T : Type}.

  Definition lattice_for_combine_production combine_production
    : lattice_for T -> lattice_for T -> lattice_for T
    := fun x y => match x, y with
                  | ⊥, _
                  | _, ⊥
                    => ⊥
                  | ⊤, _
                  | _, ⊤
                    => ⊤
                  | constant x', constant y'
                    => combine_production x' y'
                  end.

  Global Instance lattice_for_combine_production_Proper
         {prestate_beq : T -> T -> bool}
         {precombine_production}
         {H : Proper (prestate_beq ==> prestate_beq ==> lattice_for_beq prestate_beq) precombine_production}
    : Proper (lattice_for_beq prestate_beq ==> lattice_for_beq prestate_beq ==> lattice_for_beq prestate_beq) (lattice_for_combine_production precombine_production).
admit.
Defined.

  Context {fpdata : @grammar_fixedpoint_lattice_data T}.

  Class AbstractInterpretation :=
    { on_terminal : (Char -> bool) -> lattice_for T;
      on_nil_production : lattice_for T;
      precombine_production : T -> T -> lattice_for T;
      combine_production : lattice_for T -> lattice_for T -> lattice_for T
      := lattice_for_combine_production precombine_production;
      precombine_production_Proper : Proper (prestate_beq ==> prestate_beq ==> state_beq) precombine_production;
      combine_production_Proper : Proper (state_beq ==> state_beq ==> state_beq) combine_production
      := lattice_for_combine_production_Proper }.

  Global Existing Instance precombine_production_Proper.

  End general_fold.

Section on_ensembles.
  Context {Char : Type} {HSLM : StringLikeMin Char} {HSL : StringLike Char}.

  Definition ensemble_on_terminal (P : Char -> bool) : Ensemble String
    := (fun str => exists ch, is_true (P ch) /\ str ~= [ ch ])%string_like.

  Definition ensemble_on_nil_production : Ensemble String
    := (fun str => length str = 0).

  Definition ensemble_combine_production : Ensemble String -> Ensemble String -> Ensemble String
    := fun P1 P2 => fun str => exists n, P1 (take n str) /\ P2 (drop n str).

  Definition ensemble_least_upper_bound : Ensemble String -> Ensemble String -> Ensemble String
    := fun P1 P2 => fun str => P1 str \/ P2 str.
End on_ensembles.

Section fold_correctness.
  Context {Char : Type} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}.
  Context {T : Type}.
  Context {fpdata : @grammar_fixedpoint_lattice_data T}
          {aidata : @AbstractInterpretation Char T fpdata}.
  Context (G : pregrammar Char)
          (prerelated : Ensemble String -> T -> Prop).

  Definition lattice_for_related (P : Ensemble String) (st : lattice_for T) : Prop
    := match st with
       | ⊤ => True
       | ⊥ => forall str, ~P str
       | constant n => prerelated P n
       end.

  Section related.

    Global Instance lattice_for_related_ext {_ : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prerelated}
      : Proper ((beq ==> iff) ==> state_beq ==> iff) related | 2.
    Proof using HSLP.
      admit.
    Qed.

    Global Instance lattice_for_combine_production_Proper_le
           {precombine_production'}
           {H : Proper (prestate_le ==> prestate_le ==> state_le) precombine_production'}
      : Proper (state_le ==> state_le ==> state_le) (lattice_for_combine_production precombine_production').
admit.
Defined.
  End related.

  Class AbstractInterpretationCorrectness :=
    { prerelated_ext : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prerelated;
      related : Ensemble String -> state -> Prop
      := lattice_for_related;
      related_ext : Proper ((beq ==> iff) ==> state_beq ==> iff) related
      := lattice_for_related_ext;
      related_monotonic : forall s0 s1, s0 <= s1 -> (forall v, related v s0 -> related v s1);
      lub_correct
      : forall P1 st1,
          related P1 st1
          -> forall P2 st2,
            related P2 st2
            -> related (ensemble_least_upper_bound P1 P2) (least_upper_bound st1 st2);
      on_terminal_correct
      : forall P,
          related (ensemble_on_terminal P) (on_terminal P);
      on_nil_production_correct
      : related ensemble_on_nil_production on_nil_production;
      precombine_production_Proper_le
      : Proper (prestate_le ==> prestate_le ==> state_le) precombine_production;
      combine_production_Proper_le
      : Proper (state_le ==> state_le ==> state_le) combine_production
      := _;
      combine_production_correct
      : forall P1 st1,
          related P1 st1
          -> forall P2 st2,
            related P2 st2
            -> related (ensemble_combine_production P1 P2) (combine_production st1 st2)
    }.
End fold_correctness.

End FromAbstractInterpretationDefinitions.
Import Fiat_DOT_Common.Fiat.Common.

Global Instance prod_fixedpoint_lattice {prestate0 prestate1}
       {fpldata0 : grammar_fixedpoint_lattice_data prestate0}
       {fpldata1 : grammar_fixedpoint_lattice_data prestate1}
  : grammar_fixedpoint_lattice_data (@state _ fpldata0 * @state _ fpldata1).
admit.
Defined.

Global Instance prod_fixedpoint_lattice' {prestate0 prestate1}
       {fpldata0 : grammar_fixedpoint_lattice_data prestate0}
       {fpldata1 : grammar_fixedpoint_lattice_data prestate1}
  : grammar_fixedpoint_lattice_data (lattice_for prestate0 * lattice_for prestate1)
  := prod_fixedpoint_lattice.
Import Fiat.Parsers.StringLike.Core.

Module Export ProdAbstractInterpretationDefinitions.
Import Coq.Sets.Ensembles.

Section aidata.
  Context {Char : Type} {T T0 T1}
          {fpldata : grammar_fixedpoint_lattice_data T}
          {fpldata0 : grammar_fixedpoint_lattice_data T0}
          {fpldata1 : grammar_fixedpoint_lattice_data T1}.

  Definition prod_on_terminal
             (on_terminal0 : (Char -> bool) -> lattice_for T0)
             (on_terminal1 : (Char -> bool) -> lattice_for T1)
    : (Char -> bool) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun P => constant (on_terminal0 P, on_terminal1 P).

  Definition prod_on_nil_production
             (on_nil_production0 : lattice_for T0)
             (on_nil_production1 : lattice_for T1)
    : lattice_for (lattice_for T0 * lattice_for T1)
    := constant (on_nil_production0, on_nil_production1).

  Definition prod_precombine_production_dep
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1)
    : (lattice_for T0 * lattice_for T1) -> (lattice_for T0 * lattice_for T1) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun x y => constant (lattice_for_combine_production precombine_production0 (fst x) (fst y),
                            lattice_for_combine_production (precombine_production1 (fst x) (fst y)) (snd x) (snd y)).

  Definition prod_precombine_production_nondep
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (precombine_production1 : T1 -> T1 -> lattice_for T1)
    : (lattice_for T0 * lattice_for T1) -> (lattice_for T0 * lattice_for T1) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun x y => constant (lattice_for_combine_production precombine_production0 (fst x) (fst y),
                            lattice_for_combine_production precombine_production1 (snd x) (snd y)).

  Global Instance prod_precombine_production_dep_Proper
         {precombine_production0 : T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (prestate_beq ==> prestate_beq ==> state_beq) precombine_production0}
         {HP1 : Proper (state_beq ==> state_beq ==> prestate_beq ==> prestate_beq ==> state_beq) precombine_production1}
    : Proper (prestate_beq ==> prestate_beq ==> state_beq) (prod_precombine_production_dep precombine_production0 precombine_production1).
admit.
Defined.

  Definition prod_aidata_dep
             (on_terminal0 : (Char -> bool) -> lattice_for T0)
             (on_nil_production0 : lattice_for T0)
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (on_terminal1 : (Char -> bool) -> lattice_for T1)
             (on_nil_production1 : lattice_for T1)
             (precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1)
             (precombine_production0_Proper
              : Proper (prestate_beq ==> prestate_beq ==> state_beq) precombine_production0)
             (precombine_production1_Proper
              : Proper (state_beq ==> state_beq ==> prestate_beq ==> prestate_beq ==> state_beq) precombine_production1)
    : @AbstractInterpretation Char (lattice_for T0 * lattice_for T1) prod_fixedpoint_lattice'.
  Proof.
    refine {| on_terminal := prod_on_terminal on_terminal0 on_terminal1;
              on_nil_production := prod_on_nil_production on_nil_production0 on_nil_production1;
              precombine_production := prod_precombine_production_dep precombine_production0 precombine_production1 |}.
  Defined.

  Global Instance prod_precombine_production_dep_Proper_le
         {precombine_production0 : T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (prestate_le ==> prestate_le ==> state_le) precombine_production0}
         {HP1 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production1}
    : Proper (prestate_le ==> prestate_le ==> state_le) (prod_precombine_production_dep precombine_production0 precombine_production1).
admit.
Defined.

  Global Instance prod_precombine_production_nondep_dep_Proper_le
         {precombine_production0 : lattice_for T -> lattice_for T -> T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T -> lattice_for T -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production0}
         {HP1 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production1}
    : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) (fun x y => prod_precombine_production_nondep (precombine_production0 x y) (precombine_production1 x y)).
admit.
Defined.
End aidata.

Section aicdata.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}
          {T0 T1}
          {fpldata0 : grammar_fixedpoint_lattice_data T0}
          {fpldata1 : grammar_fixedpoint_lattice_data T1}
          (prerelated0 : Ensemble String -> T0 -> Prop)
          (prerelated1 : Ensemble String -> T1 -> Prop).

  Definition prod_prerelated : Ensemble String -> (lattice_for T0 * lattice_for T1) -> Prop
    := fun P st
       => lattice_for_related prerelated0 P (fst st)
          /\ lattice_for_related prerelated1 P (snd st).

  Global Instance prod_prerelated_ext
         {prerelated0_ext : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prerelated0}
         {prerelated1_ext : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prerelated1}
    : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prod_prerelated.
  Proof using HSLP.
admit.
Qed.

  Lemma prod_related_monotonic
         {related0_monotonic : forall s0 s1, (s0 <= s1)%fixedpoint -> forall v, lattice_for_related prerelated0 v s0 -> lattice_for_related prerelated0 v s1}
         {related1_monotonic : forall s0 s1, (s0 <= s1)%fixedpoint -> forall v, lattice_for_related prerelated1 v s0 -> lattice_for_related prerelated1 v s1}
    : forall s0 s1, (s0 <= s1)%fixedpoint -> forall v, lattice_for_related prod_prerelated v s0 -> lattice_for_related prod_prerelated v s1.
admit.
Defined.

  Lemma prod_lub_correct
        (lub0_correct : forall P1 st1,
            lattice_for_related prerelated0 P1 st1
            -> forall P2 st2,
              lattice_for_related prerelated0 P2 st2
              -> lattice_for_related prerelated0 (ensemble_least_upper_bound P1 P2) (st1 ⊔ st2)%fixedpoint)
        (lub1_correct : forall P1 st1,
            lattice_for_related prerelated1 P1 st1
            -> forall P2 st2,
              lattice_for_related prerelated1 P2 st2
              -> lattice_for_related prerelated1 (ensemble_least_upper_bound P1 P2) (st1 ⊔ st2)%fixedpoint)
    : forall P1 st1,
      lattice_for_related prod_prerelated P1 st1
      -> forall P2 st2,
        lattice_for_related prod_prerelated P2 st2
        -> lattice_for_related prod_prerelated (ensemble_least_upper_bound P1 P2) (st1 ⊔ st2)%fixedpoint.
admit.
Defined.

  Lemma prod_on_terminal_correct
        (on_terminal0 : (Char -> bool) -> lattice_for T0)
        (on_terminal1 : (Char -> bool) -> lattice_for T1)
        (on_terminal0_correct : forall P, lattice_for_related prerelated0 (ensemble_on_terminal P) (on_terminal0 P))
        (on_terminal1_correct : forall P, lattice_for_related prerelated1 (ensemble_on_terminal P) (on_terminal1 P))
    : forall P, lattice_for_related prod_prerelated (ensemble_on_terminal P) (prod_on_terminal on_terminal0 on_terminal1 P).
admit.
Defined.

  Lemma prod_on_nil_production_correct
        (on_nil_production0 : lattice_for T0)
        (on_nil_production1 : lattice_for T1)
        (on_nil_production0_correct : lattice_for_related prerelated0 ensemble_on_nil_production on_nil_production0)
        (on_nil_production1_correct : lattice_for_related prerelated1 ensemble_on_nil_production on_nil_production1)
    : lattice_for_related prod_prerelated ensemble_on_nil_production (prod_on_nil_production on_nil_production0 on_nil_production1).
admit.
Defined.

  Lemma prod_combine_production_dep_correct
        (precombine_production0 : T0 -> T0 -> lattice_for T0)
        (precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1)
        (combine_production0_correct : forall P1 st1,
            lattice_for_related prerelated0 P1 st1
            -> forall P2 st2,
              lattice_for_related prerelated0 P2 st2
              -> lattice_for_related prerelated0 (ensemble_combine_production P1 P2) (lattice_for_combine_production precombine_production0 st1 st2))
        (combine_production1_correct : forall P1 st1 st10,
            lattice_for_related prerelated0 P1 st10
            -> lattice_for_related prerelated1 P1 st1
            -> forall P2 st2 st20,
              lattice_for_related prerelated0 P2 st20
              -> lattice_for_related prerelated1 P2 st2
              -> lattice_for_related prerelated1 (ensemble_combine_production P1 P2) (lattice_for_combine_production (precombine_production1 st10 st20) st1 st2))
    : forall P1 st1,
      lattice_for_related prod_prerelated P1 st1
      -> forall P2 st2,
        lattice_for_related prod_prerelated P2 st2
        -> lattice_for_related prod_prerelated (ensemble_combine_production P1 P2) (lattice_for_combine_production (prod_precombine_production_dep precombine_production0 precombine_production1) st1 st2).
admit.
Defined.

  Lemma prod_combine_production_nondep_correct_specific
        (precombine_production0 : T0 -> T0 -> lattice_for T0)
        (precombine_production1 : T1 -> T1 -> lattice_for T1)
        P1 st1
        (Hrel1 : lattice_for_related prod_prerelated P1 st1)
        P2 st2
        (Hrel2 : lattice_for_related prod_prerelated P2 st2)
 
Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted) (truncated to 8.0KiB; full 45KiB file on GitHub Actions Artifacts under tmp.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-w" "-deprecated-appcontext -notation-overridden" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src" "Fiat" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock" "Bedrock" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-I" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics" "-top" "bug_01" "-native-compiler" "no" "-require-import" "Coq.Compat.AdmitAxiom" "-native-compiler" "no") -*- *)
(* File reduced by coq-bug-finder from original input, then from 916 lines to 386 lines, then from 507 lines to 948 lines, then from 951 lines to 417 lines, then from 538 lines to 916 lines, then from 919 lines to 447 lines, then from 567 lines to 917 lines, then from 921 lines to 475 lines, then from 595 lines to 831 lines, then from 834 lines to 516 lines, then from 634 lines to 1027 lines, then from 1031 lines to 795 lines, then from 910 lines to 2027 lines, then from 2031 lines to 1799 lines, then from 1801 lines to 806 lines, then from 918 lines to 1029 lines, then from 1033 lines to 887 lines, then from 999 lines to 1506 lines, then from 1510 lines to 1022 lines, then from 1110 lines to 1322 lines, then from 1325 lines to 1054 lines, then from 1142 lines to 1195 lines, then from 1199 lines to 1173 lines, then from 1176 lines to 1076 lines, then from 1161 lines to 1456 lines, then from 1459 lines to 1237 lines, then from 1310 lines to 1462 lines, then from 1466 lines to 1257 lines, then from 1325 lines to 1458 lines, then from 1462 lines to 1287 lines, then from 1353 lines to 1483 lines, then from 1487 lines to 1294 lines, then from 1360 lines to 1530 lines, then from 1534 lines to 1530 lines, then from 1530 lines to 1370 lines, then from 1435 lines to 1479 lines, then from 1483 lines to 1382 lines, then from 1447 lines to 1598 lines, then from 1602 lines to 1400 lines, then from 1461 lines to 2272 lines, then from 2275 lines to 1688 lines, then from 1691 lines to 1498 lines, then from 1556 lines to 1843 lines, then from 1847 lines to 1527 lines, then from 1585 lines to 1869 lines, then from 1873 lines to 1659 lines, then from 1712 lines to 1965 lines, then from 1969 lines to 1785 lines, then from 1807 lines to 1755 lines, then from 1808 lines to 2104 lines, then from 2108 lines to 1790 lines, then from 1841 lines to 2002 lines, then from 2006 lines to 1809 lines, then from 1859 lines to 2559 lines, then from 2563 lines to 2189 lines, then from 2192 lines to 1844 lines, then from 1892 lines to 1929 lines, then from 1932 lines to 1845 lines, then from 1892 lines to 1916 lines, then from 1920 lines to 1845 lines, then from 1892 lines to 1949 lines, then from 1953 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1942 lines, then from 1944 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1877 lines, then from 1924 lines to 1861 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1878 lines, then from 1925 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1942 lines, then from 1944 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1879 lines, then from 1925 lines to 1860 lines, then from 1864 lines to 1860 lines, then from 1840 lines to 1179 lines, then from 2974 lines to 1443 lines, then from 1438 lines to 1065 lines, then from 1090 lines to 1150 lines, then from 1154 lines to 1077 lines, then from 1081 lines to 1076 lines *)
(* coqc version 8.15+alpha compiled with OCaml 4.05.0
   coqtop version 8.15+alpha *)
Require Coq.Sets.Ensembles.
Module Export Fiat_DOT_Common_DOT_Coq__8_4__8_5__Compat.
Module Export Fiat.
Module Export Common.
Module Export Coq__8_4__8_5__Compat.
Global Set Instance Generalized Output.
End Coq__8_4__8_5__Compat.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Coq__8_4__8_5__Compat.

Module Export Fiat_DOT_Common.
Module Export Fiat.
Module Common.

Global Set Implicit Arguments.
Global Generalizable All Variables.

Global Coercion is_true : bool >-> Sortclass.

End Common.
End Fiat.
End Fiat_DOT_Common.

Module Export Fiat_DOT_Common_DOT_Equality.
Module Export Fiat.
Module Export Common.
Module Export Equality.
Import Coq.Lists.List.
Import Coq.Strings.String.

Scheme Equality for string.

Section In.
  Section list_bin.
    Context {A} (eq_A : A -> A -> bool) (a : A).

    Fixpoint list_bin (ls : list A) : bool
      := match ls with
           | nil => false
           | x::xs => orb (list_bin xs) (eq_A x a)
         end.
  End list_bin.
End In.

End Equality.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Equality.

Module Export Fiat_DOT_Common_DOT_Instances.
Module Export Fiat.
Module Export Common.
Module Export Instances.
Import Coq.Classes.Morphisms.
Global Instance drop_0_Proper {A B RA RB} {f : B}
       {H : Proper RB f}
: Proper (RA ==> RB) (fun _ : A => f).
admit.
Defined.

End Instances.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Instances.

Module Export Fiat_DOT_Common_DOT_List_DOT_Operations.
Module Export Fiat.
Module Export Common.
Module Export List.
Module Export Operations.

Import Coq.Lists.List.

Module Export List.

 Definition uniquize {A} (beq : A -> A -> bool) (ls : list A) : list A
    := fold_right
         (fun x xs => if list_bin beq x xs then xs else x::xs)
         nil
         ls.

  Fixpoint up_to (n : nat) : list nat :=
    match n with
      | 0 => nil
      | S n' => n'::up_to n'
    end.

  End List.

End Operations.

End List.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_List_DOT_Operations.

Module Export Fiat_DOT_Common_DOT_MSetExtensions.
Module Export Fiat.
Module Export Common.
Module Export MSetExtensions.
Export Coq.MSets.MSetInterface.

End MSetExtensions.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_MSetExtensions.

Module Export Fiat_DOT_Common_DOT_Notations.
Module Export Fiat.
Module Export Common.
Module Export Notations.
Reserved Infix "⊔" (at level 80).

End Notations.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Notations.

Module Export Fiat_DOT_Parsers_DOT_StringLike_DOT_Core.
Module Export Fiat.
Module Export Parsers.
Module Export StringLike.
Module Export Core.

Local Coercion is_true : bool >-> Sortclass.

Module Export StringLike.
  Class StringLikeMin {Char : Type} :=
    {
      String :> Type;
      char_at_matches : nat -> String -> (Char -> bool) -> bool;
      unsafe_get : nat -> String -> Char;
      length : String -> nat
    }.

  Class StringLike {Char : Type} {HSLM : @StringLikeMin Char} :=
    {
      is_char : String -> Char -> bool;
      take : nat -> String -> String;
      drop : nat -> String -> String;
      get : nat -> String -> option Char;
      bool_eq : String -> String -> bool;
      beq : relation String := fun x y => bool_eq x y
    }.

  Arguments StringLikeMin : clear implicits.
  Arguments StringLike Char {HSLM}.
  Delimit Scope string_like_scope with string_like.
  Infix "=s" := (@beq _ _ _) (at level 70, no associativity) : type_scope.
  Notation "s ~= [ ch ]" := (is_char s ch) (at level 70, no associativity) : string_like_scope.
  Local Open Scope string_like_scope.

  Cla
Build Log (truncated to last 8.0KiB; full 3.1MiB file on GitHub Actions Artifacts under build.log)
ated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/IndexedAndAtMostOneNonTerminalReflectiveOpt.v", line 36, characters 0-4:
Warning: The default value for instance locality is currently "local" in a
section and "global" otherwise, but is scheduled to change in a future
release. For the time being, adding instances outside of sections without
specifying an explicit locality is therefore deprecated. It is recommended to
use "export" whenever possible.
[deprecated-instance-without-locality,deprecated]
COQC src/Parsers/Refinement/FinishingLemma.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/FinishingLemma.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
COQC src/Parsers/Refinement/ReductionTactics.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/ReductionTactics.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/ReductionTactics.v", line 3, characters 0-57:
Warning:
New coercion path [Start_symbol; rproduction_of_string;
                   magic_juxta_append_rproduction] : grammar >-> Funclass is ambiguous with existing 
[Lookup] : grammar >-> Funclass. [ambiguous-paths,typechecker]
COQC src/Parsers/Refinement/Tactics.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/Tactics.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/Tactics.v", line 12, characters 0-57:
Warning:
New coercion path [Start_symbol; rproduction_of_string;
                   magic_juxta_append_rproduction] : grammar >-> Funclass is ambiguous with existing 
[Lookup] : grammar >-> Funclass. [ambiguous-paths,typechecker]
COQC src/Parsers/ExtrOcamlParsers.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/ExtrOcamlParsers.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/ExtrOcamlParsers.v", line 3, characters 0-47:
Warning:
New coercion path [Start_symbol; rproduction_of_string;
                   magic_juxta_append_rproduction] : grammar >-> Funclass is ambiguous with existing 
[Lookup] : grammar >-> Funclass. [ambiguous-paths,typechecker]
COQC src/Parsers/Refinement/PossibleTerminalsSets.v
MINIMIZER_DEBUG: /github/workspace/builds/coq/coq-failing/_install_ci/bin//coqc: COQPATH=
MINIMIZER_DEBUG: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/coqc.orig -q -native-compiler no -require-import Coq.Compat.AdmitAxiom -w -deprecated-native-compiler-option -native-compiler no -w -deprecated-appcontext\ -notation-overridden -I /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src Fiat -R /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock Bedrock /github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/PossibleTerminalsSets.v 
While loading initial state:
Warning: The native-compiler option is deprecated. To compile native files
ahead of time, use the coqnative binary instead.
[deprecated-native-compiler-option,deprecated]
File "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Parsers/Refinement/PossibleTerminalsSets.v", line 384, characters 21-30:
Error:
Unbound reference: In environment
HSLM : StringLikeMin Ascii.ascii
HSL : StringLike Ascii.ascii
HSLP : StringLikeProperties Ascii.ascii
P1 : Ensembles.Ensemble String
st10 : lattice_for nonemptyT
R10 : match st10 with
      | ⊤ => True
      | constant n =>
          n = nonempty -> forall str : String, P1 str -> length str <> 0
      | ⊥ => forall str : String, ~ P1 str
      end
l2 : lattice_for PositiveSet.t
H4 : match l2 with
     | ⊤ => True
     | constant n =>
         forall str : String,
         P1 str ->
         for_last_char str
           (fun ch : Ascii.ascii => ~ PositiveSet.In (pos_of_ascii ch) n)
     | ⊥ => forall str : String, ~ P1 str
     end
P2 : Ensembles.Ensemble String
st20 : lattice_for nonemptyT
R20 : match st20 with
      | ⊤ => True
      | constant n =>
          n = nonempty -> forall str : String, P2 str -> length str <> 0
      | ⊥ => forall str : String, ~ P2 str
      end
l0 : lattice_for PositiveSet.t
H1 : match l0 with
     | ⊤ => True
     | constant n =>
         forall str : String,
         P2 str ->
         for_last_char str
           (fun ch : Ascii.ascii => ~ PositiveSet.In (pos_of_ascii ch) n)
     | ⊥ => forall str : String, ~ P2 str
     end
x : PositiveSet.t
x0 : PositiveSet.t
The reference 3 is free.

Makefile.coq:762: recipe for target 'src/Parsers/Refinement/PossibleTerminalsSets.vo' failed
make[1]: *** [src/Parsers/Refinement/PossibleTerminalsSets.vo] Error 1
make[1]: Leaving directory '/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers'
Makefile.ci:108: recipe for target 'ci-fiat_parsers' failed
make: *** [ci-fiat_parsers] Error 2
/github/workspace/builds/coq /github/workspace
::endgroup::
Minimization Log (truncated to last 8.0KiB; full 124KiB file on GitHub Actions Artifacts under bug.log)
ful.

I will now attempt to remove unused contexts

Context removal successful.

I will now attempt to admit [abstract ...]s

Admitting [abstract ...] successful.

Admitting [abstract ...] successful.
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]

Aborted removal successful.

I will now attempt to remove unused Ltacs

Ltac removal successful.

I will now attempt to remove unused definitions

Definition removal successful.

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

Non-instance definition removal successful.

I will now attempt to remove unused variables

Variable removal successful.

I will now attempt to remove unused contexts

Context removal successful.

I will now attempt to replace Obligation with Admit Obligations

Non-fatal error: Failed to admit Obligations and preserve the error.  
Writing intermediate code to /github/workspace/cwd/tmp.v.
The new error was:
File "/tmp/tmpyqudbq0u.v", line 7, characters 0-39:
Warning: Option Instance Generalized Output is deprecated
[deprecated-option,deprecated]
File "/tmp/tmpyqudbq0u.v", line 148, characters 2-209:
Warning:
Ignored instance declaration for “String”: “forall Char : Type,
                                            StringLikeMin -> Type” is not a class
[not-a-class,typeclasses]
File "/tmp/tmpyqudbq0u.v", line 168, characters 2-51:
Warning: Declaring a scope implicitly is deprecated; use in advance an
explicit "Declare Scope string_like_scope.". [undeclared-scope,deprecated]
File "/tmp/tmpyqudbq0u.v", line 271, characters 0-55:
Warning: Declaring a scope implicitly is deprecated; use in advance an
explicit "Declare Scope grammar_fixedpoint_scope.".
[undeclared-scope,deprecated]
File "/tmp/tmpyqudbq0u.v", line 356, characters 0-2095:
Warning:
Ignored instance declaration for “state”: “forall prestate : Type,
                                           grammar_fixedpoint_lattice_data
                                             prestate -> Type” is not a class
[not-a-class,typeclasses]
Error: The section correctness, module ContextFreeGrammar, module Parsers and
module Fiat need to be closed.


Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas

Non-fatal error: Failed to admit lemmas and preserve the error.  
Writing intermediate code to /github/workspace/cwd/tmp.v.
The new error was:
File "/tmp/tmp6f78iyeg.v", line 7, characters 0-39:
Warning: Option Instance Generalized Output is deprecated
[deprecated-option,deprecated]
File "/tmp/tmp6f78iyeg.v", line 148, characters 2-209:
Warning:
Ignored instance declaration for “String”: “forall Char : Type,
                                            StringLikeMin -> Type” is not a class
[not-a-class,typeclasses]
File "/tmp/tmp6f78iyeg.v", line 168, characters 2-51:
Warning: Declaring a scope implicitly is deprecated; use in advance an
explicit "Declare Scope string_like_scope.". [undeclared-scope,deprecated]
File "/tmp/tmp6f78iyeg.v", line 271, characters 0-55:
Warning: Declaring a scope implicitly is deprecated; use in advance an
explicit "Declare Scope grammar_fixedpoint_scope.".
[undeclared-scope,deprecated]
File "/tmp/tmp6f78iyeg.v", line 376, characters 79-109:
Error:
In environment
grammar_fixedpoint_lattice_data : Type -> Type
prestate : Type
state := lattice_for prestate : Type
prestate_lt : prestate -> prestate -> bool
state_lt := lattice_for_lt prestate_lt : state -> state -> bool
prestate_beq : prestate -> prestate -> bool
state_beq := lattice_for_beq prestate_beq : state -> state -> bool
prestate_le :=
fun s1 s2 : prestate => prestate_beq s1 s2 || prestate_lt s1 s2 :
prestate -> prestate -> bool
state_le := fun s1 s2 : state => state_beq s1 s2 || state_lt s1 s2 :
state -> state -> bool
prestate_beq_Equivalence :
Equivalence (fun x x0 : prestate => prestate_beq x x0)
state_beq_Equivalence := lattice_for_Equivalence :
Equivalence (fun x x0 : state => state_beq x x0)
preleast_upper_bound : prestate -> prestate -> state
least_upper_bound := lattice_for_lub preleast_upper_bound :
state -> state -> state
preleast_upper_bound_correct_l :
forall a b : prestate, state_le (constant a) (preleast_upper_bound a b)
preleast_upper_bound_correct_r :
forall a b : prestate, state_le (constant b) (preleast_upper_bound a b)
The term "preleast_upper_bound_correct_l" has type
 "forall a b : prestate, state_le (constant a) (preleast_upper_bound a b)"
while it is expected to have type "lattice_for prestate".


Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions

Non-fatal error: Failed to admit definitions and preserve the error.  
Writing intermediate code to /github/workspace/cwd/tmp.v.
The new error was:
File "/tmp/tmpbunro1d8.v", line 7, characters 0-39:
Warning: Option Instance Generalized Output is deprecated
[deprecated-option,deprecated]
File "/tmp/tmpbunro1d8.v", line 148, characters 2-209:
Warning:
Ignored instance declaration for “String”: “forall Char : Type,
                                            StringLikeMin -> Type” is not a class
[not-a-class,typeclasses]
File "/tmp/tmpbunro1d8.v", line 168, characters 2-51:
Warning: Declaring a scope implicitly is deprecated; use in advance an
explicit "Declare Scope string_like_scope.". [undeclared-scope,deprecated]
File "/tmp/tmpbunro1d8.v", line 271, characters 0-55:
Warning: Declaring a scope implicitly is deprecated; use in advance an
explicit "Declare Scope grammar_fixedpoint_scope.".
[undeclared-scope,deprecated]
File "/tmp/tmpbunro1d8.v", line 376, characters 79-109:
Error:
In environment
grammar_fixedpoint_lattice_data : Type -> Type
prestate : Type
state := lattice_for prestate : Type
prestate_lt : prestate -> prestate -> bool
state_lt := lattice_for_lt prestate_lt : state -> state -> bool
prestate_beq : prestate -> prestate -> bool
state_beq := lattice_for_beq prestate_beq : state -> state -> bool
prestate_le :=
fun s1 s2 : prestate => prestate_beq s1 s2 || prestate_lt s1 s2 :
prestate -> prestate -> bool
state_le := fun s1 s2 : state => state_beq s1 s2 || state_lt s1 s2 :
state -> state -> bool
prestate_beq_Equivalence :
Equivalence (fun x x0 : prestate => prestate_beq x x0)
state_beq_Equivalence := lattice_for_Equivalence :
Equivalence (fun x x0 : state => state_beq x x0)
preleast_upper_bound : prestate -> prestate -> state
least_upper_bound := lattice_for_lub preleast_upper_bound :
state -> state -> state
preleast_upper_bound_correct_l :
forall a b : prestate, state_le (constant a) (preleast_upper_bound a b)
preleast_upper_bound_correct_r :
forall a b : prestate, state_le (constant b) (preleast_upper_bound a b)
The term "preleast_upper_bound_correct_l" has type
 "forall a b : prestate, state_le (constant a) (preleast_upper_bound a b)"
while it is expected to have type "lattice_for prestate".


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.]

Aborted removal successful.

I will now attempt to remove unused Ltacs

Ltac removal successful.

I will now attempt to remove unused definitions

Definition removal successful.

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

Non-instance definition removal successful.

I will now attempt to remove unused variables

Variable removal successful.

I will now attempt to remove unused contexts

Context removal successful.

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.

Originally posted by @coqbot-app[bot] in #14328 (comment)

@JasonGross
Copy link
Member

Minimized Coq File
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-w" "-deprecated-appcontext -notation-overridden" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src" "Fiat" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/Bedrock" "Bedrock" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq/user-contrib/Ltac2" "Ltac2" "-I" "/github/workspace/builds/coq/coq-failing/_build_ci/fiat_parsers/src/Common/Tactics" "-top" "bug_01" "-native-compiler" "no" "-require-import" "Coq.Compat.AdmitAxiom" "-native-compiler" "no") -*- *)
(* File reduced by coq-bug-finder from original input, then from 916 lines to 386 lines, then from 507 lines to 948 lines, then from 951 lines to 417 lines, then from 538 lines to 916 lines, then from 919 lines to 447 lines, then from 567 lines to 917 lines, then from 921 lines to 475 lines, then from 595 lines to 831 lines, then from 834 lines to 516 lines, then from 634 lines to 1027 lines, then from 1031 lines to 795 lines, then from 910 lines to 2027 lines, then from 2031 lines to 1799 lines, then from 1801 lines to 806 lines, then from 918 lines to 1029 lines, then from 1033 lines to 887 lines, then from 999 lines to 1506 lines, then from 1510 lines to 1022 lines, then from 1110 lines to 1322 lines, then from 1325 lines to 1054 lines, then from 1142 lines to 1195 lines, then from 1199 lines to 1173 lines, then from 1176 lines to 1076 lines, then from 1161 lines to 1456 lines, then from 1459 lines to 1237 lines, then from 1310 lines to 1462 lines, then from 1466 lines to 1257 lines, then from 1325 lines to 1458 lines, then from 1462 lines to 1287 lines, then from 1353 lines to 1483 lines, then from 1487 lines to 1294 lines, then from 1360 lines to 1530 lines, then from 1534 lines to 1530 lines, then from 1530 lines to 1370 lines, then from 1435 lines to 1479 lines, then from 1483 lines to 1382 lines, then from 1447 lines to 1598 lines, then from 1602 lines to 1400 lines, then from 1461 lines to 2272 lines, then from 2275 lines to 1688 lines, then from 1691 lines to 1498 lines, then from 1556 lines to 1843 lines, then from 1847 lines to 1527 lines, then from 1585 lines to 1869 lines, then from 1873 lines to 1659 lines, then from 1712 lines to 1965 lines, then from 1969 lines to 1785 lines, then from 1807 lines to 1755 lines, then from 1808 lines to 2104 lines, then from 2108 lines to 1790 lines, then from 1841 lines to 2002 lines, then from 2006 lines to 1809 lines, then from 1859 lines to 2559 lines, then from 2563 lines to 2189 lines, then from 2192 lines to 1844 lines, then from 1892 lines to 1929 lines, then from 1932 lines to 1845 lines, then from 1892 lines to 1916 lines, then from 1920 lines to 1845 lines, then from 1892 lines to 1949 lines, then from 1953 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1942 lines, then from 1944 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1877 lines, then from 1924 lines to 1861 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1878 lines, then from 1925 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1942 lines, then from 1944 lines to 1860 lines, then from 1908 lines to 1945 lines, then from 1948 lines to 1861 lines, then from 1908 lines to 1932 lines, then from 1936 lines to 1861 lines, then from 1908 lines to 1965 lines, then from 1969 lines to 1861 lines, then from 1908 lines to 1950 lines, then from 1954 lines to 1879 lines, then from 1925 lines to 1860 lines, then from 1864 lines to 1860 lines, then from 1840 lines to 1179 lines, then from 2974 lines to 1443 lines, then from 1438 lines to 1065 lines, then from 1090 lines to 1150 lines, then from 1154 lines to 1077 lines, then from 1081 lines to 1077 lines *)
(* coqc version 8.15+alpha compiled with OCaml 4.05.0
   coqtop version 8.15+alpha *)
Require Coq.MSets.MSetPositive.
Require Coq.Sets.Ensembles.
Module Export Fiat_DOT_Common_DOT_Coq__8_4__8_5__Compat.
Module Export Fiat.
Module Export Common.
Module Export Coq__8_4__8_5__Compat.
Global Set Instance Generalized Output.
End Coq__8_4__8_5__Compat.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Coq__8_4__8_5__Compat.

Module Export Fiat_DOT_Common.
Module Export Fiat.
Module Common.

Global Set Implicit Arguments.
Global Generalizable All Variables.

Global Coercion is_true : bool >-> Sortclass.

End Common.
End Fiat.
End Fiat_DOT_Common.

Module Export Fiat_DOT_Common_DOT_Equality.
Module Export Fiat.
Module Export Common.
Module Export Equality.
Import Coq.Lists.List.
Import Coq.Strings.String.

Scheme Equality for string.

Section In.
  Section list_bin.
    Context {A} (eq_A : A -> A -> bool) (a : A).

    Fixpoint list_bin (ls : list A) : bool
      := match ls with
           | nil => false
           | x::xs => orb (list_bin xs) (eq_A x a)
         end.
  End list_bin.
End In.

End Equality.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Equality.

Module Export Fiat_DOT_Common_DOT_Instances.
Module Export Fiat.
Module Export Common.
Module Export Instances.
Import Coq.Classes.Morphisms.
Global Instance drop_0_Proper {A B RA RB} {f : B}
       {H : Proper RB f}
: Proper (RA ==> RB) (fun _ : A => f).
admit.
Defined.

End Instances.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Instances.

Module Export Fiat_DOT_Common_DOT_List_DOT_Operations.
Module Export Fiat.
Module Export Common.
Module Export List.
Module Export Operations.

Import Coq.Lists.List.

Module Export List.

 Definition uniquize {A} (beq : A -> A -> bool) (ls : list A) : list A
    := fold_right
         (fun x xs => if list_bin beq x xs then xs else x::xs)
         nil
         ls.

  Fixpoint up_to (n : nat) : list nat :=
    match n with
      | 0 => nil
      | S n' => n'::up_to n'
    end.

  End List.

End Operations.

End List.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_List_DOT_Operations.

Module Export Fiat_DOT_Common_DOT_MSetExtensions.
Module Export Fiat.
Module Export Common.
Module Export MSetExtensions.
Export Coq.MSets.MSetInterface.

End MSetExtensions.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_MSetExtensions.

Module Export Fiat_DOT_Common_DOT_Notations.
Module Export Fiat.
Module Export Common.
Module Export Notations.
Reserved Infix "⊔" (at level 80).

End Notations.

End Common.

End Fiat.

End Fiat_DOT_Common_DOT_Notations.

Module Export Fiat_DOT_Parsers_DOT_StringLike_DOT_Core.
Module Export Fiat.
Module Export Parsers.
Module Export StringLike.
Module Export Core.

Local Coercion is_true : bool >-> Sortclass.

Module Export StringLike.
  Class StringLikeMin {Char : Type} :=
    {
      String :> Type;
      char_at_matches : nat -> String -> (Char -> bool) -> bool;
      unsafe_get : nat -> String -> Char;
      length : String -> nat
    }.

  Class StringLike {Char : Type} {HSLM : @StringLikeMin Char} :=
    {
      is_char : String -> Char -> bool;
      take : nat -> String -> String;
      drop : nat -> String -> String;
      get : nat -> String -> option Char;
      bool_eq : String -> String -> bool;
      beq : relation String := fun x y => bool_eq x y
    }.

  Arguments StringLikeMin : clear implicits.
  Arguments StringLike Char {HSLM}.
  Delimit Scope string_like_scope with string_like.
  Infix "=s" := (@beq _ _ _) (at level 70, no associativity) : type_scope.
  Notation "s ~= [ ch ]" := (is_char s ch) (at level 70, no associativity) : string_like_scope.
  Local Open Scope string_like_scope.

  Class StringLikeProperties (Char : Type) `{StringLike Char} :=
    {
      singleton_unique : forall s ch ch', s ~= [ ch ] -> s ~= [ ch' ] -> ch = ch';
      singleton_exists : forall s, length s = 1 -> exists ch, s ~= [ ch ];
      char_at_matches_correct : forall s n P ch, get n s = Some ch -> (char_at_matches n s P = P ch);
      get_0 : forall s ch, take 1 s ~= [ ch ] <-> get 0 s = Some ch;
      get_S : forall n s, get (S n) s = get n (drop 1 s);
      unsafe_get_correct : forall n s ch, get n s = Some ch -> unsafe_get n s = ch;
      length_singleton : forall s ch, s ~= [ ch ] -> length s = 1;
      bool_eq_char : forall s s' ch, s ~= [ ch ] -> s' ~= [ ch ] -> s =s s';
      is_char_Proper :> Proper (beq ==> eq ==> eq) is_char;
      length_Proper :> Proper (beq ==> eq) length;
      take_Proper :> Proper (eq ==> beq ==> beq) take;
      drop_Proper :> Proper (eq ==> beq ==> beq) drop;
      bool_eq_Equivalence :> Equivalence beq;
      bool_eq_empty : forall str str', length str = 0 -> length str' = 0 -> str =s str';
      take_short_length : forall str n, n <= length str -> length (take n str) = n;
      take_long : forall str n, length str <= n -> take n str =s str;
      take_take : forall str n m, take n (take m str) =s take (min n m) str;
      drop_length : forall str n, length (drop n str) = length str - n;
      drop_0 : forall str, drop 0 str =s str;
      drop_drop : forall str n m, drop n (drop m str) =s drop (n + m) str;
      drop_take : forall str n m, drop n (take m str) =s take (m - n) (drop n str);
      take_drop : forall str n m, take n (drop m str) =s drop m (take (n + m) str);
      bool_eq_from_get : forall str str', (forall n, get n str = get n str') -> str =s str';
      strings_nontrivial : forall n, exists str, length str = n
    }.

  Arguments StringLikeProperties Char {_ _}.
End StringLike.

End Core.

End StringLike.

End Parsers.

End Fiat.

End Fiat_DOT_Parsers_DOT_StringLike_DOT_Core.

Module Export Fiat.
Module Export Parsers.
Module Export ContextFreeGrammar.
Module Export Core.
Export Fiat.Parsers.StringLike.Core.

End Core.

Section syntax.
  Context {Char : Type}.

  Inductive RCharExpr :=
  | rbeq (ch : Char)
  | ror (_ _ : RCharExpr)
  | rand (_ _ : RCharExpr)
  | rneg (_ : RCharExpr)
  | rcode_le_than (code : BinNums.N)
  | rcode_ge_than (code : BinNums.N).

  Inductive ritem :=
  | RTerminal (_ : RCharExpr)
  | RNonTerminal (_ : String.string).

  Definition rproduction := list ritem.
  Definition rproductions := list rproduction.
End syntax.
Global Arguments rproductions : clear implicits.

Section semantics.
  Context {Char : Type}.

  Class interp_RCharExpr_data :=
    { irbeq : Char -> Char -> bool;
      irN_of : Char -> BinNums.N }.
End semantics.

Global Arguments interp_RCharExpr_data : clear implicits.

Import Coq.Strings.String.

Class NoDupR {T} beq (ls : list T) := nodupr : uniquize beq ls = ls.

Record pregrammar Char :=
  {
    pregrammar_rproductions : list (string * rproductions Char);
    pregrammar_idata : interp_RCharExpr_data Char;
    pregrammar_rnonterminals : list string
    := map fst pregrammar_rproductions;
    rnonterminals_unique
    : NoDupR string_beq pregrammar_rnonterminals;
    RLookup_idx : nat -> rproductions Char
    := fun n => nth n (map snd pregrammar_rproductions) nil
  }.

Module Export Definitions.

Local Coercion is_true : bool >-> Sortclass.
Delimit Scope grammar_fixedpoint_scope with fixedpoint.
Local Open Scope grammar_fixedpoint_scope.

Inductive lattice_for T := top | constant (_ : T) | bottom.
Scheme Equality for lattice_for.

Arguments bottom {_}.
Arguments top {_}.
Notation "'⊥'" := bottom : grammar_fixedpoint_scope.
Notation "'⊤'" := top : grammar_fixedpoint_scope.

Global Instance lattice_for_Equivalence {T} {beq : T -> T -> bool}
       {H : Equivalence beq}
  : Equivalence (lattice_for_beq beq).
admit.
Defined.

Definition lattice_for_lt {T} (lt : T -> T -> bool) (x y : lattice_for T)
  := match x, y with
     | ⊤, ⊤ => false
     | constant x', constant y' => lt x' y'
     | ⊥, ⊥ => false
     | _, ⊤ => true
     | ⊤, _ => false
     | _, constant _ => true
     | constant _, _ => false
     end.

Global Instance lattice_for_lt_Proper {T} {beq lt : T -> T -> bool}
       {H : Proper (beq ==> beq ==> eq) lt}
  : Proper (lattice_for_beq beq ==> lattice_for_beq beq ==> eq) (lattice_for_lt lt).
admit.
Defined.

Definition lattice_for_lub {T} (lub : T -> T -> lattice_for T) (x y : lattice_for T)
  := match x, y with
     | ⊤, ⊤ => ⊤
     | constant x', constant y' => lub x' y'
     | ⊥, ⊥ => ⊥
     | ⊤, _
     | _, ⊤
       => ⊤
     | ⊥, v
     | v, ⊥
       => v
     end.

Section lub_correct.
  Context {T} (beq : T -> T -> bool) (lt : T -> T -> bool) (lub : T -> T -> lattice_for T).

  Local Notation "x <= y" := (orb (lattice_for_beq beq x y) (lattice_for_lt lt x y)).

  Context (lub_correct_l : forall x y, constant x <= lub x y)
          (lub_correct_r : forall x y, constant y <= lub x y)
          (beq_Reflexive : Reflexive beq).
  Lemma lattice_for_lub_correct_l x y
    : x <= lattice_for_lub lub x y.
  Proof using beq_Reflexive lub_correct_l.
    admit.
  Qed.

  Lemma lattice_for_lub_correct_r x y
    : y <= lattice_for_lub lub x y.
  Proof using beq_Reflexive lub_correct_r.
    admit.
  Qed.

  Global Instance lattice_for_lub_Proper
         {lub_Proper : Proper (beq ==> beq ==> lattice_for_beq beq) lub}
    : Proper (lattice_for_beq beq ==> lattice_for_beq beq ==> lattice_for_beq beq) (lattice_for_lub lub).
admit.
Defined.
End lub_correct.

Definition lattice_for_gt_well_founded {T} {lt : T -> T -> bool}
           (gt_wf : well_founded (Basics.flip lt))
  : well_founded (Basics.flip (lattice_for_lt lt)).
admit.
Defined.

Global Instance lattice_for_lt_Transitive {T} {lt : T -> T -> bool} {_ : Transitive lt}
  : Transitive (lattice_for_lt lt).
admit.
Defined.

Class grammar_fixedpoint_lattice_data prestate :=
  { state :> _ := lattice_for prestate;
    prestate_lt : prestate -> prestate -> bool;
    state_lt : state -> state -> bool
    := lattice_for_lt prestate_lt;
    prestate_beq : prestate -> prestate -> bool;
    state_beq : state -> state -> bool
    := lattice_for_beq prestate_beq;
    prestate_le s1 s2 := (prestate_beq s1 s2 || prestate_lt s1 s2)%bool;
    state_le s1 s2 := (state_beq s1 s2 || state_lt s1 s2)%bool;
    prestate_beq_Equivalence : Equivalence prestate_beq;
    state_beq_Equivalence : Equivalence state_beq
    := lattice_for_Equivalence;
    preleast_upper_bound : prestate -> prestate -> state;
    least_upper_bound : state -> state -> state
    := lattice_for_lub preleast_upper_bound;
    preleast_upper_bound_correct_l
    : forall a b, state_le (constant a) (preleast_upper_bound a b);
    preleast_upper_bound_correct_r
    : forall a b, state_le (constant b) (preleast_upper_bound a b);
    least_upper_bound_correct_l
    : forall a b, state_le a (least_upper_bound a b)
    := lattice_for_lub_correct_l prestate_beq prestate_lt preleast_upper_bound preleast_upper_bound_correct_l _;
    least_upper_bound_correct_r
    : forall a b, state_le b (least_upper_bound a b)
    := lattice_for_lub_correct_r prestate_beq prestate_lt preleast_upper_bound preleast_upper_bound_correct_r _;
    prestate_gt_wf : well_founded (Basics.flip prestate_lt);
    state_gt_wf : well_founded (Basics.flip state_lt)
    := lattice_for_gt_well_founded prestate_gt_wf;
    preleast_upper_bound_Proper : Proper (prestate_beq ==> prestate_beq ==> state_beq) preleast_upper_bound;
    least_upper_bound_Proper : Proper (state_beq ==> state_beq ==> state_beq) least_upper_bound
    := @lattice_for_lub_Proper _ _ _ _;
    prestate_lt_Proper : Proper (prestate_beq ==> prestate_beq ==> eq) prestate_lt;
    state_lt_Proper : Proper (state_beq ==> state_beq ==> eq) state_lt
    := lattice_for_lt_Proper;
    prestate_lt_Transitive : Transitive prestate_lt;
    state_lt_Transitive : Transitive state_lt
    := lattice_for_lt_Transitive }.

Infix "<=" := (@state_le _ _) : grammar_fixedpoint_scope.
Infix "⊔" := (@least_upper_bound _ _) : grammar_fixedpoint_scope.

Global Instance lattice_for_rect_Proper_85 {A}
  : Proper (eq ==> forall_relation (fun _ => eq) ==> eq ==> eq ==> Basics.flip Basics.impl)
           (@lattice_for_rect A (fun _ => Prop)) | 3.
admit.
Defined.

Lemma lattice_for_rect_pull {A B C} f t c b v
  : f (@lattice_for_rect A (fun _ => B) t c b v)
    = @lattice_for_rect A (fun _ => C) (f t) (fun x => f (c x)) (f b) v.
admit.
Defined.

End Definitions.

Module Export AsciiLattice.
Import Coq.Strings.Ascii.
Import Coq.MSets.MSetPositive.

Section gen.
  Global Instance positive_set_fpdata
    : grammar_fixedpoint_lattice_data PositiveSet.t.
admit.
Defined.
End gen.

Definition max_ascii := Eval compute in BinPos.Pos.of_nat (S (nat_of_ascii (Ascii true true true true true true true true))).

End AsciiLattice.

Module Export FromAbstractInterpretationDefinitions.
Import Coq.Sets.Ensembles.
Import Fiat.Parsers.ContextFreeGrammar.Core.
Local Coercion is_true : bool >-> Sortclass.
Local Open Scope grammar_fixedpoint_scope.

Section general_fold.
  Context {Char : Type}
          {T : Type}.

  Definition lattice_for_combine_production combine_production
    : lattice_for T -> lattice_for T -> lattice_for T
    := fun x y => match x, y with
                  | ⊥, _
                  | _, ⊥
                    => ⊥
                  | ⊤, _
                  | _, ⊤
                    => ⊤
                  | constant x', constant y'
                    => combine_production x' y'
                  end.

  Global Instance lattice_for_combine_production_Proper
         {prestate_beq : T -> T -> bool}
         {precombine_production}
         {H : Proper (prestate_beq ==> prestate_beq ==> lattice_for_beq prestate_beq) precombine_production}
    : Proper (lattice_for_beq prestate_beq ==> lattice_for_beq prestate_beq ==> lattice_for_beq prestate_beq) (lattice_for_combine_production precombine_production).
admit.
Defined.

  Context {fpdata : @grammar_fixedpoint_lattice_data T}.

  Class AbstractInterpretation :=
    { on_terminal : (Char -> bool) -> lattice_for T;
      on_nil_production : lattice_for T;
      precombine_production : T -> T -> lattice_for T;
      combine_production : lattice_for T -> lattice_for T -> lattice_for T
      := lattice_for_combine_production precombine_production;
      precombine_production_Proper : Proper (prestate_beq ==> prestate_beq ==> state_beq) precombine_production;
      combine_production_Proper : Proper (state_beq ==> state_beq ==> state_beq) combine_production
      := lattice_for_combine_production_Proper }.

  Global Existing Instance precombine_production_Proper.

  End general_fold.

Section on_ensembles.
  Context {Char : Type} {HSLM : StringLikeMin Char} {HSL : StringLike Char}.

  Definition ensemble_on_terminal (P : Char -> bool) : Ensemble String
    := (fun str => exists ch, is_true (P ch) /\ str ~= [ ch ])%string_like.

  Definition ensemble_on_nil_production : Ensemble String
    := (fun str => length str = 0).

  Definition ensemble_combine_production : Ensemble String -> Ensemble String -> Ensemble String
    := fun P1 P2 => fun str => exists n, P1 (take n str) /\ P2 (drop n str).

  Definition ensemble_least_upper_bound : Ensemble String -> Ensemble String -> Ensemble String
    := fun P1 P2 => fun str => P1 str \/ P2 str.
End on_ensembles.

Section fold_correctness.
  Context {Char : Type} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}.
  Context {T : Type}.
  Context {fpdata : @grammar_fixedpoint_lattice_data T}
          {aidata : @AbstractInterpretation Char T fpdata}.
  Context (G : pregrammar Char)
          (prerelated : Ensemble String -> T -> Prop).

  Definition lattice_for_related (P : Ensemble String) (st : lattice_for T) : Prop
    := match st with
       | ⊤ => True
       | ⊥ => forall str, ~P str
       | constant n => prerelated P n
       end.

  Section related.

    Global Instance lattice_for_related_ext {_ : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prerelated}
      : Proper ((beq ==> iff) ==> state_beq ==> iff) related | 2.
    Proof using HSLP.
      admit.
    Qed.

    Global Instance lattice_for_combine_production_Proper_le
           {precombine_production'}
           {H : Proper (prestate_le ==> prestate_le ==> state_le) precombine_production'}
      : Proper (state_le ==> state_le ==> state_le) (lattice_for_combine_production precombine_production').
admit.
Defined.
  End related.

  Class AbstractInterpretationCorrectness :=
    { prerelated_ext : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prerelated;
      related : Ensemble String -> state -> Prop
      := lattice_for_related;
      related_ext : Proper ((beq ==> iff) ==> state_beq ==> iff) related
      := lattice_for_related_ext;
      related_monotonic : forall s0 s1, s0 <= s1 -> (forall v, related v s0 -> related v s1);
      lub_correct
      : forall P1 st1,
          related P1 st1
          -> forall P2 st2,
            related P2 st2
            -> related (ensemble_least_upper_bound P1 P2) (least_upper_bound st1 st2);
      on_terminal_correct
      : forall P,
          related (ensemble_on_terminal P) (on_terminal P);
      on_nil_production_correct
      : related ensemble_on_nil_production on_nil_production;
      precombine_production_Proper_le
      : Proper (prestate_le ==> prestate_le ==> state_le) precombine_production;
      combine_production_Proper_le
      : Proper (state_le ==> state_le ==> state_le) combine_production
      := _;
      combine_production_correct
      : forall P1 st1,
          related P1 st1
          -> forall P2 st2,
            related P2 st2
            -> related (ensemble_combine_production P1 P2) (combine_production st1 st2)
    }.
End fold_correctness.

End FromAbstractInterpretationDefinitions.
Import Fiat_DOT_Common.Fiat.Common.

Global Instance prod_fixedpoint_lattice {prestate0 prestate1}
       {fpldata0 : grammar_fixedpoint_lattice_data prestate0}
       {fpldata1 : grammar_fixedpoint_lattice_data prestate1}
  : grammar_fixedpoint_lattice_data (@state _ fpldata0 * @state _ fpldata1).
admit.
Defined.

Global Instance prod_fixedpoint_lattice' {prestate0 prestate1}
       {fpldata0 : grammar_fixedpoint_lattice_data prestate0}
       {fpldata1 : grammar_fixedpoint_lattice_data prestate1}
  : grammar_fixedpoint_lattice_data (lattice_for prestate0 * lattice_for prestate1)
  := prod_fixedpoint_lattice.
Import Fiat.Parsers.StringLike.Core.

Module Export ProdAbstractInterpretationDefinitions.
Import Coq.Sets.Ensembles.

Section aidata.
  Context {Char : Type} {T T0 T1}
          {fpldata : grammar_fixedpoint_lattice_data T}
          {fpldata0 : grammar_fixedpoint_lattice_data T0}
          {fpldata1 : grammar_fixedpoint_lattice_data T1}.

  Definition prod_on_terminal
             (on_terminal0 : (Char -> bool) -> lattice_for T0)
             (on_terminal1 : (Char -> bool) -> lattice_for T1)
    : (Char -> bool) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun P => constant (on_terminal0 P, on_terminal1 P).

  Definition prod_on_nil_production
             (on_nil_production0 : lattice_for T0)
             (on_nil_production1 : lattice_for T1)
    : lattice_for (lattice_for T0 * lattice_for T1)
    := constant (on_nil_production0, on_nil_production1).

  Definition prod_precombine_production_dep
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1)
    : (lattice_for T0 * lattice_for T1) -> (lattice_for T0 * lattice_for T1) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun x y => constant (lattice_for_combine_production precombine_production0 (fst x) (fst y),
                            lattice_for_combine_production (precombine_production1 (fst x) (fst y)) (snd x) (snd y)).

  Definition prod_precombine_production_nondep
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (precombine_production1 : T1 -> T1 -> lattice_for T1)
    : (lattice_for T0 * lattice_for T1) -> (lattice_for T0 * lattice_for T1) -> lattice_for (lattice_for T0 * lattice_for T1)
    := fun x y => constant (lattice_for_combine_production precombine_production0 (fst x) (fst y),
                            lattice_for_combine_production precombine_production1 (snd x) (snd y)).

  Global Instance prod_precombine_production_dep_Proper
         {precombine_production0 : T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (prestate_beq ==> prestate_beq ==> state_beq) precombine_production0}
         {HP1 : Proper (state_beq ==> state_beq ==> prestate_beq ==> prestate_beq ==> state_beq) precombine_production1}
    : Proper (prestate_beq ==> prestate_beq ==> state_beq) (prod_precombine_production_dep precombine_production0 precombine_production1).
admit.
Defined.

  Definition prod_aidata_dep
             (on_terminal0 : (Char -> bool) -> lattice_for T0)
             (on_nil_production0 : lattice_for T0)
             (precombine_production0 : T0 -> T0 -> lattice_for T0)
             (on_terminal1 : (Char -> bool) -> lattice_for T1)
             (on_nil_production1 : lattice_for T1)
             (precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1)
             (precombine_production0_Proper
              : Proper (prestate_beq ==> prestate_beq ==> state_beq) precombine_production0)
             (precombine_production1_Proper
              : Proper (state_beq ==> state_beq ==> prestate_beq ==> prestate_beq ==> state_beq) precombine_production1)
    : @AbstractInterpretation Char (lattice_for T0 * lattice_for T1) prod_fixedpoint_lattice'.
  Proof.
    refine {| on_terminal := prod_on_terminal on_terminal0 on_terminal1;
              on_nil_production := prod_on_nil_production on_nil_production0 on_nil_production1;
              precombine_production := prod_precombine_production_dep precombine_production0 precombine_production1 |}.
  Defined.

  Global Instance prod_precombine_production_dep_Proper_le
         {precombine_production0 : T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (prestate_le ==> prestate_le ==> state_le) precombine_production0}
         {HP1 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production1}
    : Proper (prestate_le ==> prestate_le ==> state_le) (prod_precombine_production_dep precombine_production0 precombine_production1).
admit.
Defined.

  Global Instance prod_precombine_production_nondep_dep_Proper_le
         {precombine_production0 : lattice_for T -> lattice_for T -> T0 -> T0 -> lattice_for T0}
         {precombine_production1 : lattice_for T -> lattice_for T -> T1 -> T1 -> lattice_for T1}
         {HP0 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production0}
         {HP1 : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) precombine_production1}
    : Proper (state_le ==> state_le ==> prestate_le ==> prestate_le ==> state_le) (fun x y => prod_precombine_production_nondep (precombine_production0 x y) (precombine_production1 x y)).
admit.
Defined.
End aidata.

Section aicdata.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}
          {T0 T1}
          {fpldata0 : grammar_fixedpoint_lattice_data T0}
          {fpldata1 : grammar_fixedpoint_lattice_data T1}
          (prerelated0 : Ensemble String -> T0 -> Prop)
          (prerelated1 : Ensemble String -> T1 -> Prop).

  Definition prod_prerelated : Ensemble String -> (lattice_for T0 * lattice_for T1) -> Prop
    := fun P st
       => lattice_for_related prerelated0 P (fst st)
          /\ lattice_for_related prerelated1 P (snd st).

  Global Instance prod_prerelated_ext
         {prerelated0_ext : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prerelated0}
         {prerelated1_ext : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prerelated1}
    : Proper ((beq ==> iff) ==> prestate_beq ==> iff) prod_prerelated.
  Proof using HSLP.
admit.
Qed.

  Lemma prod_related_monotonic
         {related0_monotonic : forall s0 s1, (s0 <= s1)%fixedpoint -> forall v, lattice_for_related prerelated0 v s0 -> lattice_for_related prerelated0 v s1}
         {related1_monotonic : forall s0 s1, (s0 <= s1)%fixedpoint -> forall v, lattice_for_related prerelated1 v s0 -> lattice_for_related prerelated1 v s1}
    : forall s0 s1, (s0 <= s1)%fixedpoint -> forall v, lattice_for_related prod_prerelated v s0 -> lattice_for_related prod_prerelated v s1.
admit.
Defined.

  Lemma prod_lub_correct
        (lub0_correct : forall P1 st1,
            lattice_for_related prerelated0 P1 st1
            -> forall P2 st2,
              lattice_for_related prerelated0 P2 st2
              -> lattice_for_related prerelated0 (ensemble_least_upper_bound P1 P2) (st1 ⊔ st2)%fixedpoint)
        (lub1_correct : forall P1 st1,
            lattice_for_related prerelated1 P1 st1
            -> forall P2 st2,
              lattice_for_related prerelated1 P2 st2
              -> lattice_for_related prerelated1 (ensemble_least_upper_bound P1 P2) (st1 ⊔ st2)%fixedpoint)
    : forall P1 st1,
      lattice_for_related prod_prerelated P1 st1
      -> forall P2 st2,
        lattice_for_related prod_prerelated P2 st2
        -> lattice_for_related prod_prerelated (ensemble_least_upper_bound P1 P2) (st1 ⊔ st2)%fixedpoint.
admit.
Defined.

  Lemma prod_on_terminal_correct
        (on_terminal0 : (Char -> bool) -> lattice_for T0)
        (on_terminal1 : (Char -> bool) -> lattice_for T1)
        (on_terminal0_correct : forall P, lattice_for_related prerelated0 (ensemble_on_terminal P) (on_terminal0 P))
        (on_terminal1_correct : forall P, lattice_for_related prerelated1 (ensemble_on_terminal P) (on_terminal1 P))
    : forall P, lattice_for_related prod_prerelated (ensemble_on_terminal P) (prod_on_terminal on_terminal0 on_terminal1 P).
admit.
Defined.

  Lemma prod_on_nil_production_correct
        (on_nil_production0 : lattice_for T0)
        (on_nil_production1 : lattice_for T1)
        (on_nil_production0_correct : lattice_for_related prerelated0 ensemble_on_nil_production on_nil_production0)
        (on_nil_production1_correct : lattice_for_related prerelated1 ensemble_on_nil_production on_nil_production1)
    : lattice_for_related prod_prerelated ensemble_on_nil_production (prod_on_nil_production on_nil_production0 on_nil_production1).
admit.
Defined.

  Lemma prod_combine_production_dep_correct
        (precombine_production0 : T0 -> T0 -> lattice_for T0)
        (precombine_production1 : lattice_for T0 -> lattice_for T0 -> T1 -> T1 -> lattice_for T1)
        (combine_production0_correct : forall P1 st1,
            lattice_for_related prerelated0 P1 st1
            -> forall P2 st2,
              lattice_for_related prerelated0 P2 st2
              -> lattice_for_related prerelated0 (ensemble_combine_production P1 P2) (lattice_for_combine_production precombine_production0 st1 st2))
        (combine_production1_correct : forall P1 st1 st10,
            lattice_for_related prerelated0 P1 st10
            -> lattice_for_related prerelated1 P1 st1
            -> forall P2 st2 st20,
              lattice_for_related prerelated0 P2 st20
              -> lattice_for_related prerelated1 P2 st2
              -> lattice_for_related prerelated1 (ensemble_combine_production P1 P2) (lattice_for_combine_production (precombine_production1 st10 st20) st1 st2))
    : forall P1 st1,
      lattice_for_related prod_prerelated P1 st1
      -> forall P2 st2,
        lattice_for_related prod_prerelated P2 st2
        -> lattice_for_related prod_prerelated (ensemble_combine_production P1 P2) (lattice_for_combine_production (prod_precombine_production_dep precombine_production0 precombine_production1) st1 st2).
admit.
Defined.

  Lemma prod_combine_production_nondep_correct_specific
        (precombine_production0 : T0 -> T0 -> lattice_for T0)
        (precombine_production1 : T1 -> T1 -> lattice_for T1)
        P1 st1
        (Hrel1 : lattice_for_related prod_prerelated P1 st1)
        P2 st2
        (Hrel2 : lattice_for_related prod_prerelated P2 st2)
        (combine_production0_correct
         : forall st1v,
            st1 = constant st1v
            -> forall st2v,
              st2 = constant st2v
              -> lattice_for_related prerelated0 (ensemble_combine_production P1 P2) (lattice_for_combine_production precombine_production0 (fst st1v) (fst st2v)))
        (combine_production1_correct
         : forall st1v,
            st1 = constant st1v
            -> forall st2v,
              st2 = constant st2v
              -> lattice_for_related prerelated1 (ensemble_combine_production P1 P2) (lattice_for_combine_production precombine_production1 (snd st1v) (snd st2v)))
    : lattice_for_related prod_prerelated (ensemble_combine_production P1 P2) (lattice_for_combine_production (prod_precombine_production_nondep precombine_production0 precombine_production1) st1 st2).
admit.
Defined.
End aicdata.

Global Arguments prod_prerelated_ext {_ _ _ _ T0 T1 _ _ prerelated0 prerelated1} _ _ _ _ _ _ _ _.
Global Arguments prod_related_monotonic {_ _ T0 T1 _ _ prerelated0 prerelated1} _ _ _ _ _ _ _.
Global Arguments prod_lub_correct {_ _ T0 T1 _ _ prerelated0 prerelated1} _ _ _ _ _ _ _ _.
Global Arguments prod_on_terminal_correct {_ _ _ T0 T1 prerelated0 prerelated1 on_terminal0 on_terminal1} _ _ _.
Global Arguments prod_on_nil_production_correct {_ _ T0 T1 prerelated0 prerelated1 on_nil_production0 on_nil_production1} _ _.
Global Arguments prod_precombine_production_dep_Proper_le {T0 T1 _ _ precombine_production0 precombine_production1} _ _ _ _ _ _ _ _.
Global Arguments prod_combine_production_dep_correct {_ _ _ T0 T1 prerelated0 prerelated1 precombine_production0 precombine_production1} _ _ _ _ _ _ _ _.
Global Arguments prod_precombine_production_nondep_dep_Proper_le {T T0 T1 _ _ _ precombine_production0 precombine_production1} _ _ _ _ _ _ _ _ _ _ _ _ _ _.

End ProdAbstractInterpretationDefinitions.

Local Open Scope grammar_fixedpoint_scope.

Inductive nonemptyT := nonempty | could_be_empty.

Global Instance might_be_empty_lattice : grammar_fixedpoint_lattice_data nonemptyT.
admit.
Defined.

Global Instance might_be_empty_aidata {Char} : @AbstractInterpretation Char nonemptyT _.
admit.
Defined.

Section correctness.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}.

  Definition might_be_empty_accurate
             (P : String -> Prop) (nonemptyv : nonemptyT)
    : Prop
    := nonemptyv = nonempty -> forall str, P str -> length str <> 0.

  Global Instance might_be_empty_aicdata
    : AbstractInterpretationCorrectness might_be_empty_accurate.
admit.
Defined.
End correctness.

Definition might_be_emptyT := lattice_for nonemptyT.
Coercion collapse_might_be_empty (x : might_be_emptyT) : bool
  := match x with
     | ⊤ => true
     | constant could_be_empty => true
     | constant nonempty => false
     | ⊥ => false
     end.
Local Open Scope string_like_scope.

Section forall_chars.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}.

  Definition forall_chars (str : String) (P : Char -> Prop)
    := forall n ch,
         take 1 (drop n str) ~= [ ch ]
         -> P ch.
End forall_chars.

Section for_first_char.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}.

  Definition for_first_char (str : String) (P : Char -> Prop)
    := forall ch,
         take 1 str ~= [ ch ]
         -> P ch.
End for_first_char.

Section for_last_char.
  Context {Char} {HSLM : StringLikeMin Char} {HSL : StringLike Char} {HSLP : StringLikeProperties Char}.

  Definition for_last_char (str : String) (P : Char -> Prop)
    := forall ch,
         drop (pred (length str)) str ~= [ ch ]
         -> P ch.
End for_last_char.

Import Coq.MSets.MSetPositive.

Definition all_possible_ascii' : PositiveSet.t
  := List.fold_right
       PositiveSet.add
       PositiveSet.empty
       (List.map (fun x => BinPos.Pos.of_nat (S x))
                 (Operations.List.up_to (S (Ascii.nat_of_ascii (Ascii.Ascii true true true true true true true true))))).

Definition all_possible_ascii : PositiveSet.t
  := Eval compute in all_possible_ascii'.

Definition pos_of_ascii (x : Ascii.ascii) : BinNums.positive
  := match Ascii.N_of_ascii x with
     | BinNums.N0 => max_ascii
     | BinNums.Npos x => x
     end.

Definition all_but (P : Ascii.ascii -> bool) : PositiveSet.t
  := PositiveSet.filter (fun n => negb (P (Ascii.ascii_of_pos n))) all_possible_ascii.

  Definition possible_terminals_prestate
    := (@state _ might_be_empty_lattice
        * lattice_for
            (lattice_for
               (@state _ positive_set_fpdata
                * @state _ positive_set_fpdata )
             * @state _ positive_set_fpdata ))%type.

  Global Instance possible_terminals_aidata : @AbstractInterpretation Ascii.ascii possible_terminals_prestate _.
  Proof.
    refine (@prod_aidata_dep
              _ _ _ _ _
              on_terminal
              (@on_nil_production Ascii.ascii _ _ might_be_empty_aidata)
              (@precombine_production Ascii.ascii _ _ might_be_empty_aidata)
              (prod_on_terminal
                 (prod_on_terminal
                    (fun P => constant (all_but P))
                    (fun P => constant (all_but P)))
                 (fun P => constant (all_but P)))
              (prod_on_nil_production
                 (prod_on_nil_production
                    (constant all_possible_ascii)
                    (constant all_possible_ascii))
                 (constant all_possible_ascii))
              (fun xmbe ymbe
               => prod_precombine_production_nondep
                    (prod_precombine_production_nondep
                       (fun x' y'
                        => constant (if collapse_might_be_empty xmbe
                                     then PositiveSet.inter x' y'
                                     else x'))
                       (fun x' y'
                        => constant (if collapse_might_be_empty ymbe
                                     then PositiveSet.inter x' y'
                                     else y')))
                    (fun x' y'
                     => constant (PositiveSet.inter x' y')))
              _ _).
    intros x0 y0 H0 x1 y1 H1 x2 y2 H2 x3 y3 H3.
    repeat match goal with
           | [ H : is_true (state_beq ?x ?y) |- context[collapse_might_be_empty ?x] ]
             => replace (collapse_might_be_empty x)
                with (collapse_might_be_empty y)
               by (rewrite H; reflexivity);
                  clear x H
           end.
    repeat first [ eapply @prod_precombine_production_nondep_Proper
                 | eassumption
                 | match goal with
                   | [ |- context[collapse_might_be_empty ?v] ]
                     => destruct (collapse_might_be_empty v)
                   end ];
      clear; admit.
  Defined.

Section correctness.
  Context {HSLM : StringLikeMin Ascii.ascii} {HSL : StringLike Ascii.ascii} {HSLP : StringLikeProperties Ascii.ascii}.

  Definition possible_accurate
    : forall (P : String -> Prop) (st : possible_terminals_prestate), Prop
    := prod_prerelated
         might_be_empty_accurate
         (prod_prerelated
            (prod_prerelated
               (fun P st
                => forall str, P str -> for_first_char str (fun ch => ~PositiveSet.In (pos_of_ascii ch) st))
               (fun P st
                => forall str, P str -> for_last_char str (fun ch => ~PositiveSet.In (pos_of_ascii ch) st)))
            (fun P st
             => forall str, P str -> forall_chars str (fun ch => ~PositiveSet.In (pos_of_ascii ch) st))).

  Local Ltac pull_lattice_for_rect :=
    repeat lazymatch goal with
           | [ |- context G[match ?v with ⊤ => ?T | ⊥ => ?B | constant x => @?C x end] ]
             => let RT := type of T in
                let G' := context G[lattice_for_rect (fun _ => RT) T C B v] in
                change G'
           | [ |- context G[fun k : ?KT => match @?v k with ⊤ => @?T k | ⊥ => @?B k | constant x => @?C k x end] ]
             => let RT := match type of T with forall k, @?RT k => RT end in
                let G' := context G[fun k : KT => lattice_for_rect (fun _ => RT k) (T k) (C k) (B k) (v k)] in
                change G'; cbv beta
           | [ |- context G[fun k : ?KT => ?f match @?v k with ⊤ => @?T k | ⊥ => @?B k | constant x => @?C k x end (@?arg k)] ]
             => let RT := match type of T with forall k, @?RT k => RT end in
                let G' := context G[fun k : KT => f (lattice_for_rect (fun _ => RT k) (T k) (C k) (B k) (v k)) (arg k)] in
                change G'; cbv beta
           | [ |- context G[fun k : ?KT => ?f (@?arg k) match @?v k with ⊤ => @?T k | ⊥ => @?B k | constant x => @?C k x end] ]
             => let RT := match type of T with forall k, @?RT k => RT end in
                let G' := context G[fun k : KT => f (arg k) (lattice_for_rect (fun _ => RT k) (T k) (C k) (B k) (v k))] in
                change G'; cbv beta
           end;
    rewrite !(fun A T T' x y z => lattice_for_rect_pull (A := A) (lattice_for_rect (T := T) (fun _ => T') x y z));
    setoid_rewrite (fun A T T' x y z => lattice_for_rect_pull (A := A) (lattice_for_rect (T := T) (fun _ => T') x y z)).

  Global Instance constant_inter_Proper
    : Proper (prestate_le ==> prestate_le ==> state_le) (fun x' y' => constant (PositiveSet.inter x' y')).
admit.
Defined.

  Local Ltac t_combine_pre :=
    repeat first [ assumption
                 | progress intros
                 | progress subst
                 | progress cbv [prod_prerelated ensemble_combine_production lattice_for_related might_be_empty_accurate lattice_for_combine_production] in *
                 | progress simpl in *
                 | match goal with H : and _ _ |- _ => destruct H | H : prod _ _ |- _ => destruct H end ].
  Local Ltac t_combine :=
    t_combine_pre;
    pull_lattice_for_rect.

  Local Obligation Tactic := intros.

  Global Program Instance possible_aicdata
    : AbstractInterpretationCorrectness possible_accurate
    := { prerelated_ext
         := prod_prerelated_ext
              (@prerelated_ext Ascii.ascii _ _ _ _ _ _ _ might_be_empty_aicdata)
              (prod_prerelated_ext (prod_prerelated_ext _ _) _);
         related_monotonic
         := prod_related_monotonic
              (@related_monotonic Ascii.ascii _ _ _ _ _ _ _ might_be_empty_aicdata)
              (prod_related_monotonic (prod_related_monotonic _ _) _);
         lub_correct
         := prod_lub_correct
              (@lub_correct Ascii.ascii _ _ _ _ _ _ _ might_be_empty_aicdata)
              (prod_lub_correct (prod_lub_correct _ _) _);
         on_terminal_correct
         := prod_on_terminal_correct
              (@on_terminal_correct Ascii.ascii _ _ _ _ _ _ _ might_be_empty_aicdata)
              (prod_on_terminal_correct (prod_on_terminal_correct _ _) _);
         on_nil_production_correct
         := prod_on_nil_production_correct
              (@on_nil_production_correct Ascii.ascii _ _ _ _ _ _ _ might_be_empty_aicdata)
              (prod_on_nil_production_correct (prod_on_nil_production_correct _ _) _);
         precombine_production_Proper_le
         := prod_precombine_production_dep_Proper_le
              (@precombine_production_Proper_le Ascii.ascii _ _ _ _ _ _ _ might_be_empty_aicdata)
              (prod_precombine_production_nondep_dep_Proper_le (prod_precombine_production_nondep_dep_Proper_le _ _) _);
         combine_production_correct
         := prod_combine_production_dep_correct
              (@combine_production_correct Ascii.ascii _ _ _ _ _ _ _ might_be_empty_aicdata)
              (fun P1 st1 st10 R10 R1 P2 st2 st20 R20 R2
               => prod_combine_production_nondep_correct_specific
                    _ _ _ _ _ _ _ _
                    (fun st1v Hst1v st2v Hst2v
                     => prod_combine_production_nondep_correct_specific
                          _ _ _ _ _ _ _ _ _ _)
                    _)
       }.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
admit.
Defined.
  Next Obligation.
{
 t_combine.

The error message occurs in setoid_rewrite (fun A T T' x y z => lattice_for_rect_pull (A := A) (lattice_for_rect (T := T) (fun _ => T') x y z)), btw.

@JasonGross
Copy link
Member

@ppedrot, I hope this is helpful!

@ppedrot
Copy link
Member Author

ppedrot commented Jun 21, 2021

@JasonGross yes, thanks a lot. I'll try to understand what's going on now.

@ppedrot
Copy link
Member Author

ppedrot commented Jun 21, 2021

Here is a much smaller test:

From Coq Require Import Setoid Morphisms.

Axiom lattice_for : Type -> Type.
Axiom constant : forall {T : Type}, T -> lattice_for T.

Axiom lattice_for_rect :
forall [T : Type] (P : Type), (forall t : T, P) -> forall l : lattice_for T, P.

#[local]
Declare Instance lattice_for_rect_Proper_85 : forall {A},
  Proper (forall_relation (fun _ => eq) ==> eq ==> Basics.flip Basics.impl)
           (@lattice_for_rect A Prop) | 3.

Axiom lattice_rewrite :
  forall (A T T' : Type) (x : T -> T') (c : A -> lattice_for T)
      (v : lattice_for A),
    lattice_for_rect T' x (lattice_for_rect (lattice_for T) c v) =
    lattice_for_rect T' (fun x0 : A => lattice_for_rect T' x (c x0)) v.

Axiom collapse_might_be_empty : bool.

Axiom PosSet : Type.
Axiom PosSet_inter : PosSet -> PosSet -> PosSet.

Goal
forall
  (l2 : lattice_for PosSet)
  (l0 : lattice_for PosSet),
  lattice_for_rect Prop
    (fun x : PosSet =>
     lattice_for_rect Prop
       (fun _ : PosSet => True)
       (lattice_for_rect (lattice_for PosSet)
          (fun y' : PosSet =>
           constant
             (if collapse_might_be_empty then PosSet_inter x y' else y')) l0)) l2
.
Proof.
intros.
rewrite lattice_rewrite.
(* Unbound rel in the goal *)
match goal with [ |- ?T ] => let _ := type of T in idtac end.

ppedrot added a commit to ppedrot/coq that referenced this pull request Jun 21, 2021
@ppedrot ppedrot force-pushed the cache-constr-annotation-unfication-matchrec branch from ec55829 to 74b37f2 Compare June 21, 2021 15:24
@ppedrot
Copy link
Member Author

ppedrot commented Jun 21, 2021

OK, this should be working now. I stupidly forgot to accumulate the highest free variable in the branches of a case. I added the minimized test for good measure.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 21, 2021

Hey, I have detected that there were CI failures at commit 74b37f2 without any failure in the test-suite.
I checked that the corresponding jobs for the base commit 6025946 succeeded. You can ask me to try to extract a minimal test case from this so that it can be added to the test-suite.
If you tag me saying @coqbot ci minimize, I will minimize the following target: ci-metacoq.

@JasonGross
Copy link
Member

@coqbot CI minimize

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 21, 2021

I have initiated minimization at commit 74b37f2 for the suggested target ci-metacoq as requested.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 21, 2021

Error: Could not minimize file (from ci-metacoq) (full log on GitHub Actions)

build log (truncated to last 26KiB; full 1.8MiB file on GitHub Actions Artifacts under build.log)
lating: _build_ci/metacoq/template-coq/theories/.Reflect.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.TemplateMonad.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.TermEquality.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.Typing.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.TypingWf.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.UnivSubst.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.Universes.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.WcbvEval.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.WfInv.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.config.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.gitignore  
  inflating: _build_ci/metacoq/template-coq/theories/.monad_utils.aux  
  inflating: _build_ci/metacoq/template-coq/theories/.utils.aux  
  inflating: _build_ci/metacoq/template-coq/theories/All.glob  
  inflating: _build_ci/metacoq/template-coq/theories/All.v  
  inflating: _build_ci/metacoq/template-coq/theories/All.vo  
  inflating: _build_ci/metacoq/template-coq/theories/All.vok  
  inflating: _build_ci/metacoq/template-coq/theories/All.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Ast.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Ast.v  
  inflating: _build_ci/metacoq/template-coq/theories/Ast.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Ast.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Ast.vos  
  inflating: _build_ci/metacoq/template-coq/theories/AstUtils.glob  
  inflating: _build_ci/metacoq/template-coq/theories/AstUtils.v  
  inflating: _build_ci/metacoq/template-coq/theories/AstUtils.vo  
  inflating: _build_ci/metacoq/template-coq/theories/AstUtils.vok  
  inflating: _build_ci/metacoq/template-coq/theories/AstUtils.vos  
  inflating: _build_ci/metacoq/template-coq/theories/BasicAst.glob  
  inflating: _build_ci/metacoq/template-coq/theories/BasicAst.v  
  inflating: _build_ci/metacoq/template-coq/theories/BasicAst.vo  
  inflating: _build_ci/metacoq/template-coq/theories/BasicAst.vok  
  inflating: _build_ci/metacoq/template-coq/theories/BasicAst.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Checker.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Checker.v  
  inflating: _build_ci/metacoq/template-coq/theories/Checker.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Checker.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Checker.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Constants.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Constants.v  
  inflating: _build_ci/metacoq/template-coq/theories/Constants.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Constants.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Constants.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Environment.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Environment.v  
  inflating: _build_ci/metacoq/template-coq/theories/Environment.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Environment.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Environment.vos  
  inflating: _build_ci/metacoq/template-coq/theories/EnvironmentTyping.glob  
  inflating: _build_ci/metacoq/template-coq/theories/EnvironmentTyping.v  
  inflating: _build_ci/metacoq/template-coq/theories/EnvironmentTyping.vo  
  inflating: _build_ci/metacoq/template-coq/theories/EnvironmentTyping.vok  
  inflating: _build_ci/metacoq/template-coq/theories/EnvironmentTyping.vos  
  inflating: _build_ci/metacoq/template-coq/theories/ExtractableLoader.glob  
  inflating: _build_ci/metacoq/template-coq/theories/ExtractableLoader.v  
  inflating: _build_ci/metacoq/template-coq/theories/ExtractableLoader.vo  
  inflating: _build_ci/metacoq/template-coq/theories/ExtractableLoader.vok  
  inflating: _build_ci/metacoq/template-coq/theories/ExtractableLoader.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Extraction.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Extraction.v  
  inflating: _build_ci/metacoq/template-coq/theories/Extraction.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Extraction.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Extraction.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Induction.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Induction.v  
  inflating: _build_ci/metacoq/template-coq/theories/Induction.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Induction.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Induction.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Kernames.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Kernames.v  
  inflating: _build_ci/metacoq/template-coq/theories/Kernames.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Kernames.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Kernames.vos  
  inflating: _build_ci/metacoq/template-coq/theories/LiftSubst.glob  
  inflating: _build_ci/metacoq/template-coq/theories/LiftSubst.v  
  inflating: _build_ci/metacoq/template-coq/theories/LiftSubst.vo  
  inflating: _build_ci/metacoq/template-coq/theories/LiftSubst.vok  
  inflating: _build_ci/metacoq/template-coq/theories/LiftSubst.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Loader.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Loader.v  
  inflating: _build_ci/metacoq/template-coq/theories/Loader.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Loader.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Loader.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Normal.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Normal.v  
  inflating: _build_ci/metacoq/template-coq/theories/Normal.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Normal.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Normal.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Pretty.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Pretty.v  
  inflating: _build_ci/metacoq/template-coq/theories/Pretty.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Pretty.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Pretty.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Reduction.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Reduction.v  
  inflating: _build_ci/metacoq/template-coq/theories/Reduction.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Reduction.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Reduction.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Reflect.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Reflect.v  
  inflating: _build_ci/metacoq/template-coq/theories/Reflect.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Reflect.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Reflect.vos  
   creating: _build_ci/metacoq/template-coq/theories/TemplateMonad/
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad.glob  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad.v  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad.vo  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad.vok  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad.vos  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/.Common.aux  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/.Core.aux  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/.Extractable.aux  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Common.glob  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Common.v  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Common.vo  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Common.vok  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Common.vos  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Core.glob  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Core.v  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Core.vo  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Core.vok  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Core.vos  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Extractable.glob  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Extractable.v  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Extractable.vo  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Extractable.vok  
  inflating: _build_ci/metacoq/template-coq/theories/TemplateMonad/Extractable.vos  
  inflating: _build_ci/metacoq/template-coq/theories/TermEquality.glob  
  inflating: _build_ci/metacoq/template-coq/theories/TermEquality.v  
  inflating: _build_ci/metacoq/template-coq/theories/TermEquality.vo  
  inflating: _build_ci/metacoq/template-coq/theories/TermEquality.vok  
  inflating: _build_ci/metacoq/template-coq/theories/TermEquality.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Typing.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Typing.v  
  inflating: _build_ci/metacoq/template-coq/theories/Typing.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Typing.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Typing.vos  
  inflating: _build_ci/metacoq/template-coq/theories/TypingWf.glob  
  inflating: _build_ci/metacoq/template-coq/theories/TypingWf.v  
  inflating: _build_ci/metacoq/template-coq/theories/TypingWf.vo  
  inflating: _build_ci/metacoq/template-coq/theories/TypingWf.vok  
  inflating: _build_ci/metacoq/template-coq/theories/TypingWf.vos  
  inflating: _build_ci/metacoq/template-coq/theories/UnivSubst.glob  
  inflating: _build_ci/metacoq/template-coq/theories/UnivSubst.v  
  inflating: _build_ci/metacoq/template-coq/theories/UnivSubst.vo  
  inflating: _build_ci/metacoq/template-coq/theories/UnivSubst.vok  
  inflating: _build_ci/metacoq/template-coq/theories/UnivSubst.vos  
  inflating: _build_ci/metacoq/template-coq/theories/Universes.glob  
  inflating: _build_ci/metacoq/template-coq/theories/Universes.v  
  inflating: _build_ci/metacoq/template-coq/theories/Universes.vo  
  inflating: _build_ci/metacoq/template-coq/theories/Universes.vok  
  inflating: _build_ci/metacoq/template-coq/theories/Universes.vos  
  inflating: _build_ci/metacoq/template-coq/theories/WcbvEval.glob  
  inflating: _build_ci/metacoq/template-coq/theories/WcbvEval.v  
  inflating: _build_ci/metacoq/template-coq/theories/WcbvEval.vo  
  inflating: _build_ci/metacoq/template-coq/theories/WcbvEval.vok  
  inflating: _build_ci/metacoq/template-coq/theories/WcbvEval.vos  
  inflating: _build_ci/metacoq/template-coq/theories/WfInv.glob  
  inflating: _build_ci/metacoq/template-coq/theories/WfInv.v  
  inflating: _build_ci/metacoq/template-coq/theories/WfInv.vo  
  inflating: _build_ci/metacoq/template-coq/theories/WfInv.vok  
  inflating: _build_ci/metacoq/template-coq/theories/WfInv.vos  
   creating: _build_ci/metacoq/template-coq/theories/common/
  inflating: _build_ci/metacoq/template-coq/theories/common/.uGraph.aux  
  inflating: _build_ci/metacoq/template-coq/theories/common/uGraph.glob  
  inflating: _build_ci/metacoq/template-coq/theories/common/uGraph.v  
  inflating: _build_ci/metacoq/template-coq/theories/common/uGraph.vo  
  inflating: _build_ci/metacoq/template-coq/theories/common/uGraph.vok  
  inflating: _build_ci/metacoq/template-coq/theories/common/uGraph.vos  
  inflating: _build_ci/metacoq/template-coq/theories/config.glob  
  inflating: _build_ci/metacoq/template-coq/theories/config.v  
  inflating: _build_ci/metacoq/template-coq/theories/config.vo  
  inflating: _build_ci/metacoq/template-coq/theories/config.vok  
  inflating: _build_ci/metacoq/template-coq/theories/config.vos  
  inflating: _build_ci/metacoq/template-coq/theories/monad_utils.glob  
  inflating: _build_ci/metacoq/template-coq/theories/monad_utils.v  
  inflating: _build_ci/metacoq/template-coq/theories/monad_utils.vo  
  inflating: _build_ci/metacoq/template-coq/theories/monad_utils.vok  
  inflating: _build_ci/metacoq/template-coq/theories/monad_utils.vos  
   creating: _build_ci/metacoq/template-coq/theories/utils/
  inflating: _build_ci/metacoq/template-coq/theories/utils.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.All_Forall.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.LibHypsNaming.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCArith.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCCompare.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCEquality.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCList.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCOption.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCPrelude.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCProd.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCRelations.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCSquash.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCString.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.MCUtils.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/.wGraph.aux  
  inflating: _build_ci/metacoq/template-coq/theories/utils/All_Forall.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/All_Forall.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/All_Forall.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/All_Forall.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/All_Forall.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/LibHypsNaming.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/LibHypsNaming.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/LibHypsNaming.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/LibHypsNaming.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/LibHypsNaming.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCArith.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCArith.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCArith.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCArith.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCArith.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCCompare.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCCompare.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCCompare.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCCompare.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCCompare.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCEquality.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCEquality.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCEquality.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCEquality.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCEquality.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCList.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCList.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCList.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCList.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCList.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCOption.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCOption.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCOption.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCOption.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCOption.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCPrelude.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCPrelude.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCPrelude.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCPrelude.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCPrelude.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCProd.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCProd.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCProd.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCProd.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCProd.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCRelations.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCRelations.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCRelations.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCRelations.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCRelations.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCSquash.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCSquash.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCSquash.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCSquash.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCSquash.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCString.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCString.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCString.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCString.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCString.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCUtils.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCUtils.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCUtils.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCUtils.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MCUtils.vos  
  inflating: _build_ci/metacoq/template-coq/theories/utils/MC_ExtrOCamlInt63.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/wGraph.glob  
  inflating: _build_ci/metacoq/template-coq/theories/utils/wGraph.v  
  inflating: _build_ci/metacoq/template-coq/theories/utils/wGraph.vo  
  inflating: _build_ci/metacoq/template-coq/theories/utils/wGraph.vok  
  inflating: _build_ci/metacoq/template-coq/theories/utils/wGraph.vos  
  inflating: _build_ci/metacoq/template-coq/update_plugin.sh  
   creating: _build_ci/metacoq/test-suite/
  inflating: _build_ci/metacoq/test-suite/CheckerTest.v  
  inflating: _build_ci/metacoq/test-suite/Makefile  
  inflating: _build_ci/metacoq/test-suite/Makefile.coq.local  
  inflating: _build_ci/metacoq/test-suite/_CoqProject  
  inflating: _build_ci/metacoq/test-suite/bug1.v  
  inflating: _build_ci/metacoq/test-suite/bug2.v  
  inflating: _build_ci/metacoq/test-suite/bug5.v  
  inflating: _build_ci/metacoq/test-suite/bug6.v  
  inflating: _build_ci/metacoq/test-suite/bug7.v  
  inflating: _build_ci/metacoq/test-suite/bug8.v  
  inflating: _build_ci/metacoq/test-suite/bugkncst.v  
  inflating: _build_ci/metacoq/test-suite/case.v  
  inflating: _build_ci/metacoq/test-suite/castprop.v  
  inflating: _build_ci/metacoq/test-suite/cofix.v  
  inflating: _build_ci/metacoq/test-suite/erasure_live_test.v  
  inflating: _build_ci/metacoq/test-suite/erasure_test.v  
  inflating: _build_ci/metacoq/test-suite/evars.v  
  inflating: _build_ci/metacoq/test-suite/extractable.v  
  inflating: _build_ci/metacoq/test-suite/hnf_ctor.v  
  inflating: _build_ci/metacoq/test-suite/int.v  
  inflating: _build_ci/metacoq/test-suite/issue27.v  
  inflating: _build_ci/metacoq/test-suite/issue28.v  
  inflating: _build_ci/metacoq/test-suite/issue453.v  
  inflating: _build_ci/metacoq/test-suite/letin.v  
  inflating: _build_ci/metacoq/test-suite/modules_sections.v  
  inflating: _build_ci/metacoq/test-suite/mutind.v  
  inflating: _build_ci/metacoq/test-suite/opaque.v  
  inflating: _build_ci/metacoq/test-suite/order_rec.v  
   creating: _build_ci/metacoq/test-suite/plugin-demo/
  inflating: _build_ci/metacoq/test-suite/plugin-demo/.gitignore  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/Makefile  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/Makefile.plugin.local  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/README.md  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/_CoqProject  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/_PluginProject  
   creating: _build_ci/metacoq/test-suite/plugin-demo/gen-src/
  inflating: _build_ci/metacoq/test-suite/plugin-demo/gen-src/to-lower.sh  
   creating: _build_ci/metacoq/test-suite/plugin-demo/src/
  inflating: _build_ci/metacoq/test-suite/plugin-demo/src/demo_plugin.mlpack  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/src/g_demo_plugin.mlg  
   creating: _build_ci/metacoq/test-suite/plugin-demo/test/
  inflating: _build_ci/metacoq/test-suite/plugin-demo/test/test.v  
   creating: _build_ci/metacoq/test-suite/plugin-demo/theories/
  inflating: _build_ci/metacoq/test-suite/plugin-demo/theories/Extraction.v  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/theories/Lens.v  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/theories/Loader.v  
  inflating: _build_ci/metacoq/test-suite/plugin-demo/theories/MyPlugin.v  
  inflating: _build_ci/metacoq/test-suite/primitive.v  
  inflating: _build_ci/metacoq/test-suite/proj.v  
  inflating: _build_ci/metacoq/test-suite/run_in_tactic.v  
  inflating: _build_ci/metacoq/test-suite/safechecker_test.v  
  inflating: _build_ci/metacoq/test-suite/sprop_tests.v  
  inflating: _build_ci/metacoq/test-suite/tmExistingInstance.v  
  inflating: _build_ci/metacoq/test-suite/tmFreshName.v  
  inflating: _build_ci/metacoq/test-suite/tmInferInstance.v  
  inflating: _build_ci/metacoq/test-suite/tmVariable.v  
  inflating: _build_ci/metacoq/test-suite/unfold.v  
  inflating: _build_ci/metacoq/test-suite/univ.v  
  inflating: _build_ci/metacoq/test-suite/vs.v  
   creating: _build_ci/metacoq/translations/
  inflating: _build_ci/metacoq/translations/Makefile  
  inflating: _build_ci/metacoq/translations/Makefile.coq.local  
  inflating: _build_ci/metacoq/translations/MiniHoTT.v  
  inflating: _build_ci/metacoq/translations/MiniHoTT_paths.v  
  inflating: _build_ci/metacoq/translations/README.md  
  inflating: _build_ci/metacoq/translations/_CoqProject.in  
  inflating: _build_ci/metacoq/translations/metacoq-config  
  inflating: _build_ci/metacoq/translations/param_binary.v  
  inflating: _build_ci/metacoq/translations/param_cheap_packed.v  
  inflating: _build_ci/metacoq/translations/param_generous_packed.v  
  inflating: _build_ci/metacoq/translations/param_generous_unpacked.v  
  inflating: _build_ci/metacoq/translations/param_original.v  
  inflating: _build_ci/metacoq/translations/sigma.v  
  inflating: _build_ci/metacoq/translations/standard_model.v  
  inflating: _build_ci/metacoq/translations/times_bool_fun.v  
  inflating: _build_ci/metacoq/translations/times_bool_fun2.v  
  inflating: _build_ci/metacoq/translations/translation_utils.v  
++ popd
/github/workspace/builds/coq /github/workspace
++ echo ::endgroup::
::endgroup::
++ echo '::group::download passing artifacts @ 60259469496e4592156c1a900ba4ce19b685f6d5 https://gitlab.com/coq/coq/-/jobs/1363212529/artifacts/download https://gitlab.com/coq/coq/-/jobs/1363154856/artifacts/download'
::group::download passing artifacts @ 60259469496e4592156c1a900ba4ce19b685f6d5 https://gitlab.com/coq/coq/-/jobs/1363212529/artifacts/download https://gitlab.com/coq/coq/-/jobs/1363154856/artifacts/download
++ echo '::warning::download passing artifacts @ 60259469496e4592156c1a900ba4ce19b685f6d5 https://gitlab.com/coq/coq/-/jobs/1363212529/artifacts/download https://gitlab.com/coq/coq/-/jobs/1363154856/artifacts/download'
::warning::download passing artifacts @ 60259469496e4592156c1a900ba4ce19b685f6d5 https://gitlab.com/coq/coq/-/jobs/1363212529/artifacts/download https://gitlab.com/coq/coq/-/jobs/1363154856/artifacts/download
++ pushd coq-passing
/github/workspace/builds/coq/coq-passing /github/workspace/builds/coq /github/workspace
++ git checkout 60259469496e4592156c1a900ba4ce19b685f6d5
Note: checking out '60259469496e4592156c1a900ba4ce19b685f6d5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 6025946949 Merge PR #14526: Explain how to fix locality warnings
++ for i in ${PASSING_ARTIFACT_URLS}
+++ sha1sum
+++ cut '-d ' -f1
+++ echo https://gitlab.com/coq/coq/-/jobs/1363212529/artifacts/download
++ hash=bb9db779da664c8916be9ebe5e2248d5ffef9ecc
++ wget https://gitlab.com/coq/coq/-/jobs/1363212529/artifacts/download -O artifact-bb9db779da664c8916be9ebe5e2248d5ffef9ecc.zip
--2021-06-21 19:10:46--  https://gitlab.com/coq/coq/-/jobs/1363212529/artifacts/download
Resolving gitlab.com (gitlab.com)... 172.65.251.78, 2606:4700:90:0:f22e:fbec:5bed:a9b9
Connecting to gitlab.com (gitlab.com)|172.65.251.78|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-06-21 19:10:46 ERROR 404: Not Found.
minimizer log

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.

@JasonGross
Copy link
Member

Hmmm, seems like the version of master this is based on is too old. (Maybe we should make artifacts persist for longer @Zimmi48 ?). @ppedrot , mind rebasing this on latest master (perhaps on top of the recent fix for the build:base job)?

ppedrot added a commit to ppedrot/coq that referenced this pull request Jun 21, 2021
@ppedrot ppedrot force-pushed the cache-constr-annotation-unfication-matchrec branch from 74b37f2 to cafc76b Compare June 21, 2021 20:24
@ppedrot
Copy link
Member Author

ppedrot commented Jun 21, 2021

@JasonGross done. This is what I call bleeding edge...

@ppedrot
Copy link
Member Author

ppedrot commented Jun 21, 2021

@JasonGross looks like metacoq is broken on master, this is unrelated to this PR.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 21, 2021

Hey, I have detected that there were CI failures at commit cafc76b without any failure in the test-suite.
I checked that the corresponding jobs for the base commit 76e20b5 succeeded. You can ask me to try to extract a minimal test case from this so that it can be added to the test-suite.
If you tag me saying @coqbot ci minimize, I will minimize the following target: ci-metacoq.

@Zimmi48
Copy link
Member

Zimmi48 commented Jun 22, 2021

Hmmm, seems like the version of master this is based on is too old.

The reason for the failure was that the base:build job was cancelled (and thus ci-metacoq was skipped). We should probably find a way of improving the reports for cancelled and skipped jobs.

@Zimmi48
Copy link
Member

Zimmi48 commented Jun 22, 2021

I checked that the corresponding jobs for the base commit 76e20b5 succeeded.

Hum, that's weird because the corresponding job for the base commit failed in this case: https://gitlab.com/coq/coq/-/jobs/1364637965

We introduce a new internal type of annotated terms which are essentially a pair
of a term and an annotation, in a recursive way. The annotation is a boolean
standing for the closedness of the term. This guarantees a O(1) access
to the underlying term, as well as a O(1) access to closedness. Building
the annotation is O(n) in the term and is an upfront cost payed before entering
the recursion.

This trick could be generalized to any annotation which is local, i.e. only depends
on the data of the direct subterms of a term. There are various places that could
benefit from it, but for the time being I do not want to introduce yet another
generic term API.
@ppedrot ppedrot force-pushed the cache-constr-annotation-unfication-matchrec branch from cafc76b to 226c823 Compare June 23, 2021 11:48
@ppedrot
Copy link
Member Author

ppedrot commented Jun 23, 2021

This is ready and needs an assignee. @SkySkimmer ?

@SkySkimmer SkySkimmer self-assigned this Jun 24, 2021
@SkySkimmer
Copy link
Contributor

@coqbot: merge now

@coqbot-app coqbot-app bot merged commit bfd27a1 into coq:master Jun 24, 2021
@ppedrot ppedrot deleted the cache-constr-annotation-unfication-matchrec branch June 24, 2021 08:55
jfehrle pushed a commit to jfehrle/coq that referenced this pull request Sep 21, 2021
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
4 participants