7018
|
1 |
(* Title: HOL/Induct/Tree.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Stefan Berghofer, TU Muenchen
|
|
4 |
Copyright 1999 TU Muenchen
|
|
5 |
|
|
6 |
Infinitely branching trees
|
|
7 |
*)
|
|
8 |
|
|
9 |
Tree = Main +
|
|
10 |
|
|
11 |
datatype 'a tree = Atom 'a | Branch "nat => 'a tree"
|
|
12 |
|
|
13 |
consts
|
|
14 |
map_tree :: "('a => 'b) => 'a tree => 'b tree"
|
|
15 |
|
|
16 |
primrec
|
|
17 |
"map_tree f (Atom a) = Atom (f a)"
|
|
18 |
"map_tree f (Branch ts) = Branch (%x. map_tree f (ts x))"
|
|
19 |
|
|
20 |
consts
|
|
21 |
exists_tree :: "('a => bool) => 'a tree => bool"
|
|
22 |
|
|
23 |
primrec
|
|
24 |
"exists_tree P (Atom a) = P a"
|
|
25 |
"exists_tree P (Branch ts) = (? x. exists_tree P (ts x))"
|
|
26 |
|
|
27 |
end
|