【发布时间】:2020-07-30 16:31:54
【问题描述】:
任务。
假设我们给 Coq 定义如下:
Inductive R2 : nat -> list nat -> Prop :=
| c1 : R2 0 []
| c2 : forall n l, R2 n l -> R2 (S n) (n :: l)
| c3 : forall n l, R2 (S n) l -> R2 n l.
以下哪个命题是可证明的?
我证明了三分之二。
Example Example_R21 : R2 2 [1;0].
Proof.
apply c2. apply c2. apply c1.
Qed.
Example Example_R22 : R2 1 [1;2;1;0].
Proof.
repeat constructor.
Qed.
第3个是不可证明的,因为c3只会增加n,永远不会等于list的头+1。但是如何正式证明它是不可证明的呢?
Example Example_R23 : not (R2 6 [3;2;1;0]).
Proof.
Qed.
更新 1
Fixpoint gen (n: nat) : list nat :=
match n with
| 0 => []
| S n' => (n' :: gen n')
end.
Lemma R2_gen : forall (n : nat) (l : list nat), R2 n l -> l = gen n.
Proof.
intros n l H. induction H.
- simpl. reflexivity.
- simpl. rewrite IHR2. reflexivity.
- simpl in IHR2. ?
【问题讨论】: