Created
September 30, 2010 10:33
-
-
Save oskimura/604371 to your computer and use it in GitHub Desktop.
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
(* This is coq *) | |
Print nat. | |
Inductive nat : Set := | |
| O : nat | |
| S : nat -> nat. | |
Fixpoint plus (m n : nat) {struct m} : nat := | |
match m with | |
| O => n | |
| S m' => S (plus m' n) | |
end. | |
Print plus. | |
Check plus O O. | |
Check plus (S O) O. | |
Check plus (S (S (S O))) (S O). | |
Eval compute in plus (S (S (S O))) (S O). | |
(* | |
Parameter mult : nat -> nat -> nat. | |
Eval compute in mult (S O) (S O). | |
*) | |
Check S. | |
Check plus. | |
Check S. | |
Fixpoint mult (m n : nat) : nat := | |
match m with | |
| O => O | |
| S m' => (plus n (mult m' n)) | |
end | |
. | |
Check mult O O. | |
Check mult (S O) O. | |
Check mult O (S O). | |
Eval compute in mult O O. | |
Eval compute in mult (S (S O)) (S O). | |
Eval compute in mult O (S O). | |
Eval compute in mult (S O) O. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ガリグ先生のテキストの演習