Created
April 12, 2017 11:36
-
-
Save MikeMKH/75f8bc37541cc3f60f5bd0fff286f95f to your computer and use it in GitHub Desktop.
Simple proofs using Rewrite in Coq, taken from Proof by Rewriting section of https://www.seas.upenn.edu/~cis500/current/sf/Basics.html
This file contains hidden or 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
(* taken from the Proof by Rewriting section of https://www.seas.upenn.edu/~cis500/current/sf/Basics.html *) | |
Theorem plus_id : forall n m : nat, | |
n = m -> n + n = m + m. | |
Proof. | |
intros. | |
rewrite <- H. | |
reflexivity. | |
Qed. | |
Theorem plus_id_exercise : forall n m o : nat, | |
n = m -> m = o -> n + m = m + o. | |
Proof. | |
intros. | |
rewrite -> H. | |
rewrite -> H0. | |
reflexivity. | |
Qed. | |
Theorem mult_0_plus : forall n m : nat, | |
(0 + n) * m = n * m. | |
Proof. | |
intros. | |
rewrite -> plus_O_n. | |
reflexivity. | |
Qed. | |
Theorem plus_1_l : forall n:nat, | |
1 + n = S n. | |
Proof. | |
intros. | |
reflexivity. | |
Qed. | |
Theorem mult_S_1 : forall n m : nat, | |
m = S n -> | |
m * (1 + n) = m * m. | |
Proof. | |
intros. | |
rewrite -> plus_1_l. | |
rewrite <- H. | |
reflexivity. | |
Qed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, I had to reintroduce the plus_1_l theorem from a different section.