1 (* Title: HOLCF/holcfb.ML |
1 (* Title: HOLCF/holcfb.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Franz Regensburger |
3 Author: Franz Regensburger |
|
4 Changed by: David von Oheimb |
4 Copyright 1993 Technische Universitaet Muenchen |
5 Copyright 1993 Technische Universitaet Muenchen |
|
6 *) |
5 |
7 |
6 Lemmas for Holcfb.thy |
|
7 *) |
|
8 |
8 |
9 open Holcfb; |
9 open Holcfb; |
10 |
10 |
11 (* ------------------------------------------------------------------------ *) |
11 (* ------------------------------------------------------------------------ *) |
12 (* <::nat=>nat=>bool is a well-ordering *) |
12 (* <::nat=>nat=>bool is a well-ordering *) |
13 (* ------------------------------------------------------------------------ *) |
13 (* ------------------------------------------------------------------------ *) |
14 |
14 |
|
15 (* |
15 qed_goal "well_ordering_nat" Nat.thy |
16 qed_goal "well_ordering_nat" Nat.thy |
16 "!P. P(x::nat) --> (? y. P(y) & (! x. P(x) --> y <= x))" |
17 "!P. P(x::nat) --> (? y. P(y) & (! x. P(x) --> y <= x))" |
17 (fn prems => |
18 (fn prems => |
18 [ |
19 [ |
19 (res_inst_tac [("n","x")] less_induct 1), |
20 (res_inst_tac [("n","x")] less_induct 1), |
32 (atac 1), |
33 (atac 1), |
33 (strip_tac 1), |
34 (strip_tac 1), |
34 (rtac leI 1), |
35 (rtac leI 1), |
35 (fast_tac HOL_cs 1) |
36 (fast_tac HOL_cs 1) |
36 ]); |
37 ]); |
37 |
38 *) |
38 |
39 |
39 (* ------------------------------------------------------------------------ *) |
40 (* ------------------------------------------------------------------------ *) |
40 (* Lemmas for selecting the least element in a nonempty set *) |
41 (* Lemmas for selecting the least element in a nonempty set *) |
41 (* ------------------------------------------------------------------------ *) |
42 (* ------------------------------------------------------------------------ *) |
42 |
43 |
|
44 (* |
43 qed_goalw "theleast" Holcfb.thy [theleast_def] |
45 qed_goalw "theleast" Holcfb.thy [theleast_def] |
44 "P(x) ==> P(theleast(P)) & (!x.P(x)--> theleast(P) <= x)" |
46 "P(x) ==> P(theleast(P)) & (!x.P(x)--> theleast(P) <= x)" |
45 (fn prems => |
47 (fn prems => |
46 [ |
48 [ |
47 (cut_facts_tac prems 1), |
49 (cut_facts_tac prems 1), |
48 (rtac (well_ordering_nat RS spec RS mp RS exE) 1), |
50 (rtac (well_ordering_nat RS spec RS mp RS exE) 1), |
49 (atac 1), |
51 (atac 1), |
50 (rtac selectI 1), |
52 (rtac selectI 1), |
51 (atac 1) |
53 (atac 1) |
52 ]); |
54 ]); |
|
55 *) |
53 |
56 |
|
57 |
|
58 (* val theleast1 = LeastI "?P ?k êë ?P (´x. ?P x)" *) |
|
59 (* |
54 val theleast1= theleast RS conjunct1; |
60 val theleast1= theleast RS conjunct1; |
55 (* ?P1(?x1) ==> ?P1(theleast(?P1)) *) |
61 (* ?P1(?x1) ==> ?P1(theleast(?P1)) *) |
|
62 *) |
56 |
63 |
|
64 (* val theleast2 = Least_le "?P ?k êë (´x. ?P x) <= ?k" *) |
|
65 (* |
57 qed_goal "theleast2" Holcfb.thy "P(x) ==> theleast(P) <= x" |
66 qed_goal "theleast2" Holcfb.thy "P(x) ==> theleast(P) <= x" |
58 (fn prems => |
67 (fn prems => |
59 [ |
68 [ |
60 (rtac (theleast RS conjunct2 RS spec RS mp) 1), |
69 (rtac (theleast RS conjunct2 RS spec RS mp) 1), |
61 (resolve_tac prems 1), |
70 (resolve_tac prems 1), |
62 (resolve_tac prems 1) |
71 (resolve_tac prems 1) |
63 ]); |
72 ]); |
64 |
73 *) |
65 |
74 |
66 (* ------------------------------------------------------------------------ *) |
75 (* ------------------------------------------------------------------------ *) |
67 (* Some lemmas in HOL.thy *) |
76 (* Some lemmas in HOL.thy *) |
68 (* ------------------------------------------------------------------------ *) |
77 (* ------------------------------------------------------------------------ *) |
69 |
78 |
70 |
79 |
71 qed_goal "de_morgan1" HOL.thy "(~a & ~b)=(~(a | b))" |
80 (* val de_morgan1 = de_Morgan_disj RS sym; "(~a & ~b)=(~(a | b))" *) |
72 (fn prems => |
|
73 [ |
|
74 (rtac iffI 1), |
|
75 (fast_tac HOL_cs 1), |
|
76 (fast_tac HOL_cs 1) |
|
77 ]); |
|
78 |
81 |
79 qed_goal "de_morgan2" HOL.thy "(~a | ~b)=(~(a & b))" |
82 (* val de_morgan2 = de_Morgan_conj RS sym; "(~a | ~b)=(~(a & b))" *) |
80 (fn prems => |
|
81 [ |
|
82 (rtac iffI 1), |
|
83 (fast_tac HOL_cs 1), |
|
84 (fast_tac HOL_cs 1) |
|
85 ]); |
|
86 |
83 |
87 |
84 |
88 qed_goal "notall2ex" HOL.thy "(~ (!x.P(x))) = (? x.~P(x))" |
85 (* val notall2ex = not_all "(~ (!x.P(x))) = (? x.~P(x))" *) |
89 (fn prems => |
|
90 [ |
|
91 (rtac iffI 1), |
|
92 (fast_tac HOL_cs 1), |
|
93 (fast_tac HOL_cs 1) |
|
94 ]); |
|
95 |
86 |
96 qed_goal "notex2all" HOL.thy "(~ (? x.P(x))) = (!x.~P(x))" |
87 (* val notex2all = not_ex "(~ (? x.P(x))) = (!x.~P(x))" *) |
97 (fn prems => |
|
98 [ |
|
99 (rtac iffI 1), |
|
100 (fast_tac HOL_cs 1), |
|
101 (fast_tac HOL_cs 1) |
|
102 ]); |
|
103 |
88 |
104 |
89 |
105 qed_goal "selectI3" HOL.thy "(? x. P(x)) ==> P(@ x.P(x))" |
90 (* val selectI3 = select_eq_Ex RS iffD2 "(? x. P(x)) ==> P(@ x.P(x))" *) |
106 (fn prems => |
|
107 [ |
|
108 (cut_facts_tac prems 1), |
|
109 (etac exE 1), |
|
110 (etac selectI 1) |
|
111 ]); |
|
112 |
91 |
113 qed_goal "selectE" HOL.thy "P(@ x.P(x)) ==> (? x. P(x))" |
92 (* val selectE = select_eq_Ex RS iffD1 "P(@ x.P(x)) ==> (? x. P(x))" *) |
114 (fn prems => |
|
115 [ |
|
116 (cut_facts_tac prems 1), |
|
117 (etac exI 1) |
|
118 ]); |
|
119 |
|
120 qed_goal "select_eq_Ex" HOL.thy "(P(@ x.P(x))) = (? x. P(x))" |
|
121 (fn prems => |
|
122 [ |
|
123 (rtac (iff RS mp RS mp) 1), |
|
124 (strip_tac 1), |
|
125 (etac selectE 1), |
|
126 (strip_tac 1), |
|
127 (etac selectI3 1) |
|
128 ]); |
|
129 |
93 |
130 |
94 |
|
95 (* |
131 qed_goal "notnotI" HOL.thy "P ==> ~~P" |
96 qed_goal "notnotI" HOL.thy "P ==> ~~P" |
132 (fn prems => |
97 (fn prems => |
133 [ |
98 [ |
134 (cut_facts_tac prems 1), |
99 (cut_facts_tac prems 1), |
135 (fast_tac HOL_cs 1) |
100 (fast_tac HOL_cs 1) |
136 ]); |
101 ]); |
|
102 *) |
137 |
103 |
138 |
104 (* val classical2 = case_split_thm; "[|Q ==> R; ~Q ==> R|]==>R" *) |
|
105 (* |
139 qed_goal "classical2" HOL.thy "[|Q ==> R; ~Q ==> R|]==>R" |
106 qed_goal "classical2" HOL.thy "[|Q ==> R; ~Q ==> R|]==>R" |
140 (fn prems => |
107 (fn prems => |
141 [ |
108 [ |
142 (rtac disjE 1), |
109 (rtac disjE 1), |
143 (rtac excluded_middle 1), |
110 (rtac excluded_middle 1), |
144 (eresolve_tac prems 1), |
111 (eresolve_tac prems 1), |
145 (eresolve_tac prems 1) |
112 (eresolve_tac prems 1) |
146 ]); |
113 ]); |
|
114 *) |
|
115 (* |
|
116 fun case_tac s = res_inst_tac [("Q",s)] classical2; |
|
117 *) |
147 |
118 |
148 |
119 |
149 |
120 |
150 val classical3 = (notE RS notI); |
121 val classical3 = (notE RS notI); |
151 (* [| ?P ==> ~ ?P1; ?P ==> ?P1 |] ==> ~ ?P *) |
122 (* [| ?P ==> ~ ?P1; ?P ==> ?P1 |] ==> ~ ?P *) |
152 |
123 |
153 |
124 (* |
154 qed_goal "nat_less_cases" Nat.thy |
125 qed_goal "nat_less_cases" Nat.thy |
155 "[| (m::nat) < n ==> P(n,m); m=n ==> P(n,m);n < m ==> P(n,m)|]==>P(n,m)" |
126 "[| (m::nat) < n ==> P(n,m); m=n ==> P(n,m);n < m ==> P(n,m)|]==>P(n,m)" |
156 ( fn prems => |
127 ( fn prems => |
157 [ |
128 [ |
158 (res_inst_tac [("m1","n"),("n1","m")] (less_linear RS disjE) 1), |
129 (res_inst_tac [("m1","n"),("n1","m")] (less_linear RS disjE) 1), |
159 (etac disjE 2), |
130 (etac disjE 2), |
160 (etac (hd (tl (tl prems))) 1), |
131 (etac (hd (tl (tl prems))) 1), |
161 (etac (sym RS hd (tl prems)) 1), |
132 (etac (sym RS hd (tl prems)) 1), |
162 (etac (hd prems) 1) |
133 (etac (hd prems) 1) |
163 ]); |
134 ]); |
|
135 *) |
164 |
136 |
165 |
137 (* |
166 |
138 qed_goal "Suc_less_mono" Nat.thy "Suc n < Suc m = (n < m)" (fn _ => [ |
167 |
139 fast_tac (HOL_cs addIs [Suc_mono] addDs [Suc_less_SucD]) 1]); |
168 |
140 *) |
169 |
|
170 |
|