簡體   English   中英

如何證明Coq中的邏輯等價?

[英]How to prove logical equivalence in Coq?

如何使用Coq證明以下內容?

(q V p)∧(¬p-> q)<->(p V q)。

我的嘗試

Lemma work: (forall p q: Prop, (q \/ p)/\(~p -> q) <-> (p \/ q)).
Proof.
intros p q.
split.
intros q_or_p_and_not_p_implies_q.
intros p_or_q.
split.

這是一個非常相似的陳述的證明。 將第一個p \\/ q交換為q \\/ p需要更多的工作,以便與您給出的語句匹配。

Theorem work : (forall p q : Prop, (p \/ q) /\ (~p -> q) <-> (p \/ q)).
Proof.
  intros p q.
  split.

  (* Prove the "->" direction *)
  intros given.
  destruct given as [p_or_q _].
  exact p_or_q.

  (* Prove the "<-" direction *)
  intros p_or_q.
  refine (conj p_or_q _).
  case p_or_q.
    (* We're given that p is true, so ~p implies anything *)
    intros p_true p_false.
    case (p_false p_true).
    (* We're given that q is true *)
    intros q_true p_false.
    exact q_true.
Qed.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM