无法在定义中使用 destruct tatic 时遇到问题

Have problem with unable to use destruct tatic in a Definition

我正在使用 coq 中的定义,它需要从定理中产生一些东西,但不能在定义中析构。

Theorem sp : forall (X : Type) (T : X -> Prop)..... , exists (a : X), T a.
Definition yield_sp : (X : Type) (T : X -> Prop) (H : sp X T .....)..... : X.

当我试图破坏 H 时,coq 警告说

Case analysis on sort Type is not allowed for inductive definition ex.

我想知道它的原因,以及如何使用定义从 "exists" 命题中产生一个元素。

你不能从存在证明中提取证人。有几个选项:

  • 将证明的语句更改为{x : T | P x},其行为more-or-less类似于存在量词,但支持投影函数proj1_sig : {x : T | P x} -> T

  • 假设一个选择公理,如 https://coq.inria.fr/library/Coq.Logic.ClassicalChoice.html

  • 如果您正在对可数类型进行量化 并且 您的命题是可判定的,您可以使用 中的技巧来提取证人。