![](/img/trans.png)
[英]How or is that possible to prove or falsify `forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q.` in Coq?
[英]How to prove the lemma “(P \/ Q) /\ ~P -> Q.” in coq?
我試圖用tatics [intros],[apply],[assume],[destruct],[left],[right],[split]證明這個引理但是失敗了。 任何人都可以教我如何證明它嗎?
Lemma a : (P \/ Q) /\ ~P -> Q.
proof.
一般來說,如何證明諸如false-> P,P / ~P等簡單命題?
你缺少的策略是矛盾 ,用於證明包含矛盾假設的目標。 因為你不允許使用矛盾,我相信你想要應用的引理是False的歸納原則。 在這樣做之后,您可以應用否定的命題並通過假設關閉分支。 請注意,您可以比教練要求做得更好,並且不使用任何列出的策略! 析取三段論的證明術語相對容易寫:
Definition dis_syllogism (P Q : Prop) (H : (P ∨ Q) ∧ ¬P) : Q :=
match H with
| conj H₁ H₂ =>
match H₁ with
| or_introl H₃ => False_ind Q (H₂ H₃)
| or_intror H₃ => H₃
end
end.
Section Example.
(* Introduce some hypotheses.. *)
Hypothesis P Q : Prop.
Lemma a : (P \/ Q) /\ ~P -> Q.
intros.
inversion H.
destruct H0.
contradiction.
assumption.
Qed.
End Example.
為了證明所有這些簡單的事情,你有戰術家庭tauto
, rtauto
, intuition
和firstorder
。
我相信它們都比tauto更強大,這是直覺主義命題邏輯的完整決策程序。
然后, intuition
允許你使用一些提示和引理,並且firstorder可以推理出一階歸納。
當然,在文檔中有更多細節,但這些是你想要用於這些目標的策略。
請記住, ~P
表示P->False
,反轉False
假設完成目標(因為False
沒有構造函數)。 所以你真的需要apply
和inversion
。
Lemma a : forall (P Q:Prop), (P \/ Q) /\ ~P -> Q.
Proof.
intros.
inversion H.
inversion H0.
- apply H1 in H2. (* applying ~P on P gives H2: False *)
inversion H2.
- apply H2.
Qed.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.