author | wenzelm |
Wed, 08 Apr 2015 19:39:08 +0200 | |
changeset 59970 | e9f73d87d904 |
parent 59523 | 860fb1c65553 |
child 60758 | d8d85a8172b5 |
permissions | -rw-r--r-- |
30246 | 1 |
(* Title: HOL/Option.thy |
2 |
Author: Folklore |
|
3 |
*) |
|
4 |
||
58889 | 5 |
section {* Datatype option *} |
30246 | 6 |
|
7 |
theory Option |
|
58916 | 8 |
imports Lifting Finite_Set |
30246 | 9 |
begin |
10 |
||
58310 | 11 |
datatype 'a option = |
57091 | 12 |
None |
55406 | 13 |
| Some (the: 'a) |
57123
b5324647e0f1
tuned whitespace, to make datatype definitions slightly less intimidating
blanchet
parents:
57091
diff
changeset
|
14 |
|
55531
601ca8efa000
renamed 'datatype_new_compat' to 'datatype_compat'
blanchet
parents:
55518
diff
changeset
|
15 |
datatype_compat option |
55404
5cb95b79a51f
transformed 'option' and 'list' into new-style datatypes (but register them as old-style as well)
blanchet
parents:
55129
diff
changeset
|
16 |
|
55406 | 17 |
lemma [case_names None Some, cases type: option]: |
18 |
-- {* for backward compatibility -- names of variables differ *} |
|
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55414
diff
changeset
|
19 |
"(y = None \<Longrightarrow> P) \<Longrightarrow> (\<And>a. y = Some a \<Longrightarrow> P) \<Longrightarrow> P" |
55406 | 20 |
by (rule option.exhaust) |
21 |
||
22 |
lemma [case_names None Some, induct type: option]: |
|
23 |
-- {* for backward compatibility -- names of variables differ *} |
|
24 |
"P None \<Longrightarrow> (\<And>option. P (Some option)) \<Longrightarrow> P option" |
|
25 |
by (rule option.induct) |
|
26 |
||
55442 | 27 |
text {* Compatibility: *} |
28 |
||
55404
5cb95b79a51f
transformed 'option' and 'list' into new-style datatypes (but register them as old-style as well)
blanchet
parents:
55129
diff
changeset
|
29 |
setup {* Sign.mandatory_path "option" *} |
5cb95b79a51f
transformed 'option' and 'list' into new-style datatypes (but register them as old-style as well)
blanchet
parents:
55129
diff
changeset
|
30 |
|
5cb95b79a51f
transformed 'option' and 'list' into new-style datatypes (but register them as old-style as well)
blanchet
parents:
55129
diff
changeset
|
31 |
lemmas inducts = option.induct |
5cb95b79a51f
transformed 'option' and 'list' into new-style datatypes (but register them as old-style as well)
blanchet
parents:
55129
diff
changeset
|
32 |
lemmas cases = option.case |
5cb95b79a51f
transformed 'option' and 'list' into new-style datatypes (but register them as old-style as well)
blanchet
parents:
55129
diff
changeset
|
33 |
|
5cb95b79a51f
transformed 'option' and 'list' into new-style datatypes (but register them as old-style as well)
blanchet
parents:
55129
diff
changeset
|
34 |
setup {* Sign.parent_path *} |
30246 | 35 |
|
36 |
lemma not_None_eq [iff]: "(x ~= None) = (EX y. x = Some y)" |
|
37 |
by (induct x) auto |
|
38 |
||
39 |
lemma not_Some_eq [iff]: "(ALL y. x ~= Some y) = (x = None)" |
|
40 |
by (induct x) auto |
|
41 |
||
42 |
text{*Although it may appear that both of these equalities are helpful |
|
43 |
only when applied to assumptions, in practice it seems better to give |
|
44 |
them the uniform iff attribute. *} |
|
45 |
||
31080 | 46 |
lemma inj_Some [simp]: "inj_on Some A" |
47 |
by (rule inj_onI) simp |
|
48 |
||
55404
5cb95b79a51f
transformed 'option' and 'list' into new-style datatypes (but register them as old-style as well)
blanchet
parents:
55129
diff
changeset
|
49 |
lemma case_optionE: |
30246 | 50 |
assumes c: "(case x of None => P | Some y => Q y)" |
51 |
obtains |
|
52 |
(None) "x = None" and P |
|
53 |
| (Some) y where "x = Some y" and "Q y" |
|
54 |
using c by (cases x) simp_all |
|
55 |
||
53010 | 56 |
lemma split_option_all: "(\<forall>x. P x) \<longleftrightarrow> P None \<and> (\<forall>x. P (Some x))" |
57 |
by (auto intro: option.induct) |
|
58 |
||
59 |
lemma split_option_ex: "(\<exists>x. P x) \<longleftrightarrow> P None \<or> (\<exists>x. P (Some x))" |
|
60 |
using split_option_all[of "\<lambda>x. \<not>P x"] by blast |
|
61 |
||
31080 | 62 |
lemma UNIV_option_conv: "UNIV = insert None (range Some)" |
63 |
by(auto intro: classical) |
|
64 |
||
59522 | 65 |
lemma rel_option_None1 [simp]: "rel_option P None x \<longleftrightarrow> x = None" |
66 |
by(cases x) simp_all |
|
67 |
||
68 |
lemma rel_option_None2 [simp]: "rel_option P x None \<longleftrightarrow> x = None" |
|
69 |
by(cases x) simp_all |
|
70 |
||
71 |
lemma rel_option_inf: "inf (rel_option A) (rel_option B) = rel_option (inf A B)" (is "?lhs = ?rhs") |
|
72 |
proof(rule antisym) |
|
73 |
show "?lhs \<le> ?rhs" by(auto elim!: option.rel_cases) |
|
74 |
qed(auto elim: option.rel_mono_strong) |
|
75 |
||
76 |
lemma rel_option_reflI: |
|
77 |
"(\<And>x. x \<in> set_option y \<Longrightarrow> P x x) \<Longrightarrow> rel_option P y y" |
|
78 |
by(cases y) auto |
|
79 |
||
59523 | 80 |
|
30246 | 81 |
subsubsection {* Operations *} |
82 |
||
55518
1ddb2edf5ceb
folded 'Option.set' into BNF-generated 'set_option'
blanchet
parents:
55467
diff
changeset
|
83 |
lemma ospec [dest]: "(ALL x:set_option A. P x) ==> A = Some x ==> P x" |
30246 | 84 |
by simp |
85 |
||
51703
f2e92fc0c8aa
modifiers for classical wrappers operate on Proof.context instead of claset;
wenzelm
parents:
51096
diff
changeset
|
86 |
setup {* map_theory_claset (fn ctxt => ctxt addSD2 ("ospec", @{thm ospec})) *} |
30246 | 87 |
|
55518
1ddb2edf5ceb
folded 'Option.set' into BNF-generated 'set_option'
blanchet
parents:
55467
diff
changeset
|
88 |
lemma elem_set [iff]: "(x : set_option xo) = (xo = Some x)" |
30246 | 89 |
by (cases xo) auto |
90 |
||
55518
1ddb2edf5ceb
folded 'Option.set' into BNF-generated 'set_option'
blanchet
parents:
55467
diff
changeset
|
91 |
lemma set_empty_eq [simp]: "(set_option xo = {}) = (xo = None)" |
30246 | 92 |
by (cases xo) auto |
93 |
||
55466 | 94 |
lemma map_option_case: "map_option f y = (case y of None => None | Some x => Some (f x))" |
95 |
by (auto split: option.split) |
|
30246 | 96 |
|
55466 | 97 |
lemma map_option_is_None [iff]: |
98 |
"(map_option f opt = None) = (opt = None)" |
|
99 |
by (simp add: map_option_case split add: option.split) |
|
30246 | 100 |
|
55466 | 101 |
lemma map_option_eq_Some [iff]: |
102 |
"(map_option f xo = Some y) = (EX z. xo = Some z & f z = y)" |
|
103 |
by (simp add: map_option_case split add: option.split) |
|
30246 | 104 |
|
55466 | 105 |
lemma map_option_o_case_sum [simp]: |
106 |
"map_option f o case_sum g h = case_sum (map_option f o g) (map_option f o h)" |
|
107 |
by (rule o_case_sum) |
|
30246 | 108 |
|
55466 | 109 |
lemma map_option_cong: "x = y \<Longrightarrow> (\<And>a. y = Some a \<Longrightarrow> f a = g a) \<Longrightarrow> map_option f x = map_option g y" |
46526 | 110 |
by (cases x) auto |
111 |
||
59521 | 112 |
functor map_option: map_option |
113 |
by(simp_all add: option.map_comp fun_eq_iff option.map_id) |
|
40609 | 114 |
|
55466 | 115 |
lemma case_map_option [simp]: |
116 |
"case_option g h (map_option f x) = case_option g (h \<circ> f) x" |
|
51096 | 117 |
by (cases x) simp_all |
118 |
||
58916 | 119 |
lemma rel_option_iff: |
120 |
"rel_option R x y = (case (x, y) of (None, None) \<Rightarrow> True |
|
121 |
| (Some x, Some y) \<Rightarrow> R x y |
|
122 |
| _ \<Rightarrow> False)" |
|
123 |
by (auto split: prod.split option.split) |
|
124 |
||
59522 | 125 |
definition is_none :: "'a option \<Rightarrow> bool" |
126 |
where [code_post]: "is_none x \<longleftrightarrow> x = None" |
|
127 |
||
128 |
lemma is_none_simps [simp]: |
|
129 |
"is_none None" |
|
130 |
"\<not> is_none (Some x)" |
|
131 |
by(simp_all add: is_none_def) |
|
132 |
||
133 |
lemma is_none_code [code]: |
|
134 |
"is_none None = True" |
|
135 |
"is_none (Some x) = False" |
|
136 |
by simp_all |
|
137 |
||
138 |
lemma rel_option_unfold: |
|
139 |
"rel_option R x y \<longleftrightarrow> |
|
140 |
(is_none x \<longleftrightarrow> is_none y) \<and> (\<not> is_none x \<longrightarrow> \<not> is_none y \<longrightarrow> R (the x) (the y))" |
|
141 |
by(simp add: rel_option_iff split: option.split) |
|
142 |
||
143 |
lemma rel_optionI: |
|
144 |
"\<lbrakk> is_none x \<longleftrightarrow> is_none y; \<lbrakk> \<not> is_none x; \<not> is_none y \<rbrakk> \<Longrightarrow> P (the x) (the y) \<rbrakk> |
|
145 |
\<Longrightarrow> rel_option P x y" |
|
146 |
by(simp add: rel_option_unfold) |
|
147 |
||
148 |
lemma is_none_map_option [simp]: "is_none (map_option f x) \<longleftrightarrow> is_none x" |
|
149 |
by(simp add: is_none_def) |
|
150 |
||
151 |
lemma the_map_option: "\<not> is_none x \<Longrightarrow> the (map_option f x) = f (the x)" |
|
152 |
by(clarsimp simp add: is_none_def) |
|
153 |
||
154 |
||
39149 | 155 |
primrec bind :: "'a option \<Rightarrow> ('a \<Rightarrow> 'b option) \<Rightarrow> 'b option" where |
156 |
bind_lzero: "bind None f = None" | |
|
157 |
bind_lunit: "bind (Some x) f = f x" |
|
30246 | 158 |
|
59522 | 159 |
lemma is_none_bind: "is_none (bind f g) \<longleftrightarrow> is_none f \<or> is_none (g (the f))" |
160 |
by(cases f) simp_all |
|
161 |
||
39149 | 162 |
lemma bind_runit[simp]: "bind x Some = x" |
163 |
by (cases x) auto |
|
164 |
||
165 |
lemma bind_assoc[simp]: "bind (bind x f) g = bind x (\<lambda>y. bind (f y) g)" |
|
166 |
by (cases x) auto |
|
167 |
||
168 |
lemma bind_rzero[simp]: "bind x (\<lambda>x. None) = None" |
|
169 |
by (cases x) auto |
|
170 |
||
46526 | 171 |
lemma bind_cong: "x = y \<Longrightarrow> (\<And>a. y = Some a \<Longrightarrow> f a = g a) \<Longrightarrow> bind x f = bind y g" |
172 |
by (cases x) auto |
|
173 |
||
58895
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
174 |
lemma bind_split: "P (bind m f) |
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
175 |
\<longleftrightarrow> (m = None \<longrightarrow> P None) \<and> (\<forall>v. m=Some v \<longrightarrow> P (f v))" |
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
176 |
by (cases m) auto |
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
177 |
|
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
178 |
lemma bind_split_asm: "P (bind m f) = (\<not>( |
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
179 |
m=None \<and> \<not>P None |
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
180 |
\<or> (\<exists>x. m=Some x \<and> \<not>P (f x))))" |
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
181 |
by (cases m) auto |
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
182 |
|
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
183 |
lemmas bind_splits = bind_split bind_split_asm |
de0a4a76d7aa
Added Option.bind_split{,_asm,s}
lammich <lammich@in.tum.de>
parents:
58889
diff
changeset
|
184 |
|
59522 | 185 |
lemma bind_eq_Some_conv: "bind f g = Some x \<longleftrightarrow> (\<exists>y. f = Some y \<and> g y = Some x)" |
186 |
by(cases f) simp_all |
|
187 |
||
188 |
lemma map_option_bind: "map_option f (bind x g) = bind x (map_option f \<circ> g)" |
|
189 |
by(cases x) simp_all |
|
190 |
||
191 |
lemma bind_option_cong: |
|
192 |
"\<lbrakk> x = y; \<And>z. z \<in> set_option y \<Longrightarrow> f z = g z \<rbrakk> \<Longrightarrow> bind x f = bind y g" |
|
193 |
by(cases y) simp_all |
|
194 |
||
195 |
lemma bind_option_cong_simp: |
|
196 |
"\<lbrakk> x = y; \<And>z. z \<in> set_option y =simp=> f z = g z \<rbrakk> \<Longrightarrow> bind x f = bind y g" |
|
197 |
unfolding simp_implies_def by(rule bind_option_cong) |
|
198 |
||
199 |
lemma bind_option_cong_code: "x = y \<Longrightarrow> bind x f = bind y f" by simp |
|
200 |
setup \<open>Code_Simp.map_ss (Simplifier.add_cong @{thm bind_option_cong_code})\<close> |
|
201 |
||
202 |
||
49189 | 203 |
definition these :: "'a option set \<Rightarrow> 'a set" |
204 |
where |
|
205 |
"these A = the ` {x \<in> A. x \<noteq> None}" |
|
206 |
||
207 |
lemma these_empty [simp]: |
|
208 |
"these {} = {}" |
|
209 |
by (simp add: these_def) |
|
210 |
||
211 |
lemma these_insert_None [simp]: |
|
212 |
"these (insert None A) = these A" |
|
213 |
by (auto simp add: these_def) |
|
214 |
||
215 |
lemma these_insert_Some [simp]: |
|
216 |
"these (insert (Some x) A) = insert x (these A)" |
|
217 |
proof - |
|
218 |
have "{y \<in> insert (Some x) A. y \<noteq> None} = insert (Some x) {y \<in> A. y \<noteq> None}" |
|
219 |
by auto |
|
220 |
then show ?thesis by (simp add: these_def) |
|
221 |
qed |
|
222 |
||
223 |
lemma in_these_eq: |
|
224 |
"x \<in> these A \<longleftrightarrow> Some x \<in> A" |
|
225 |
proof |
|
226 |
assume "Some x \<in> A" |
|
227 |
then obtain B where "A = insert (Some x) B" by auto |
|
228 |
then show "x \<in> these A" by (auto simp add: these_def intro!: image_eqI) |
|
229 |
next |
|
230 |
assume "x \<in> these A" |
|
231 |
then show "Some x \<in> A" by (auto simp add: these_def) |
|
232 |
qed |
|
233 |
||
234 |
lemma these_image_Some_eq [simp]: |
|
235 |
"these (Some ` A) = A" |
|
236 |
by (auto simp add: these_def intro!: image_eqI) |
|
237 |
||
238 |
lemma Some_image_these_eq: |
|
239 |
"Some ` these A = {x\<in>A. x \<noteq> None}" |
|
240 |
by (auto simp add: these_def image_image intro!: image_eqI) |
|
241 |
||
242 |
lemma these_empty_eq: |
|
243 |
"these B = {} \<longleftrightarrow> B = {} \<or> B = {None}" |
|
244 |
by (auto simp add: these_def) |
|
245 |
||
246 |
lemma these_not_empty_eq: |
|
247 |
"these B \<noteq> {} \<longleftrightarrow> B \<noteq> {} \<and> B \<noteq> {None}" |
|
248 |
by (auto simp add: these_empty_eq) |
|
249 |
||
55518
1ddb2edf5ceb
folded 'Option.set' into BNF-generated 'set_option'
blanchet
parents:
55467
diff
changeset
|
250 |
hide_const (open) bind these |
55466 | 251 |
hide_fact (open) bind_cong |
30246 | 252 |
|
49189 | 253 |
|
58916 | 254 |
subsection {* Transfer rules for the Transfer package *} |
255 |
||
256 |
context |
|
257 |
begin |
|
258 |
interpretation lifting_syntax . |
|
259 |
||
260 |
lemma option_bind_transfer [transfer_rule]: |
|
261 |
"(rel_option A ===> (A ===> rel_option B) ===> rel_option B) |
|
262 |
Option.bind Option.bind" |
|
263 |
unfolding rel_fun_def split_option_all by simp |
|
264 |
||
59523 | 265 |
lemma pred_option_parametric [transfer_rule]: |
266 |
"((A ===> op =) ===> rel_option A ===> op =) pred_option pred_option" |
|
267 |
by(rule rel_funI)+(auto simp add: rel_option_unfold is_none_def dest: rel_funD) |
|
268 |
||
58916 | 269 |
end |
270 |
||
271 |
||
55089
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
272 |
subsubsection {* Interaction with finite sets *} |
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
273 |
|
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
274 |
lemma finite_option_UNIV [simp]: |
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
275 |
"finite (UNIV :: 'a option set) = finite (UNIV :: 'a set)" |
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
276 |
by (auto simp add: UNIV_option_conv elim: finite_imageD intro: inj_Some) |
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
277 |
|
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
278 |
instance option :: (finite) finite |
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
279 |
by default (simp add: UNIV_option_conv) |
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
280 |
|
181751ad852f
swapped dependencies of 'Finite_Set' and 'Option' (to move BNF up)
blanchet
parents:
53940
diff
changeset
|
281 |
|
30246 | 282 |
subsubsection {* Code generator setup *} |
283 |
||
59522 | 284 |
lemma equal_None_code_unfold [code_unfold]: |
38857
97775f3e8722
renamed class/constant eq to equal; tuned some instantiations
haftmann
parents:
37880
diff
changeset
|
285 |
"HOL.equal x None \<longleftrightarrow> is_none x" |
53940
36cf426cb1c6
Added symmetric code_unfold-lemmas for null and is_none
lammich <lammich@in.tum.de>
parents:
53010
diff
changeset
|
286 |
"HOL.equal None = is_none" |
36cf426cb1c6
Added symmetric code_unfold-lemmas for null and is_none
lammich <lammich@in.tum.de>
parents:
53010
diff
changeset
|
287 |
by (auto simp add: equal is_none_def) |
30246 | 288 |
|
36176
3fe7e97ccca8
replaced generic 'hide' command by more conventional 'hide_class', 'hide_type', 'hide_const', 'hide_fact' -- frees some popular keywords;
wenzelm
parents:
35719
diff
changeset
|
289 |
hide_const (open) is_none |
30246 | 290 |
|
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
291 |
code_printing |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
292 |
type_constructor option \<rightharpoonup> |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
293 |
(SML) "_ option" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
294 |
and (OCaml) "_ option" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
295 |
and (Haskell) "Maybe _" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
296 |
and (Scala) "!Option[(_)]" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
297 |
| constant None \<rightharpoonup> |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
298 |
(SML) "NONE" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
299 |
and (OCaml) "None" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
300 |
and (Haskell) "Nothing" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
301 |
and (Scala) "!None" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
302 |
| constant Some \<rightharpoonup> |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
303 |
(SML) "SOME" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
304 |
and (OCaml) "Some _" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
305 |
and (Haskell) "Just" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
306 |
and (Scala) "Some" |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
307 |
| class_instance option :: equal \<rightharpoonup> |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
308 |
(Haskell) - |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
309 |
| constant "HOL.equal :: 'a option \<Rightarrow> 'a option \<Rightarrow> bool" \<rightharpoonup> |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
51703
diff
changeset
|
310 |
(Haskell) infix 4 "==" |
30246 | 311 |
|
312 |
code_reserved SML |
|
313 |
option NONE SOME |
|
314 |
||
315 |
code_reserved OCaml |
|
316 |
option None Some |
|
317 |
||
34886 | 318 |
code_reserved Scala |
319 |
Option None Some |
|
320 |
||
30246 | 321 |
end |