author | paulson |
Fri, 28 Nov 2003 12:09:37 +0100 | |
changeset 14269 | 502a7c95de73 |
parent 14265 | 95b42e69436c |
child 14319 | 255190be18c0 |
permissions | -rw-r--r-- |
12196 | 1 |
(* Title : NthRoot.ML |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
4 |
Description : Existence of nth root. Adapted from |
|
5 |
http://www.math.unl.edu/~webnotes |
|
6 |
*) |
|
7 |
||
8 |
(*---------------------------------------------------------------------- |
|
9 |
Existence of nth root |
|
10 |
Various lemmas needed for this result. We follow the proof |
|
11 |
given by John Lindsay Orr (jorr@math.unl.edu) in his Analysis |
|
12 |
Webnotes available on the www at http://www.math.unl.edu/~webnotes |
|
13 |
Lemmas about sequences of reals are used to reach the result. |
|
14 |
---------------------------------------------------------------------*) |
|
15 |
||
16 |
Goal "[| (0::real) < a; 0 < n |] \ |
|
17 |
\ ==> EX s. s : {x. x ^ n <= a & 0 < x}"; |
|
18 |
by (case_tac "1 <= a" 1); |
|
19 |
by (res_inst_tac [("x","1")] exI 1); |
|
20 |
by (dtac not_real_leE 2); |
|
21 |
by (dtac (less_not_refl2 RS not0_implies_Suc) 2); |
|
22 |
by (auto_tac (claset() addSIs [realpow_Suc_le_self], |
|
23 |
simpset() addsimps [real_zero_less_one])); |
|
24 |
qed "lemma_nth_realpow_non_empty"; |
|
25 |
||
26 |
Goal "[| (0::real) < a; 0 < n |] \ |
|
27 |
\ ==> EX u. isUb (UNIV::real set) {x. x ^ n <= a & 0 < x} u"; |
|
28 |
by (case_tac "1 <= a" 1); |
|
29 |
by (res_inst_tac [("x","a")] exI 1); |
|
30 |
by (dtac not_real_leE 2); |
|
31 |
by (res_inst_tac [("x","1")] exI 2); |
|
32 |
by (ALLGOALS(rtac (setleI RS isUbI))); |
|
13601 | 33 |
by Safe_tac; |
34 |
by (ALLGOALS Simp_tac); |
|
12196 | 35 |
by (ALLGOALS(rtac ccontr)); |
36 |
by (ALLGOALS(dtac not_real_leE)); |
|
37 |
by (dtac realpow_ge_self2 1 THEN assume_tac 1); |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
13601
diff
changeset
|
38 |
by (dres_inst_tac [("n","n")] realpow_less 1); |
12196 | 39 |
by (REPEAT(assume_tac 1)); |
40 |
by (dtac real_le_trans 1 THEN assume_tac 1); |
|
41 |
by (dres_inst_tac [("y","y ^ n")] order_less_le_trans 1); |
|
42 |
by (assume_tac 1 THEN etac real_less_irrefl 1); |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
13601
diff
changeset
|
43 |
by (dres_inst_tac [("n","n")] ((real_zero_less_one) RS realpow_less) 1); |
12196 | 44 |
by (Auto_tac); |
45 |
qed "lemma_nth_realpow_isUb_ex"; |
|
46 |
||
47 |
Goal "[| (0::real) < a; 0 < n |] \ |
|
48 |
\ ==> EX u. isLub (UNIV::real set) {x. x ^ n <= a & 0 < x} u"; |
|
49 |
by (blast_tac (claset() addIs [lemma_nth_realpow_isUb_ex, |
|
50 |
lemma_nth_realpow_non_empty,reals_complete]) 1); |
|
51 |
qed "nth_realpow_isLub_ex"; |
|
52 |
||
53 |
(*--------------------------------------------- |
|
54 |
First Half -- lemmas first |
|
55 |
--------------------------------------------*) |
|
56 |
Goal "isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u \ |
|
57 |
\ ==> u + inverse(real_of_posnat k) ~: {x. x ^ n <= a & 0 < x}"; |
|
58 |
by (Step_tac 1 THEN dtac isLubD2 1 THEN Blast_tac 1); |
|
59 |
by (asm_full_simp_tac (simpset() addsimps [real_le_def]) 1); |
|
60 |
val lemma_nth_realpow_seq = result(); |
|
61 |
||
62 |
Goal "[| isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u; \ |
|
63 |
\ 0 < a; 0 < n |] ==> 0 < u"; |
|
64 |
by (dtac lemma_nth_realpow_non_empty 1 THEN Auto_tac); |
|
65 |
by (dres_inst_tac [("y","s")] (isLub_isUb RS isUbD) 1); |
|
66 |
by (auto_tac (claset() addIs [order_less_le_trans],simpset())); |
|
67 |
val lemma_nth_realpow_isLub_gt_zero = result(); |
|
68 |
||
69 |
Goal "[| isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u; \ |
|
70 |
\ 0 < a; 0 < n |] ==> ALL k. a <= (u + inverse(real_of_posnat k)) ^ n"; |
|
71 |
by (Step_tac 1); |
|
12486 | 72 |
by (ftac lemma_nth_realpow_seq 1 THEN Step_tac 1); |
12196 | 73 |
by (auto_tac (claset() addEs [real_less_asym], |
74 |
simpset() addsimps [real_le_def])); |
|
75 |
by (fold_tac [real_le_def]); |
|
76 |
by (rtac real_less_trans 1); |
|
77 |
by (auto_tac (claset() addIs [real_inv_real_of_posnat_gt_zero, |
|
78 |
lemma_nth_realpow_isLub_gt_zero],simpset())); |
|
79 |
val lemma_nth_realpow_isLub_ge = result(); |
|
80 |
||
81 |
(*----------------------- |
|
82 |
First result we want |
|
83 |
----------------------*) |
|
84 |
Goal "[| (0::real) < a; 0 < n; \ |
|
85 |
\ isLub (UNIV::real set) \ |
|
86 |
\ {x. x ^ n <= a & 0 < x} u |] ==> a <= u ^ n"; |
|
12486 | 87 |
by (ftac lemma_nth_realpow_isLub_ge 1 THEN Step_tac 1); |
12196 | 88 |
by (rtac (LIMSEQ_inverse_real_of_posnat_add RS LIMSEQ_pow |
89 |
RS LIMSEQ_le_const) 1); |
|
90 |
by (auto_tac (claset(),simpset() addsimps [real_of_nat_def, |
|
91 |
real_of_posnat_Suc])); |
|
92 |
qed "realpow_nth_ge"; |
|
93 |
||
94 |
(*--------------------------------------------- |
|
95 |
Second Half |
|
96 |
--------------------------------------------*) |
|
97 |
||
98 |
Goal "[| isLub (UNIV::real set) S u; x < u |] \ |
|
99 |
\ ==> ~ isUb (UNIV::real set) S x"; |
|
100 |
by (Step_tac 1); |
|
101 |
by (dtac isLub_le_isUb 1); |
|
102 |
by (assume_tac 1); |
|
103 |
by (dtac order_less_le_trans 1); |
|
104 |
by (auto_tac (claset(),simpset() |
|
105 |
addsimps [real_less_not_refl])); |
|
106 |
qed "less_isLub_not_isUb"; |
|
107 |
||
108 |
Goal "~ isUb (UNIV::real set) S u \ |
|
109 |
\ ==> EX x: S. u < x"; |
|
110 |
by (rtac ccontr 1 THEN etac swap 1); |
|
111 |
by (rtac (setleI RS isUbI) 1); |
|
112 |
by (auto_tac (claset(),simpset() addsimps [real_le_def])); |
|
113 |
qed "not_isUb_less_ex"; |
|
114 |
||
115 |
Goal "[| isLub (UNIV::real set) {x. x ^ n <= a & (0::real) < x} u; \ |
|
116 |
\ 0 < a; 0 < n |] ==> ALL k. (u*(1 + -inverse(real_of_posnat k))) ^ n <= a"; |
|
117 |
by (Step_tac 1); |
|
118 |
by (forward_tac [less_isLub_not_isUb RS not_isUb_less_ex] 1); |
|
119 |
by (res_inst_tac [("n","k")] real_mult_less_self 1); |
|
120 |
by (blast_tac (claset() addIs [lemma_nth_realpow_isLub_gt_zero]) 1); |
|
121 |
by (Step_tac 1); |
|
122 |
by (dres_inst_tac [("n","k")] (lemma_nth_realpow_isLub_gt_zero RS |
|
123 |
real_mult_add_one_minus_ge_zero) 1); |
|
124 |
by (dtac (conjI RS realpow_le2) 3); |
|
125 |
by (rtac (CLAIM "x < y ==> (x::real) <= y") 3); |
|
126 |
by (auto_tac (claset() addIs [real_le_trans],simpset())); |
|
127 |
val lemma_nth_realpow_isLub_le = result(); |
|
128 |
||
129 |
(*----------------------- |
|
130 |
Second result we want |
|
131 |
----------------------*) |
|
132 |
Goal "[| (0::real) < a; 0 < n; \ |
|
133 |
\ isLub (UNIV::real set) \ |
|
134 |
\ {x. x ^ n <= a & 0 < x} u |] ==> u ^ n <= a"; |
|
12486 | 135 |
by (ftac lemma_nth_realpow_isLub_le 1 THEN Step_tac 1); |
12196 | 136 |
by (rtac (LIMSEQ_inverse_real_of_posnat_add_minus_mult RS LIMSEQ_pow |
137 |
RS LIMSEQ_le_const2) 1); |
|
138 |
by (auto_tac (claset(),simpset() addsimps [real_of_nat_def,real_of_posnat_Suc])); |
|
139 |
qed "realpow_nth_le"; |
|
140 |
||
141 |
(*----------- The theorem at last! -----------*) |
|
142 |
Goal "[| (0::real) < a; 0 < n |] ==> EX r. r ^ n = a"; |
|
12486 | 143 |
by (ftac nth_realpow_isLub_ex 1 THEN Auto_tac); |
12196 | 144 |
by (auto_tac (claset() addIs [realpow_nth_le, |
145 |
realpow_nth_ge,real_le_anti_sym],simpset())); |
|
146 |
qed "realpow_nth"; |
|
147 |
||
148 |
(* positive only *) |
|
149 |
Goal "[| (0::real) < a; 0 < n |] ==> EX r. 0 < r & r ^ n = a"; |
|
12486 | 150 |
by (ftac nth_realpow_isLub_ex 1 THEN Auto_tac); |
12196 | 151 |
by (auto_tac (claset() addIs [realpow_nth_le, |
152 |
realpow_nth_ge,real_le_anti_sym, |
|
153 |
lemma_nth_realpow_isLub_gt_zero],simpset())); |
|
154 |
qed "realpow_pos_nth"; |
|
155 |
||
156 |
Goal "(0::real) < a ==> EX r. 0 < r & r ^ Suc n = a"; |
|
157 |
by (blast_tac (claset() addIs [realpow_pos_nth]) 1); |
|
158 |
qed "realpow_pos_nth2"; |
|
159 |
||
160 |
(* uniqueness of nth positive root *) |
|
161 |
Goal "[| (0::real) < a; 0 < n |] ==> EX! r. 0 < r & r ^ n = a"; |
|
162 |
by (auto_tac (claset() addSIs [realpow_pos_nth],simpset())); |
|
14269 | 163 |
by (cut_inst_tac [("x","r"),("y","y")] linorder_less_linear 1); |
12196 | 164 |
by (Auto_tac); |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
13601
diff
changeset
|
165 |
by (dres_inst_tac [("x","r")] realpow_less 1); |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
13601
diff
changeset
|
166 |
by (dres_inst_tac [("x","y")] realpow_less 4); |
12196 | 167 |
by (auto_tac (claset(),simpset() addsimps [real_less_not_refl])); |
168 |
qed "realpow_pos_nth_unique"; |
|
169 |