| author | wenzelm | 
| Sun, 16 Jul 2000 20:50:15 +0200 | |
| changeset 9356 | 30c3d3e308ee | 
| parent 9081 | d54b2c41fe0e | 
| child 9434 | d2fa043ab24f | 
| permissions | -rw-r--r-- | 
| 7334 | 1 | (* Title: HOL/Real/Real.ML | 
| 2 | ID: $Id$ | |
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 3 | Author: Jacques D. Fleuriot and Lawrence C. Paulson | 
| 7334 | 4 | Copyright: 1998 University of Cambridge | 
| 5 | Description: Type "real" is a linear order | |
| 6 | *) | |
| 7 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 8 | (**** The simproc abel_cancel ****) | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 9 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 10 | (*** Two lemmas needed for the simprocs ***) | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 11 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 12 | (*Deletion of other terms in the formula, seeking the -x at the front of z*) | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 13 | Goal "((x::real) + (y + z) = y + u) = ((x + z) = u)"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 14 | by (stac real_add_left_commute 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 15 | by (rtac real_add_left_cancel 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 16 | qed "real_add_cancel_21"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 17 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 18 | (*A further rule to deal with the case that | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 19 | everything gets cancelled on the right.*) | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 20 | Goal "((x::real) + (y + z) = y) = (x = -z)"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 21 | by (stac real_add_left_commute 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 22 | by (res_inst_tac [("t", "y")] (real_add_zero_right RS subst) 1
 | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 23 | THEN stac real_add_left_cancel 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 24 | by (simp_tac (simpset() addsimps [real_eq_diff_eq RS sym]) 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 25 | qed "real_add_cancel_end"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 26 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 27 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 28 | structure Real_Cancel_Data = | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 29 | struct | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 30 | val ss = HOL_ss | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 31 | val eq_reflection = eq_reflection | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 32 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 33 | val thy = RealDef.thy | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 34 | val T = HOLogic.realT | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 35 |   val zero		= Const ("0", T)
 | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 36 | val restrict_to_left = restrict_to_left | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 37 | val add_cancel_21 = real_add_cancel_21 | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 38 | val add_cancel_end = real_add_cancel_end | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 39 | val add_left_cancel = real_add_left_cancel | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 40 | val add_assoc = real_add_assoc | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 41 | val add_commute = real_add_commute | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 42 | val add_left_commute = real_add_left_commute | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 43 | val add_0 = real_add_zero_left | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 44 | val add_0_right = real_add_zero_right | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 45 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 46 | val eq_diff_eq = real_eq_diff_eq | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 47 | val eqI_rules = [real_less_eqI, real_eq_eqI, real_le_eqI] | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 48 | fun dest_eqI th = | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 49 | #1 (HOLogic.dest_bin "op =" HOLogic.boolT | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 50 | (HOLogic.dest_Trueprop (concl_of th))) | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 51 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 52 | val diff_def = real_diff_def | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 53 | val minus_add_distrib = real_minus_add_distrib | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 54 | val minus_minus = real_minus_minus | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 55 | val minus_0 = real_minus_zero | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 56 | val add_inverses = [real_add_minus, real_add_minus_left]; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 57 | val cancel_simps = [real_add_minus_cancel, real_minus_add_cancel] | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 58 | end; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 59 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 60 | structure Real_Cancel = Abel_Cancel (Real_Cancel_Data); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 61 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 62 | Addsimprocs [Real_Cancel.sum_conv, Real_Cancel.rel_conv]; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 63 | |
| 9081 | 64 | Goal "- (z - y) = y - (z::real)"; | 
| 65 | by (Simp_tac 1); | |
| 66 | qed "real_minus_diff_eq"; | |
| 67 | Addsimps [real_minus_diff_eq]; | |
| 68 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 69 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 70 | (**** Theorems about the ordering ****) | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 71 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 72 | Goal "(0 < x) = (EX y. x = real_of_preal y)"; | 
| 7334 | 73 | by (auto_tac (claset(), simpset() addsimps [real_of_preal_zero_less])); | 
| 74 | by (cut_inst_tac [("x","x")] real_of_preal_trichotomy 1);
 | |
| 75 | by (blast_tac (claset() addSEs [real_less_irrefl, | |
| 76 | real_of_preal_not_minus_gt_zero RS notE]) 1); | |
| 77 | qed "real_gt_zero_preal_Ex"; | |
| 78 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 79 | Goal "real_of_preal z < x ==> EX y. x = real_of_preal y"; | 
| 7334 | 80 | by (blast_tac (claset() addSDs [real_of_preal_zero_less RS real_less_trans] | 
| 81 | addIs [real_gt_zero_preal_Ex RS iffD1]) 1); | |
| 82 | qed "real_gt_preal_preal_Ex"; | |
| 83 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 84 | Goal "real_of_preal z <= x ==> EX y. x = real_of_preal y"; | 
| 7334 | 85 | by (blast_tac (claset() addDs [real_le_imp_less_or_eq, | 
| 86 | real_gt_preal_preal_Ex]) 1); | |
| 87 | qed "real_ge_preal_preal_Ex"; | |
| 88 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 89 | Goal "y <= 0 ==> ALL x. y < real_of_preal x"; | 
| 7334 | 90 | by (auto_tac (claset() addEs [real_le_imp_less_or_eq RS disjE] | 
| 91 | addIs [real_of_preal_zero_less RSN(2,real_less_trans)], | |
| 92 | simpset() addsimps [real_of_preal_zero_less])); | |
| 93 | qed "real_less_all_preal"; | |
| 94 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 95 | Goal "~ 0 < y ==> ALL x. y < real_of_preal x"; | 
| 7334 | 96 | by (blast_tac (claset() addSIs [real_less_all_preal,real_leI]) 1); | 
| 97 | qed "real_less_all_real2"; | |
| 98 | ||
| 99 | Goal "((x::real) < y) = (-y < -x)"; | |
| 100 | by (rtac (real_less_sum_gt_0_iff RS subst) 1); | |
| 101 | by (res_inst_tac [("W1","x")] (real_less_sum_gt_0_iff RS subst) 1);
 | |
| 102 | by (simp_tac (simpset() addsimps [real_add_commute]) 1); | |
| 103 | qed "real_less_swap_iff"; | |
| 104 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 105 | Goal "[| R + L = S; (0::real) < L |] ==> R < S"; | 
| 7334 | 106 | by (rtac (real_less_sum_gt_0_iff RS iffD1) 1); | 
| 107 | by (auto_tac (claset(), simpset() addsimps real_add_ac)); | |
| 108 | qed "real_lemma_add_positive_imp_less"; | |
| 109 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 110 | Goal "EX T::real. 0 < T & R + T = S ==> R < S"; | 
| 7334 | 111 | by (blast_tac (claset() addIs [real_lemma_add_positive_imp_less]) 1); | 
| 112 | qed "real_ex_add_positive_left_less"; | |
| 113 | ||
| 114 | (*Alternative definition for real_less. NOT for rewriting*) | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 115 | Goal "(R < S) = (EX T::real. 0 < T & R + T = S)"; | 
| 7334 | 116 | by (blast_tac (claset() addSIs [real_less_add_positive_left_Ex, | 
| 117 | real_ex_add_positive_left_less]) 1); | |
| 118 | qed "real_less_iff_add"; | |
| 119 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 120 | Goal "((0::real) < x) = (-x < x)"; | 
| 7334 | 121 | by Safe_tac; | 
| 122 | by (rtac ccontr 2 THEN forward_tac | |
| 123 | [real_leI RS real_le_imp_less_or_eq] 2); | |
| 124 | by (Step_tac 2); | |
| 125 | by (dtac (real_minus_zero_less_iff RS iffD2) 2); | |
| 126 | by (blast_tac (claset() addIs [real_less_trans]) 2); | |
| 127 | by (auto_tac (claset(), | |
| 128 | simpset() addsimps | |
| 129 | [real_gt_zero_preal_Ex,real_of_preal_minus_less_self])); | |
| 130 | qed "real_gt_zero_iff"; | |
| 131 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 132 | Goal "(x < (0::real)) = (x < -x)"; | 
| 7334 | 133 | by (rtac (real_minus_zero_less_iff RS subst) 1); | 
| 134 | by (stac real_gt_zero_iff 1); | |
| 135 | by (Full_simp_tac 1); | |
| 136 | qed "real_lt_zero_iff"; | |
| 137 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 138 | Goalw [real_le_def] "((0::real) <= x) = (-x <= x)"; | 
| 7334 | 139 | by (auto_tac (claset(), simpset() addsimps [real_lt_zero_iff RS sym])); | 
| 140 | qed "real_ge_zero_iff"; | |
| 141 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 142 | Goalw [real_le_def] "(x <= (0::real)) = (x <= -x)"; | 
| 7334 | 143 | by (auto_tac (claset(), simpset() addsimps [real_gt_zero_iff RS sym])); | 
| 144 | qed "real_le_zero_iff"; | |
| 145 | ||
| 146 | Goal "(real_of_preal m1 <= real_of_preal m2) = (m1 <= m2)"; | |
| 147 | by (auto_tac (claset() addSIs [preal_leI], | |
| 148 | simpset() addsimps [real_less_le_iff RS sym])); | |
| 149 | by (dtac preal_le_less_trans 1 THEN assume_tac 1); | |
| 150 | by (etac preal_less_irrefl 1); | |
| 151 | qed "real_of_preal_le_iff"; | |
| 152 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 153 | Goal "[| 0 < x; 0 < y |] ==> (0::real) < x * y"; | 
| 7334 | 154 | by (auto_tac (claset(), simpset() addsimps [real_gt_zero_preal_Ex])); | 
| 155 | by (res_inst_tac [("x","y*ya")] exI 1);
 | |
| 156 | by (full_simp_tac (simpset() addsimps [real_of_preal_mult]) 1); | |
| 157 | qed "real_mult_order"; | |
| 158 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 159 | Goal "[| x < 0; y < 0 |] ==> (0::real) < x * y"; | 
| 7334 | 160 | by (REPEAT(dtac (real_minus_zero_less_iff RS iffD2) 1)); | 
| 161 | by (dtac real_mult_order 1 THEN assume_tac 1); | |
| 162 | by (Asm_full_simp_tac 1); | |
| 163 | qed "real_mult_less_zero1"; | |
| 164 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 165 | Goal "[| 0 <= x; 0 <= y |] ==> (0::real) <= x * y"; | 
| 7334 | 166 | by (REPEAT(dtac real_le_imp_less_or_eq 1)); | 
| 167 | by (auto_tac (claset() addIs [real_mult_order, real_less_imp_le], | |
| 168 | simpset())); | |
| 169 | qed "real_le_mult_order"; | |
| 170 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 171 | Goal "[| 0 < x; 0 <= y |] ==> (0::real) <= x * y"; | 
| 7334 | 172 | by (dtac real_le_imp_less_or_eq 1); | 
| 173 | by (auto_tac (claset() addIs [real_mult_order, | |
| 174 | real_less_imp_le],simpset())); | |
| 175 | qed "real_less_le_mult_order"; | |
| 176 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 177 | Goal "[| x <= 0; y <= 0 |] ==> (0::real) <= x * y"; | 
| 7334 | 178 | by (rtac real_less_or_eq_imp_le 1); | 
| 179 | by (dtac real_le_imp_less_or_eq 1 THEN etac disjE 1); | |
| 180 | by Auto_tac; | |
| 181 | by (dtac real_le_imp_less_or_eq 1); | |
| 182 | by (auto_tac (claset() addDs [real_mult_less_zero1],simpset())); | |
| 183 | qed "real_mult_le_zero1"; | |
| 184 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 185 | Goal "[| 0 <= x; y < 0 |] ==> x * y <= (0::real)"; | 
| 7334 | 186 | by (rtac real_less_or_eq_imp_le 1); | 
| 187 | by (dtac real_le_imp_less_or_eq 1 THEN etac disjE 1); | |
| 188 | by Auto_tac; | |
| 189 | by (dtac (real_minus_zero_less_iff RS iffD2) 1); | |
| 190 | by (rtac (real_minus_zero_less_iff RS subst) 1); | |
| 191 | by (blast_tac (claset() addDs [real_mult_order] | |
| 192 | addIs [real_minus_mult_eq2 RS ssubst]) 1); | |
| 193 | qed "real_mult_le_zero"; | |
| 194 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 195 | Goal "[| 0 < x; y < 0 |] ==> x*y < (0::real)"; | 
| 7334 | 196 | by (dtac (real_minus_zero_less_iff RS iffD2) 1); | 
| 197 | by (dtac real_mult_order 1 THEN assume_tac 1); | |
| 198 | by (rtac (real_minus_zero_less_iff RS iffD1) 1); | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 199 | by (Asm_full_simp_tac 1); | 
| 7334 | 200 | qed "real_mult_less_zero"; | 
| 201 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 202 | Goalw [real_one_def] "0 < 1r"; | 
| 7334 | 203 | by (auto_tac (claset() addIs [real_gt_zero_preal_Ex RS iffD2], | 
| 204 | simpset() addsimps [real_of_preal_def])); | |
| 205 | qed "real_zero_less_one"; | |
| 206 | ||
| 207 | (*** Monotonicity results ***) | |
| 208 | ||
| 209 | Goal "(v+z < w+z) = (v < (w::real))"; | |
| 210 | by (Simp_tac 1); | |
| 211 | qed "real_add_right_cancel_less"; | |
| 212 | ||
| 213 | Goal "(z+v < z+w) = (v < (w::real))"; | |
| 214 | by (Simp_tac 1); | |
| 215 | qed "real_add_left_cancel_less"; | |
| 216 | ||
| 217 | Addsimps [real_add_right_cancel_less, real_add_left_cancel_less]; | |
| 218 | ||
| 219 | Goal "(v+z <= w+z) = (v <= (w::real))"; | |
| 220 | by (Simp_tac 1); | |
| 221 | qed "real_add_right_cancel_le"; | |
| 222 | ||
| 223 | Goal "(z+v <= z+w) = (v <= (w::real))"; | |
| 224 | by (Simp_tac 1); | |
| 225 | qed "real_add_left_cancel_le"; | |
| 226 | ||
| 227 | Addsimps [real_add_right_cancel_le, real_add_left_cancel_le]; | |
| 228 | ||
| 229 | (*"v<=w ==> v+z <= w+z"*) | |
| 230 | bind_thm ("real_add_less_mono1", real_add_right_cancel_less RS iffD2);
 | |
| 231 | ||
| 232 | (*"v<=w ==> v+z <= w+z"*) | |
| 233 | bind_thm ("real_add_le_mono1", real_add_right_cancel_le RS iffD2);
 | |
| 234 | ||
| 235 | Goal "!!z z'::real. [| w'<w; z'<=z |] ==> w' + z' < w + z"; | |
| 236 | by (etac (real_add_less_mono1 RS real_less_le_trans) 1); | |
| 237 | by (Simp_tac 1); | |
| 238 | qed "real_add_less_le_mono"; | |
| 239 | ||
| 240 | Goal "!!z z'::real. [| w'<=w; z'<z |] ==> w' + z' < w + z"; | |
| 241 | by (etac (real_add_le_mono1 RS real_le_less_trans) 1); | |
| 242 | by (Simp_tac 1); | |
| 243 | qed "real_add_le_less_mono"; | |
| 244 | ||
| 245 | Goal "!!(A::real). A < B ==> C + A < C + B"; | |
| 246 | by (Simp_tac 1); | |
| 247 | qed "real_add_less_mono2"; | |
| 248 | ||
| 249 | Goal "!!(A::real). A + C < B + C ==> A < B"; | |
| 250 | by (Full_simp_tac 1); | |
| 251 | qed "real_less_add_right_cancel"; | |
| 252 | ||
| 253 | Goal "!!(A::real). C + A < C + B ==> A < B"; | |
| 254 | by (Full_simp_tac 1); | |
| 255 | qed "real_less_add_left_cancel"; | |
| 256 | ||
| 257 | Goal "!!(A::real). A + C <= B + C ==> A <= B"; | |
| 258 | by (Full_simp_tac 1); | |
| 259 | qed "real_le_add_right_cancel"; | |
| 260 | ||
| 261 | Goal "!!(A::real). C + A <= C + B ==> A <= B"; | |
| 262 | by (Full_simp_tac 1); | |
| 263 | qed "real_le_add_left_cancel"; | |
| 264 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 265 | Goal "[| 0 < x; 0 < y |] ==> (0::real) < x + y"; | 
| 7334 | 266 | by (etac real_less_trans 1); | 
| 267 | by (dtac real_add_less_mono2 1); | |
| 268 | by (Full_simp_tac 1); | |
| 269 | qed "real_add_order"; | |
| 270 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 271 | Goal "[| 0 <= x; 0 <= y |] ==> (0::real) <= x + y"; | 
| 7334 | 272 | by (REPEAT(dtac real_le_imp_less_or_eq 1)); | 
| 273 | by (auto_tac (claset() addIs [real_add_order, real_less_imp_le], | |
| 274 | simpset())); | |
| 275 | qed "real_le_add_order"; | |
| 276 | ||
| 277 | Goal "[| R1 < S1; R2 < S2 |] ==> R1 + R2 < S1 + (S2::real)"; | |
| 278 | by (dtac real_add_less_mono1 1); | |
| 279 | by (etac real_less_trans 1); | |
| 280 | by (etac real_add_less_mono2 1); | |
| 281 | qed "real_add_less_mono"; | |
| 282 | ||
| 283 | Goal "!!(q1::real). q1 <= q2 ==> x + q1 <= x + q2"; | |
| 284 | by (Simp_tac 1); | |
| 285 | qed "real_add_left_le_mono1"; | |
| 286 | ||
| 287 | Goal "[|i<=j; k<=l |] ==> i + k <= j + (l::real)"; | |
| 288 | by (dtac real_add_le_mono1 1); | |
| 289 | by (etac real_le_trans 1); | |
| 290 | by (Simp_tac 1); | |
| 291 | qed "real_add_le_mono"; | |
| 292 | ||
| 293 | Goal "EX (x::real). x < y"; | |
| 294 | by (rtac (real_add_zero_right RS subst) 1); | |
| 295 | by (res_inst_tac [("x","y + (-1r)")] exI 1);
 | |
| 296 | by (auto_tac (claset() addSIs [real_add_less_mono2], | |
| 297 | simpset() addsimps [real_minus_zero_less_iff2, real_zero_less_one])); | |
| 298 | qed "real_less_Ex"; | |
| 299 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 300 | Goal "(0::real) < r ==> u + (-r) < u"; | 
| 7334 | 301 | by (res_inst_tac [("C","r")] real_less_add_right_cancel 1);
 | 
| 302 | by (simp_tac (simpset() addsimps [real_add_assoc]) 1); | |
| 303 | qed "real_add_minus_positive_less_self"; | |
| 304 | ||
| 305 | Goal "((r::real) <= s) = (-s <= -r)"; | |
| 306 | by (Step_tac 1); | |
| 307 | by (dres_inst_tac [("x","-s")] real_add_left_le_mono1 1);
 | |
| 308 | by (dres_inst_tac [("x","r")] real_add_left_le_mono1 2);
 | |
| 309 | by Auto_tac; | |
| 310 | by (dres_inst_tac [("z","-r")] real_add_le_mono1 1);
 | |
| 311 | by (dres_inst_tac [("z","s")] real_add_le_mono1 2);
 | |
| 312 | by (auto_tac (claset(), simpset() addsimps [real_add_assoc])); | |
| 313 | qed "real_le_minus_iff"; | |
| 314 | Addsimps [real_le_minus_iff RS sym]; | |
| 315 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 316 | Goal "0 <= 1r"; | 
| 7334 | 317 | by (rtac (real_zero_less_one RS real_less_imp_le) 1); | 
| 318 | qed "real_zero_le_one"; | |
| 319 | Addsimps [real_zero_le_one]; | |
| 320 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 321 | Goal "(0::real) <= x*x"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 322 | by (res_inst_tac [("R2.0","0"),("R1.0","x")] real_linear_less2 1);
 | 
| 7334 | 323 | by (auto_tac (claset() addIs [real_mult_order, | 
| 324 | real_mult_less_zero1,real_less_imp_le], | |
| 325 | simpset())); | |
| 326 | qed "real_le_square"; | |
| 327 | Addsimps [real_le_square]; | |
| 328 | ||
| 329 | (*---------------------------------------------------------------------------- | |
| 330 | An embedding of the naturals in the reals | |
| 331 | ----------------------------------------------------------------------------*) | |
| 332 | ||
| 333 | Goalw [real_of_posnat_def] "real_of_posnat 0 = 1r"; | |
| 334 | by (full_simp_tac (simpset() addsimps [pnat_one_iff RS sym,real_of_preal_def]) 1); | |
| 335 | by (fold_tac [real_one_def]); | |
| 336 | by (rtac refl 1); | |
| 337 | qed "real_of_posnat_one"; | |
| 338 | ||
| 339 | Goalw [real_of_posnat_def] "real_of_posnat 1 = 1r + 1r"; | |
| 340 | by (full_simp_tac (simpset() addsimps [real_of_preal_def,real_one_def, | |
| 341 | pnat_two_eq,real_add,prat_of_pnat_add RS sym,preal_of_prat_add RS sym | |
| 342 | ] @ pnat_add_ac) 1); | |
| 343 | qed "real_of_posnat_two"; | |
| 344 | ||
| 345 | Goalw [real_of_posnat_def] | |
| 346 | "real_of_posnat n1 + real_of_posnat n2 = real_of_posnat (n1 + n2) + 1r"; | |
| 347 | by (full_simp_tac (simpset() addsimps [real_of_posnat_one RS sym, | |
| 348 | real_of_posnat_def,real_of_preal_add RS sym,preal_of_prat_add RS sym, | |
| 349 | prat_of_pnat_add RS sym,pnat_of_nat_add]) 1); | |
| 350 | qed "real_of_posnat_add"; | |
| 351 | ||
| 352 | Goal "real_of_posnat (n + 1) = real_of_posnat n + 1r"; | |
| 353 | by (res_inst_tac [("x1","1r")] (real_add_right_cancel RS iffD1) 1);
 | |
| 354 | by (rtac (real_of_posnat_add RS subst) 1); | |
| 355 | by (full_simp_tac (simpset() addsimps [real_of_posnat_two,real_add_assoc]) 1); | |
| 356 | qed "real_of_posnat_add_one"; | |
| 357 | ||
| 358 | Goal "real_of_posnat (Suc n) = real_of_posnat n + 1r"; | |
| 359 | by (stac (real_of_posnat_add_one RS sym) 1); | |
| 360 | by (Simp_tac 1); | |
| 361 | qed "real_of_posnat_Suc"; | |
| 362 | ||
| 363 | Goal "inj(real_of_posnat)"; | |
| 364 | by (rtac injI 1); | |
| 365 | by (rewtac real_of_posnat_def); | |
| 366 | by (dtac (inj_real_of_preal RS injD) 1); | |
| 367 | by (dtac (inj_preal_of_prat RS injD) 1); | |
| 368 | by (dtac (inj_prat_of_pnat RS injD) 1); | |
| 369 | by (etac (inj_pnat_of_nat RS injD) 1); | |
| 370 | qed "inj_real_of_posnat"; | |
| 371 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 372 | Goalw [real_of_posnat_def] "0 < real_of_posnat n"; | 
| 7334 | 373 | by (rtac (real_gt_zero_preal_Ex RS iffD2) 1); | 
| 374 | by (Blast_tac 1); | |
| 375 | qed "real_of_posnat_less_zero"; | |
| 376 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 377 | Goal "real_of_posnat n ~= 0"; | 
| 7334 | 378 | by (rtac (real_of_posnat_less_zero RS real_not_refl2 RS not_sym) 1); | 
| 379 | qed "real_of_posnat_not_eq_zero"; | |
| 380 | Addsimps[real_of_posnat_not_eq_zero]; | |
| 381 | ||
| 382 | Goal "1r <= real_of_posnat n"; | |
| 383 | by (simp_tac (simpset() addsimps [real_of_posnat_one RS sym]) 1); | |
| 384 | by (induct_tac "n" 1); | |
| 385 | by (auto_tac (claset(), | |
| 386 | simpset () addsimps [real_of_posnat_Suc,real_of_posnat_one, | |
| 387 | real_of_posnat_less_zero, real_less_imp_le])); | |
| 388 | qed "real_of_posnat_less_one"; | |
| 389 | Addsimps [real_of_posnat_less_one]; | |
| 390 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 391 | Goal "rinv(real_of_posnat n) ~= 0"; | 
| 7334 | 392 | by (rtac ((real_of_posnat_less_zero RS | 
| 393 | real_not_refl2 RS not_sym) RS rinv_not_zero) 1); | |
| 394 | qed "real_of_posnat_rinv_not_zero"; | |
| 395 | Addsimps [real_of_posnat_rinv_not_zero]; | |
| 396 | ||
| 397 | Goal "rinv(real_of_posnat x) = rinv(real_of_posnat y) ==> x = y"; | |
| 398 | by (rtac (inj_real_of_posnat RS injD) 1); | |
| 399 | by (res_inst_tac [("n2","x")] 
 | |
| 400 | (real_of_posnat_rinv_not_zero RS real_mult_left_cancel RS iffD1) 1); | |
| 401 | by (full_simp_tac (simpset() addsimps [(real_of_posnat_less_zero RS | |
| 402 | real_not_refl2 RS not_sym) RS real_mult_inv_left]) 1); | |
| 403 | by (asm_full_simp_tac (simpset() addsimps [(real_of_posnat_less_zero RS | |
| 404 | real_not_refl2 RS not_sym)]) 1); | |
| 405 | qed "real_of_posnat_rinv_inj"; | |
| 406 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 407 | Goal "0 < x ==> 0 < rinv x"; | 
| 7334 | 408 | by (EVERY1[rtac ccontr, dtac real_leI]); | 
| 409 | by (forward_tac [real_minus_zero_less_iff2 RS iffD2] 1); | |
| 410 | by (forward_tac [real_not_refl2 RS not_sym] 1); | |
| 411 | by (dtac (real_not_refl2 RS not_sym RS rinv_not_zero) 1); | |
| 412 | by (EVERY1[dtac real_le_imp_less_or_eq, Step_tac]); | |
| 413 | by (dtac real_mult_less_zero1 1 THEN assume_tac 1); | |
| 414 | by (auto_tac (claset() addIs [real_zero_less_one RS real_less_asym], | |
| 9053 | 415 | simpset())); | 
| 7334 | 416 | qed "real_rinv_gt_zero"; | 
| 417 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 418 | Goal "x < 0 ==> rinv x < 0"; | 
| 7499 | 419 | by (ftac real_not_refl2 1); | 
| 7334 | 420 | by (dtac (real_minus_zero_less_iff RS iffD2) 1); | 
| 421 | by (rtac (real_minus_zero_less_iff RS iffD1) 1); | |
| 422 | by (dtac (real_minus_rinv RS sym) 1); | |
| 423 | by (auto_tac (claset() addIs [real_rinv_gt_zero], simpset())); | |
| 424 | qed "real_rinv_less_zero"; | |
| 425 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 426 | Goal "0 < rinv(real_of_posnat n)"; | 
| 7334 | 427 | by (rtac (real_of_posnat_less_zero RS real_rinv_gt_zero) 1); | 
| 428 | qed "real_of_posnat_rinv_gt_zero"; | |
| 429 | Addsimps [real_of_posnat_rinv_gt_zero]; | |
| 430 | ||
| 431 | Goal "x+x = x*(1r+1r)"; | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 432 | by (simp_tac (simpset() addsimps [real_add_mult_distrib2]) 1); | 
| 7334 | 433 | qed "real_add_self"; | 
| 434 | ||
| 435 | Goal "x < x + 1r"; | |
| 436 | by (rtac (real_less_sum_gt_0_iff RS iffD1) 1); | |
| 437 | by (full_simp_tac (simpset() addsimps [real_zero_less_one, | |
| 438 | real_add_assoc, real_add_left_commute]) 1); | |
| 439 | qed "real_self_less_add_one"; | |
| 440 | ||
| 441 | Goal "1r < 1r + 1r"; | |
| 442 | by (rtac real_self_less_add_one 1); | |
| 443 | qed "real_one_less_two"; | |
| 444 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 445 | Goal "0 < 1r + 1r"; | 
| 7334 | 446 | by (rtac ([real_zero_less_one, | 
| 447 | real_one_less_two] MRS real_less_trans) 1); | |
| 448 | qed "real_zero_less_two"; | |
| 449 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 450 | Goal "1r + 1r ~= 0"; | 
| 7334 | 451 | by (rtac (real_zero_less_two RS real_not_refl2 RS not_sym) 1); | 
| 452 | qed "real_two_not_zero"; | |
| 453 | ||
| 454 | Addsimps [real_two_not_zero]; | |
| 455 | ||
| 456 | Goal "x*rinv(1r + 1r) + x*rinv(1r + 1r) = x"; | |
| 457 | by (stac real_add_self 1); | |
| 458 | by (full_simp_tac (simpset() addsimps [real_mult_assoc]) 1); | |
| 459 | qed "real_sum_of_halves"; | |
| 460 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 461 | Goal "[| (0::real) < z; x < y |] ==> x*z < y*z"; | 
| 7334 | 462 | by (rotate_tac 1 1); | 
| 463 | by (dtac real_less_sum_gt_zero 1); | |
| 464 | by (rtac real_sum_gt_zero_less 1); | |
| 465 | by (dtac real_mult_order 1 THEN assume_tac 1); | |
| 466 | by (asm_full_simp_tac (simpset() addsimps [real_add_mult_distrib2, | |
| 9053 | 467 | real_mult_commute ]) 1); | 
| 7334 | 468 | qed "real_mult_less_mono1"; | 
| 469 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 470 | Goal "[| (0::real) < z; x < y |] ==> z*x < z*y"; | 
| 7334 | 471 | by (asm_simp_tac (simpset() addsimps [real_mult_commute,real_mult_less_mono1]) 1); | 
| 472 | qed "real_mult_less_mono2"; | |
| 473 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 474 | Goal "[| (0::real) < z; x*z < y*z |] ==> x < y"; | 
| 7334 | 475 | by (forw_inst_tac [("x","x*z")] (real_rinv_gt_zero 
 | 
| 476 | RS real_mult_less_mono1) 1); | |
| 477 | by (auto_tac (claset(), | |
| 478 | simpset() addsimps | |
| 479 | [real_mult_assoc,real_not_refl2 RS not_sym])); | |
| 480 | qed "real_mult_less_cancel1"; | |
| 481 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 482 | Goal "[| (0::real) < z; z*x < z*y |] ==> x < y"; | 
| 7334 | 483 | by (etac real_mult_less_cancel1 1); | 
| 484 | by (asm_full_simp_tac (simpset() addsimps [real_mult_commute]) 1); | |
| 485 | qed "real_mult_less_cancel2"; | |
| 486 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 487 | Goal "(0::real) < z ==> (x*z < y*z) = (x < y)"; | 
| 7334 | 488 | by (blast_tac (claset() addIs [real_mult_less_mono1, | 
| 489 | real_mult_less_cancel1]) 1); | |
| 490 | qed "real_mult_less_iff1"; | |
| 491 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 492 | Goal "(0::real) < z ==> (z*x < z*y) = (x < y)"; | 
| 7334 | 493 | by (blast_tac (claset() addIs [real_mult_less_mono2, | 
| 494 | real_mult_less_cancel2]) 1); | |
| 495 | qed "real_mult_less_iff2"; | |
| 496 | ||
| 497 | Addsimps [real_mult_less_iff1,real_mult_less_iff2]; | |
| 498 | ||
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 499 | (* 05/00 *) | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 500 | Goalw [real_le_def] "[| (0::real) < z; x*z<=y*z |] ==> x<=y"; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 501 | by (Auto_tac); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 502 | qed "real_mult_le_cancel1"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 503 | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 504 | Goalw [real_le_def] "[| (0::real) < z; z*x<=z*y |] ==> x<=y"; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 505 | by (Auto_tac); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 506 | qed "real_mult_le_cancel2"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 507 | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 508 | Goalw [real_le_def] "(0::real) < z ==> (x*z <= y*z) = (x <= y)"; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 509 | by (Auto_tac); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 510 | qed "real_mult_le_cancel_iff1"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 511 | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 512 | Goalw [real_le_def] "(0::real) < z ==> (z*x <= z*y) = (x <= y)"; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 513 | by (Auto_tac); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 514 | qed "real_mult_le_cancel_iff2"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 515 | |
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 516 | Addsimps [real_mult_le_cancel_iff1,real_mult_le_cancel_iff2]; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 517 | |
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 518 | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 519 | Goal "[| (0::real) <= z; x < y |] ==> x*z <= y*z"; | 
| 7334 | 520 | by (EVERY1 [rtac real_less_or_eq_imp_le, dtac real_le_imp_less_or_eq]); | 
| 521 | by (auto_tac (claset() addIs [real_mult_less_mono1],simpset())); | |
| 522 | qed "real_mult_le_less_mono1"; | |
| 523 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 524 | Goal "[| (0::real) <= z; x < y |] ==> z*x <= z*y"; | 
| 7334 | 525 | by (asm_simp_tac (simpset() addsimps [real_mult_commute,real_mult_le_less_mono1]) 1); | 
| 526 | qed "real_mult_le_less_mono2"; | |
| 527 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 528 | Goal "[| (0::real) <= z; x <= y |] ==> z*x <= z*y"; | 
| 7334 | 529 | by (dres_inst_tac [("x","x")] real_le_imp_less_or_eq 1);
 | 
| 530 | by (auto_tac (claset() addIs [real_mult_le_less_mono2], simpset())); | |
| 531 | qed "real_mult_le_le_mono1"; | |
| 532 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 533 | Goal "[| (0::real) < r1; r1 < r2; 0 < x; x < y|] ==> r1 * x < r2 * y"; | 
| 7334 | 534 | by (dres_inst_tac [("x","x")] real_mult_less_mono2 1);
 | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 535 | by (dres_inst_tac [("R1.0","0")] real_less_trans 2);
 | 
| 7334 | 536 | by (dres_inst_tac [("x","r1")] real_mult_less_mono1 3);
 | 
| 537 | by Auto_tac; | |
| 538 | by (blast_tac (claset() addIs [real_less_trans]) 1); | |
| 539 | qed "real_mult_less_mono"; | |
| 540 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 541 | Goal "[| (0::real) < r1; r1 < r2; 0 < y|] ==> 0 < r2 * y"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 542 | by (rtac real_mult_order 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 543 | by (assume_tac 2); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 544 | by (blast_tac (claset() addIs [real_less_trans]) 1); | 
| 7334 | 545 | qed "real_mult_order_trans"; | 
| 546 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 547 | Goal "[| (0::real) < r1; r1 < r2; 0 <= x; x < y|] ==> r1 * x < r2 * y"; | 
| 7334 | 548 | by (auto_tac (claset() addSDs [real_le_imp_less_or_eq] | 
| 549 | addIs [real_mult_less_mono,real_mult_order_trans], | |
| 550 | simpset())); | |
| 551 | qed "real_mult_less_mono3"; | |
| 552 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 553 | Goal "[| (0::real) <= r1; r1 < r2; 0 <= x; x < y|] ==> r1 * x < r2 * y"; | 
| 7334 | 554 | by (auto_tac (claset() addSDs [real_le_imp_less_or_eq] | 
| 555 | addIs [real_mult_less_mono,real_mult_order_trans, | |
| 556 | real_mult_order], | |
| 557 | simpset())); | |
| 558 | by (dres_inst_tac [("R2.0","x")] real_less_trans 1);
 | |
| 559 | by (assume_tac 1); | |
| 560 | by (blast_tac (claset() addIs [real_mult_order]) 1); | |
| 561 | qed "real_mult_less_mono4"; | |
| 562 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 563 | Goal "[| (0::real) < r1; r1 <= r2; 0 <= x; x <= y |] ==> r1 * x <= r2 * y"; | 
| 7334 | 564 | by (rtac real_less_or_eq_imp_le 1); | 
| 565 | by (REPEAT(dtac real_le_imp_less_or_eq 1)); | |
| 566 | by (auto_tac (claset() addIs [real_mult_less_mono, | |
| 567 | real_mult_order_trans,real_mult_order], | |
| 568 | simpset())); | |
| 569 | qed "real_mult_le_mono"; | |
| 570 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 571 | Goal "[| (0::real) < r1; r1 < r2; 0 <= x; x <= y |] ==> r1 * x <= r2 * y"; | 
| 7334 | 572 | by (rtac real_less_or_eq_imp_le 1); | 
| 573 | by (REPEAT(dtac real_le_imp_less_or_eq 1)); | |
| 574 | by (auto_tac (claset() addIs [real_mult_less_mono, real_mult_order_trans, | |
| 575 | real_mult_order], | |
| 576 | simpset())); | |
| 577 | qed "real_mult_le_mono2"; | |
| 578 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 579 | Goal "[| (0::real) <= r1; r1 < r2; 0 <= x; x <= y |] ==> r1 * x <= r2 * y"; | 
| 7334 | 580 | by (dtac real_le_imp_less_or_eq 1); | 
| 581 | by (auto_tac (claset() addIs [real_mult_le_mono2],simpset())); | |
| 582 | by (dtac real_le_trans 1 THEN assume_tac 1); | |
| 583 | by (auto_tac (claset() addIs [real_less_le_mult_order], simpset())); | |
| 584 | qed "real_mult_le_mono3"; | |
| 585 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 586 | Goal "[| (0::real) <= r1; r1 <= r2; 0 <= x; x <= y |] ==> r1 * x <= r2 * y"; | 
| 7334 | 587 | by (dres_inst_tac [("x","r1")] real_le_imp_less_or_eq 1);
 | 
| 588 | by (auto_tac (claset() addIs [real_mult_le_mono3, real_mult_le_le_mono1], | |
| 589 | simpset())); | |
| 590 | qed "real_mult_le_mono4"; | |
| 591 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 592 | Goal "1r <= x ==> 0 < x"; | 
| 7334 | 593 | by (rtac ccontr 1 THEN dtac real_leI 1); | 
| 594 | by (dtac real_le_trans 1 THEN assume_tac 1); | |
| 595 | by (auto_tac (claset() addDs [real_zero_less_one RSN (2,real_le_less_trans)], | |
| 596 | simpset() addsimps [real_less_not_refl])); | |
| 597 | qed "real_gt_zero"; | |
| 598 | ||
| 599 | Goal "[| 1r < r; 1r <= x |] ==> x <= r * x"; | |
| 600 | by (dtac (real_gt_zero RS real_less_imp_le) 1); | |
| 601 | by (auto_tac (claset() addSDs [real_mult_le_less_mono1], | |
| 602 | simpset())); | |
| 603 | qed "real_mult_self_le"; | |
| 604 | ||
| 605 | Goal "[| 1r <= r; 1r <= x |] ==> x <= r * x"; | |
| 606 | by (dtac real_le_imp_less_or_eq 1); | |
| 607 | by (auto_tac (claset() addIs [real_mult_self_le], | |
| 608 | simpset() addsimps [real_le_refl])); | |
| 609 | qed "real_mult_self_le2"; | |
| 610 | ||
| 611 | Goal "x < y ==> x < (x + y)*rinv(1r + 1r)"; | |
| 612 | by (dres_inst_tac [("C","x")] real_add_less_mono2 1);
 | |
| 613 | by (dtac (real_add_self RS subst) 1); | |
| 614 | by (dtac (real_zero_less_two RS real_rinv_gt_zero RS | |
| 615 | real_mult_less_mono1) 1); | |
| 616 | by (asm_full_simp_tac (simpset() addsimps [real_mult_assoc]) 1); | |
| 617 | qed "real_less_half_sum"; | |
| 618 | ||
| 619 | Goal "x < y ==> (x + y)*rinv(1r + 1r) < y"; | |
| 620 | by (dtac real_add_less_mono1 1); | |
| 621 | by (dtac (real_add_self RS subst) 1); | |
| 622 | by (dtac (real_zero_less_two RS real_rinv_gt_zero RS | |
| 623 | real_mult_less_mono1) 1); | |
| 624 | by (asm_full_simp_tac (simpset() addsimps [real_mult_assoc]) 1); | |
| 625 | qed "real_gt_half_sum"; | |
| 626 | ||
| 627 | Goal "x < y ==> EX r::real. x < r & r < y"; | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 628 | by (blast_tac (claset() addSIs [real_less_half_sum, real_gt_half_sum]) 1); | 
| 7334 | 629 | qed "real_dense"; | 
| 630 | ||
| 631 | Goal "(EX n. rinv(real_of_posnat n) < r) = (EX n. 1r < r * real_of_posnat n)"; | |
| 632 | by (Step_tac 1); | |
| 633 | by (dres_inst_tac [("n1","n")] (real_of_posnat_less_zero 
 | |
| 634 | RS real_mult_less_mono1) 1); | |
| 635 | by (dres_inst_tac [("n2","n")] (real_of_posnat_less_zero RS 
 | |
| 636 | real_rinv_gt_zero RS real_mult_less_mono1) 2); | |
| 637 | by (auto_tac (claset(), | |
| 638 | simpset() addsimps [(real_of_posnat_less_zero RS | |
| 639 | real_not_refl2 RS not_sym), | |
| 640 | real_mult_assoc])); | |
| 641 | qed "real_of_posnat_rinv_Ex_iff"; | |
| 642 | ||
| 643 | Goal "(rinv(real_of_posnat n) < r) = (1r < r * real_of_posnat n)"; | |
| 644 | by (Step_tac 1); | |
| 645 | by (dres_inst_tac [("n1","n")] (real_of_posnat_less_zero 
 | |
| 646 | RS real_mult_less_mono1) 1); | |
| 647 | by (dres_inst_tac [("n2","n")] (real_of_posnat_less_zero RS 
 | |
| 648 | real_rinv_gt_zero RS real_mult_less_mono1) 2); | |
| 649 | by (auto_tac (claset(), simpset() addsimps [real_mult_assoc])); | |
| 650 | qed "real_of_posnat_rinv_iff"; | |
| 651 | ||
| 652 | Goal "(rinv(real_of_posnat n) <= r) = (1r <= r * real_of_posnat n)"; | |
| 653 | by (Step_tac 1); | |
| 654 | by (dres_inst_tac [("n2","n")] (real_of_posnat_less_zero RS 
 | |
| 655 | real_less_imp_le RS real_mult_le_le_mono1) 1); | |
| 656 | by (dres_inst_tac [("n3","n")] (real_of_posnat_less_zero RS 
 | |
| 657 | real_rinv_gt_zero RS real_less_imp_le RS | |
| 658 | real_mult_le_le_mono1) 2); | |
| 659 | by (auto_tac (claset(), simpset() addsimps real_mult_ac)); | |
| 660 | qed "real_of_posnat_rinv_le_iff"; | |
| 661 | ||
| 662 | Goalw [real_of_posnat_def] "(real_of_posnat n < real_of_posnat m) = (n < m)"; | |
| 663 | by Auto_tac; | |
| 664 | qed "real_of_posnat_less_iff"; | |
| 665 | ||
| 666 | Addsimps [real_of_posnat_less_iff]; | |
| 667 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 668 | Goal "0 < u ==> (u < rinv (real_of_posnat n)) = (real_of_posnat n < rinv(u))"; | 
| 7334 | 669 | by (Step_tac 1); | 
| 670 | by (res_inst_tac [("n2","n")] (real_of_posnat_less_zero RS 
 | |
| 671 | real_rinv_gt_zero RS real_mult_less_cancel1) 1); | |
| 672 | by (res_inst_tac [("x1","u")] ( real_rinv_gt_zero
 | |
| 673 | RS real_mult_less_cancel1) 2); | |
| 674 | by (auto_tac (claset(), | |
| 675 | simpset() addsimps [real_of_posnat_less_zero, | |
| 676 | real_not_refl2 RS not_sym])); | |
| 677 | by (res_inst_tac [("z","u")] real_mult_less_cancel2 1);
 | |
| 678 | by (res_inst_tac [("n1","n")] (real_of_posnat_less_zero RS 
 | |
| 679 | real_mult_less_cancel2) 3); | |
| 680 | by (auto_tac (claset(), | |
| 681 | simpset() addsimps [real_of_posnat_less_zero, | |
| 682 | real_not_refl2 RS not_sym,real_mult_assoc RS sym])); | |
| 683 | qed "real_of_posnat_less_rinv_iff"; | |
| 684 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 685 | Goal "0 < u ==> (u = rinv(real_of_posnat n)) = (real_of_posnat n = rinv u)"; | 
| 7334 | 686 | by (auto_tac (claset(), | 
| 687 | simpset() addsimps [real_rinv_rinv, | |
| 688 | real_of_posnat_less_zero,real_not_refl2 RS not_sym])); | |
| 689 | qed "real_of_posnat_rinv_eq_iff"; | |
| 690 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 691 | Goal "[| 0 < r; r < x |] ==> rinv x < rinv r"; | 
| 7499 | 692 | by (ftac real_less_trans 1 THEN assume_tac 1); | 
| 693 | by (ftac real_rinv_gt_zero 1); | |
| 7334 | 694 | by (forw_inst_tac [("x","x")] real_rinv_gt_zero 1);
 | 
| 695 | by (forw_inst_tac [("x","r"),("z","rinv r")] real_mult_less_mono1 1);
 | |
| 696 | by (assume_tac 1); | |
| 697 | by (asm_full_simp_tac (simpset() addsimps [real_not_refl2 RS | |
| 698 | not_sym RS real_mult_inv_right]) 1); | |
| 7499 | 699 | by (ftac real_rinv_gt_zero 1); | 
| 7334 | 700 | by (forw_inst_tac [("x","1r"),("z","rinv x")] real_mult_less_mono2 1);
 | 
| 701 | by (assume_tac 1); | |
| 702 | by (asm_full_simp_tac (simpset() addsimps [real_not_refl2 RS | |
| 703 | not_sym RS real_mult_inv_left,real_mult_assoc RS sym]) 1); | |
| 704 | qed "real_rinv_less_swap"; | |
| 705 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 706 | Goal "[| 0 < r; 0 < x|] ==> (r < x) = (rinv x < rinv r)"; | 
| 7334 | 707 | by (auto_tac (claset() addIs [real_rinv_less_swap],simpset())); | 
| 708 | by (res_inst_tac [("t","r")] (real_rinv_rinv RS subst) 1);
 | |
| 709 | by (etac (real_not_refl2 RS not_sym) 1); | |
| 710 | by (res_inst_tac [("t","x")] (real_rinv_rinv RS subst) 1);
 | |
| 711 | by (etac (real_not_refl2 RS not_sym) 1); | |
| 712 | by (auto_tac (claset() addIs [real_rinv_less_swap], | |
| 713 | simpset() addsimps [real_rinv_gt_zero])); | |
| 714 | qed "real_rinv_less_iff"; | |
| 715 | ||
| 716 | Goal "r < r + rinv(real_of_posnat n)"; | |
| 717 | by (res_inst_tac [("C","-r")] real_less_add_left_cancel 1);
 | |
| 718 | by (full_simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); | |
| 719 | qed "real_add_rinv_real_of_posnat_less"; | |
| 720 | Addsimps [real_add_rinv_real_of_posnat_less]; | |
| 721 | ||
| 722 | Goal "r <= r + rinv(real_of_posnat n)"; | |
| 723 | by (rtac real_less_imp_le 1); | |
| 724 | by (Simp_tac 1); | |
| 725 | qed "real_add_rinv_real_of_posnat_le"; | |
| 726 | Addsimps [real_add_rinv_real_of_posnat_le]; | |
| 727 | ||
| 728 | Goal "r + (-rinv(real_of_posnat n)) < r"; | |
| 729 | by (res_inst_tac [("C","-r")] real_less_add_left_cancel 1);
 | |
| 730 | by (full_simp_tac (simpset() addsimps [real_add_assoc RS sym, | |
| 731 | real_minus_zero_less_iff2]) 1); | |
| 732 | qed "real_add_minus_rinv_real_of_posnat_less"; | |
| 733 | Addsimps [real_add_minus_rinv_real_of_posnat_less]; | |
| 734 | ||
| 735 | Goal "r + (-rinv(real_of_posnat n)) <= r"; | |
| 736 | by (rtac real_less_imp_le 1); | |
| 737 | by (Simp_tac 1); | |
| 738 | qed "real_add_minus_rinv_real_of_posnat_le"; | |
| 739 | Addsimps [real_add_minus_rinv_real_of_posnat_le]; | |
| 740 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 741 | Goal "0 < r ==> r*(1r + (-rinv(real_of_posnat n))) < r"; | 
| 7334 | 742 | by (simp_tac (simpset() addsimps [real_add_mult_distrib2]) 1); | 
| 743 | by (res_inst_tac [("C","-r")] real_less_add_left_cancel 1);
 | |
| 744 | by (auto_tac (claset() addIs [real_mult_order], | |
| 745 | simpset() addsimps [real_add_assoc RS sym, | |
| 746 | real_minus_zero_less_iff2])); | |
| 747 | qed "real_mult_less_self"; | |
| 748 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 749 | Goal "0 <= 1r + (-rinv(real_of_posnat n))"; | 
| 7334 | 750 | by (res_inst_tac [("C","rinv(real_of_posnat n)")] real_le_add_right_cancel 1);
 | 
| 751 | by (simp_tac (simpset() addsimps [real_add_assoc, | |
| 752 | real_of_posnat_rinv_le_iff]) 1); | |
| 753 | qed "real_add_one_minus_rinv_ge_zero"; | |
| 754 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 755 | Goal "0 < r ==> 0 <= r*(1r + (-rinv(real_of_posnat n)))"; | 
| 7334 | 756 | by (dtac (real_add_one_minus_rinv_ge_zero RS real_mult_le_less_mono1) 1); | 
| 757 | by Auto_tac; | |
| 758 | qed "real_mult_add_one_minus_ge_zero"; | |
| 759 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 760 | Goal "(x*y = 0) = (x = 0 | y = (0::real))"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 761 | by Auto_tac; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 762 | by (blast_tac (claset() addIs [ccontr] addDs [real_mult_not_zero]) 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 763 | qed "real_mult_is_0"; | 
| 7334 | 764 | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 765 | Goal "(0 = x*y) = (0 = x | (0::real) = y)"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 766 | by (stac eq_commute 1 THEN stac real_mult_is_0 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 767 | by Auto_tac; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 768 | qed "real_0_is_mult"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 769 | AddIffs [real_mult_is_0, real_0_is_mult]; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 770 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 771 | Goal "[| x ~= 1r; y * x = y |] ==> y = 0"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 772 | by (subgoal_tac "y*(1r + -x) = 0" 1); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 773 | by (stac real_add_mult_distrib2 2); | 
| 7334 | 774 | by (auto_tac (claset(), | 
| 775 | simpset() addsimps [real_eq_minus_iff2 RS sym])); | |
| 776 | qed "real_mult_eq_self_zero"; | |
| 777 | Addsimps [real_mult_eq_self_zero]; | |
| 778 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 779 | Goal "[| x ~= 1r; y = y * x |] ==> y = 0"; | 
| 7334 | 780 | by (dtac sym 1); | 
| 781 | by (Asm_full_simp_tac 1); | |
| 782 | qed "real_mult_eq_self_zero2"; | |
| 783 | Addsimps [real_mult_eq_self_zero2]; | |
| 784 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 785 | Goal "[| 0 <= x*y; 0 < x |] ==> (0::real) <= y"; | 
| 7499 | 786 | by (ftac real_rinv_gt_zero 1); | 
| 7334 | 787 | by (dres_inst_tac [("x","rinv x")] real_less_le_mult_order 1);
 | 
| 788 | by (dtac (real_not_refl2 RS not_sym RS real_mult_inv_left) 2); | |
| 789 | by (auto_tac (claset(), | |
| 790 | simpset() addsimps [real_mult_assoc RS sym])); | |
| 791 | qed "real_mult_ge_zero_cancel"; | |
| 792 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 793 | Goal "[|x ~= 0; y ~= 0 |] ==> rinv(x) + rinv(y) = (x + y)*rinv(x*y)"; | 
| 7334 | 794 | by (asm_full_simp_tac (simpset() addsimps | 
| 795 | [real_rinv_distrib,real_add_mult_distrib, | |
| 796 | real_mult_assoc RS sym]) 1); | |
| 797 | by (stac real_mult_assoc 1); | |
| 798 | by (rtac (real_mult_left_commute RS subst) 1); | |
| 799 | by (asm_full_simp_tac (simpset() addsimps [real_add_commute]) 1); | |
| 800 | qed "real_rinv_add"; | |
| 801 | ||
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 802 | (* 05/00 *) | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 803 | Goal "(0 <= -R) = (R <= (0::real))"; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 804 | by (auto_tac (claset() addDs [sym], | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 805 | simpset() addsimps [real_le_less])); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 806 | qed "real_minus_zero_le_iff"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 807 | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 808 | Goal "(-R <= 0) = ((0::real) <= R)"; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 809 | by (auto_tac (claset(),simpset() addsimps | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 810 | [real_minus_zero_less_iff2,real_le_less])); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 811 | qed "real_minus_zero_le_iff2"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 812 | |
| 9053 | 813 | Addsimps [real_minus_zero_le_iff, real_minus_zero_le_iff2]; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 814 | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 815 | Goal "x * x + y * y = 0 ==> x = (0::real)"; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 816 | by (dtac real_add_minus_eq_minus 1); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 817 | by (cut_inst_tac [("x","x")] real_le_square 1);
 | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 818 | by (Auto_tac THEN dtac real_le_anti_sym 1); | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 819 | by Auto_tac; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 820 | qed "real_sum_squares_cancel"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 821 | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 822 | Goal "x * x + y * y = 0 ==> y = (0::real)"; | 
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 823 | by (res_inst_tac [("y","x")] real_sum_squares_cancel 1);
 | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 824 | by (asm_full_simp_tac (simpset() addsimps [real_add_commute]) 1); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 825 | qed "real_sum_squares_cancel2"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 826 | |
| 7334 | 827 | (*---------------------------------------------------------------------------- | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 828 | Some convenient biconditionals for products of signs (lcp) | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 829 | ----------------------------------------------------------------------------*) | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 830 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 831 | Goal "((0::real) < x*y) = (0 < x & 0 < y | x < 0 & y < 0)"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 832 | by (auto_tac (claset(), | 
| 9069 | 833 | simpset() addsimps [order_le_less, linorder_not_less, | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 834 | real_mult_order, real_mult_less_zero1])); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 835 | by (ALLGOALS (rtac ccontr)); | 
| 9069 | 836 | by (auto_tac (claset(), simpset() addsimps [order_le_less, linorder_not_less])); | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 837 | by (ALLGOALS (etac rev_mp)); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 838 | by (ALLGOALS (dtac real_mult_less_zero THEN' assume_tac)); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 839 | by (auto_tac (claset() addDs [order_less_not_sym], | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 840 | simpset() addsimps [real_mult_commute])); | 
| 9069 | 841 | qed "real_zero_less_mult_iff"; | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 842 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 843 | Goal "((0::real) <= x*y) = (0 <= x & 0 <= y | x <= 0 & y <= 0)"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 844 | by (auto_tac (claset(), | 
| 9069 | 845 | simpset() addsimps [order_le_less, linorder_not_less, | 
| 846 | real_zero_less_mult_iff])); | |
| 847 | qed "real_zero_le_mult_iff"; | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 848 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 849 | Goal "(x*y < (0::real)) = (0 < x & y < 0 | x < 0 & 0 < y)"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 850 | by (auto_tac (claset(), | 
| 9069 | 851 | simpset() addsimps [real_zero_le_mult_iff, | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 852 | linorder_not_le RS sym])); | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 853 | by (auto_tac (claset() addDs [order_less_not_sym], | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 854 | simpset() addsimps [linorder_not_le])); | 
| 9069 | 855 | qed "real_mult_less_zero_iff"; | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 856 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 857 | Goal "(x*y <= (0::real)) = (0 <= x & y <= 0 | x <= 0 & 0 <= y)"; | 
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 858 | by (auto_tac (claset() addDs [order_less_not_sym], | 
| 9069 | 859 | simpset() addsimps [real_zero_less_mult_iff, | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 860 | linorder_not_less RS sym])); | 
| 9069 | 861 | qed "real_mult_le_zero_iff"; | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 862 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 863 | |
| 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 864 | (*---------------------------------------------------------------------------- | 
| 7334 | 865 | Another embedding of the naturals in the reals (see real_of_posnat) | 
| 866 | ----------------------------------------------------------------------------*) | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 867 | Goalw [real_of_nat_def] "real_of_nat 0 = 0"; | 
| 9069 | 868 | by (simp_tac (simpset() addsimps [real_of_posnat_one]) 1); | 
| 7334 | 869 | qed "real_of_nat_zero"; | 
| 870 | ||
| 871 | Goalw [real_of_nat_def] "real_of_nat 1 = 1r"; | |
| 9069 | 872 | by (simp_tac (simpset() addsimps [real_of_posnat_two, real_add_assoc]) 1); | 
| 7334 | 873 | qed "real_of_nat_one"; | 
| 9069 | 874 | Addsimps [real_of_nat_zero, real_of_nat_one]; | 
| 7334 | 875 | |
| 876 | Goalw [real_of_nat_def] | |
| 9069 | 877 | "real_of_nat (m + n) = real_of_nat m + real_of_nat n"; | 
| 7334 | 878 | by (simp_tac (simpset() addsimps | 
| 9069 | 879 | [real_of_posnat_add,real_add_assoc RS sym]) 1); | 
| 7334 | 880 | qed "real_of_nat_add"; | 
| 881 | ||
| 882 | Goalw [real_of_nat_def] "real_of_nat (Suc n) = real_of_nat n + 1r"; | |
| 883 | by (simp_tac (simpset() addsimps [real_of_posnat_Suc] @ real_add_ac) 1); | |
| 884 | qed "real_of_nat_Suc"; | |
| 9069 | 885 | Addsimps [real_of_nat_Suc]; | 
| 7334 | 886 | |
| 9069 | 887 | Goalw [real_of_nat_def] "(real_of_nat n < real_of_nat m) = (n < m)"; | 
| 7334 | 888 | by Auto_tac; | 
| 889 | qed "real_of_nat_less_iff"; | |
| 890 | ||
| 9069 | 891 | AddIffs [real_of_nat_less_iff]; | 
| 7334 | 892 | |
| 893 | Goal "inj real_of_nat"; | |
| 894 | by (rtac injI 1); | |
| 895 | by (auto_tac (claset() addSIs [inj_real_of_posnat RS injD], | |
| 896 | simpset() addsimps [real_of_nat_def,real_add_right_cancel])); | |
| 897 | qed "inj_real_of_nat"; | |
| 898 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
9013diff
changeset | 899 | Goalw [real_of_nat_def] "0 <= real_of_nat n"; | 
| 7334 | 900 | by (res_inst_tac [("C","1r")] real_le_add_right_cancel 1);
 | 
| 901 | by (asm_full_simp_tac (simpset() addsimps [real_add_assoc]) 1); | |
| 902 | qed "real_of_nat_ge_zero"; | |
| 9069 | 903 | AddIffs [real_of_nat_ge_zero]; | 
| 7334 | 904 | |
| 9069 | 905 | Goal "real_of_nat (m * n) = real_of_nat m * real_of_nat n"; | 
| 906 | by (induct_tac "m" 1); | |
| 7334 | 907 | by (auto_tac (claset(), | 
| 9069 | 908 | simpset() addsimps [real_of_nat_add, | 
| 7334 | 909 | real_add_mult_distrib, real_add_commute])); | 
| 910 | qed "real_of_nat_mult"; | |
| 911 | ||
| 912 | Goal "(real_of_nat n = real_of_nat m) = (n = m)"; | |
| 913 | by (auto_tac (claset() addDs [inj_real_of_nat RS injD], | |
| 914 | simpset())); | |
| 915 | qed "real_of_nat_eq_cancel"; | |
| 916 | ||
| 9069 | 917 | Goal "n <= m --> real_of_nat (m - n) = real_of_nat m + (-real_of_nat n)"; | 
| 918 | by (induct_tac "m" 1); | |
| 7334 | 919 | by (auto_tac (claset(), | 
| 8867 | 920 | simpset() addsimps [Suc_diff_le, le_Suc_eq, real_of_nat_Suc, | 
| 921 | real_of_nat_zero] @ real_add_ac)); | |
| 922 | qed_spec_mp "real_of_nat_minus"; | |
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 923 | |
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 924 | (* 05/00 *) | 
| 9069 | 925 | Goal "n < m ==> real_of_nat (m - n) = \ | 
| 926 | \ real_of_nat m + -real_of_nat n"; | |
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 927 | by (auto_tac (claset() addIs [real_of_nat_minus],simpset())); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 928 | qed "real_of_nat_minus2"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 929 | |
| 9069 | 930 | Goalw [real_diff_def] | 
| 931 | "n < m ==> real_of_nat (m - n) = real_of_nat m - real_of_nat n"; | |
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 932 | by (etac real_of_nat_minus2 1); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 933 | qed "real_of_nat_diff"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 934 | |
| 9069 | 935 | Goalw [real_diff_def] | 
| 936 | "n <= m ==> real_of_nat (m - n) = real_of_nat m - real_of_nat n"; | |
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 937 | by (etac real_of_nat_minus 1); | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 938 | qed "real_of_nat_diff2"; | 
| 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 939 | |
| 9069 | 940 | Goal "(real_of_nat n = 0) = (n = 0)"; | 
| 941 | by (auto_tac (claset() addIs [inj_real_of_nat RS injD], simpset())); | |
| 942 | qed "real_of_nat_zero_iff"; | |
| 943 | AddIffs [real_of_nat_zero_iff]; | |
| 9013 
9dd0274f76af
Updated files to remove 0r and 1r from theorems in descendant theories
 fleuriot parents: 
8867diff
changeset | 944 | |
| 9069 | 945 | Goal "neg z ==> real_of_nat (nat z) = 0"; | 
| 946 | by (asm_simp_tac (simpset() addsimps [neg_nat, real_of_nat_zero]) 1); | |
| 947 | qed "real_of_nat_neg_int"; | |
| 948 | Addsimps [real_of_nat_neg_int]; | |
| 949 |