| 12196 |      1 | (*lcp: lemmas needed now because 2 is a binary numeral!*)
 | 
|  |      2 | 
 | 
|  |      3 | Goal "m+m = m*(2::nat)";
 | 
|  |      4 | by Auto_tac; 
 | 
|  |      5 | qed "m_add_m_eq2";
 | 
|  |      6 | 
 | 
|  |      7 | (*lcp: needed for binary 2 MOVE UP???*)
 | 
|  |      8 | 
 | 
|  |      9 | Goal "(0::real) <= x^2";
 | 
|  |     10 | by (asm_full_simp_tac (simpset() addsimps [numeral_2_eq_2]) 1); 
 | 
|  |     11 | qed "zero_le_x_squared";
 | 
|  |     12 | Addsimps [zero_le_x_squared];
 | 
|  |     13 | 
 | 
|  |     14 | fun multl_by_tac x i = 
 | 
|  |     15 |        let val cancel_thm = 
 | 
|  |     16 |            CLAIM "[| (0::real)<z; z*x<z*y |] ==> x<y" 
 | 
|  |     17 |        in
 | 
|  |     18 |            res_inst_tac [("z",x)] cancel_thm i 
 | 
|  |     19 |        end;
 | 
|  |     20 | 
 | 
|  |     21 | fun multr_by_tac x i = 
 | 
|  |     22 |        let val cancel_thm = 
 | 
|  |     23 |            CLAIM "[| (0::real)<z; x*z<y*z |] ==> x<y" 
 | 
|  |     24 |        in
 | 
|  |     25 |            res_inst_tac [("z",x)] cancel_thm i 
 | 
|  |     26 |        end;
 | 
|  |     27 | 
 | 
|  |     28 | (* unused? *)
 | 
|  |     29 | Goal "ALL x y. x < y --> (f::real=>real) x < f y ==> inj f";
 | 
|  |     30 | by (rtac injI 1 THEN rtac ccontr 1);
 | 
|  |     31 | by (dtac (ARITH_PROVE "x ~= y ==> x < y | y < (x::real)") 1);
 | 
|  |     32 | by (Step_tac 1);
 | 
|  |     33 | by (auto_tac (claset() addSDs [spec],simpset()));
 | 
|  |     34 | qed "real_monofun_inj";
 | 
|  |     35 | 
 | 
|  |     36 | (* HyperDef *)
 | 
|  |     37 | 
 | 
|  |     38 | Goal "0 = Abs_hypreal (hyprel `` {%n. 0})";
 | 
|  |     39 | by (simp_tac (simpset() addsimps [hypreal_zero_def RS meta_eq_to_obj_eq RS sym]) 1);
 | 
|  |     40 | qed "hypreal_zero_num";
 | 
|  |     41 | 
 | 
|  |     42 | Goal "1 = Abs_hypreal (hyprel `` {%n. 1})";
 | 
|  |     43 | by (simp_tac (simpset() addsimps [hypreal_one_def RS meta_eq_to_obj_eq RS sym]) 1);
 | 
|  |     44 | qed "hypreal_one_num";
 | 
|  |     45 | 
 | 
|  |     46 | (* RealOrd *)
 | 
|  |     47 | 
 | 
|  |     48 | Goalw [real_of_posnat_def] "0 < real_of_posnat n";
 | 
|  |     49 | by (rtac (real_gt_zero_preal_Ex RS iffD2) 1);
 | 
|  |     50 | by (Blast_tac 1);
 | 
|  |     51 | qed "real_of_posnat_gt_zero";
 | 
|  |     52 | 
 | 
|  |     53 | Addsimps [real_of_posnat_gt_zero];
 | 
|  |     54 | 
 | 
|  |     55 | bind_thm ("real_inv_real_of_posnat_gt_zero",
 | 
|  |     56 |           real_of_posnat_gt_zero RS real_inverse_gt_0);
 | 
|  |     57 | Addsimps [real_inv_real_of_posnat_gt_zero];
 | 
|  |     58 | 
 | 
|  |     59 | bind_thm ("real_of_posnat_ge_zero",real_of_posnat_gt_zero RS order_less_imp_le);
 | 
|  |     60 | Addsimps [real_of_posnat_ge_zero];
 | 
|  |     61 | 
 | 
|  |     62 | Goal "real_of_posnat n ~= 0";
 | 
|  |     63 | by (rtac (real_of_posnat_gt_zero RS real_not_refl2 RS not_sym) 1);
 | 
|  |     64 | qed "real_of_posnat_not_eq_zero";
 | 
|  |     65 | Addsimps[real_of_posnat_not_eq_zero];
 | 
|  |     66 | 
 | 
|  |     67 | Addsimps [real_of_posnat_not_eq_zero RS real_mult_inv_left];
 | 
|  |     68 | Addsimps [real_of_posnat_not_eq_zero RS real_mult_inv_right];
 | 
|  |     69 | 
 | 
|  |     70 | Goal "1 <= real_of_posnat n";
 | 
|  |     71 | by (simp_tac (simpset() addsimps [real_of_posnat_one RS sym]) 1);
 | 
|  |     72 | by (induct_tac "n" 1);
 | 
|  |     73 | by (auto_tac (claset(),
 | 
|  |     74 | 	      simpset () addsimps [real_of_posnat_Suc,real_of_posnat_one,
 | 
|  |     75 | 				   order_less_imp_le]));
 | 
|  |     76 | qed "real_of_posnat_ge_one";
 | 
|  |     77 | Addsimps [real_of_posnat_ge_one];
 | 
