src/HOL/Option.thy
author berghofe
Fri Jul 24 13:03:20 1998 +0200 (1998-07-24)
changeset 5183 89f162de39cf
parent 4752 1c334bd00038
child 5445 3905974ad555
permissions -rw-r--r--
Adapted to new datatype package.
nipkow@2019
     1
(*  Title:      Option.thy
nipkow@2019
     2
    ID:         $Id$
nipkow@2019
     3
    Author:     Tobias Nipkow
nipkow@2019
     4
    Copyright   1994  TU Muenchen
nipkow@2019
     5
nipkow@2019
     6
Datatype 'a option
nipkow@2019
     7
*)
nipkow@2019
     8
berghofe@5183
     9
Option = Datatype +
oheimb@4133
    10
nipkow@2019
    11
datatype 'a option = None | Some 'a
oheimb@4133
    12
oheimb@4133
    13
constdefs
oheimb@4133
    14
oheimb@4133
    15
  the		:: "'a option => 'a"
oheimb@4192
    16
 "the == %y. case y of None => arbitrary | Some x => x"
oheimb@4133
    17
oheimb@4133
    18
  option_map	:: "('a => 'b) => ('a option => 'b option)"
oheimb@4192
    19
 "option_map == %f y. case y of None => None | Some x => Some (f x)"
oheimb@4133
    20
oheimb@4752
    21
consts
oheimb@4752
    22
oheimb@4752
    23
  o2s	   :: "'a option => 'a set"
oheimb@4752
    24
berghofe@5183
    25
primrec
oheimb@4752
    26
 "o2s  None    = {}"
oheimb@4752
    27
 "o2s (Some x) = {x}"
oheimb@4752
    28
nipkow@2019
    29
end