1 (* Title : RComplete.thy |
1 (* Title : HOL/Real/RComplete.ML |
2 ID : $Id$ |
2 ID : $Id$ |
3 Author : Jacques D. Fleuriot |
3 Author : Jacques D. Fleuriot |
4 Copyright : 1998 University of Cambridge |
4 Copyright : 1998 University of Cambridge |
5 Description : Completeness theorems for positive |
5 |
6 reals and reals |
6 Completeness theorems for positive reals and reals. |
7 *) |
7 *) |
8 |
8 |
9 claset_ref() := claset() delWrapper "bspec"; |
9 claset_ref() := claset() delWrapper "bspec"; |
10 |
10 |
11 (*--------------------------------------------------------- |
11 (*--------------------------------------------------------- |
16 (*a few lemmas*) |
16 (*a few lemmas*) |
17 Goal "ALL x:P. #0 < x ==> \ |
17 Goal "ALL x:P. #0 < x ==> \ |
18 \ ((EX x:P. y < x) = (EX X. real_of_preal X : P & \ |
18 \ ((EX x:P. y < x) = (EX X. real_of_preal X : P & \ |
19 \ y < real_of_preal X))"; |
19 \ y < real_of_preal X))"; |
20 by (blast_tac (claset() addSDs [bspec, |
20 by (blast_tac (claset() addSDs [bspec, |
21 rename_numerals thy real_gt_zero_preal_Ex RS iffD1]) 1); |
21 rename_numerals real_gt_zero_preal_Ex RS iffD1]) 1); |
22 qed "real_sup_lemma1"; |
22 qed "real_sup_lemma1"; |
23 |
23 |
24 Goal "[| ALL x:P. #0 < x; EX x. x: P; EX y. ALL x: P. x < y |] \ |
24 Goal "[| ALL x:P. #0 < x; EX x. x: P; EX y. ALL x: P. x < y |] \ |
25 \ ==> (EX X. X: {w. real_of_preal w : P}) & \ |
25 \ ==> (EX X. X: {w. real_of_preal w : P}) & \ |
26 \ (EX Y. ALL X: {w. real_of_preal w : P}. X < Y)"; |
26 \ (EX Y. ALL X: {w. real_of_preal w : P}. X < Y)"; |
27 by (rtac conjI 1); |
27 by (rtac conjI 1); |
28 by (blast_tac (claset() addDs [bspec, |
28 by (blast_tac (claset() addDs [bspec, |
29 rename_numerals thy real_gt_zero_preal_Ex RS iffD1]) 1); |
29 rename_numerals real_gt_zero_preal_Ex RS iffD1]) 1); |
30 by Auto_tac; |
30 by Auto_tac; |
31 by (dtac bspec 1 THEN assume_tac 1); |
31 by (dtac bspec 1 THEN assume_tac 1); |
32 by (ftac bspec 1 THEN assume_tac 1); |
32 by (ftac bspec 1 THEN assume_tac 1); |
33 by (dtac real_less_trans 1 THEN assume_tac 1); |
33 by (dtac real_less_trans 1 THEN assume_tac 1); |
34 by (dtac ((rename_numerals thy real_gt_zero_preal_Ex) RS iffD1) 1 |
34 by (dtac ((rename_numerals real_gt_zero_preal_Ex) RS iffD1) 1 |
35 THEN etac exE 1); |
35 THEN etac exE 1); |
36 by (res_inst_tac [("x","ya")] exI 1); |
36 by (res_inst_tac [("x","ya")] exI 1); |
37 by Auto_tac; |
37 by Auto_tac; |
38 by (dres_inst_tac [("x","real_of_preal X")] bspec 1 THEN assume_tac 1); |
38 by (dres_inst_tac [("x","real_of_preal X")] bspec 1 THEN assume_tac 1); |
39 by (etac real_of_preal_lessD 1); |
39 by (etac real_of_preal_lessD 1); |
54 by (res_inst_tac |
54 by (res_inst_tac |
55 [("x","real_of_preal (psup({w. real_of_preal w : P}))")] exI 1); |
55 [("x","real_of_preal (psup({w. real_of_preal w : P}))")] exI 1); |
56 by Auto_tac; |
56 by Auto_tac; |
57 by (ftac real_sup_lemma2 1 THEN Auto_tac); |
57 by (ftac real_sup_lemma2 1 THEN Auto_tac); |
58 by (case_tac "#0 < ya" 1); |
58 by (case_tac "#0 < ya" 1); |
59 by (dtac ((rename_numerals thy real_gt_zero_preal_Ex) RS iffD1) 1); |
59 by (dtac ((rename_numerals real_gt_zero_preal_Ex) RS iffD1) 1); |
60 by (dtac (rename_numerals thy real_less_all_real2) 2); |
60 by (dtac (rename_numerals real_less_all_real2) 2); |
61 by Auto_tac; |
61 by Auto_tac; |
62 by (rtac (preal_complete RS spec RS iffD1) 1); |
62 by (rtac (preal_complete RS spec RS iffD1) 1); |
63 by Auto_tac; |
63 by Auto_tac; |
64 by (ftac real_gt_preal_preal_Ex 1); |
64 by (ftac real_gt_preal_preal_Ex 1); |
65 by Auto_tac; |
65 by Auto_tac; |
66 (* second part *) |
66 (* second part *) |
67 by (rtac (real_sup_lemma1 RS iffD2) 1 THEN assume_tac 1); |
67 by (rtac (real_sup_lemma1 RS iffD2) 1 THEN assume_tac 1); |
68 by (case_tac "#0 < ya" 1); |
68 by (case_tac "#0 < ya" 1); |
69 by (auto_tac (claset() addSDs (map (rename_numerals thy) |
69 by (auto_tac (claset() addSDs (map rename_numerals |
70 [real_less_all_real2, |
70 [real_less_all_real2, |
71 real_gt_zero_preal_Ex RS iffD1]), |
71 real_gt_zero_preal_Ex RS iffD1]), |
72 simpset())); |
72 simpset())); |
73 by (ftac real_sup_lemma2 2 THEN Auto_tac); |
73 by (ftac real_sup_lemma2 2 THEN Auto_tac); |
74 by (ftac real_sup_lemma2 1 THEN Auto_tac); |
74 by (ftac real_sup_lemma2 1 THEN Auto_tac); |
103 by (res_inst_tac |
103 by (res_inst_tac |
104 [("x","real_of_preal(psup({w. real_of_preal w : S}))")] exI 1); |
104 [("x","real_of_preal(psup({w. real_of_preal w : S}))")] exI 1); |
105 by (auto_tac (claset(), simpset() addsimps |
105 by (auto_tac (claset(), simpset() addsimps |
106 [isLub_def,leastP_def,isUb_def])); |
106 [isLub_def,leastP_def,isUb_def])); |
107 by (auto_tac (claset() addSIs [setleI,setgeI] |
107 by (auto_tac (claset() addSIs [setleI,setgeI] |
108 addSDs [(rename_numerals thy real_gt_zero_preal_Ex) RS iffD1], |
108 addSDs [(rename_numerals real_gt_zero_preal_Ex) RS iffD1], |
109 simpset())); |
109 simpset())); |
110 by (forw_inst_tac [("x","y")] bspec 1 THEN assume_tac 1); |
110 by (forw_inst_tac [("x","y")] bspec 1 THEN assume_tac 1); |
111 by (dtac ((rename_numerals thy real_gt_zero_preal_Ex) RS iffD1) 1); |
111 by (dtac ((rename_numerals real_gt_zero_preal_Ex) RS iffD1) 1); |
112 by (auto_tac (claset(), simpset() addsimps [real_of_preal_le_iff])); |
112 by (auto_tac (claset(), simpset() addsimps [real_of_preal_le_iff])); |
113 by (rtac preal_psup_leI2a 1); |
113 by (rtac preal_psup_leI2a 1); |
114 by (forw_inst_tac [("y","real_of_preal ya")] setleD 1 THEN assume_tac 1); |
114 by (forw_inst_tac [("y","real_of_preal ya")] setleD 1 THEN assume_tac 1); |
115 by (ftac real_ge_preal_preal_Ex 1); |
115 by (ftac real_ge_preal_preal_Ex 1); |
116 by (Step_tac 1); |
116 by (Step_tac 1); |
117 by (res_inst_tac [("x","y")] exI 1); |
117 by (res_inst_tac [("x","y")] exI 1); |
118 by (blast_tac (claset() addSDs [setleD] addIs [real_of_preal_le_iff RS iffD1]) 1); |
118 by (blast_tac (claset() addSDs [setleD] addIs [real_of_preal_le_iff RS iffD1]) 1); |
119 by (forw_inst_tac [("x","x")] bspec 1 THEN assume_tac 1); |
119 by (forw_inst_tac [("x","x")] bspec 1 THEN assume_tac 1); |
120 by (ftac isUbD2 1); |
120 by (ftac isUbD2 1); |
121 by (dtac ((rename_numerals thy real_gt_zero_preal_Ex) RS iffD1) 1); |
121 by (dtac ((rename_numerals real_gt_zero_preal_Ex) RS iffD1) 1); |
122 by (auto_tac (claset() addSDs [isUbD, real_ge_preal_preal_Ex], |
122 by (auto_tac (claset() addSDs [isUbD, real_ge_preal_preal_Ex], |
123 simpset() addsimps [real_of_preal_le_iff])); |
123 simpset() addsimps [real_of_preal_le_iff])); |
124 by (blast_tac (claset() addSDs [setleD] addSIs [psup_le_ub1] |
124 by (blast_tac (claset() addSDs [setleD] addSIs [psup_le_ub1] |
125 addIs [real_of_preal_le_iff RS iffD1]) 1); |
125 addIs [real_of_preal_le_iff RS iffD1]) 1); |
126 qed "posreals_complete"; |
126 qed "posreals_complete"; |
231 by (res_inst_tac [("R1.0","x"),("R2.0","#0")] real_linear_less2 1); |
231 by (res_inst_tac [("R1.0","x"),("R2.0","#0")] real_linear_less2 1); |
232 by (res_inst_tac [("x","0")] exI 1); |
232 by (res_inst_tac [("x","0")] exI 1); |
233 by (res_inst_tac [("x","0")] exI 2); |
233 by (res_inst_tac [("x","0")] exI 2); |
234 by (auto_tac (claset() addEs [real_less_trans], |
234 by (auto_tac (claset() addEs [real_less_trans], |
235 simpset() addsimps [real_of_posnat_one,real_zero_less_one])); |
235 simpset() addsimps [real_of_posnat_one,real_zero_less_one])); |
236 by (ftac ((rename_numerals thy real_rinv_gt_zero) RS reals_Archimedean) 1); |
236 by (ftac ((rename_numerals real_rinv_gt_zero) RS reals_Archimedean) 1); |
237 by (Step_tac 1 THEN res_inst_tac [("x","n")] exI 1); |
237 by (Step_tac 1 THEN res_inst_tac [("x","n")] exI 1); |
238 by (forw_inst_tac [("y","rinv x")] |
238 by (forw_inst_tac [("y","rinv x")] |
239 (rename_numerals thy real_mult_less_mono1) 1); |
239 (rename_numerals real_mult_less_mono1) 1); |
240 by (auto_tac (claset(),simpset() addsimps [real_not_refl2 RS not_sym])); |
240 by (auto_tac (claset(),simpset() addsimps [real_not_refl2 RS not_sym])); |
241 by (dres_inst_tac [("n1","n"),("y","#1")] |
241 by (dres_inst_tac [("n1","n"),("y","#1")] |
242 (real_of_posnat_less_zero RS real_mult_less_mono2) 1); |
242 (real_of_posnat_less_zero RS real_mult_less_mono2) 1); |
243 by (auto_tac (claset(), |
243 by (auto_tac (claset(), |
244 simpset() addsimps [rename_numerals thy real_of_posnat_less_zero, |
244 simpset() addsimps [rename_numerals real_of_posnat_less_zero, |
245 real_not_refl2 RS not_sym, |
245 real_not_refl2 RS not_sym, |
246 real_mult_assoc RS sym])); |
246 real_mult_assoc RS sym])); |
247 qed "reals_Archimedean2"; |
247 qed "reals_Archimedean2"; |
248 |
248 |
249 |
249 |