17248
|
1 |
(* Title: LCF/lcf.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Tobias Nipkow
|
|
4 |
Copyright 1992 University of Cambridge
|
|
5 |
*)
|
|
6 |
|
|
7 |
(* Standard abbreviations *)
|
|
8 |
|
|
9 |
val rstac = resolve_tac;
|
|
10 |
fun stac th = rtac(th RS sym RS subst);
|
|
11 |
fun sstac ths = EVERY' (map stac ths);
|
|
12 |
|
|
13 |
fun strip_tac i = REPEAT(rstac [impI,allI] i);
|
|
14 |
|
|
15 |
val eq_imp_less1 = prove_goal (the_context ()) "x=y ==> x << y"
|
|
16 |
(fn prems => [rtac (rewrite_rule[eq_def](hd prems) RS conjunct1) 1]);
|
|
17 |
|
|
18 |
val eq_imp_less2 = prove_goal (the_context ()) "x=y ==> y << x"
|
|
19 |
(fn prems => [rtac (rewrite_rule[eq_def](hd prems) RS conjunct2) 1]);
|
|
20 |
|
|
21 |
val less_refl = refl RS eq_imp_less1;
|
|
22 |
|
|
23 |
val less_anti_sym = prove_goal (the_context ()) "[| x << y; y << x |] ==> x=y"
|
|
24 |
(fn prems => [rewtac eq_def,
|
|
25 |
REPEAT(rstac(conjI::prems)1)]);
|
|
26 |
|
|
27 |
val ext = prove_goal (the_context ())
|
|
28 |
"(!!x::'a::cpo. f(x)=(g(x)::'b::cpo)) ==> (%x. f(x))=(%x. g(x))"
|
|
29 |
(fn [prem] => [REPEAT(rstac[less_anti_sym, less_ext, allI,
|
|
30 |
prem RS eq_imp_less1,
|
|
31 |
prem RS eq_imp_less2]1)]);
|
|
32 |
|
|
33 |
val cong = prove_goal (the_context ()) "[| f=g; x=y |] ==> f(x)=g(y)"
|
|
34 |
(fn prems => [cut_facts_tac prems 1, etac subst 1, etac subst 1,
|
|
35 |
rtac refl 1]);
|
|
36 |
|
|
37 |
val less_ap_term = less_refl RS mono;
|
|
38 |
val less_ap_thm = less_refl RSN (2,mono);
|
|
39 |
val ap_term = refl RS cong;
|
|
40 |
val ap_thm = refl RSN (2,cong);
|
|
41 |
|
|
42 |
val UU_abs = prove_goal (the_context ()) "(%x::'a::cpo. UU) = UU"
|
|
43 |
(fn _ => [rtac less_anti_sym 1, rtac minimal 2,
|
|
44 |
rtac less_ext 1, rtac allI 1, rtac minimal 1]);
|
|
45 |
|
|
46 |
val UU_app = UU_abs RS sym RS ap_thm;
|
|
47 |
|
|
48 |
val less_UU = prove_goal (the_context ()) "x << UU ==> x=UU"
|
|
49 |
(fn prems=> [rtac less_anti_sym 1,rstac prems 1,rtac minimal 1]);
|
|
50 |
|
|
51 |
|
|
52 |
val tr_induct = prove_goal (the_context ()) "[| P(UU); P(TT); P(FF) |] ==> ALL b. P(b)"
|
|
53 |
(fn prems => [rtac allI 1, rtac mp 1,
|
|
54 |
res_inst_tac[("p","b")]tr_cases 2,
|
|
55 |
fast_tac (FOL_cs addIs prems) 1]);
|
|
56 |
|
|
57 |
|
|
58 |
val Contrapos = prove_goal (the_context ()) "(A ==> B) ==> (~B ==> ~A)"
|
|
59 |
(fn prems => [rtac notI 1, rtac notE 1, rstac prems 1,
|
|
60 |
rstac prems 1, atac 1]);
|
|
61 |
|
|
62 |
val not_less_imp_not_eq1 = eq_imp_less1 COMP Contrapos;
|
|
63 |
val not_less_imp_not_eq2 = eq_imp_less2 COMP Contrapos;
|
|
64 |
|
|
65 |
val not_UU_eq_TT = not_TT_less_UU RS not_less_imp_not_eq2;
|
|
66 |
val not_UU_eq_FF = not_FF_less_UU RS not_less_imp_not_eq2;
|
|
67 |
val not_TT_eq_UU = not_TT_less_UU RS not_less_imp_not_eq1;
|
|
68 |
val not_TT_eq_FF = not_TT_less_FF RS not_less_imp_not_eq1;
|
|
69 |
val not_FF_eq_UU = not_FF_less_UU RS not_less_imp_not_eq1;
|
|
70 |
val not_FF_eq_TT = not_FF_less_TT RS not_less_imp_not_eq1;
|
|
71 |
|
|
72 |
|
|
73 |
val COND_cases_iff = (prove_goal (the_context ())
|
|
74 |
"ALL b. P(b=>x|y) <-> (b=UU-->P(UU)) & (b=TT-->P(x)) & (b=FF-->P(y))"
|
|
75 |
(fn _ => [cut_facts_tac [not_UU_eq_TT,not_UU_eq_FF,not_TT_eq_UU,
|
|
76 |
not_TT_eq_FF,not_FF_eq_UU,not_FF_eq_TT]1,
|
|
77 |
rtac tr_induct 1, stac COND_UU 1, stac COND_TT 2,
|
|
78 |
stac COND_FF 3, REPEAT(fast_tac FOL_cs 1)])) RS spec;
|
|
79 |
|
|
80 |
val lemma = prove_goal (the_context ()) "A<->B ==> B ==> A"
|
|
81 |
(fn prems => [cut_facts_tac prems 1, rewtac iff_def,
|
|
82 |
fast_tac FOL_cs 1]);
|
|
83 |
|
|
84 |
val COND_cases = conjI RSN (2,conjI RS (COND_cases_iff RS lemma));
|
|
85 |
|
|
86 |
|
|
87 |
val LCF_ss = FOL_ss addsimps
|
|
88 |
[minimal,
|
|
89 |
UU_app, UU_app RS ap_thm, UU_app RS ap_thm RS ap_thm,
|
|
90 |
not_TT_less_FF,not_FF_less_TT,not_TT_less_UU,not_FF_less_UU,
|
|
91 |
not_UU_eq_TT,not_UU_eq_FF,not_TT_eq_UU,not_TT_eq_FF,
|
|
92 |
not_FF_eq_UU,not_FF_eq_TT,
|
|
93 |
COND_UU,COND_TT,COND_FF,
|
|
94 |
surj_pairing,FST,SND];
|
17876
|
95 |
|
|
96 |
change_simpset (fn _ => LCF_ss);
|