Created
May 27, 2016 02:54
-
-
Save palmskog/ca35b2892641fa36f055289b5b738858 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
Fixpoint fin_of_nat (m n : nat) : fin n + {p | m = n + p} := | |
match n with | |
| 0 => inr (exist _ m eq_refl) | |
| S n' => | |
match m with | |
| 0 => inl None | |
| S m' => | |
match fin_of_nat m' n' with | |
| inl f => inl (Some f) | |
| inr (exist _ x H) => inr (exist _ x (f_equal _ H)) | |
end | |
end | |
end. | |
Lemma fin_of_nat_fin_to_nat : | |
forall (n : nat) (a : fin n), | |
fin_of_nat (fin_to_nat a) n = inl a. | |
Proof. | |
induction n; simpl; intuition. | |
destruct a; simpl in *; auto. | |
now rewrite IHn. | |
Qed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment