src/HOL/Induct/Ordinals.thy
author wenzelm
Sat May 27 17:42:02 2006 +0200 (2006-05-27)
changeset 19736 d8d0f8f51d69
parent 16417 9bc16273c2d4
child 21404 eb85850d3eb7
permissions -rw-r--r--
tuned;
wenzelm@11649
     1
(*  Title:      HOL/Induct/Ordinals.thy
wenzelm@11641
     2
    ID:         $Id$
wenzelm@11641
     3
    Author:     Stefan Berghofer and Markus Wenzel, TU Muenchen
wenzelm@11641
     4
*)
wenzelm@11641
     5
wenzelm@11641
     6
header {* Ordinals *}
wenzelm@11641
     7
haftmann@16417
     8
theory Ordinals imports Main begin
wenzelm@11641
     9
wenzelm@11641
    10
text {*
wenzelm@11641
    11
  Some basic definitions of ordinal numbers.  Draws an Agda
wenzelm@11649
    12
  development (in Martin-L\"of type theory) by Peter Hancock (see
wenzelm@11641
    13
  \url{http://www.dcs.ed.ac.uk/home/pgh/chat.html}).
wenzelm@11641
    14
*}
wenzelm@11641
    15
wenzelm@11641
    16
datatype ordinal =
wenzelm@11641
    17
    Zero
wenzelm@11641
    18
  | Succ ordinal
wenzelm@11641
    19
  | Limit "nat => ordinal"
wenzelm@11641
    20
wenzelm@11641
    21
consts
wenzelm@11641
    22
  pred :: "ordinal => nat => ordinal option"
wenzelm@11641
    23
primrec
wenzelm@11641
    24
  "pred Zero n = None"
wenzelm@11641
    25
  "pred (Succ a) n = Some a"
wenzelm@11641
    26
  "pred (Limit f) n = Some (f n)"
wenzelm@11641
    27
wenzelm@11641
    28
consts
wenzelm@11641
    29
  iter :: "('a => 'a) => nat => ('a => 'a)"
wenzelm@11641
    30
primrec
wenzelm@11641
    31
  "iter f 0 = id"
wenzelm@11641
    32
  "iter f (Suc n) = f \<circ> (iter f n)"
wenzelm@11641
    33
wenzelm@19736
    34
definition
wenzelm@11641
    35
  OpLim :: "(nat => (ordinal => ordinal)) => (ordinal => ordinal)"
wenzelm@19736
    36
  "OpLim F a = Limit (\<lambda>n. F n a)"
wenzelm@11641
    37
  OpItw :: "(ordinal => ordinal) => (ordinal => ordinal)"    ("\<Squnion>")
wenzelm@19736
    38
  "\<Squnion>f = OpLim (iter f)"
wenzelm@11641
    39
wenzelm@11641
    40
consts
wenzelm@11641
    41
  cantor :: "ordinal => ordinal => ordinal"
wenzelm@11641
    42
primrec
wenzelm@11641
    43
  "cantor a Zero = Succ a"
wenzelm@11641
    44
  "cantor a (Succ b) = \<Squnion>(\<lambda>x. cantor x b) a"
wenzelm@11641
    45
  "cantor a (Limit f) = Limit (\<lambda>n. cantor a (f n))"
wenzelm@11641
    46
wenzelm@11641
    47
consts
wenzelm@11641
    48
  Nabla :: "(ordinal => ordinal) => (ordinal => ordinal)"    ("\<nabla>")
wenzelm@11641
    49
primrec
wenzelm@11641
    50
  "\<nabla>f Zero = f Zero"
wenzelm@11641
    51
  "\<nabla>f (Succ a) = f (Succ (\<nabla>f a))"
wenzelm@11641
    52
  "\<nabla>f (Limit h) = Limit (\<lambda>n. \<nabla>f (h n))"
wenzelm@11641
    53
wenzelm@19736
    54
definition
wenzelm@11641
    55
  deriv :: "(ordinal => ordinal) => (ordinal => ordinal)"
wenzelm@19736
    56
  "deriv f = \<nabla>(\<Squnion>f)"
wenzelm@11641
    57
wenzelm@11641
    58
consts
wenzelm@11641
    59
  veblen :: "ordinal => ordinal => ordinal"
wenzelm@11641
    60
primrec
wenzelm@11641
    61
  "veblen Zero = \<nabla>(OpLim (iter (cantor Zero)))"
wenzelm@11641
    62
  "veblen (Succ a) = \<nabla>(OpLim (iter (veblen a)))"
wenzelm@11641
    63
  "veblen (Limit f) = \<nabla>(OpLim (\<lambda>n. veblen (f n)))"
wenzelm@11641
    64
wenzelm@19736
    65
definition
wenzelm@19736
    66
  "veb a = veblen a Zero"
wenzelm@19736
    67
  "\<epsilon>\<^isub>0 = veb Zero"
wenzelm@19736
    68
  "\<Gamma>\<^isub>0 = Limit (\<lambda>n. iter veb n Zero)"
wenzelm@11641
    69
wenzelm@11641
    70
end