Terms as types in Coq

拟墨画扇 提交于 2019-12-12 05:49:55

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!