|  |     78 | 
 | 
|  |     79 | Goal "inverse(real_of_posnat n) ~= 0";
 | 
|  |     80 | by (rtac ((real_of_posnat_gt_zero RS 
 | 
|  |     81 |     real_not_refl2 RS not_sym) RS real_inverse_not_zero) 1);
 | 
|  |     82 | qed "real_of_posnat_real_inv_not_zero";
 | 
|  |     83 | Addsimps [real_of_posnat_real_inv_not_zero];
 | 
|  |     84 | 
 | 
|  |     85 | Goal "inverse(real_of_posnat x) = inverse(real_of_posnat y) ==> x = y";
 | 
|  |     86 | by (rtac (inj_real_of_posnat RS injD) 1);
 | 
|  |     87 | by (res_inst_tac [("n2","x")] 
 | 
|  |     88 |     (real_of_posnat_real_inv_not_zero RS real_mult_left_cancel RS iffD1) 1);
 | 
|  |     89 | by (asm_full_simp_tac (simpset() addsimps [(real_of_posnat_gt_zero RS 
 | 
|  |     90 |     real_not_refl2 RS not_sym) RS real_mult_inv_left]) 1);
 | 
|  |     91 | qed "real_of_posnat_real_inv_inj";
 | 
|  |     92 | 
 | 
|  |     93 | Goal "r < r + inverse(real_of_posnat n)";
 | 
|  |     94 | by Auto_tac;
 | 
|  |     95 | qed "real_add_inv_real_of_posnat_less";
 | 
|  |     96 | Addsimps [real_add_inv_real_of_posnat_less];
 | 
|  |     97 | 
 | 
|  |     98 | Goal "r <= r + inverse(real_of_posnat n)";
 | 
|  |     99 | by Auto_tac;
 | 
|  |    100 | qed "real_add_inv_real_of_posnat_le";
 | 
|  |    101 | Addsimps [real_add_inv_real_of_posnat_le];
 | 
|  |    102 | 
 | 
|  |    103 | Goal "0 < r ==> r*(1 + -inverse(real_of_posnat n)) < r";
 | 
|  |    104 | by (simp_tac (simpset() addsimps [real_add_mult_distrib2]) 1);
 | 
|  |    105 | by (res_inst_tac [("C","-r")] real_less_add_left_cancel 1);
 | 
|  |    106 | by (auto_tac (claset() addIs [real_mult_order],simpset() 
 | 
|  |    107 |     addsimps [real_add_assoc RS sym,real_minus_zero_less_iff2]));
 | 
|  |    108 | qed "real_mult_less_self";
 | 
|  |    109 | 
 | 
|  |    110 | Goal "(EX n. inverse(real_of_posnat n) < r) = (EX n. 1 < r * real_of_posnat n)";
 | 
|  |    111 | by (Step_tac 1);
 | 
|  |    112 | by (dres_inst_tac [("n1","n")] (real_of_posnat_gt_zero 
 | 
|  |    113 |                        RS real_mult_less_mono1) 1);
 | 
|  |    114 | by (dres_inst_tac [("n2","n")] (real_of_posnat_gt_zero RS 
 | 
|  |    115 |         real_inverse_gt_0 RS real_mult_less_mono1) 2);
 | 
|  |    116 | by (auto_tac (claset(),
 | 
|  |    117 | 	      simpset() addsimps [(real_of_posnat_gt_zero RS 
 | 
|  |    118 |     real_not_refl2 RS not_sym),real_mult_assoc]));
 | 
|  |    119 | qed "real_of_posnat_inv_Ex_iff";
 | 
|  |    120 | 
 | 
|  |    121 | Goal "(inverse(real_of_posnat n) < r) = (1 < r * real_of_posnat n)";
 | 
|  |    122 | by (Step_tac 1);
 | 
|  |    123 | by (dres_inst_tac [("n1","n")] (real_of_posnat_gt_zero 
 | 
|  |    124 |                        RS real_mult_less_mono1) 1);
 | 
|  |    125 | by (dres_inst_tac [("n2","n")] (real_of_posnat_gt_zero RS 
 | 
|  |    126 |         real_inverse_gt_0 RS real_mult_less_mono1) 2);
 | 
|  |    127 | by (auto_tac (claset(),simpset() addsimps [real_mult_assoc]));
 | 
|  |    128 | qed "real_of_posnat_inv_iff";
 | 
|  |    129 | 
 | 
|  |    130 | Goal "[| (0::real) <=z; x<y |] ==> z*x<=z*y";
 | 
|  |    131 | by (asm_simp_tac (simpset() addsimps [real_mult_commute,real_mult_le_less_mono1]) 1);
 | 
|  |    132 | qed "real_mult_le_less_mono2";
 | 
|  |    133 | 
 | 
|  |    134 | Goal "[| (0::real) <=z; x<=y |] ==> z*x<=z*y";
 | 
|  |    135 | by (dres_inst_tac [("x","x")] real_le_imp_less_or_eq 1);
 | 
|  |    136 | by (auto_tac (claset() addIs [real_mult_le_less_mono2], simpset()));
 | 
|  |    137 | qed "real_mult_le_le_mono1";
 | 
|  |    138 | 
 | 
|  |    139 | Goal "[| (0::real)<=z; x<=y |] ==> x*z<=y*z";
 | 
|  |    140 | by (dtac (real_mult_le_le_mono1) 1);
 | 
|  |    141 | by (auto_tac (claset(),simpset() addsimps [real_mult_commute]));
 | 
