Skip to content

Instantly share code, notes, and snippets.

@oskimura
Created September 30, 2010 10:33
Show Gist options
  • Save oskimura/604371 to your computer and use it in GitHub Desktop.
Save oskimura/604371 to your computer and use it in GitHub Desktop.
(* 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.
@oskimura
Copy link
Author

oskimura commented Oct 1, 2010

ガリグ先生のテキストの演習

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment