Created
April 3, 2012 06:38
-
-
Save einblicker/2289811 to your computer and use it in GitHub Desktop.
hungry functionにいくら自然数を食わせてもhungryなままであることを証明
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
Section HungryIsImmutable. | |
CoInductive hungry := h : (nat -> hungry) -> hungry. | |
CoFixpoint f := h (fun _ => f). | |
Definition unH x := | |
match x with | |
| h f => f | |
end. | |
Infix "$" := unH (at level 120). | |
Fixpoint mkHungry n := | |
match n with | |
| O => f $ O | |
| S m => mkHungry m $ S m | |
end. | |
Theorem hungryIsImmutable : forall n, mkHungry n = f. | |
Proof. | |
induction n; [ | simpl; rewrite IHn ]; reflexivity. | |
Qed. | |
End HungryIsImmutable. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment