2525
|
1 |
(* Title: HOL/MiniML/Maybe.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Wolfgang Naraschewski and Tobias Nipkow
|
|
4 |
Copyright 1996 TU Muenchen
|
|
5 |
*)
|
1300
|
6 |
|
2525
|
7 |
(* constructor laws for option_bind *)
|
5069
|
8 |
Goalw [option_bind_def] "option_bind (Some s) f = (f s)";
|
1300
|
9 |
by (Simp_tac 1);
|
2525
|
10 |
qed "option_bind_Some";
|
1300
|
11 |
|
5069
|
12 |
Goalw [option_bind_def] "option_bind None f = None";
|
2525
|
13 |
by (Simp_tac 1);
|
|
14 |
qed "option_bind_None";
|
1300
|
15 |
|
2525
|
16 |
Addsimps [option_bind_Some,option_bind_None];
|
|
17 |
|
|
18 |
(* expansion of option_bind *)
|
5069
|
19 |
Goalw [option_bind_def] "P(option_bind res f) = \
|
4072
|
20 |
\ ((res = None --> P None) & (!s. res = Some s --> P(f s)))";
|
5184
|
21 |
by (rtac option.split 1);
|
4072
|
22 |
qed "split_option_bind";
|
1751
|
23 |
|
5069
|
24 |
Goal
|
2525
|
25 |
"((option_bind m f) = None) = ((m=None) | (? p. m = Some p & f p = None))";
|
4423
|
26 |
by (simp_tac (simpset() addsplits [split_option_bind]) 1);
|
2525
|
27 |
qed "option_bind_eq_None";
|
1757
|
28 |
|
2525
|
29 |
Addsimps [option_bind_eq_None];
|
2625
|
30 |
|
|
31 |
(* auxiliary lemma *)
|
5069
|
32 |
Goal "(y = Some x) = (Some x = y)";
|
4423
|
33 |
by ( simp_tac (simpset() addsimps [eq_sym_conv]) 1);
|
2625
|
34 |
qed "rotate_Some";
|