author | paulson <lp15@cam.ac.uk> |
Sun, 29 Mar 2020 21:30:52 +0100 | |
changeset 71627 | 2a24c2015a61 |
parent 63680 | 6e1e8b5abbfa |
child 76063 | 24c9f56aa035 |
permissions | -rw-r--r-- |
11649 | 1 |
(* Title: HOL/Induct/Ordinals.thy |
11641 | 2 |
Author: Stefan Berghofer and Markus Wenzel, TU Muenchen |
3 |
*) |
|
4 |
||
60530 | 5 |
section \<open>Ordinals\<close> |
11641 | 6 |
|
46914 | 7 |
theory Ordinals |
8 |
imports Main |
|
9 |
begin |
|
11641 | 10 |
|
60530 | 11 |
text \<open> |
11641 | 12 |
Some basic definitions of ordinal numbers. Draws an Agda |
11649 | 13 |
development (in Martin-L\"of type theory) by Peter Hancock (see |
63680 | 14 |
\<^url>\<open>http://www.dcs.ed.ac.uk/home/pgh/chat.html\<close>). |
60530 | 15 |
\<close> |
11641 | 16 |
|
58310 | 17 |
datatype ordinal = |
11641 | 18 |
Zero |
19 |
| Succ ordinal |
|
60532 | 20 |
| Limit "nat \<Rightarrow> ordinal" |
11641 | 21 |
|
60532 | 22 |
primrec pred :: "ordinal \<Rightarrow> nat \<Rightarrow> ordinal option" |
46914 | 23 |
where |
11641 | 24 |
"pred Zero n = None" |
39246 | 25 |
| "pred (Succ a) n = Some a" |
26 |
| "pred (Limit f) n = Some (f n)" |
|
11641 | 27 |
|
60532 | 28 |
abbreviation (input) iter :: "('a \<Rightarrow> 'a) \<Rightarrow> nat \<Rightarrow> ('a \<Rightarrow> 'a)" |
46914 | 29 |
where "iter f n \<equiv> f ^^ n" |
30 |
||
60532 | 31 |
definition OpLim :: "(nat \<Rightarrow> (ordinal \<Rightarrow> ordinal)) \<Rightarrow> (ordinal \<Rightarrow> ordinal)" |
46914 | 32 |
where "OpLim F a = Limit (\<lambda>n. F n a)" |
11641 | 33 |
|
60532 | 34 |
definition OpItw :: "(ordinal \<Rightarrow> ordinal) \<Rightarrow> (ordinal \<Rightarrow> ordinal)" ("\<Squnion>") |
46914 | 35 |
where "\<Squnion>f = OpLim (iter f)" |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19736
diff
changeset
|
36 |
|
60532 | 37 |
primrec cantor :: "ordinal \<Rightarrow> ordinal \<Rightarrow> ordinal" |
46914 | 38 |
where |
11641 | 39 |
"cantor a Zero = Succ a" |
39246 | 40 |
| "cantor a (Succ b) = \<Squnion>(\<lambda>x. cantor x b) a" |
41 |
| "cantor a (Limit f) = Limit (\<lambda>n. cantor a (f n))" |
|
11641 | 42 |
|
60532 | 43 |
primrec Nabla :: "(ordinal \<Rightarrow> ordinal) \<Rightarrow> (ordinal \<Rightarrow> ordinal)" ("\<nabla>") |
46914 | 44 |
where |
11641 | 45 |
"\<nabla>f Zero = f Zero" |
39246 | 46 |
| "\<nabla>f (Succ a) = f (Succ (\<nabla>f a))" |
47 |
| "\<nabla>f (Limit h) = Limit (\<lambda>n. \<nabla>f (h n))" |
|
11641 | 48 |
|
60532 | 49 |
definition deriv :: "(ordinal \<Rightarrow> ordinal) \<Rightarrow> (ordinal \<Rightarrow> ordinal)" |
46914 | 50 |
where "deriv f = \<nabla>(\<Squnion>f)" |
11641 | 51 |
|
60532 | 52 |
primrec veblen :: "ordinal \<Rightarrow> ordinal \<Rightarrow> ordinal" |
46914 | 53 |
where |
11641 | 54 |
"veblen Zero = \<nabla>(OpLim (iter (cantor Zero)))" |
39246 | 55 |
| "veblen (Succ a) = \<nabla>(OpLim (iter (veblen a)))" |
56 |
| "veblen (Limit f) = \<nabla>(OpLim (\<lambda>n. veblen (f n)))" |
|
11641 | 57 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19736
diff
changeset
|
58 |
definition "veb a = veblen a Zero" |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
46914
diff
changeset
|
59 |
definition "\<epsilon>\<^sub>0 = veb Zero" |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
46914
diff
changeset
|
60 |
definition "\<Gamma>\<^sub>0 = Limit (\<lambda>n. iter veb n Zero)" |
11641 | 61 |
|
62 |
end |