|  |    142 | qed "real_mult_le_le_mono2";
 | 
|  |    143 | 
 | 
|  |    144 | Goal "(inverse(real_of_posnat n) <= r) = (1 <= r * real_of_posnat n)";
 | 
|  |    145 | by (Step_tac 1);
 | 
|  |    146 | by (dres_inst_tac [("n2","n")] (real_of_posnat_gt_zero RS 
 | 
|  |    147 |     order_less_imp_le RS real_mult_le_le_mono1) 1);
 | 
|  |    148 | by (dres_inst_tac [("n3","n")] (real_of_posnat_gt_zero RS 
 | 
|  |    149 |         real_inverse_gt_0 RS order_less_imp_le RS 
 | 
|  |    150 |         real_mult_le_le_mono1) 2);
 | 
|  |    151 | by (auto_tac (claset(),simpset() addsimps real_mult_ac));
 | 
|  |    152 | qed "real_of_posnat_inv_le_iff";
 | 
|  |    153 | 
 | 
|  |    154 | Goalw [real_of_posnat_def] 
 | 
|  |    155 |       "(real_of_posnat n < real_of_posnat m) = (n < m)";
 | 
|  |    156 | by Auto_tac;
 | 
|  |    157 | qed "real_of_posnat_less_iff";
 | 
|  |    158 | Addsimps [real_of_posnat_less_iff];
 | 
|  |    159 | 
 | 
|  |    160 | Goal "(real_of_posnat n <= real_of_posnat m) = (n <= m)";
 | 
|  |    161 | by (auto_tac (claset() addDs [inj_real_of_posnat RS injD],
 | 
|  |    162 |     simpset() addsimps [real_le_less,le_eq_less_or_eq]));
 | 
|  |    163 | qed "real_of_posnat_le_iff";
 | 
|  |    164 | Addsimps [real_of_posnat_le_iff];
 | 
|  |    165 | 
 | 
|  |    166 | Goal "[| (0::real)<z; x*z<y*z |] ==> x<y";
 | 
|  |    167 | by Auto_tac;
 | 
|  |    168 | qed "real_mult_less_cancel3";
 | 
|  |    169 | 
 | 
|  |    170 | Goal "[| (0::real)<z; z*x<z*y |] ==> x<y";
 | 
|  |    171 | by Auto_tac;
 | 
|  |    172 | qed "real_mult_less_cancel4";
 | 
|  |    173 | 
 | 
|  |    174 | Goal "0 < u  ==> (u < inverse (real_of_posnat n)) = (real_of_posnat n < inverse(u))";
 | 
|  |    175 | by (Step_tac 1);
 | 
|  |    176 | by (res_inst_tac [("n2","n")] ((real_of_posnat_gt_zero RS 
 | 
|  |    177 |     real_inverse_gt_0) RS real_mult_less_cancel3) 1);
 | 
|  |    178 | by (res_inst_tac [("x1","u")] ( real_inverse_gt_0
 | 
|  |    179 |    RS real_mult_less_cancel3) 2);
 | 
|  |    180 | by (auto_tac (claset(),
 | 
|  |    181 | 	      simpset() addsimps [real_not_refl2 RS not_sym]));
 | 
|  |    182 | by (res_inst_tac [("z","u")] real_mult_less_cancel4 1);
 | 
|  |    183 | by (res_inst_tac [("n1","n")] (real_of_posnat_gt_zero RS 
 | 
|  |    184 |     real_mult_less_cancel4) 3);
 | 
|  |    185 | by (auto_tac (claset(),
 | 
|  |    186 | 	      simpset() addsimps [real_not_refl2 RS not_sym,
 | 
|  |    187 |               real_mult_assoc RS sym]));
 | 
|  |    188 | qed "real_of_posnat_less_inv_iff";
 | 
|  |    189 | 
 | 
|  |    190 | Goal "0 < u ==> (u = inverse(real_of_posnat n)) = (real_of_posnat n = inverse u)";
 | 
|  |    191 | by Auto_tac;
 | 
|  |    192 | qed "real_of_posnat_inv_eq_iff";
 | 
|  |    193 | 
 | 
|  |    194 | Goal "0 <= 1 + -inverse(real_of_posnat n)";
 | 
|  |    195 | by (res_inst_tac [("C","inverse(real_of_posnat n)")] real_le_add_right_cancel 1);
 | 
|  |    196 | by (simp_tac (simpset() addsimps [real_add_assoc,
 | 
|  |    197 |     real_of_posnat_inv_le_iff]) 1);
 | 
|  |    198 | qed "real_add_one_minus_inv_ge_zero";
 | 
|  |    199 | 
 | 
|  |    200 | Goal "0 < r ==> 0 <= r*(1 + -inverse(real_of_posnat n))";
 | 
|  |    201 | by (dtac (real_add_one_minus_inv_ge_zero RS real_mult_le_less_mono1) 1);
 | 
|  |    202 | by (Auto_tac);
 | 
|  |    203 | qed "real_mult_add_one_minus_ge_zero";
 | 
|  |    204 | 
 | 
|  |    205 | Goal "x*y = (1::real) ==> y = inverse x";
 | 
|  |    206 | by (case_tac "x ~= 0" 1);
 | 
|  |    207 | by (res_inst_tac [("c1","x")] (real_mult_left_cancel RS iffD1) 1);
 | 
|  |    208 | by Auto_tac;
 | 
|  |    209 | qed "real_inverse_unique";
 | 
|  |    210 | 
 | 
