简体   繁体   中英

How to prove logical equivalence in Coq?

How do I prove the following using Coq?

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

My Attempt

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.

Here is a proof of a very similar statement. It requires a little more work to swap the first p \\/ q to q \\/ p in order to match the statement you gave.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM