假設我有一個很簡單的感應型:在Coq的
Inductive ind : Set :=
| ind0 : ind
| ind1 : ind -> ind.
,我想證明某些值可以不存在。具體來說,不可能有非正當的價值觀:~exists i, i = ind1 i
。
我環顧四周互聯網上的位,並與一無所獲。我能寫:
Fixpoint depth (i : ind) : nat :=
match i with
| ind0 => 0
| ind1 i2 => 1 + depth i2
end.
Goal ~exists i, i = ind1 i.
Proof.
intro. inversion_clear H.
remember (depth x) as d.
induction d.
rewrite H0 in Heqd; simpl in Heqd. discriminate.
rewrite H0 in Heqd; simpl in Heqd. injection Heqd. assumption.
Qed.
其工作原理,但似乎真的醜陋和非一般。
完美地工作。今天我學到了一些關於'intros'的新東西。謝謝! – jon 2013-05-05 19:05:42