Created
July 4, 2018 19:09
-
-
Save ikanher/f75eca7a6da9c5c02b0cd4190f9c9812 to your computer and use it in GitHub Desktop.
Beginning of How to Prove it proves in Coq.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import Classical. | |
(* | |
¬(P ∧ Q) ⇔ (¬P ∨ ¬Q) | |
*) | |
Theorem demorgan_1: forall P Q : Prop, ~(P /\ Q) <-> (~P \/ ~Q). | |
Proof. intros p q. unfold iff. split. | |
- intros H. apply not_and_or in H. assumption. | |
- intros H. apply or_not_and in H. assumption. Qed. | |
(* | |
¬(P ∨ Q) ⇔ (¬P ∧ ¬Q) | |
*) | |
Theorem demorgan_2: forall P Q : Prop, ~(P \/ Q) <-> (~P /\ ~Q). | |
Proof. intros p q. unfold iff. split. | |
- intros H. apply not_or_and in H. assumption. | |
- intros H. apply and_not_or in H. assumption. Qed. | |
(* | |
P ∧ Q ⇔ Q ∧ P | |
*) | |
Theorem commutative_1: forall P Q : Prop, P /\ Q <-> Q /\ P. | |
Proof. tauto. Qed. | |
(* | |
P ∨ Q ⇔ Q ∨ P | |
*) | |
Theorem commutative_2: forall P Q : Prop, P \/ Q <-> Q \/ P. | |
Proof. tauto. Qed. | |
(* | |
(P ∧ (Q ∧ R) <-> (P ∧ Q) ∧ R) | |
*) | |
Theorem associative_1: forall P Q R : Prop, (P /\ (Q /\ R) <-> (P /\ Q) /\ R). | |
Proof. tauto. Qed. | |
Theorem distributive_1: forall P Q R : Prop, (P /\ (Q \/ R)) <-> (P /\ Q) \/ (P /\ R). | |
Proof. intros. unfold iff. split. | |
- tauto. | |
- tauto. Qed. | |
Theorem distributive_2: forall P Q R : Prop, (P \/ (Q /\ R)) <-> (P \/ Q) /\ (P \/ R). | |
Proof. intros. unfold iff. split. | |
- tauto. | |
- tauto. Qed. | |
Theorem conditional_1: forall P Q : Prop, (P -> Q) <-> (~P \/ Q). | |
Proof. intros. unfold iff. split. | |
- intros H. apply imply_to_or. assumption. | |
- intros H. apply or_to_imply. assumption. Qed. | |
Theorem conditional_2: forall P Q : Prop, (P -> Q) <-> ~(P /\ ~Q). | |
Proof. intros. unfold iff. split. | |
- intros H. tauto. | |
- intros H. tauto. Qed. | |
Theorem contrapositive: forall P Q: Prop, (P -> Q) <-> ~Q -> ~P. | |
Proof. | |
intros P Q. unfold iff. intro H. tauto. Qed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment