这是我在数学定理中使用的归纳型pc
。反演在Coq中产生意外的存在T
Inductive pc (n : nat) : Type :=
| pcs : forall (m : nat), m < n -> pc n
| pcm : pc n -> pc n -> pc n.
而另一感应型pc_tree
,这基本上是一个包含一个或多个pc
个二叉树。 pcts
是一个包含单个pc
的叶节点构造函数,而pctm
是包含多个pc
的内部节点构造函数。
Inductive pc_tree : Type :=
| pcts : forall (n : nat), pc n -> pc_tree
| pctm : pc_tree -> pc_tree -> pc_tree.
和归纳定义的命题contains
。 contains n x t
表示树t
包含至少一个x : pc n
的发生。
Inductive contains (n : nat) (x : pc n) : pc_tree -> Prop :=
| contain0 : contains n x (pcts n x)
| contain1 : forall (t s : pc_tree), contains n x t -> contains n x (pctm t s)
| contain2 : forall (t s : pc_tree), contains n x t -> contains n x (pctm s t).
现在,问题的引理我需要证明:
Lemma contains_single_eq : forall (n : nat) (x y : pc n), contains n x (pcts n y) -> x = y.
引理的意思非常简单:如果具有包含y : pc n
单叶节点树包含一些x : pc n
,它遵循x = y
。我想我应该可以通过contains
上的简单inversion
来证明这一点。所以当我写了
Lemma contains_single_eq : forall (n : nat) (x y : pc n), contains n x (pcts n y) -> x = y.
intros n x y H. inversion H.
我期待得到x = y
作为上下文中的假设。下面是我所得到的:
1 subgoal
n : nat
x : pc n
y : pc n
H : contains n x (pcts n y)
H1 : existT (fun n : nat => pc n) n x = existT (fun n : nat => pc n) n y
====================================================================== (1/1)
x = y
H1
与我的预期完全不同。 (我以前从未见过existT
)。我所关心的是我证明contains_single_eq
,但我不确定如何使用H1
,或者它是否可用。
有什么想法?
'{x:T&P x}'是一个从属总和,例如'T * P'是一个非相关和。 '@existT T P x H:{x:T&P x}'比如'@pair T P x H:T * P'。存在x:T,P x','{x:T | P x}'和'{x:T&P x}'非常相似。使用'Print ex.','Print sig.'和'Print sigT.'命令。 –