author | wenzelm |
Thu, 08 Dec 2005 20:16:04 +0100 | |
changeset 18374 | 598e7fd7438b |
parent 17441 | 5b5feca0344a |
permissions | -rw-r--r-- |
9251
bd57acd44fc1
more tidying. also generalized some tactics to prove "Type A" and
paulson
parents:
9249
diff
changeset
|
1 |
(* Title: CTT/Bool |
0 | 2 |
ID: $Id$ |
1459 | 3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
0 | 4 |
Copyright 1991 University of Cambridge |
5 |
*) |
|
6 |
||
7 |
val bool_defs = [Bool_def,true_def,false_def,cond_def]; |
|
8 |
||
9 |
(*Derivation of rules for the type Bool*) |
|
10 |
||
11 |
(*formation rule*) |
|
9249 | 12 |
Goalw bool_defs "Bool type"; |
13 |
by (typechk_tac []) ; |
|
14 |
qed "boolF"; |
|
0 | 15 |
|
16 |
||
17 |
(*introduction rules for true, false*) |
|
18 |
||
9249 | 19 |
Goalw bool_defs "true : Bool"; |
20 |
by (typechk_tac []) ; |
|
21 |
qed "boolI_true"; |
|
0 | 22 |
|
9249 | 23 |
Goalw bool_defs "false : Bool"; |
24 |
by (typechk_tac []) ; |
|
25 |
qed "boolI_false"; |
|
0 | 26 |
|
27 |
(*elimination rule: typing of cond*) |
|
17441 | 28 |
Goalw bool_defs |
9249 | 29 |
"[| p:Bool; a : C(true); b : C(false) |] ==> cond(p,a,b) : C(p)"; |
30 |
by (typechk_tac []); |
|
31 |
by (ALLGOALS (etac TE)); |
|
32 |
by (typechk_tac []) ; |
|
33 |
qed "boolE"; |
|
0 | 34 |
|
9249 | 35 |
Goalw bool_defs |
36 |
"[| p = q : Bool; a = c : C(true); b = d : C(false) |] \ |
|
37 |
\ ==> cond(p,a,b) = cond(q,c,d) : C(p)"; |
|
38 |
by (rtac PlusEL 1); |
|
39 |
by (REPEAT (eresolve_tac [asm_rl, refl_elem RS TEL] 1)) ; |
|
40 |
qed "boolEL"; |
|
0 | 41 |
|
42 |
(*computation rules for true, false*) |
|
43 |
||
17441 | 44 |
Goalw bool_defs |
9249 | 45 |
"[| a : C(true); b : C(false) |] ==> cond(true,a,b) = a : C(true)"; |
46 |
by (resolve_tac comp_rls 1); |
|
47 |
by (typechk_tac []); |
|
48 |
by (ALLGOALS (etac TE)); |
|
49 |
by (typechk_tac []) ; |
|
50 |
qed "boolC_true"; |
|
0 | 51 |
|
9249 | 52 |
Goalw bool_defs |
53 |
"[| a : C(true); b : C(false) |] ==> cond(false,a,b) = b : C(false)"; |
|
54 |
by (resolve_tac comp_rls 1); |
|
55 |
by (typechk_tac []); |
|
56 |
by (ALLGOALS (etac TE)); |
|
57 |
by (typechk_tac []) ; |
|
58 |
qed "boolC_false"; |