[英]How to make use of a hypothesis containing forall in Coq?
I am trying to prove the equivalence of P \\/ Q
and ~ P -> Q
, under the assumption of Excluded Middle, 在排除中间的假设下,我试图证明
P \\/ Q
和~ P -> Q
的等价性,
Theorem eq_of_or :
excluded_middle ->
forall P Q : Prop,
(P \/ Q) <-> (~ P -> Q).
where the Excluded Middle is the following. 其中“排除的中间”为以下位置。
Definition excluded_middle := forall P : Prop, P \/ ~ P.
Actually, the proof of one direction does not require the Excluded Middle. 实际上,一个方向的证明不需要排除中间。 In my attempt at proving the other direction, I get stuck when I am trying to utilize the Excluded Middle among the hypotheses,
在尝试证明另一个方向的过程中,当我尝试利用假设中的“排除中间”时,我陷入了困境,
Proof.
intros EM P Q. split.
{ intros [H | H]. intros HNP.
- unfold not in HNP. exfalso.
apply HNP. apply H.
- intros HNP. apply H. }
{ intros H. unfold excluded_middle in EM.
unfold not in EM. unfold not in H.
}
where the current environment is the following: 当前环境如下:
1 subgoal
EM : forall P : Prop, P \/ (P -> False)
P, Q : Prop
H : (P -> False) -> Q
______________________________________(1/1)
P \/ Q
I understand that under such circumstance, what we need to do next is to do something like the "case analysis" of P, including the use of tactics left
and right
, if my proof makes sense till now. 据我所知,在这种情况下,我们下一步需要做的是做这样的事情P的“案例分析”,包括使用战术的
left
和right
,如果我的证明是有道理至今。
Thanks in advance for any advice and suggestion! 在此先感谢您的任何意见和建议!
You can instantiate EM : forall P : Prop, P \\/ ~ P
with any proposition (I instantiated it with P
below and destructed it immediately), since EM
is essentially a function that takes an arbitrary proposition P
and returns a proof of either P
or ~ P
. 您可以实例化
EM : forall P : Prop, P \\/ ~ P
具有任何命题(我在下面用P
实例化并立即对其进行销毁),因为EM
本质上是一个接受任意命题P
并返回任一P
的证明的函数或~ P
。
Theorem eq_of_or' :
excluded_middle ->
forall P Q : Prop, (~ P -> Q) -> P \/ Q.
Proof.
intros EM P Q.
destruct (EM P) as [p | np]. (* <- the key part is here *)
- left. apply p.
- right.
apply (H np).
(* or, equivalently, *)
Undo.
apply H.
apply np.
Undo 2.
(* we can also combine two `apply` into one: *)
apply H, np.
Qed.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.