src/HOL/Real/Hyperreal/HyperPow.ML
changeset 10715 c838477b5c18
parent 10712 351ba950d4d9
child 10720 1ce5a189f672
equal deleted inserted replaced
10714:07f75bf77a33 10715:c838477b5c18
    18 
    18 
    19 Goal "r ~= (0::hypreal) --> inverse(r ^ n) = (inverse r) ^ n";
    19 Goal "r ~= (0::hypreal) --> inverse(r ^ n) = (inverse r) ^ n";
    20 by (induct_tac "n" 1);
    20 by (induct_tac "n" 1);
    21 by (Auto_tac);
    21 by (Auto_tac);
    22 by (forw_inst_tac [("n","n")] hrealpow_not_zero 1);
    22 by (forw_inst_tac [("n","n")] hrealpow_not_zero 1);
    23 by (auto_tac (claset() addDs [inverse_mult_eq],
    23 by (auto_tac (claset(), simpset() addsimps [inverse_mult_eq]));
    24     simpset()));
       
    25 qed_spec_mp "hrealpow_inverse";
    24 qed_spec_mp "hrealpow_inverse";
    26 
    25 
    27 Goal "abs (r::hypreal) ^ n = abs (r ^ n)";
    26 Goal "abs (r::hypreal) ^ n = abs (r ^ n)";
    28 by (induct_tac "n" 1);
    27 by (induct_tac "n" 1);
    29 by (auto_tac (claset(),simpset() addsimps [hrabs_mult,hrabs_one]));
    28 by (auto_tac (claset(), simpset() addsimps [hrabs_mult,hrabs_one]));
    30 qed "hrealpow_hrabs";
    29 qed "hrealpow_hrabs";
    31 
    30 
    32 Goal "(r::hypreal) ^ (n + m) = (r ^ n) * (r ^ m)";
    31 Goal "(r::hypreal) ^ (n + m) = (r ^ n) * (r ^ m)";
    33 by (induct_tac "n" 1);
    32 by (induct_tac "n" 1);
    34 by (auto_tac (claset(),simpset() addsimps hypreal_mult_ac));
    33 by (auto_tac (claset(), simpset() addsimps hypreal_mult_ac));
    35 qed "hrealpow_add";
    34 qed "hrealpow_add";
    36 
    35 
    37 Goal "(r::hypreal) ^ 1 = r";
    36 Goal "(r::hypreal) ^ 1 = r";
    38 by (Simp_tac 1);
    37 by (Simp_tac 1);
    39 qed "hrealpow_one";
    38 qed "hrealpow_one";
    44 qed "hrealpow_two";
    43 qed "hrealpow_two";
    45 
    44 
    46 Goal "(0::hypreal) < r --> 0 <= r ^ n";
    45 Goal "(0::hypreal) < r --> 0 <= r ^ n";
    47 by (induct_tac "n" 1);
    46 by (induct_tac "n" 1);
    48 by (auto_tac (claset() addDs [hypreal_less_imp_le] 
    47 by (auto_tac (claset() addDs [hypreal_less_imp_le] 
    49     addIs [hypreal_le_mult_order],simpset() addsimps 
    48                        addIs [hypreal_le_mult_order],
    50     [hypreal_zero_less_one RS hypreal_less_imp_le]));
    49              simpset() addsimps [hypreal_zero_less_one RS hypreal_less_imp_le]));
    51 qed_spec_mp "hrealpow_ge_zero";
    50 qed_spec_mp "hrealpow_ge_zero";
    52 
    51 
    53 Goal "(0::hypreal) < r --> 0 < r ^ n";
    52 Goal "(0::hypreal) < r --> 0 < r ^ n";
    54 by (induct_tac "n" 1);
    53 by (induct_tac "n" 1);
    55 by (auto_tac (claset() addIs [hypreal_mult_order],
    54 by (auto_tac (claset() addIs [hypreal_mult_order],
    56     simpset() addsimps [hypreal_zero_less_one]));
    55               simpset() addsimps [hypreal_zero_less_one]));
    57 qed_spec_mp "hrealpow_gt_zero";
    56 qed_spec_mp "hrealpow_gt_zero";
    58 
    57 
    59 Goal "(0::hypreal) <= r --> 0 <= r ^ n";
    58 Goal "(0::hypreal) <= r --> 0 <= r ^ n";
    60 by (induct_tac "n" 1);
    59 by (induct_tac "n" 1);
    61 by (auto_tac (claset() addIs [hypreal_le_mult_order],simpset() 
    60 by (auto_tac (claset() addIs [hypreal_le_mult_order],
    62     addsimps [hypreal_zero_less_one RS hypreal_less_imp_le]));
    61           simpset() addsimps [hypreal_zero_less_one RS hypreal_less_imp_le]));
    63 qed_spec_mp "hrealpow_ge_zero2";
    62 qed_spec_mp "hrealpow_ge_zero2";
    64 
    63 
    65 Goal "(0::hypreal) < x & x <= y --> x ^ n <= y ^ n";
    64 Goal "(0::hypreal) < x & x <= y --> x ^ n <= y ^ n";
    66 by (induct_tac "n" 1);
    65 by (induct_tac "n" 1);
    67 by (auto_tac (claset() addSIs [hypreal_mult_le_mono],
    66 by (auto_tac (claset() addSIs [hypreal_mult_le_mono],
    68     simpset() addsimps [hypreal_le_refl]));
    67               simpset() addsimps [hypreal_le_refl]));
    69 by (asm_simp_tac (simpset() addsimps [hrealpow_ge_zero]) 1);
    68 by (asm_simp_tac (simpset() addsimps [hrealpow_ge_zero]) 1);
    70 qed_spec_mp "hrealpow_le";
    69 qed_spec_mp "hrealpow_le";
    71 
    70 
    72 Goal "(0::hypreal) < x & x < y & 0 < n --> x ^ n < y ^ n";
    71 Goal "(0::hypreal) < x & x < y & 0 < n --> x ^ n < y ^ n";
    73 by (induct_tac "n" 1);
    72 by (induct_tac "n" 1);
    74 by (auto_tac (claset() addIs [hypreal_mult_less_mono,gr0I] 
    73 by (auto_tac (claset() addIs [hypreal_mult_less_mono,gr0I] 
    75     addDs [hrealpow_gt_zero],simpset()));
    74                        addDs [hrealpow_gt_zero],
       
    75               simpset()));
    76 qed "hrealpow_less";
    76 qed "hrealpow_less";
    77 
    77 
    78 Goal "1hr ^ n = 1hr";
    78 Goal "1hr ^ n = 1hr";
    79 by (induct_tac "n" 1);
    79 by (induct_tac "n" 1);
    80 by (Auto_tac);
    80 by (Auto_tac);
    81 qed "hrealpow_eq_one";
    81 qed "hrealpow_eq_one";
    82 Addsimps [hrealpow_eq_one];
    82 Addsimps [hrealpow_eq_one];
    83 
    83 
    84 Goal "abs(-(1hr ^ n)) = 1hr";
    84 Goal "abs(-(1hr ^ n)) = 1hr";
    85 by (simp_tac (simpset() addsimps 
    85 by (simp_tac (simpset() addsimps [hrabs_one]) 1);
    86     [hrabs_minus_cancel,hrabs_one]) 1);
       
    87 qed "hrabs_minus_hrealpow_one";
    86 qed "hrabs_minus_hrealpow_one";
    88 Addsimps [hrabs_minus_hrealpow_one];
    87 Addsimps [hrabs_minus_hrealpow_one];
    89 
    88 
    90 Goal "abs((-1hr) ^ n) = 1hr";
    89 Goal "abs((-1hr) ^ n) = 1hr";
    91 by (induct_tac "n" 1);
    90 by (induct_tac "n" 1);
    92 by (auto_tac (claset(),simpset() addsimps [hrabs_mult,
    91 by (auto_tac (claset(),
    93          hrabs_minus_cancel,hrabs_one]));
    92       simpset() addsimps [hrabs_mult, hrabs_one]));
    94 qed "hrabs_hrealpow_minus_one";
    93 qed "hrabs_hrealpow_minus_one";
    95 Addsimps [hrabs_hrealpow_minus_one];
    94 Addsimps [hrabs_hrealpow_minus_one];
    96 
    95 
    97 Goal "((r::hypreal) * s) ^ n = (r ^ n) * (s ^ n)";
    96 Goal "((r::hypreal) * s) ^ n = (r ^ n) * (s ^ n)";
    98 by (induct_tac "n" 1);
    97 by (induct_tac "n" 1);
    99 by (auto_tac (claset(),simpset() addsimps hypreal_mult_ac));
    98 by (auto_tac (claset(), simpset() addsimps hypreal_mult_ac));
   100 qed "hrealpow_mult";
    99 qed "hrealpow_mult";
   101 
   100 
   102 Goal "(0::hypreal) <= r ^ 2";
   101 Goal "(0::hypreal) <= r ^ 2";
   103 by (simp_tac (simpset() addsimps [hrealpow_two]) 1);
   102 by (simp_tac (simpset() addsimps [hrealpow_two]) 1);
   104 qed "hrealpow_two_le";
   103 qed "hrealpow_two_le";
   105 Addsimps [hrealpow_two_le];
   104 Addsimps [hrealpow_two_le];
   106 
   105 
   107 Goal "(0::hypreal) <= u ^ 2 + v ^ 2";
   106 Goal "(0::hypreal) <= u ^ 2 + v ^ 2";
   108 by (auto_tac (claset() addIs [hypreal_le_add_order],simpset()));
   107 by (auto_tac (claset() addIs [hypreal_le_add_order], simpset()));
   109 qed "hrealpow_two_le_add_order";
   108 qed "hrealpow_two_le_add_order";
   110 Addsimps [hrealpow_two_le_add_order];
   109 Addsimps [hrealpow_two_le_add_order];
   111 
   110 
   112 Goal "(0::hypreal) <= u ^ 2 + v ^ 2 + w ^ 2";
   111 Goal "(0::hypreal) <= u ^ 2 + v ^ 2 + w ^ 2";
   113 by (auto_tac (claset() addSIs [hypreal_le_add_order],simpset()));
   112 by (auto_tac (claset() addSIs [hypreal_le_add_order], simpset()));
   114 qed "hrealpow_two_le_add_order2";
   113 qed "hrealpow_two_le_add_order2";
   115 Addsimps [hrealpow_two_le_add_order2];
   114 Addsimps [hrealpow_two_le_add_order2];
   116 
   115 
   117 Goal "(x ^ 2 + y ^ 2 + z ^ 2 = (0::hypreal)) = (x = 0 & y = 0 & z = 0)";
   116 Goal "(x ^ 2 + y ^ 2 + z ^ 2 = (0::hypreal)) = (x = 0 & y = 0 & z = 0)";
   118 by (simp_tac (HOL_ss addsimps [hypreal_three_squares_add_zero_iff, 
   117 by (simp_tac (HOL_ss addsimps [hypreal_three_squares_add_zero_iff, 
   130                         delsimps [hpowr_Suc]) 1);
   129                         delsimps [hpowr_Suc]) 1);
   131 qed "hrealpow_two_hrabs";
   130 qed "hrealpow_two_hrabs";
   132 Addsimps [hrealpow_two_hrabs];
   131 Addsimps [hrealpow_two_hrabs];
   133 
   132 
   134 Goal "!!r. 1hr < r ==> 1hr < r ^ 2";
   133 Goal "!!r. 1hr < r ==> 1hr < r ^ 2";
   135 by (auto_tac (claset(),simpset() addsimps [hrealpow_two]));
   134 by (auto_tac (claset(), simpset() addsimps [hrealpow_two]));
   136 by (cut_facts_tac [hypreal_zero_less_one] 1);
   135 by (cut_facts_tac [hypreal_zero_less_one] 1);
   137 by (forw_inst_tac [("R1.0","0")] hypreal_less_trans 1);
   136 by (forw_inst_tac [("R1.0","0")] hypreal_less_trans 1);
   138 by (assume_tac 1);
   137 by (assume_tac 1);
   139 by (dres_inst_tac [("z","r"),("x","1hr")] hypreal_mult_less_mono1 1);
   138 by (dres_inst_tac [("z","r"),("x","1hr")] hypreal_mult_less_mono1 1);
   140 by (auto_tac (claset() addIs [hypreal_less_trans],simpset()));
   139 by (auto_tac (claset() addIs [hypreal_less_trans], simpset()));
   141 qed "hrealpow_two_gt_one";
   140 qed "hrealpow_two_gt_one";
   142 
   141 
   143 Goal "!!r. 1hr <= r ==> 1hr <= r ^ 2";
   142 Goal "!!r. 1hr <= r ==> 1hr <= r ^ 2";
   144 by (etac (hypreal_le_imp_less_or_eq RS disjE) 1);
   143 by (etac (hypreal_le_imp_less_or_eq RS disjE) 1);
   145 by (etac (hrealpow_two_gt_one RS hypreal_less_imp_le) 1);
   144 by (etac (hrealpow_two_gt_one RS hypreal_less_imp_le) 1);
   149 Goal "!!r. (0::hypreal) < r ==> 0 < r ^ Suc n";
   148 Goal "!!r. (0::hypreal) < r ==> 0 < r ^ Suc n";
   150 by (forw_inst_tac [("n","n")] hrealpow_ge_zero 1);
   149 by (forw_inst_tac [("n","n")] hrealpow_ge_zero 1);
   151 by (forw_inst_tac [("n1","n")]
   150 by (forw_inst_tac [("n1","n")]
   152     ((hypreal_not_refl2 RS not_sym) RS hrealpow_not_zero RS not_sym) 1);
   151     ((hypreal_not_refl2 RS not_sym) RS hrealpow_not_zero RS not_sym) 1);
   153 by (auto_tac (claset() addSDs [hypreal_le_imp_less_or_eq]
   152 by (auto_tac (claset() addSDs [hypreal_le_imp_less_or_eq]
   154      addIs [hypreal_mult_order],simpset()));
   153                        addIs [hypreal_mult_order],
       
   154               simpset()));
   155 qed "hrealpow_Suc_gt_zero";
   155 qed "hrealpow_Suc_gt_zero";
   156 
   156 
   157 Goal "!!r. (0::hypreal) <= r ==> 0 <= r ^ Suc n";
   157 Goal "!!r. (0::hypreal) <= r ==> 0 <= r ^ Suc n";
   158 by (etac (hypreal_le_imp_less_or_eq RS disjE) 1);
   158 by (etac (hypreal_le_imp_less_or_eq RS disjE) 1);
   159 by (etac (hrealpow_ge_zero) 1);
   159 by (etac (hrealpow_ge_zero) 1);
   168     hypreal_one_less_two,hypreal_le_refl]));
   168     hypreal_one_less_two,hypreal_le_refl]));
   169 qed "two_hrealpow_ge_one";
   169 qed "two_hrealpow_ge_one";
   170 
   170 
   171 Goal "hypreal_of_nat n < (1hr + 1hr) ^ n";
   171 Goal "hypreal_of_nat n < (1hr + 1hr) ^ n";
   172 by (induct_tac "n" 1);
   172 by (induct_tac "n" 1);
   173 by (auto_tac (claset(),simpset() addsimps [hypreal_of_nat_Suc,hypreal_of_nat_zero,
   173 by (auto_tac (claset(),
   174     hypreal_zero_less_one,hypreal_add_mult_distrib,hypreal_of_nat_one]));
   174         simpset() addsimps [hypreal_of_nat_Suc,hypreal_of_nat_zero,
       
   175           hypreal_zero_less_one,hypreal_add_mult_distrib,hypreal_of_nat_one]));
   175 by (blast_tac (claset() addSIs [hypreal_add_less_le_mono,
   176 by (blast_tac (claset() addSIs [hypreal_add_less_le_mono,
   176     two_hrealpow_ge_one]) 1);
   177     two_hrealpow_ge_one]) 1);
   177 qed "two_hrealpow_gt";
   178 qed "two_hrealpow_gt";
   178 Addsimps [two_hrealpow_gt,two_hrealpow_ge_one];
   179 Addsimps [two_hrealpow_gt,two_hrealpow_ge_one];
   179 
   180 
   193 qed "hrealpow_minus_two";
   194 qed "hrealpow_minus_two";
   194 Addsimps [hrealpow_minus_two];
   195 Addsimps [hrealpow_minus_two];
   195 
   196 
   196 Goal "(0::hypreal) < r & r < 1hr --> r ^ Suc n < r ^ n";
   197 Goal "(0::hypreal) < r & r < 1hr --> r ^ Suc n < r ^ n";
   197 by (induct_tac "n" 1);
   198 by (induct_tac "n" 1);
   198 by (auto_tac (claset(),simpset() addsimps 
   199 by (auto_tac (claset(),
   199         [hypreal_mult_less_mono2]));
   200               simpset() addsimps [hypreal_mult_less_mono2]));
   200 qed_spec_mp "hrealpow_Suc_less";
   201 qed_spec_mp "hrealpow_Suc_less";
   201 
   202 
   202 Goal "(0::hypreal) <= r & r < 1hr --> r ^ Suc n <= r ^ n";
   203 Goal "(0::hypreal) <= r & r < 1hr --> r ^ Suc n <= r ^ n";
   203 by (induct_tac "n" 1);
   204 by (induct_tac "n" 1);
   204 by (auto_tac (claset() addIs [hypreal_less_imp_le] addSDs
   205 by (auto_tac (claset() addIs [hypreal_less_imp_le]
   205      [hypreal_le_imp_less_or_eq,hrealpow_Suc_less],simpset()
   206                        addSDs [hypreal_le_imp_less_or_eq,hrealpow_Suc_less],
   206      addsimps [hypreal_le_refl,hypreal_mult_less_mono2]));
   207       simpset() addsimps [hypreal_le_refl,hypreal_mult_less_mono2]));
   207 qed_spec_mp "hrealpow_Suc_le";
   208 qed_spec_mp "hrealpow_Suc_le";
   208 
   209 
   209 (* a few more theorems needed here *)
   210 (* a few more theorems needed here *)
   210 Goal "1hr <= r --> r ^ n <= r ^ Suc n";
   211 Goal "1hr <= r --> r ^ n <= r ^ Suc n";
   211 by (induct_tac "n" 1);
   212 by (induct_tac "n" 1);
   212 by (auto_tac (claset() addSIs [hypreal_mult_le_le_mono1],simpset()));
   213 by (auto_tac (claset() addSIs [hypreal_mult_le_le_mono1], simpset()));
   213 by (rtac ccontr 1 THEN dtac not_hypreal_leE 1);
   214 by (rtac ccontr 1 THEN dtac not_hypreal_leE 1);
   214 by (dtac hypreal_le_less_trans 1 THEN assume_tac 1);
   215 by (dtac hypreal_le_less_trans 1 THEN assume_tac 1);
   215 by (etac (hypreal_zero_less_one RS hypreal_less_asym) 1);
   216 by (etac (hypreal_zero_less_one RS hypreal_less_asym) 1);
   216 qed "hrealpow_less_Suc";
   217 qed "hrealpow_less_Suc";
   217 
   218 
   218 Goal "Abs_hypreal(hyprel^^{%n. X n}) ^ m = Abs_hypreal(hyprel^^{%n. (X n) ^ m})";
   219 Goal "Abs_hypreal(hyprel^^{%n. X n}) ^ m = Abs_hypreal(hyprel^^{%n. (X n) ^ m})";
   219 by (nat_ind_tac "m" 1);
   220 by (nat_ind_tac "m" 1);
   220 by (auto_tac (claset(),simpset() addsimps 
   221 by (auto_tac (claset(),
   221     [hypreal_one_def,hypreal_mult]));
   222               simpset() addsimps [hypreal_one_def,hypreal_mult]));
   222 qed "hrealpow";
   223 qed "hrealpow";
   223 
   224 
   224 Goal "(x + (y::hypreal)) ^ 2 = \
   225 Goal "(x + (y::hypreal)) ^ 2 = \
   225 \     x ^ 2 + y ^ 2 + (hypreal_of_nat 2)*x*y";
   226 \     x ^ 2 + y ^ 2 + (hypreal_of_nat 2)*x*y";
   226 by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib2,
   227 by (simp_tac (simpset() addsimps [hypreal_add_mult_distrib2,
   236  ---------------------------------------------------------------*)
   237  ---------------------------------------------------------------*)
   237 Goalw [hypreal_zero_def] 
   238 Goalw [hypreal_zero_def] 
   238   "[|(0::hypreal) <= x;0 <= y;x ^ Suc n <= y ^ Suc n |] ==> x <= y";
   239   "[|(0::hypreal) <= x;0 <= y;x ^ Suc n <= y ^ Suc n |] ==> x <= y";
   239 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
   240 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
   240 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
   241 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
   241 by (auto_tac (claset(),simpset() addsimps 
   242 by (auto_tac (claset(),
   242     [hrealpow,hypreal_le,hypreal_mult]));
   243               simpset() addsimps [hrealpow,hypreal_le,hypreal_mult]));
   243 by (ultra_tac (claset() addIs [realpow_increasing],simpset()) 1);
   244 by (ultra_tac (claset() addIs [realpow_increasing], simpset()) 1);
   244 qed "hrealpow_increasing";
   245 qed "hrealpow_increasing";
   245 
   246 
   246 goalw HyperPow.thy [hypreal_zero_def] 
   247 goalw HyperPow.thy [hypreal_zero_def] 
   247   "!!x. [|(0::hypreal) <= x;0 <= y;x ^ Suc n = y ^ Suc n |] ==> x = y";
   248   "!!x. [|(0::hypreal) <= x;0 <= y;x ^ Suc n = y ^ Suc n |] ==> x = y";
   248 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
   249 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
   249 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
   250 by (res_inst_tac [("z","y")] eq_Abs_hypreal 1);
   250 by (auto_tac (claset(),simpset() addsimps 
   251 by (auto_tac (claset(), simpset() addsimps [hrealpow,hypreal_mult,hypreal_le]));
   251     [hrealpow,hypreal_mult,hypreal_le]));
       
   252 by (ultra_tac (claset() addIs [realpow_Suc_cancel_eq],
   252 by (ultra_tac (claset() addIs [realpow_Suc_cancel_eq],
   253     simpset()) 1);
   253     simpset()) 1);
   254 qed "hrealpow_Suc_cancel_eq";
   254 qed "hrealpow_Suc_cancel_eq";
   255 
   255 
   256 Goal "x : HFinite --> x ^ n : HFinite";
   256 Goal "x : HFinite --> x ^ n : HFinite";
   257 by (induct_tac "n" 1);
   257 by (induct_tac "n" 1);
   258 by (auto_tac (claset() addIs [HFinite_mult],simpset()));
   258 by (auto_tac (claset() addIs [HFinite_mult], simpset()));
   259 qed_spec_mp "hrealpow_HFinite";
   259 qed_spec_mp "hrealpow_HFinite";
   260 
   260 
   261 (*---------------------------------------------------------------
   261 (*---------------------------------------------------------------
   262                   Hypernaturals Powers
   262                   Hypernaturals Powers
   263  --------------------------------------------------------------*)
   263  --------------------------------------------------------------*)
   279 qed "hyperpow";
   279 qed "hyperpow";
   280 
   280 
   281 Goalw [hypreal_zero_def,hypnat_one_def]
   281 Goalw [hypreal_zero_def,hypnat_one_def]
   282       "(0::hypreal) pow (n + 1hn) = 0";
   282       "(0::hypreal) pow (n + 1hn) = 0";
   283 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   283 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   284 by (auto_tac (claset(),simpset() addsimps 
   284 by (auto_tac (claset(), simpset() addsimps [hyperpow,hypnat_add]));
   285     [hyperpow,hypnat_add]));
       
   286 qed "hyperpow_zero";
   285 qed "hyperpow_zero";
   287 Addsimps [hyperpow_zero];
   286 Addsimps [hyperpow_zero];
   288 
   287 
   289 Goalw [hypreal_zero_def]
   288 Goalw [hypreal_zero_def]
   290       "r ~= (0::hypreal) --> r pow n ~= 0";
   289       "r ~= (0::hypreal) --> r pow n ~= 0";
   291 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   290 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   292 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   291 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   293 by (auto_tac (claset(),simpset() addsimps [hyperpow]));
   292 by (auto_tac (claset(), simpset() addsimps [hyperpow]));
   294 by (dtac FreeUltrafilterNat_Compl_mem 1);
   293 by (dtac FreeUltrafilterNat_Compl_mem 1);
   295 by (fuf_empty_tac (claset() addIs [realpow_not_zero RS notE],
   294 by (fuf_empty_tac (claset() addIs [realpow_not_zero RS notE],
   296     simpset()) 1);
   295     simpset()) 1);
   297 qed_spec_mp "hyperpow_not_zero";
   296 qed_spec_mp "hyperpow_not_zero";
   298 
   297 
   302 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   301 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   303 by (auto_tac (claset() addSDs [FreeUltrafilterNat_Compl_mem],
   302 by (auto_tac (claset() addSDs [FreeUltrafilterNat_Compl_mem],
   304     simpset() addsimps [hypreal_inverse,hyperpow]));
   303     simpset() addsimps [hypreal_inverse,hyperpow]));
   305 by (rtac FreeUltrafilterNat_subset 1);
   304 by (rtac FreeUltrafilterNat_subset 1);
   306 by (auto_tac (claset() addDs [realpow_not_zero] 
   305 by (auto_tac (claset() addDs [realpow_not_zero] 
   307     addIs [realpow_inverse],simpset()));
   306                        addIs [realpow_inverse], 
       
   307               simpset()));
   308 qed "hyperpow_inverse";
   308 qed "hyperpow_inverse";
   309 
   309 
   310 Goal "abs r pow n = abs (r pow n)";
   310 Goal "abs r pow n = abs (r pow n)";
   311 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   311 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   312 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   312 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   313 by (auto_tac (claset(),simpset() addsimps [hypreal_hrabs,
   313 by (auto_tac (claset(),
   314     hyperpow,realpow_abs]));
   314               simpset() addsimps [hypreal_hrabs, hyperpow,realpow_abs]));
   315 qed "hyperpow_hrabs";
   315 qed "hyperpow_hrabs";
   316 
   316 
   317 Goal "r pow (n + m) = (r pow n) * (r pow m)";
   317 Goal "r pow (n + m) = (r pow n) * (r pow m)";
   318 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   318 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   319 by (res_inst_tac [("z","m")] eq_Abs_hypnat 1);
   319 by (res_inst_tac [("z","m")] eq_Abs_hypnat 1);
   320 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   320 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   321 by (auto_tac (claset(),simpset() addsimps [hyperpow,hypnat_add,
   321 by (auto_tac (claset(),
   322      hypreal_mult,realpow_add]));
   322           simpset() addsimps [hyperpow,hypnat_add, hypreal_mult,realpow_add]));
   323 qed "hyperpow_add";
   323 qed "hyperpow_add";
   324 
   324 
   325 Goalw [hypnat_one_def] "r pow 1hn = r";
   325 Goalw [hypnat_one_def] "r pow 1hn = r";
   326 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   326 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   327 by (auto_tac (claset(),simpset() addsimps [hyperpow]));
   327 by (auto_tac (claset(), simpset() addsimps [hyperpow]));
   328 qed "hyperpow_one";
   328 qed "hyperpow_one";
   329 Addsimps [hyperpow_one];
   329 Addsimps [hyperpow_one];
   330 
   330 
   331 Goalw [hypnat_one_def] 
   331 Goalw [hypnat_one_def] 
   332       "r pow (1hn + 1hn) = r * r";
   332       "r pow (1hn + 1hn) = r * r";
   333 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   333 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   334 by (auto_tac (claset(),simpset() addsimps [hyperpow,hypnat_add,
   334 by (auto_tac (claset(),
   335      hypreal_mult,realpow_two]));
   335            simpset() addsimps [hyperpow,hypnat_add, hypreal_mult,realpow_two]));
   336 qed "hyperpow_two";
   336 qed "hyperpow_two";
   337 
   337 
   338 Goalw [hypreal_zero_def]
   338 Goalw [hypreal_zero_def]
   339       "(0::hypreal) < r --> 0 < r pow n";
   339       "(0::hypreal) < r --> 0 < r pow n";
   340 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   340 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   341 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   341 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   342 by (auto_tac (claset() addSEs [FreeUltrafilterNat_subset,
   342 by (auto_tac (claset() addSEs [FreeUltrafilterNat_subset, realpow_gt_zero],
   343     realpow_gt_zero],simpset() addsimps [hyperpow,hypreal_less,
   343        simpset() addsimps [hyperpow,hypreal_less, hypreal_le]));
   344     hypreal_le]));
       
   345 qed_spec_mp "hyperpow_gt_zero";
   344 qed_spec_mp "hyperpow_gt_zero";
   346 
   345 
   347 Goal "(0::hypreal) < r --> 0 <= r pow n";
   346 Goal "(0::hypreal) < r --> 0 <= r pow n";
   348 by (blast_tac (claset() addSIs [hyperpow_gt_zero,
   347 by (blast_tac (claset() addSIs [hyperpow_gt_zero, hypreal_less_imp_le]) 1);
   349     hypreal_less_imp_le]) 1);
       
   350 qed_spec_mp "hyperpow_ge_zero";
   348 qed_spec_mp "hyperpow_ge_zero";
   351 
   349 
   352 Goalw [hypreal_zero_def]
   350 Goalw [hypreal_zero_def]
   353       "(0::hypreal) <= r --> 0 <= r pow n";
   351       "(0::hypreal) <= r --> 0 <= r pow n";
   354 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   352 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   355 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   353 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   356 by (auto_tac (claset() addSEs [FreeUltrafilterNat_subset,
   354 by (auto_tac (claset() addSEs [FreeUltrafilterNat_subset, realpow_ge_zero2],
   357     realpow_ge_zero2],simpset() addsimps [hyperpow,hypreal_le]));
   355               simpset() addsimps [hyperpow,hypreal_le]));
   358 qed "hyperpow_ge_zero2";
   356 qed "hyperpow_ge_zero2";
   359 
   357 
   360 Goalw [hypreal_zero_def]
   358 Goalw [hypreal_zero_def]
   361       "(0::hypreal) < x & x <= y --> x pow n <= y pow n";
   359       "(0::hypreal) < x & x <= y --> x pow n <= y pow n";
   362 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   360 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   367     simpset() addsimps [hyperpow,hypreal_le,hypreal_less]));
   365     simpset() addsimps [hyperpow,hypreal_le,hypreal_less]));
   368 qed_spec_mp "hyperpow_le";
   366 qed_spec_mp "hyperpow_le";
   369 
   367 
   370 Goalw [hypreal_one_def] "1hr pow n = 1hr";
   368 Goalw [hypreal_one_def] "1hr pow n = 1hr";
   371 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   369 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   372 by (auto_tac (claset(),simpset() addsimps [hyperpow]));
   370 by (auto_tac (claset(), simpset() addsimps [hyperpow]));
   373 qed "hyperpow_eq_one";
   371 qed "hyperpow_eq_one";
   374 Addsimps [hyperpow_eq_one];
   372 Addsimps [hyperpow_eq_one];
   375 
   373 
   376 Goalw [hypreal_one_def]
   374 Goalw [hypreal_one_def]
   377       "abs(-(1hr pow n)) = 1hr";
   375       "abs(-(1hr pow n)) = 1hr";
   378 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   376 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   379 by (auto_tac (claset(),simpset() addsimps [abs_one,
   377 by (auto_tac (claset(), 
   380     hrabs_minus_cancel,hyperpow,hypreal_hrabs]));
   378       simpset() addsimps [abs_one, hyperpow,hypreal_hrabs]));
   381 qed "hrabs_minus_hyperpow_one";
   379 qed "hrabs_minus_hyperpow_one";
   382 Addsimps [hrabs_minus_hyperpow_one];
   380 Addsimps [hrabs_minus_hyperpow_one];
   383 
   381 
   384 Goalw [hypreal_one_def]
   382 Goalw [hypreal_one_def]
   385       "abs((-1hr) pow n) = 1hr";
   383       "abs((-1hr) pow n) = 1hr";
   386 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   384 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   387 by (auto_tac (claset(),simpset() addsimps 
   385 by (auto_tac (claset(),
   388     [hyperpow,hypreal_minus,hypreal_hrabs]));
   386        simpset() addsimps [hyperpow,hypreal_minus,hypreal_hrabs]));
   389 qed "hrabs_hyperpow_minus_one";
   387 qed "hrabs_hyperpow_minus_one";
   390 Addsimps [hrabs_hyperpow_minus_one];
   388 Addsimps [hrabs_hyperpow_minus_one];
   391 
   389 
   392 Goal "(r * s) pow n = (r pow n) * (s pow n)";
   390 Goal "(r * s) pow n = (r pow n) * (s pow n)";
   393 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   391 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   394 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   392 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   395 by (res_inst_tac [("z","s")] eq_Abs_hypreal 1);
   393 by (res_inst_tac [("z","s")] eq_Abs_hypreal 1);
   396 by (auto_tac (claset(),simpset() addsimps [hyperpow,
   394 by (auto_tac (claset(),
   397     hypreal_mult,realpow_mult]));
   395        simpset() addsimps [hyperpow, hypreal_mult,realpow_mult]));
   398 qed "hyperpow_mult";
   396 qed "hyperpow_mult";
   399 
   397 
   400 Goal "(0::hypreal) <= r pow (1hn + 1hn)";
   398 Goal "(0::hypreal) <= r pow (1hn + 1hn)";
   401 by (simp_tac (simpset() addsimps [hyperpow_two]) 1);
   399 by (simp_tac (simpset() addsimps [hyperpow_two]) 1);
   402 qed "hyperpow_two_le";
   400 qed "hyperpow_two_le";
   411 by (simp_tac (simpset() addsimps [hyperpow_hrabs,hrabs_eqI1]) 1);
   409 by (simp_tac (simpset() addsimps [hyperpow_hrabs,hrabs_eqI1]) 1);
   412 qed "hyperpow_two_hrabs";
   410 qed "hyperpow_two_hrabs";
   413 Addsimps [hyperpow_two_hrabs];
   411 Addsimps [hyperpow_two_hrabs];
   414 
   412 
   415 Goal "!!r. 1hr < r ==> 1hr < r pow (1hn + 1hn)";
   413 Goal "!!r. 1hr < r ==> 1hr < r pow (1hn + 1hn)";
   416 by (auto_tac (claset(),simpset() addsimps [hyperpow_two]));
   414 by (auto_tac (claset(), simpset() addsimps [hyperpow_two]));
   417 by (cut_facts_tac [hypreal_zero_less_one] 1);
   415 by (cut_facts_tac [hypreal_zero_less_one] 1);
   418 by (forw_inst_tac [("R1.0","0")] hypreal_less_trans 1);
   416 by (forw_inst_tac [("R1.0","0")] hypreal_less_trans 1);
   419 by (assume_tac 1);
   417 by (assume_tac 1);
   420 by (dres_inst_tac [("z","r"),("x","1hr")] 
   418 by (dres_inst_tac [("z","r"),("x","1hr")] 
   421     hypreal_mult_less_mono1 1);
   419     hypreal_mult_less_mono1 1);
   422 by (auto_tac (claset() addIs [hypreal_less_trans],simpset()));
   420 by (auto_tac (claset() addIs [hypreal_less_trans], simpset()));
   423 qed "hyperpow_two_gt_one";
   421 qed "hyperpow_two_gt_one";
   424 
   422 
   425 Goal "!!r. 1hr <= r ==> 1hr <= r pow (1hn + 1hn)";
   423 Goal "!!r. 1hr <= r ==> 1hr <= r pow (1hn + 1hn)";
   426 by (auto_tac (claset() addSDs [hypreal_le_imp_less_or_eq] 
   424 by (auto_tac (claset() addSDs [hypreal_le_imp_less_or_eq] 
   427      addIs [hyperpow_two_gt_one,hypreal_less_imp_le],
   425      addIs [hyperpow_two_gt_one,hypreal_less_imp_le],
   431 Goalw [hypnat_one_def,hypreal_zero_def]
   429 Goalw [hypnat_one_def,hypreal_zero_def]
   432       "!!r. (0::hypreal) < r ==> 0 < r pow (n + 1hn)";
   430       "!!r. (0::hypreal) < r ==> 0 < r pow (n + 1hn)";
   433 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   431 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   434 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   432 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   435 by (auto_tac (claset() addSEs [FreeUltrafilterNat_subset]
   433 by (auto_tac (claset() addSEs [FreeUltrafilterNat_subset]
   436     addDs [realpow_Suc_gt_zero],simpset() addsimps [hyperpow,
   434                        addDs [realpow_Suc_gt_zero], 
   437     hypreal_less,hypnat_add]));
   435               simpset() addsimps [hyperpow, hypreal_less,hypnat_add]));
   438 qed "hyperpow_Suc_gt_zero";
   436 qed "hyperpow_Suc_gt_zero";
   439 
   437 
   440 Goal "!!r. (0::hypreal) <= r ==> 0 <= r pow (n + 1hn)";
   438 Goal "!!r. (0::hypreal) <= r ==> 0 <= r pow (n + 1hn)";
   441 by (auto_tac (claset() addSDs [hypreal_le_imp_less_or_eq] 
   439 by (auto_tac (claset() addSDs [hypreal_le_imp_less_or_eq] 
   442     addIs [hyperpow_ge_zero,hypreal_less_imp_le], 
   440     addIs [hyperpow_ge_zero,hypreal_less_imp_le], 
   454 
   452 
   455 Addsimps [simplify (simpset()) realpow_minus_one];
   453 Addsimps [simplify (simpset()) realpow_minus_one];
   456 Goalw [hypreal_one_def]
   454 Goalw [hypreal_one_def]
   457       "(-1hr) pow ((1hn + 1hn)*n) = 1hr";
   455       "(-1hr) pow ((1hn + 1hn)*n) = 1hr";
   458 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   456 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   459 by (auto_tac (claset(),simpset() addsimps [hyperpow,
   457 by (auto_tac (claset(),
   460     hypnat_add,hypreal_minus]));
   458               simpset() addsimps [hyperpow, hypnat_add,hypreal_minus]));
   461 qed "hyperpow_minus_one2";
   459 qed "hyperpow_minus_one2";
   462 Addsimps [hyperpow_minus_one2];
   460 Addsimps [hyperpow_minus_one2];
   463 
   461 
   464 Goalw [hypreal_zero_def,
   462 Goalw [hypreal_zero_def,
   465       hypreal_one_def,hypnat_one_def]
   463       hypreal_one_def,hypnat_one_def]
   486       hypreal_one_def,hypnat_one_def]
   484       hypreal_one_def,hypnat_one_def]
   487      "(0::hypreal) <= r & r < 1hr & n < N --> r pow N <= r pow n";
   485      "(0::hypreal) <= r & r < 1hr & n < N --> r pow N <= r pow n";
   488 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   486 by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
   489 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   487 by (res_inst_tac [("z","N")] eq_Abs_hypnat 1);
   490 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   488 by (res_inst_tac [("z","r")] eq_Abs_hypreal 1);
   491 by (auto_tac (claset(),simpset() addsimps [hyperpow,
   489 by (auto_tac (claset(),
   492     hypreal_le,hypreal_less,hypnat_less]));
   490         simpset() addsimps [hyperpow, hypreal_le,hypreal_less,hypnat_less]));
   493 by (etac (FreeUltrafilterNat_Int RS FreeUltrafilterNat_subset) 1);
   491 by (etac (FreeUltrafilterNat_Int RS FreeUltrafilterNat_subset) 1);
   494 by (etac FreeUltrafilterNat_Int 1);
   492 by (etac FreeUltrafilterNat_Int 1);
   495 by (auto_tac (claset() addSDs [conjI RS realpow_less_le],
   493 by (auto_tac (claset() addSDs [conjI RS realpow_less_le],
   496     simpset()));
   494     simpset()));
   497 qed_spec_mp "hyperpow_less_le";
   495 qed_spec_mp "hyperpow_less_le";
   508               simpset() addsimps [HNatInfinite_iff]));
   506               simpset() addsimps [HNatInfinite_iff]));
   509 qed "hyperpow_SHNat_le";
   507 qed "hyperpow_SHNat_le";
   510 
   508 
   511 Goalw [hypreal_of_real_def,hypnat_of_nat_def] 
   509 Goalw [hypreal_of_real_def,hypnat_of_nat_def] 
   512       "(hypreal_of_real r) pow (hypnat_of_nat n) = hypreal_of_real (r ^ n)";
   510       "(hypreal_of_real r) pow (hypnat_of_nat n) = hypreal_of_real (r ^ n)";
   513 by (auto_tac (claset(),simpset() addsimps [hyperpow]));
   511 by (auto_tac (claset(), simpset() addsimps [hyperpow]));
   514 qed "hyperpow_realpow";
   512 qed "hyperpow_realpow";
   515 
   513 
   516 Goalw [SReal_def]
   514 Goalw [SReal_def]
   517      "(hypreal_of_real r) pow (hypnat_of_nat n) : SReal";
   515      "(hypreal_of_real r) pow (hypnat_of_nat n) : SReal";
   518 by (auto_tac (claset(),simpset() addsimps [hyperpow_realpow]));
   516 by (auto_tac (claset(), simpset() addsimps [hyperpow_realpow]));
   519 qed "hyperpow_SReal";
   517 qed "hyperpow_SReal";
   520 Addsimps [hyperpow_SReal];
   518 Addsimps [hyperpow_SReal];
   521 
   519 
   522 Goal "!!N. N : HNatInfinite ==> (0::hypreal) pow N = 0";
   520 Goal "!!N. N : HNatInfinite ==> (0::hypreal) pow N = 0";
   523 by (dtac HNatInfinite_is_Suc 1);
   521 by (dtac HNatInfinite_is_Suc 1);
   561 
   559 
   562 goalw HyperPow.thy [hypnat_of_nat_def] 
   560 goalw HyperPow.thy [hypnat_of_nat_def] 
   563      "(x ^ n : Infinitesimal) = \
   561      "(x ^ n : Infinitesimal) = \
   564 \     (x pow (hypnat_of_nat n) : Infinitesimal)";
   562 \     (x pow (hypnat_of_nat n) : Infinitesimal)";
   565 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
   563 by (res_inst_tac [("z","x")] eq_Abs_hypreal 1);
   566 by (auto_tac (claset(),simpset() addsimps [hrealpow,
   564 by (auto_tac (claset(), simpset() addsimps [hrealpow, hyperpow]));
   567     hyperpow]));
       
   568 qed "hrealpow_hyperpow_Infinitesimal_iff";
   565 qed "hrealpow_hyperpow_Infinitesimal_iff";
   569 
   566 
   570 goal HyperPow.thy 
   567 goal HyperPow.thy 
   571      "!!x. [| x : Infinitesimal; 0 < n |] \
   568      "!!x. [| x : Infinitesimal; 0 < n |] \
   572 \           ==> x ^ n : Infinitesimal";
   569 \           ==> x ^ n : Infinitesimal";
   573 by (auto_tac (claset() addSIs [Infinitesimal_hyperpow],
   570 by (auto_tac (claset() addSIs [Infinitesimal_hyperpow],
   574     simpset() addsimps [hrealpow_hyperpow_Infinitesimal_iff,
   571     simpset() addsimps [hrealpow_hyperpow_Infinitesimal_iff,
   575     hypnat_of_nat_less_iff,hypnat_of_nat_zero] 
   572                         hypnat_of_nat_less_iff,hypnat_of_nat_zero] 
   576     delsimps [hypnat_of_nat_less_iff RS sym]));
   573               delsimps [hypnat_of_nat_less_iff RS sym]));
   577 qed "Infinitesimal_hrealpow";
   574 qed "Infinitesimal_hrealpow";
   578 
   575 
   579 
   576 
   580 
   577 
   581 
   578