问题
Parameter R: Type.
Parameter P: R.
Parameter O: P. (*Error: The term "P" has type "R" which should be Set, Prop or Type.*)
doesn't work because terms can't have terms in Coq. How can we bypass this restriction? One would imagine several possibilities: parametrization, subset types, classes, records, ensembles, explicit universe levels... My question is about the recommended and easiest way(s) of implementing terms as types in Coq (along w/ MWEs). PS. I don't assume the "recommended" and "easiest" to coincide.
A simple example would be
Parameter Obj: Type.
Parameter Phy Int: Obj. (*physical, intelligent*)
Parameter tree house: Phy.
回答1:
An answer based on a suggestion and subsequent semi-refutation @ejgallego:
Let Obj := Type.
Let Phy:Obj := Type.
Let tree:Phy := Type.
Parameter house branch leaf: Phy.
Let oak:tree := Type.
Let moldyoak:oak := Type.
Parameter moldyoak1:moldyoak.
Parameter moldyoak11:moldyoak1.
The solution is consistent but unsound:
Check nat:moldyoak. (*(nat:moldyoak) : moldyoak*)
So we're looking for another one
来源:https://stackoverflow.com/questions/38313727/terms-as-types-in-coq