证明Coq中的iota增加
我被困在一个目标上 假设我们有以下定义:证明Coq中的iota增加,coq,theorem-proving,Coq,Theorem Proving,我被困在一个目标上 假设我们有以下定义: Fixpoint iota (n : nat) : list nat := match n with | 0 => [] | S k => iota k ++ [k] end. 我们想证明: 定理t1:forall n,In n(iota n)->False。 到目前为止,我已设法做到以下几点: Theorem t1 : forall n, In n (iota n) -> False. Proof.
Fixpoint iota (n : nat) : list nat :=
match n with
| 0 => []
| S k => iota k ++ [k]
end.
我们想证明:
定理t1:forall n,In n(iota n)->False。
到目前为止,我已设法做到以下几点:
Theorem t1 : forall n, In n (iota n) -> False.
Proof.
intros.
induction n.
- cbn in H. contradiction.
- cbn in H. apply app_split in H.
Focus 2. unfold not. intros.
unfold In in H0. destruct H0. assert (~(n = S n)) by now apply s_inj.
contradiction.
apply H0.
apply IHn.
我使用了这两个引理,省略了证明:
Axiom app_split : forall A x (l l2 : list A), In x (l ++ l2) -> not (In x l2) -> In x l.
Axiom s_inj : forall n, ~(n = S n).
然而,我完全被卡住了,我需要以某种方式证明:
In(iota n)
假设In(S n)(iota n)
正如你所观察到的那样,nInInInInInInInInIn与InIn在你的陈述中是同步的,这使得归纳假设很难被调用(如果不是完全无用的话)
这里的诀窍是证明一个比你实际感兴趣的更一般的陈述,它打破了两个n
s之间的依赖关系。我建议:
Theorem t : forall n k, n <= k -> In k (iota n) -> False.
如果你想偷看一下t
的证明,你可以有趣的是——当某些东西无法用当前公式证明时,人们如何获得直觉——是某些假设还是归纳假设会直接(或间接)被证明与结论相矛盾?或者是否存在“不够充分/足够强”的归纳假设的概念?人们如何判断?(一旦你给我看,这是显而易见的,但我自己弄清楚了…)主要是经验。但是,每当两件事情步调一致,或者一个值固定为常数,并且阻止你使用归纳假设时,这是一种强烈的气味,你可能需要寻找一个更一般的陈述。设置一些练习,在其中你必须概括归纳假设,使其发挥作用。你可能需要非常感谢!基本上我需要“git gud”:。
Corollary t1 : forall n, In n (iota n) -> False.
intro n; apply (t n n); reflexivity.
Qed.