src/HOL/Option.thy
author berghofe
Tue May 30 18:02:49 2000 +0200 (2000-05-30)
changeset 9001 93af64f54bf2
parent 5445 3905974ad555
permissions -rw-r--r--
the is now defined using primrec, avoiding explicit use of arbitrary.
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
berghofe@9001
    13
consts
berghofe@9001
    14
  the :: "'a option => 'a"
berghofe@9001
    15
  o2s :: "'a option => 'a set"
oheimb@4133
    16
berghofe@9001
    17
primrec
berghofe@9001
    18
 "the (Some x) = x"
oheimb@4133
    19
berghofe@9001
    20
primrec
berghofe@9001
    21
 "o2s  None    = {}"
berghofe@9001
    22
 "o2s (Some x) = {x}"
berghofe@9001
    23
berghofe@9001
    24
constdefs
oheimb@4133
    25
  option_map	:: "('a => 'b) => ('a option => 'b option)"
oheimb@4192
    26
 "option_map == %f y. case y of None => None | Some x => Some (f x)"
oheimb@4133
    27
nipkow@2019
    28
end