|  |    211 | Goal "[| (0::real) < x; x < 1 |] ==> 1 < inverse x";
 | 
|  |    212 | by (auto_tac (claset() addDs [real_inverse_less_swap],simpset()));
 | 
|  |    213 | qed "real_inverse_gt_one";
 | 
|  |    214 | 
 | 
|  |    215 | Goal "(0 < real (n::nat)) = (0 < n)";
 | 
|  |    216 | by (rtac (real_of_nat_less_iff RS subst) 1);
 | 
|  |    217 | by Auto_tac;
 | 
|  |    218 | qed "real_of_nat_gt_zero_cancel_iff";
 | 
|  |    219 | Addsimps [real_of_nat_gt_zero_cancel_iff];
 | 
|  |    220 | 
 | 
|  |    221 | Goal "(real (n::nat) <= 0) = (n = 0)";
 | 
|  |    222 | by (rtac ((real_of_nat_zero) RS subst) 1);
 | 
| 12486 |    223 | by (stac real_of_nat_le_iff 1);
 | 
| 12196 |    224 | by Auto_tac;
 | 
|  |    225 | qed "real_of_nat_le_zero_cancel_iff";
 | 
|  |    226 | Addsimps [real_of_nat_le_zero_cancel_iff];
 | 
|  |    227 | 
 | 
|  |    228 | Goal "~ real (n::nat) < 0";
 | 
|  |    229 | by (simp_tac (simpset() addsimps [symmetric real_le_def,
 | 
|  |    230 |     real_of_nat_ge_zero]) 1);
 | 
|  |    231 | qed "not_real_of_nat_less_zero";
 | 
|  |    232 | Addsimps [not_real_of_nat_less_zero];
 | 
|  |    233 | 
 | 
|  |    234 | Goalw [real_le_def,le_def] 
 | 
|  |    235 |       "(0 <= real (n::nat)) = (0 <= n)";
 | 
|  |    236 | by (Simp_tac 1);
 | 
|  |    237 | qed "real_of_nat_ge_zero_cancel_iff";
 | 
|  |    238 | Addsimps [real_of_nat_ge_zero_cancel_iff];
 | 
|  |    239 | 
 | 
|  |    240 | Goal "real n = (if n=0 then 0 else 1 + real ((n::nat) - 1))";
 | 
|  |    241 | by (case_tac "n" 1);
 | 
|  |    242 | by (auto_tac (claset(),simpset() addsimps [real_of_nat_Suc]));
 | 
|  |    243 | qed "real_of_nat_num_if";
 | 
|  |    244 | 
 | 
|  |    245 | Goal "4 * real n = real (4 * (n::nat))";
 | 
|  |    246 | by Auto_tac;
 | 
|  |    247 | qed "real_of_nat_mult_num_4_eq";
 | 
|  |    248 | 
 | 
|  |    249 | (*REDUNDANT
 | 
|  |    250 |     Goal "x * x = -(y * y) ==> x = (0::real)";
 | 
|  |    251 |     by (auto_tac (claset() addIs [
 | 
|  |    252 | 	real_sum_squares_cancel],simpset()));
 | 
|  |    253 |     qed "real_sum_squares_cancel1a";
 | 
|  |    254 | 
 | 
|  |    255 |     Goal "x * x = -(y * y) ==> y = (0::real)";
 | 
|  |    256 |     by (auto_tac (claset() addIs [
 | 
|  |    257 | 	real_sum_squares_cancel],simpset()));
 | 
|  |    258 |     qed "real_sum_squares_cancel2a";
 | 
|  |    259 | *)
 | 
|  |    260 | 
 | 
|  |    261 | Goal "x * x = -(y * y) ==> x = (0::real) & y=0";
 | 
|  |    262 | by (auto_tac (claset() addIs [real_sum_squares_cancel],simpset()));
 | 
|  |    263 | qed "real_sum_squares_cancel_a";
 | 
|  |    264 | 
 | 
|  |    265 | Goal "x*x - (1::real) = (x + 1)*(x - 1)";
 | 
|  |    266 | by (auto_tac (claset(),simpset() addsimps [real_add_mult_distrib,
 | 
|  |    267 |     real_add_mult_distrib2,real_diff_def]));
 | 
|  |    268 | qed "real_squared_diff_one_factored";
 | 
|  |    269 | 
 | 
|  |    270 | Goal "(x*x = (1::real)) = (x = 1 | x = - 1)";
 | 
|  |    271 | by Auto_tac;
 | 
|  |    272 | by (dtac (CLAIM "x = (y::real) ==> x - y = 0") 1);
 | 
|  |    273 | by (auto_tac (claset(),simpset() addsimps [real_squared_diff_one_factored]));
 | 
|  |    274 | qed "real_mult_is_one";
 | 
|  |    275 | AddIffs [real_mult_is_one];
 | 
|  |    276 | 
 | 
|  |    277 | Goal "(x + y/2 <= (y::real)) = (x <= y /2)";
 | 
|  |    278 | by Auto_tac;
 | 
|  |    279 | qed "real_le_add_half_cancel";
 | 
|  |    280 | Addsimps [real_le_add_half_cancel];
 | 
|  |    281 | 
 | 
|  |    282 | Goal "(x::real) - x/2 = x/2";
 | 
|  |    283 | by Auto_tac;
 | 
|  |    284 | qed "real_minus_half_eq";
 | 
|  |    285 | Addsimps [real_minus_half_eq];
 | 
|  |    286 | 
 | 
|  |    287 | Goal "[|(0::real) < x;0 < x1; x1 * y < x * u |] ==> inverse x * y < inverse x1 * u";
 | 
|  |    288 | by (multl_by_tac "x" 1);
 | 
|  |    289 | by (auto_tac (claset(),simpset() addsimps [real_mult_assoc RS sym]));
 | 
|  |    290 | by (simp_tac (simpset() addsimps real_mult_ac) 1);
 | 
|  |    291 | by (multr_by_tac "x1" 1);
 | 
|  |    292 | by (auto_tac (claset(),simpset() addsimps real_mult_ac));
 | 
|  |    293 | qed "real_mult_inverse_cancel";
 | 
|  |    294 | 
 | 
|  |    295 | Goal "[|(0::real) < x;0 < x1; x1 * y < x * u |] ==> y * inverse x < u * inverse x1";
 | 
|  |    296 | by (auto_tac (claset() addDs [real_mult_inverse_cancel],simpset() addsimps real_mult_ac));
 | 
|  |    297 | qed "real_mult_inverse_cancel2";
 | 
|  |    298 | 
 | 
|  |    299 | Goal "0 < inverse (real (Suc n))";
 | 
|  |    300 | by Auto_tac;
 | 
|  |    301 | qed "inverse_real_of_nat_gt_zero";
 | 
|  |    302 | Addsimps [ inverse_real_of_nat_gt_zero];
 | 
|  |    303 | 
 | 
|  |    304 | Goal "0 <= inverse (real (Suc n))";
 | 
|  |    305 | by Auto_tac;
 | 
|  |    306 | qed "inverse_real_of_nat_ge_zero";
 | 
|  |    307 | Addsimps [ inverse_real_of_nat_ge_zero];
 | 
|  |    308 | 
 | 
|  |    309 | Goal "x ~= 0 ==> x * x + y * y ~= (0::real)";
 | 
|  |    310 | by (rtac (CLAIM "!!x. ((x = y ==> False)) ==> x ~= y") 1);
 | 
|  |    311 | by (dtac (real_sum_squares_cancel) 1);
 | 
|  |    312 | by (Asm_full_simp_tac 1);
 | 
|  |    313 | qed "real_sum_squares_not_zero";
 | 
|  |    314 | 
 | 
|  |    315 | Goal "y ~= 0 ==> x * x + y * y ~= (0::real)";
 | 
|  |    316 | by (rtac (CLAIM "!!x. ((x = y ==> False)) ==> x ~= y") 1);
 | 
|  |    317 | by (dtac (real_sum_squares_cancel2) 1);
 | 
|  |    318 | by (Asm_full_simp_tac 1);
 | 
|  |    319 | qed "real_sum_squares_not_zero2";
 | 
|  |    320 | 
 | 
|  |    321 | (* RealAbs *)
 | 
|  |    322 | 
 | 
|  |    323 | (* nice theorem *)
 | 
|  |    324 | Goal "abs x * abs x = x * (x::real)";
 | 
|  |    325 | by (cut_inst_tac [("R1.0","x"),("R2.0","0")] real_linear 1);
 | 
|  |    326 | by (auto_tac (claset(),simpset() addsimps [abs_eqI2,abs_minus_eqI2]));
 | 
|  |    327 | qed "abs_mult_abs";
 | 
|  |    328 | Addsimps [abs_mult_abs];
 | 
|  |    329 | 
 | 
|  |    330 | (* RealPow *)
 | 
|  |    331 | Goalw [real_divide_def]
 | 
|  |    332 |     "(x/y) ^ n = ((x::real) ^ n/ y ^ n)";
 | 
|  |    333 | by (auto_tac (claset(),simpset() addsimps [realpow_mult,
 | 
|  |    334 |     realpow_inverse]));
 | 
|  |    335 | qed "realpow_divide";
 | 
|  |    336 | 
 | 
|  |    337 | Goal "isCont (%x. x ^ n) x";
 | 
|  |    338 | by (rtac (DERIV_pow RS DERIV_isCont) 1);
 | 
|  |    339 | qed "isCont_realpow";
 | 
|  |    340 | Addsimps [isCont_realpow];
 | 
|  |    341 | 
 | 
|  |    342 | Goal "(0::real) <= r --> 0 <= r ^ n";
 | 
|  |    343 | by (induct_tac "n" 1);
 | 
|  |    344 | by (auto_tac (claset(),simpset() addsimps [real_0_le_mult_iff]));
 | 
|  |    345 | qed_spec_mp "realpow_ge_zero2";
 | 
|  |    346 | 
 | 
|  |    347 | Goal "(0::real) <= x & x <= y --> x ^ n <= y ^ n";
 | 
|  |    348 | by (induct_tac "n" 1);
 | 
|  |    349 | by (auto_tac (claset() addSIs [real_mult_le_mono],
 | 
|  |    350 |     simpset() addsimps [realpow_ge_zero2]));
 | 
|  |    351 | qed_spec_mp "realpow_le2";
 | 
|  |    352 | 
 | 
|  |    353 | Goal "(1::real) < r ==> 1 < r ^ (Suc n)";
 | 
|  |    354 | by (forw_inst_tac [("n","n")] realpow_ge_one 1);
 | 
|  |    355 | by (dtac real_le_imp_less_or_eq 1 THEN Step_tac 1);
 | 
|  |    356 | by (forward_tac [(real_zero_less_one RS real_less_trans)] 1);
 | 
|  |    357 | by (dres_inst_tac [("y","r ^ n")] (real_mult_less_mono2) 1);
 | 
|  |    358 | by (assume_tac 1);
 | 
|  |    359 | by (auto_tac (claset() addDs [real_less_trans],simpset()));
 | 
|  |    360 | qed "realpow_Suc_gt_one";
 | 
|  |    361 | 
 | 
|  |    362 | Goal "(x ^ 2 + y ^ 2 = (0::real)) = (x = 0 & y = 0)";
 | 
|  |    363 | by (auto_tac (claset() addIs [real_sum_squares_cancel, real_sum_squares_cancel2], 
 | 
|  |    364 |               simpset() addsimps [numeral_2_eq_2]));
 | 
|  |    365 | qed "realpow_two_sum_zero_iff";
 | 
|  |    366 | Addsimps [realpow_two_sum_zero_iff];
 | 
|  |    367 | 
 | 
|  |    368 | Goal "(0::real) <= u ^ 2 + v ^ 2";
 | 
|  |    369 | by (rtac (real_le_add_order) 1);
 | 
|  |    370 | by (auto_tac (claset(), simpset() addsimps [numeral_2_eq_2])); 
 | 
|  |    371 | qed "realpow_two_le_add_order";
 | 
|  |    372 | Addsimps [realpow_two_le_add_order];
 | 
|  |    373 | 
 | 
|  |    374 | Goal "(0::real) <= u ^ 2 + v ^ 2 + w ^ 2";
 | 
|  |    375 | by (REPEAT(rtac (real_le_add_order) 1));
 | 
|  |    376 | by (auto_tac (claset(), simpset() addsimps [numeral_2_eq_2])); 
 | 
|  |    377 | qed "realpow_two_le_add_order2";
 | 
|  |    378 | Addsimps [realpow_two_le_add_order2];
 | 
|  |    379 | 
 | 
|  |    380 | Goal "(0::real) <= x*x + y*y";
 | 
|  |    381 | by (cut_inst_tac [("u","x"),("v","y")] realpow_two_le_add_order 1);
 | 
|  |    382 | by (auto_tac (claset(), simpset() addsimps [numeral_2_eq_2])); 
 | 
|  |    383 | qed "real_mult_self_sum_ge_zero";
 | 
|  |    384 | Addsimps [real_mult_self_sum_ge_zero];
 | 
|  |    385 | Addsimps [real_mult_self_sum_ge_zero RS abs_eqI1];
 | 
|  |    386 | 
 | 
|  |    387 | Goal "x ~= 0 ==> (0::real) < x * x + y * y";
 | 
|  |    388 | by (cut_inst_tac [("x","x"),("y","y")] real_mult_self_sum_ge_zero 1);
 | 
|  |    389 | by (dtac real_le_imp_less_or_eq 1);
 | 
|  |    390 | by (dres_inst_tac [("y","y")] real_sum_squares_not_zero 1);
 | 
|  |    391 | by Auto_tac;
 | 
|  |    392 | qed "real_sum_square_gt_zero";
 | 
|  |    393 | 
 | 
|  |    394 | Goal "y ~= 0 ==> (0::real) < x * x + y * y";
 | 
|  |    395 | by (rtac (real_add_commute RS subst) 1);
 | 
|  |    396 | by (etac real_sum_square_gt_zero 1);
 | 
|  |    397 | qed "real_sum_square_gt_zero2";
 | 
|  |    398 | 
 | 
|  |    399 | Goal "-(u * u) <= (x * (x::real))";
 | 
|  |    400 | by (res_inst_tac [("j","0")] real_le_trans 1);
 | 
|  |    401 | by Auto_tac;
 | 
|  |    402 | qed "real_minus_mult_self_le";
 | 
|  |    403 | Addsimps [real_minus_mult_self_le];
 | 
|  |    404 | 
 | 
|  |    405 | Goal "-(u ^ 2) <= (x::real) ^ 2";
 | 
|  |    406 | by (auto_tac (claset(), simpset() addsimps [numeral_2_eq_2])); 
 | 
|  |    407 | qed "realpow_square_minus_le";
 | 
|  |    408 | Addsimps [realpow_square_minus_le];
 | 
|  |    409 | 
 | 
|  |    410 | Goal "(m::real) ^ n = (if n=0 then 1 else m * m ^ (n - 1))";
 | 
|  |    411 | by (case_tac "n" 1);
 | 
|  |    412 | by Auto_tac;
 | 
|  |    413 | qed "realpow_num_eq_if";
 | 
|  |    414 | 
 | 
|  |    415 | Goal "0 < (2::real) ^ (4*d)";
 | 
|  |    416 | by (induct_tac "d" 1);
 | 
|  |    417 | by (auto_tac (claset(),simpset() addsimps [realpow_num_eq_if]));
 | 
|  |    418 | qed "real_num_zero_less_two_pow";
 | 
|  |    419 | Addsimps [real_num_zero_less_two_pow];
 | 
|  |    420 | 
 | 
|  |    421 | Goal "x * (4::real)   < y ==> x * (2 ^ 8) < y * (2 ^ 6)";
 | 
|  |    422 | by (subgoal_tac "(2::real) ^ 8 = 4 * (2 ^ 6)" 1);
 | 
|  |    423 | by (asm_simp_tac (simpset() addsimps [real_mult_assoc RS sym]) 1);
 | 
|  |    424 | by (auto_tac (claset(),simpset() addsimps [realpow_num_eq_if]));
 | 
|  |    425 | qed "lemma_realpow_num_two_mono";
 | 
|  |    426 | 
 | 
|  |    427 | Goal "2 ^ 2 = (4::real)";
 | 
|  |    428 | by (simp_tac (simpset() addsimps [realpow_num_eq_if]) 1);
 | 
|  |    429 | val lemma_realpow_4 = result();
 | 
|  |    430 | Addsimps [lemma_realpow_4];
 | 
|  |    431 | 
 | 
|  |    432 | Goal "2 ^ 4 = (16::real)";
 | 
|  |    433 | by (simp_tac (simpset() addsimps [realpow_num_eq_if]) 1);
 | 
|  |    434 | val lemma_realpow_16 = result();
 | 
|  |    435 | Addsimps [lemma_realpow_16];
 | 
|  |    436 | 
 | 
|  |    437 | (* HyperOrd *)
 | 
|  |    438 | 
 | 
|  |    439 | Goal "[| (0::hypreal) < x; y < 0 |] ==> y*x < 0";
 | 
|  |    440 | by (auto_tac (claset(),simpset() addsimps [hypreal_mult_commute,
 | 
|  |    441 |     hypreal_mult_less_zero]));
 | 
|  |    442 | qed "hypreal_mult_less_zero2";
 | 
|  |    443 | 
 | 
|  |    444 | (* HyperPow *)
 | 
|  |    445 | Goal "(0::hypreal) <= x * x";
 | 
|  |    446 | by (auto_tac (claset(),simpset() addsimps 
 | 
|  |    447 |     [hypreal_0_le_mult_iff]));
 | 
|  |    448 | qed "hypreal_mult_self_ge_zero";
 | 
|  |    449 | Addsimps [hypreal_mult_self_ge_zero];
 | 
|  |    450 | 
 | 
|  |    451 | (* deleted from distribution but I prefer to have it *)
 | 
|  |    452 | Goal "[|(0::hypreal) <= x; 0 <= y; x ^ Suc n = y ^ Suc n |] ==> x = y";
 | 
|  |    453 | by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
 | 
|  |    454 | by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
 | 
|  |    455 | by (auto_tac (claset(),simpset() addsimps 
 | 
|  |    456 |     [hrealpow,hypreal_mult,hypreal_le,hypreal_zero_num]));
 | 
|  |    457 | by (ultra_tac (claset() addIs [realpow_Suc_cancel_eq],
 | 
|  |    458 |     simpset()) 1);
 | 
|  |    459 | qed "hrealpow_Suc_cancel_eq";
 | 
|  |    460 | 
 | 
|  |    461 | (* NSA.ML: next two were there before? Not in distrib though *)
 | 
|  |    462 | 
 | 
|  |    463 | Goal "[| x + y : HInfinite; y: HFinite |] ==> x : HInfinite";
 | 
|  |    464 | by (rtac ccontr 1);
 | 
|  |    465 | by (dtac (HFinite_HInfinite_iff RS iffD2) 1);
 | 
|  |    466 | by (auto_tac (claset() addDs [HFinite_add],simpset() 
 | 
|  |    467 |     addsimps [HInfinite_HFinite_iff]));
 | 
|  |    468 | qed "HInfinite_HFinite_add_cancel";
 | 
|  |    469 | 
 | 
|  |    470 | Goal "[| x : HInfinite; y : HFinite |] ==> x + y : HInfinite";
 | 
|  |    471 | by (res_inst_tac [("y","-y")] HInfinite_HFinite_add_cancel 1);
 | 
|  |    472 | by (auto_tac (claset(),simpset() addsimps [hypreal_add_assoc,
 | 
|  |    473 |     HFinite_minus_iff]));
 | 
|  |    474 | qed "HInfinite_HFinite_add";
 | 
|  |    475 | 
 | 
|  |    476 | Goal "[| x : HInfinite; x <= y; 0 <= x |] ==> y : HInfinite";
 | 
|  |    477 | by (auto_tac (claset() addIs [HFinite_bounded],simpset() 
 | 
|  |    478 |     addsimps [HInfinite_HFinite_iff]));
 | 
|  |    479 | qed "HInfinite_ge_HInfinite";
 | 
|  |    480 | 
 | 
|  |    481 | Goal "[| x : Infinitesimal; x ~= 0 |] ==> inverse x : HInfinite";
 | 
|  |    482 | by (rtac ccontr 1 THEN dtac (HFinite_HInfinite_iff RS iffD2) 1);
 | 
|  |    483 | by (auto_tac (claset() addDs [Infinitesimal_HFinite_mult2],simpset()));
 | 
|  |    484 | qed "Infinitesimal_inverse_HInfinite";
 | 
|  |    485 | 
 | 
|  |    486 | Goal "n : HNatInfinite ==> inverse (hypreal_of_hypnat n) : Infinitesimal";
 | 
|  |    487 | by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
 | 
|  |    488 | by (auto_tac (claset(),simpset() addsimps [hypreal_of_hypnat,hypreal_inverse,
 | 
|  |    489 |     HNatInfinite_FreeUltrafilterNat_iff,Infinitesimal_FreeUltrafilterNat_iff2]));
 | 
|  |    490 | by (rtac bexI 1 THEN rtac lemma_hyprel_refl 2);
 | 
|  |    491 | by Auto_tac;
 | 
|  |    492 | by (dres_inst_tac [("x","m + 1")] spec 1);
 | 
|  |    493 | by (Ultra_tac 1);
 | 
|  |    494 | by (subgoal_tac "abs(inverse (real (Y x))) = inverse(real (Y x))" 1);
 | 
|  |    495 | by (auto_tac (claset() addSIs [abs_eqI2],simpset()));
 | 
