我正在阅读Benjamin Pierce的软件基础系列。在第一本书的逻辑章节中,我遇到了一个问题。在证明定理
Theorem not_exists_dist :
excluded_middle ->
forall (X:Type) (P : X -> Prop),
~ (exists x, ~ P x) -> (forall x, P x).
其中excluded_middle
为
Definition excluded_middle := forall P : Prop,
P / ~ P.
定理的证明可以如下:
Proof.
unfold excluded_middle.
intros exmid X P H x.
destruct (exmid (P x)) as [H1 | H2].
- apply H1.
- destruct H.
exists x. apply H2.
Qed.
令我困惑的是第二种情况下的destruct H
。destruct
战术在这里做什么?这似乎和我以前所知道的不一样。(H
这里是~ (exists x : X, ~ P x)
)。使用destruct H
后,子目标由P x
转换为exists x : X, ~ P x
。
当您销毁形式为A -> B
的项时,您将得到A
的目标和destruct B
将产生的目标。not A
被定义为A -> False
,所以在你的例子中,B
是False
,destruct B
没有目标。所以你最终只得到A
。
这是一个很长的证明:
Theorem not_exists_dist :
excluded_middle ->
forall (X:Type) (P : X -> Prop),
~ (exists x, ~ P x) -> (forall x, P x).
Proof.
unfold excluded_middle.
intros exmid X P H x.
destruct (exmid (P x)) as [H1 | H2].
- apply H1.
- assert(ex (fun x : X => not (P x))) as H3.
exists x. apply H2.
specialize (H H3).
destruct H.
Qed.