If I have the following line:
Definition Foo : Set := list nat.
then I compile with no problems.
However, suppose I want to do the same with Coq.Lists.ListSet
, a library representing finite sets as lists:
(*Section first_definitions.
Variable A : Type.
Definition listset := list A.*)
Definition Bar : Set := listset nat.
I get the following error:
The term "listset nat" has type "Type" while it is expected to have type
"Set" (universe inconsistency).
- Is there a way to "cast"
listset
so that it lives inSet
instead ofType
? i.e. If I know I'm going to be usinglistset
with parameters of typeSet
, is there a way to make it live in theSet
heirarchy somehow? - Why does the error happen for
listset
, but not forlist
, whenlistset
is defined to belist
?
Note: The actual type is called set
, but I've renamed it to listset
to avoid confusion with the sort Set
.
EDIT: =
replaced with :=
Because
list
is a template universe polymorphic inductive definition (seeAbout list.
), which in this case means that iflist
is applied to a type inSet
, the result is still inSet
.AFAIK, there is no way to make definitions template universe polymorphic, but you can make them universe polymorphic like so:
One more option is to use
Set Universe Polymorphism
command so you won't need to prepend your definitions with thePolymorphic
keyword. This feature has experimental status at the time of writing. And it does not apply retroactively, so I guess you would need to fork your ownListSet
.