src/HOL/Induct/Ordinals.thy
author urbanc
Tue Jun 05 09:56:19 2007 +0200 (2007-06-05)
changeset 23243 a37d3e6e8323
parent 21404 eb85850d3eb7
child 36862 952b2b102a0a
permissions -rw-r--r--
included Class.thy in the compiling process for Nominal/Examples
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@21404
    35
  OpLim :: "(nat => (ordinal => ordinal)) => (ordinal => ordinal)" where
wenzelm@19736
    36
  "OpLim F a = Limit (\<lambda>n. F n a)"
wenzelm@21404
    37
wenzelm@21404
    38
definition
wenzelm@21404
    39
  OpItw :: "(ordinal => ordinal) => (ordinal => ordinal)"    ("\<Squnion>") where
wenzelm@19736
    40
  "\<Squnion>f = OpLim (iter f)"
wenzelm@11641
    41
wenzelm@11641
    42
consts
wenzelm@11641
    43
  cantor :: "ordinal => ordinal => ordinal"
wenzelm@11641
    44
primrec
wenzelm@11641
    45
  "cantor a Zero = Succ a"
wenzelm@11641
    46
  "cantor a (Succ b) = \<Squnion>(\<lambda>x. cantor x b) a"
wenzelm@11641
    47
  "cantor a (Limit f) = Limit (\<lambda>n. cantor a (f n))"
wenzelm@11641
    48
wenzelm@11641
    49
consts
wenzelm@11641
    50
  Nabla :: "(ordinal => ordinal) => (ordinal => ordinal)"    ("\<nabla>")
wenzelm@11641
    51
primrec
wenzelm@11641
    52
  "\<nabla>f Zero = f Zero"
wenzelm@11641
    53
  "\<nabla>f (Succ a) = f (Succ (\<nabla>f a))"
wenzelm@11641
    54
  "\<nabla>f (Limit h) = Limit (\<lambda>n. \<nabla>f (h n))"
wenzelm@11641
    55
wenzelm@19736
    56
definition
wenzelm@21404
    57
  deriv :: "(ordinal => ordinal) => (ordinal => ordinal)" where
wenzelm@19736
    58
  "deriv f = \<nabla>(\<Squnion>f)"
wenzelm@11641
    59
wenzelm@11641
    60
consts
wenzelm@11641
    61
  veblen :: "ordinal => ordinal => ordinal"
wenzelm@11641
    62
primrec
wenzelm@11641
    63
  "veblen Zero = \<nabla>(OpLim (iter (cantor Zero)))"
wenzelm@11641
    64
  "veblen (Succ a) = \<nabla>(OpLim (iter (veblen a)))"
wenzelm@11641
    65
  "veblen (Limit f) = \<nabla>(OpLim (\<lambda>n. veblen (f n)))"
wenzelm@11641
    66
wenzelm@21404
    67
definition "veb a = veblen a Zero"
wenzelm@21404
    68
definition "\<epsilon>\<^isub>0 = veb Zero"
wenzelm@21404
    69
definition "\<Gamma>\<^isub>0 = Limit (\<lambda>n. iter veb n Zero)"
wenzelm@11641
    70
wenzelm@11641
    71
end