Closed Ptival closed 4 years ago
Oh yeah, basically zero plugins support universe polymorphism :/
But I'm not sure if that's the particular issue here. I'll take a look.
When you run this the first time, what definition does it say that it is working on before you hit this error?
When I run the Preprocess command on existing Coq modules, the Transforming <term>
messages don't seem to be emitted.
e.g.
Preprocess Module Coq.Init.Datatypes as Datatypes'.
I do see the output for those, which is why I find it confusing. In CoqIDE they show up. Can you try running it via coqc on command line?
Though it does not print it for dependencies it pulls in, which is a bug I need to fix
[...]
Transforming identity
Transforming identity_rect
Transforming identity_ind
Transforming identity_rec
Transforming ID
Transforming id
Transforming IDProp
Transforming idProp
[error here]
I pushed better reporting that prints when it transforming dependencies, too. The last message before the error is:
Transforming dependency Coq.Classes.RelationClasses.StrictOrder_Transitive
I will look into why this fails and whether we need to work around it or fix it in the plugin.
Full function definition is:
RelationClasses.StrictOrder_Transitive =
fun (A : Type) (R : Relation_Definitions.relation A)
(StrictOrder : @RelationClasses.StrictOrder A R) =>
match StrictOrder return (@RelationClasses.Transitive A R) with
| RelationClasses.Build_StrictOrder _ _ StrictOrder_Transitive =>
StrictOrder_Transitive
end
For now, you can run it with the following opaque definitions (of course this can cause problems if you want to lift them in DEVOID later, and may mean that you need to make things that depend on them opaque later too):
Preprocess Module Coq.ZArith.BinInt as BinInt'
{ opaque
Coq.Classes.RelationClasses.StrictOrder_Transitive
Coq.Classes.RelationClasses.StrictOrder_Irreflexive
Coq.Classes.RelationClasses.Equivalence_Transitive
Coq.Classes.RelationClasses.Equivalence_Reflexive
Coq.Classes.RelationClasses.Equivalence_Symmetric
Coq.Classes.RelationClasses.PER_Symmetric
Coq.Classes.RelationClasses.PER_Transitive
Coq.PArith.BinPos.Pos.add_reg_r
Coq.PArith.BinPos.Pos.add_no_neutral
Coq.PArith.BinPos.Pos.compare_sub_mask
Coq.PArith.BinPos.Pos.sub_mask_carry_spec
Coq.PArith.BinPos.Pos.sub_mask_carry
Coq.PArith.BinPos.Pos.add_carry
Coq.PArith.BinPos.Pos.sub_mask
Coq.PArith.BinPos.Pos.peano_rect
Coq.PArith.BinPos.Pos.add
}.
I will look at the particular definitions and try to figure out why this is happening. Some of them are mutual recursion, but some of them like StrictOrder_Transitive
I just don't know.
Ah, the root cause seems to be that Scheme induction
defines induction principles that look different from the ones that Coq defines for inductive types in Prop
more generally. So when you generate induction schema for Prop, you should write:
Scheme Minimality for Coq.Classes.RelationClasses.StrictOrder Sort Prop.
The following thus works:
From Coq Require Import ZArith.BinInt.
Scheme Minimality for Coq.Classes.RelationClasses.StrictOrder Sort Prop.
Scheme Induction for Coq.Classes.RelationClasses.StrictOrder Sort Set.
Scheme Induction for Coq.Classes.RelationClasses.StrictOrder Sort Type.
Scheme Minimality for Coq.Classes.RelationClasses.Equivalence Sort Prop.
Scheme Minimality for Coq.Classes.RelationClasses.PER Sort Prop.
Preprocess Module Coq.ZArith.BinInt as BinInt'
{ opaque
Coq.PArith.BinPos.Pos.add_reg_r
Coq.PArith.BinPos.Pos.add_no_neutral
Coq.PArith.BinPos.Pos.compare_sub_mask
Coq.PArith.BinPos.Pos.sub_mask_carry_spec
Coq.PArith.BinPos.Pos.sub_mask_carry
Coq.PArith.BinPos.Pos.add_carry
Coq.PArith.BinPos.Pos.sub_mask
Coq.PArith.BinPos.Pos.peano_rect
Coq.PArith.BinPos.Pos.add
}.
The rest appear to be mutual recursion.
I unfortunately don't know how to provide good error messaging for this.
Updated the README and added much better error messaging for all of these situations.
The following:
results in the error:
The code in CRelationClasses is universe-polymorphic, which does not seem to be supported, so this might be a cause for the trouble. Not sure how to work around this.