2015-02-02 03:36:06 +00:00
|
|
|
open nat
|
|
|
|
|
2015-02-26 00:20:44 +00:00
|
|
|
definition foo : nat → nat
|
|
|
|
| foo (0 + x) := x
|
2015-02-02 03:36:06 +00:00
|
|
|
|
2015-02-26 00:20:44 +00:00
|
|
|
definition foo : nat → nat → nat
|
|
|
|
| foo 0 _ := 0
|
|
|
|
| foo x ⌞y⌟ := x
|
2015-02-02 03:36:06 +00:00
|
|
|
|
2015-02-26 00:20:44 +00:00
|
|
|
definition foo : nat → nat → nat
|
|
|
|
| foo 0 _ := 0
|
|
|
|
| foo ⌞x⌟ x := x
|
2015-02-02 03:36:06 +00:00
|
|
|
|
|
|
|
inductive tree (A : Type) :=
|
2015-02-26 01:00:10 +00:00
|
|
|
| node : tree_list A → tree A
|
|
|
|
| leaf : A → tree A
|
2015-02-02 03:36:06 +00:00
|
|
|
with tree_list :=
|
2015-02-26 01:00:10 +00:00
|
|
|
| nil {} : tree_list A
|
|
|
|
| cons : tree A → tree_list A → tree_list A
|
2015-02-02 03:36:06 +00:00
|
|
|
|
|
|
|
definition is_leaf {A : Type} : tree A → bool
|
2015-02-26 00:20:44 +00:00
|
|
|
with is_leaf_aux : tree_list A → bool
|
|
|
|
| is_leaf (tree.node _) := bool.ff
|
|
|
|
| is_leaf (tree.leaf _) := bool.tt
|
|
|
|
| is_leaf_aux tree_list.nil := bool.ff
|
|
|
|
| is_leaf_aux (tree_list.cons _ _) := bool.ff
|
2015-02-02 03:36:06 +00:00
|
|
|
|
2015-02-26 00:20:44 +00:00
|
|
|
definition foo : nat → nat
|
|
|
|
| foo 0 := 0
|
|
|
|
| foo (x+1) := let y := x + 2 in y * y
|
2015-02-02 03:36:06 +00:00
|
|
|
|
|
|
|
example : foo 5 = 36 := rfl
|
|
|
|
|
2015-02-26 00:20:44 +00:00
|
|
|
definition boo : nat → nat
|
|
|
|
| boo (x + 1) := boo (x + 2)
|
|
|
|
| boo 0 := 0
|