Coq:消除 `forall`?
Coq: eliminating `forall`?
我正在努力证明以下定理(假定非空域):
Theorem t (A: Set) (P: A -> Prop): (forall a: A, P a) -> (exists a: A, P a).
Proof.
intros H.
Noramlly,有 forall a: A, P a
我会推导出 P c
,其中 c
是一个常数。 IE。 forall
量词将被淘汰。一旦完成,我将再次推断 exists a
并且我的简单证明将是 Qed
ed.
但是,我在 Coq 中找不到正确的方法来消除 forall
。
我是新手,想知道如何在 Coq 中消除 forall
或者证明上述定理的更好方法是什么?
P.S。我看过 的答案,但它似乎与我的问题无关。
与其他逻辑形式主义(例如 Isabelle/HOL)不同,在 Coq 中完全有可能有一个空域。如果你想证明你的陈述,你必须明确地假设 A
不为空。这是一种可能。
Definition non_empty (A : Type) : Prop :=
exists x : A, True.
Theorem t (A : Set) (P : A -> Prop) :
non_empty A ->
(forall a : A, P a) ->
(exists a : A, P a).
Proof.
intros [c _] H. exists c. apply H.
Qed.
我正在努力证明以下定理(假定非空域):
Theorem t (A: Set) (P: A -> Prop): (forall a: A, P a) -> (exists a: A, P a).
Proof.
intros H.
Noramlly,有 forall a: A, P a
我会推导出 P c
,其中 c
是一个常数。 IE。 forall
量词将被淘汰。一旦完成,我将再次推断 exists a
并且我的简单证明将是 Qed
ed.
但是,我在 Coq 中找不到正确的方法来消除 forall
。
我是新手,想知道如何在 Coq 中消除 forall
或者证明上述定理的更好方法是什么?
P.S。我看过
与其他逻辑形式主义(例如 Isabelle/HOL)不同,在 Coq 中完全有可能有一个空域。如果你想证明你的陈述,你必须明确地假设 A
不为空。这是一种可能。
Definition non_empty (A : Type) : Prop :=
exists x : A, True.
Theorem t (A : Set) (P : A -> Prop) :
non_empty A ->
(forall a : A, P a) ->
(exists a : A, P a).
Proof.
intros [c _] H. exists c. apply H.
Qed.