src/HOL/Option.thy
author oheimb
Tue Mar 24 15:51:37 1998 +0100 (1998-03-24)
changeset 4752 1c334bd00038
parent 4192 c38ab5af38b5
child 5183 89f162de39cf
permissions -rw-r--r--
added o2s
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
nipkow@2019
     9
Option = Arith +
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
oheimb@4752
    25
primrec o2s option
oheimb@4752
    26
oheimb@4752
    27
 "o2s  None    = {}"
oheimb@4752
    28
 "o2s (Some x) = {x}"
oheimb@4752
    29
nipkow@2019
    30
end