-
-
Save Lysxia/c541ee3621df70b655f4b74517a226ee to your computer and use it in GitHub Desktop.
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
From Coq Require Import NArith. | |
Lemma lem1 p : (Pos.succ p) = (p + 1)%positive. | |
Proof. | |
induction p; cbn; auto. | |
Qed. | |
Lemma lem2 p p0 : | |
(Pos.succ (p + p0)) = (p + Pos.succ p0)%positive /\ Pos.add_carry p p0 = (p + Pos.succ p0)%positive. | |
Proof. | |
revert p0; induction p; cbn; intros []; cbn; split; auto. | |
all: f_equal. | |
all: try solve [apply IHp | apply lem1]. | |
etransitivity; [ eapply IHp | symmetry; eapply IHp]. | |
Qed. | |
Goal | |
forall n m, | |
N.succ (N.add n m) = N.add n (N.succ m). | |
Proof. | |
intros [] []; cbn; f_equal; apply lem1 + apply lem2. | |
Qed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment