author | paulson |
Mon, 26 May 1997 12:38:29 +0200 | |
changeset 3342 | ec3b55fcb165 |
parent 3295 | c9c99aa082fb |
child 3344 | b3e39a2987c1 |
permissions | -rw-r--r-- |
2019 | 1 |
(* Title: Option.ML |
2 |
ID: $Id$ |
|
3 |
Author: Tobias Nipkow |
|
4 |
Copyright 1996 TU Muenchen |
|
5 |
||
6 |
Derived rules |
|
7 |
*) |
|
8 |
||
9 |
open Option; |
|
10 |
||
3295
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
11 |
val opt_exhaustion = #nchotomy (the (datatype_info Option.thy "option")) |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
12 |
RS spec; |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
13 |
|
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
14 |
(*--------------------------------------------------------------------------- |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
15 |
* Do a case analysis on something of type 'a option. |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
16 |
*---------------------------------------------------------------------------*) |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
17 |
|
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
18 |
fun option_case_tac t = |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
19 |
(cut_inst_tac [("x",t)] opt_exhaustion |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
20 |
THEN' etac disjE |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
21 |
THEN' rotate_tac ~1 |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
22 |
THEN' Asm_full_simp_tac |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
23 |
THEN' etac exE |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
24 |
THEN' rotate_tac ~1 |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
25 |
THEN' Asm_full_simp_tac); |
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
26 |
|
c9c99aa082fb
Deleted obsolete proofs. But option_case_tac will be obsolete too
paulson
parents:
2935
diff
changeset
|
27 |
|
2019 | 28 |
goal Option.thy "P(case opt of None => a | Some(x) => b(x)) = \ |
29 |
\ ((opt = None --> P a) & (!x. opt = Some x --> P(b(x))))"; |
|
30 |
by (option.induct_tac "opt" 1); |
|
31 |
by (Simp_tac 1); |
|
32 |
by (Asm_full_simp_tac 1); |
|
33 |
qed"expand_option_case"; |