Defining constants using existence proofs in Coq

萝らか妹 提交于 2019-12-01 18:16:04

问题


After proving an existence statement, it is often notationally convenient to introduce a constant symbol for some witness of this theorem.

As a simple example, it is much more simple to write (in typical mathematical notation)

∀x. ∅ ⊆ x.

than it is to write

∀x. ∃y. empty(y) and y ⊆ x.

I am looking to replicate this effect in Coq. Here is the basic scenario I am encountering and my attempt which leads to an error (now in real Coq code):

Variable A:Type.
Hypothesis inhabited: exists x:A, x=x.

Definition inhabitant:A.
  destruct inhabited.  
  (*Error: Case analysis on sort Type is not allowed for inductive definition ex.*)

I am wondering what this error message even means and if there is any way to get around this. Thanks!


回答1:


Your issue is related to the usual Prop vs Type distinction. The existence of your witness lies in Prop (see definition of type ex), so you can't inspect it to build a concrete term, you need to have this fact proved in Type.

You are looking for the sig (or a variation like sigS or sigT) type whose notation is :

Hypothesis inhabited : {x : A | x = x }.


来源:https://stackoverflow.com/questions/28765188/defining-constants-using-existence-proofs-in-coq

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