|  |    496 | by (rtac real_inverse_less_swap 1);
 | 
|  |    497 | by Auto_tac;
 | 
|  |    498 | qed "HNatInfinite_inverse_Infinitesimal";
 | 
|  |    499 | Addsimps [HNatInfinite_inverse_Infinitesimal];
 | 
|  |    500 | 
 | 
|  |    501 | Goal "n : HNatInfinite ==> inverse (hypreal_of_hypnat n) ~= 0";
 | 
|  |    502 | by (auto_tac (claset() addSIs [hypreal_inverse_not_zero],simpset()));
 | 
|  |    503 | qed "HNatInfinite_inverse_not_zero";
 | 
|  |    504 | Addsimps [HNatInfinite_inverse_not_zero];
 | 
|  |    505 | 
 | 
|  |    506 | Goal "N : HNatInfinite \
 | 
|  |    507 | \     ==> (*fNat* (%x. inverse (real x))) N : Infinitesimal";
 | 
|  |    508 | by (res_inst_tac [("f1","inverse")]  (starfun_stafunNat_o2 RS subst) 1);
 | 
|  |    509 | by (subgoal_tac "hypreal_of_hypnat N ~= 0" 1);
 | 
|  |    510 | by (auto_tac (claset(),simpset() addsimps [starfunNat_real_of_nat]));
 | 
|  |    511 | qed "starfunNat_inverse_real_of_nat_Infinitesimal";
 | 
|  |    512 | Addsimps [starfunNat_inverse_real_of_nat_Infinitesimal];
 | 
|  |    513 | 
 | 
|  |    514 | Goal "[| x : HInfinite; y : HFinite - Infinitesimal |] \
 | 
|  |    515 | \     ==> x * y : HInfinite";
 | 
|  |    516 | by (rtac ccontr 1 THEN dtac (HFinite_HInfinite_iff RS iffD2) 1); 
 | 
|  |    517 | by (ftac HFinite_Infinitesimal_not_zero 1);
 | 
|  |    518 | by (dtac HFinite_not_Infinitesimal_inverse 1);
 | 
|  |    519 | by (Step_tac 1 THEN dtac HFinite_mult 1);
 | 
|  |    520 | by (auto_tac (claset(),simpset() addsimps [hypreal_mult_assoc,
 | 
|  |    521 |     HFinite_HInfinite_iff]));
 | 
|  |    522 | qed "HInfinite_HFinite_not_Infinitesimal_mult";
 | 
|  |    523 | 
 | 
|  |    524 | Goal "[| x : HInfinite; y : HFinite - Infinitesimal |] \
 | 
|  |    525 | \     ==> y * x : HInfinite";
 | 
|  |    526 | by (auto_tac (claset(),simpset() addsimps [hypreal_mult_commute,
 | 
|  |    527 |     HInfinite_HFinite_not_Infinitesimal_mult]));
 | 
|  |    528 | qed "HInfinite_HFinite_not_Infinitesimal_mult2";
 | 
|  |    529 | 
 | 
|  |    530 | Goal "[| x : HInfinite; 0 < x; y : Reals |] ==> y < x";
 | 
|  |    531 | by (auto_tac (claset() addSDs [bspec],simpset() addsimps 
 | 
|  |    532 |     [HInfinite_def,hrabs_def,order_less_imp_le]));
 | 
|  |    533 | qed "HInfinite_gt_SReal";
 | 
|  |    534 | 
 | 
|  |    535 | Goal "[| x : HInfinite; 0 < x |] ==> 1 < x";
 | 
|  |    536 | by (auto_tac (claset() addIs [HInfinite_gt_SReal],simpset()));
 | 
|  |    537 | qed "HInfinite_gt_zero_gt_one";
 | 
|  |    538 | 
 | 
|  |    539 | (* not added at proof?? *)
 | 
|  |    540 | Addsimps [HInfinite_omega];
 | 
|  |    541 | 
 | 
|  |    542 | (* Add in HyperDef.ML? *)
 | 
|  |    543 | Goalw [omega_def] "0 < omega";
 | 
|  |    544 | by (auto_tac (claset(),simpset() addsimps [hypreal_less,hypreal_zero_num]));
 | 
|  |    545 | qed "hypreal_omega_gt_zero";
 | 
|  |    546 | Addsimps [hypreal_omega_gt_zero];
 | 
|  |    547 | 
 | 
|  |    548 | Goal "1 ~: HInfinite";
 | 
|  |    549 | by (simp_tac (simpset() addsimps [HInfinite_HFinite_iff]) 1);
 | 
|  |    550 | qed "not_HInfinite_one";
 | 
|  |    551 | Addsimps [not_HInfinite_one];
 | 
|  |    552 | 
 | 
|  |    553 | 
 | 
|  |    554 | (* RComplete.ML *)
 | 
|  |    555 | 
 | 
|  |    556 | Goal "0 < x ==> ALL y. EX (n::nat). y < real n * x";
 | 
|  |    557 | by (Step_tac 1);
 | 
|  |    558 | by (cut_inst_tac [("x","y*inverse(x)")] reals_Archimedean2 1);
 | 
|  |    559 | by (Step_tac 1);
 | 
|  |    560 | by (forw_inst_tac [("x","y * inverse x")] (real_mult_less_mono1) 1);
 | 
|  |    561 | by (auto_tac (claset(),simpset() addsimps [real_mult_assoc,real_of_nat_def]));
 | 
|  |    562 | qed "reals_Archimedean3";
 | 
|  |    563 | 
 |