| author | paulson | 
| Wed, 05 Mar 2003 16:03:33 +0100 | |
| changeset 13846 | b2c494d76012 | 
| parent 13438 | 527811f00c56 | 
| child 14335 | 9c0b5e081037 | 
| permissions | -rw-r--r-- | 
| 5078 | 1 | (* Title : PRat.ML | 
| 7219 | 2 | ID : $Id$ | 
| 5078 | 3 | Author : Jacques D. Fleuriot | 
| 4 | Copyright : 1998 University of Cambridge | |
| 5 | Description : The positive rationals | |
| 6 | *) | |
| 7 | ||
| 9426 | 8 | (*** Many theorems similar to those in theory Integ ***) | 
| 5078 | 9 | (*** Proving that ratrel is an equivalence relation ***) | 
| 10 | ||
| 7219 | 11 | Goal "[| (x1::pnat) * y2 = x2 * y1; x2 * y3 = x3 * y2 |] \ | 
| 5078 | 12 | \ ==> x1 * y3 = x3 * y1"; | 
| 13 | by (res_inst_tac [("k1","y2")] (pnat_mult_cancel1 RS iffD1) 1);
 | |
| 14 | by (auto_tac (claset(), simpset() addsimps [pnat_mult_assoc RS sym])); | |
| 15 | by (auto_tac (claset(),simpset() addsimps [pnat_mult_commute])); | |
| 16 | by (dres_inst_tac [("s","x2 * y3")] sym 1);
 | |
| 17 | by (asm_simp_tac (simpset() addsimps [pnat_mult_left_commute, | |
| 18 | pnat_mult_commute]) 1); | |
| 19 | qed "prat_trans_lemma"; | |
| 20 | ||
| 21 | (** Natural deduction for ratrel **) | |
| 22 | ||
| 23 | Goalw [ratrel_def] | |
| 24 | "(((x1,y1),(x2,y2)): ratrel) = (x1 * y2 = x2 * y1)"; | |
| 25 | by (Fast_tac 1); | |
| 26 | qed "ratrel_iff"; | |
| 27 | ||
| 28 | Goalw [ratrel_def] | |
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 29 | "[| x1 * y2 = x2 * y1 |] ==> ((x1,y1),(x2,y2)): ratrel"; | 
| 5078 | 30 | by (Fast_tac 1); | 
| 31 | qed "ratrelI"; | |
| 32 | ||
| 33 | Goalw [ratrel_def] | |
| 34 | "p: ratrel --> (EX x1 y1 x2 y2. \ | |
| 35 | \ p = ((x1,y1),(x2,y2)) & x1 *y2 = x2 *y1)"; | |
| 36 | by (Fast_tac 1); | |
| 37 | qed "ratrelE_lemma"; | |
| 38 | ||
| 9969 | 39 | val [major,minor] = Goal | 
| 5078 | 40 | "[| p: ratrel; \ | 
| 41 | \ !!x1 y1 x2 y2. [| p = ((x1,y1),(x2,y2)); x1*y2 = x2*y1 \ | |
| 42 | \ |] ==> Q |] ==> Q"; | |
| 43 | by (cut_facts_tac [major RS (ratrelE_lemma RS mp)] 1); | |
| 44 | by (REPEAT (eresolve_tac [asm_rl,exE,conjE,minor] 1)); | |
| 45 | qed "ratrelE"; | |
| 46 | ||
| 47 | AddSIs [ratrelI]; | |
| 48 | AddSEs [ratrelE]; | |
| 49 | ||
| 50 | Goal "(x,x): ratrel"; | |
| 9369 | 51 | by (pair_tac "x" 1); | 
| 52 | by (rtac ratrelI 1); | |
| 53 | by (rtac refl 1); | |
| 5078 | 54 | qed "ratrel_refl"; | 
| 55 | ||
| 56 | Goalw [equiv_def, refl_def, sym_def, trans_def] | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 57 | "equiv UNIV ratrel"; | 
| 5078 | 58 | by (fast_tac (claset() addSIs [ratrel_refl] | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 59 | addSEs [sym, prat_trans_lemma]) 1); | 
| 5078 | 60 | qed "equiv_ratrel"; | 
| 61 | ||
| 9108 | 62 | bind_thm ("equiv_ratrel_iff", [equiv_ratrel, UNIV_I, UNIV_I] MRS eq_equiv_class_iff);
 | 
| 5078 | 63 | |
| 10834 | 64 | Goalw  [prat_def,ratrel_def,quotient_def] "ratrel``{(x,y)}:prat";
 | 
| 5078 | 65 | by (Blast_tac 1); | 
| 66 | qed "ratrel_in_prat"; | |
| 67 | ||
| 68 | Goal "inj_on Abs_prat prat"; | |
| 69 | by (rtac inj_on_inverseI 1); | |
| 70 | by (etac Abs_prat_inverse 1); | |
| 71 | qed "inj_on_Abs_prat"; | |
| 72 | ||
| 73 | Addsimps [equiv_ratrel_iff,inj_on_Abs_prat RS inj_on_iff, | |
| 74 | ratrel_iff, ratrel_in_prat, Abs_prat_inverse]; | |
| 75 | ||
| 76 | Addsimps [equiv_ratrel RS eq_equiv_class_iff]; | |
| 9108 | 77 | bind_thm ("eq_ratrelD", equiv_ratrel RSN (2,eq_equiv_class));
 | 
| 5078 | 78 | |
| 79 | Goal "inj(Rep_prat)"; | |
| 80 | by (rtac inj_inverseI 1); | |
| 81 | by (rtac Rep_prat_inverse 1); | |
| 82 | qed "inj_Rep_prat"; | |
| 83 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 84 | (** prat_of_pnat: the injection from pnat to prat **) | 
| 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 85 | Goal "inj(prat_of_pnat)"; | 
| 5078 | 86 | by (rtac injI 1); | 
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 87 | by (rewtac prat_of_pnat_def); | 
| 5078 | 88 | by (dtac (inj_on_Abs_prat RS inj_onD) 1); | 
| 89 | by (REPEAT (rtac ratrel_in_prat 1)); | |
| 90 | by (dtac eq_equiv_class 1); | |
| 91 | by (rtac equiv_ratrel 1); | |
| 92 | by (Fast_tac 1); | |
| 93 | by Safe_tac; | |
| 94 | by (Asm_full_simp_tac 1); | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 95 | qed "inj_prat_of_pnat"; | 
| 5078 | 96 | |
| 9969 | 97 | val [prem] = Goal | 
| 10834 | 98 |     "(!!x y. z = Abs_prat(ratrel``{(x,y)}) ==> P) ==> P";
 | 
| 5078 | 99 | by (res_inst_tac [("x1","z")] 
 | 
| 100 | (rewrite_rule [prat_def] Rep_prat RS quotientE) 1); | |
| 101 | by (dres_inst_tac [("f","Abs_prat")] arg_cong 1);
 | |
| 102 | by (res_inst_tac [("p","x")] PairE 1);
 | |
| 103 | by (rtac prem 1); | |
| 104 | by (asm_full_simp_tac (simpset() addsimps [Rep_prat_inverse]) 1); | |
| 105 | qed "eq_Abs_prat"; | |
| 106 | ||
| 107 | (**** qinv: inverse on prat ****) | |
| 108 | ||
| 10834 | 109 | Goalw [congruent_def] "congruent ratrel (%(x,y). ratrel``{(y,x)})";
 | 
| 10232 
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
 paulson parents: 
9969diff
changeset | 110 | by (auto_tac (claset(), simpset() addsimps [pnat_mult_commute])); | 
| 5078 | 111 | qed "qinv_congruent"; | 
| 112 | ||
| 113 | Goalw [qinv_def] | |
| 10834 | 114 |       "qinv (Abs_prat(ratrel``{(x,y)})) = Abs_prat(ratrel `` {(y,x)})";
 | 
| 5078 | 115 | by (simp_tac (simpset() addsimps | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 116 | [equiv_ratrel RS UN_equiv_class, qinv_congruent]) 1); | 
| 5078 | 117 | qed "qinv"; | 
| 118 | ||
| 119 | Goal "qinv (qinv z) = z"; | |
| 120 | by (res_inst_tac [("z","z")] eq_Abs_prat 1);
 | |
| 121 | by (asm_simp_tac (simpset() addsimps [qinv]) 1); | |
| 122 | qed "qinv_qinv"; | |
| 123 | ||
| 124 | Goal "inj(qinv)"; | |
| 125 | by (rtac injI 1); | |
| 126 | by (dres_inst_tac [("f","qinv")] arg_cong 1);
 | |
| 127 | by (asm_full_simp_tac (simpset() addsimps [qinv_qinv]) 1); | |
| 128 | qed "inj_qinv"; | |
| 129 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 130 | Goalw [prat_of_pnat_def] | 
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 131 | "qinv(prat_of_pnat (Abs_pnat (Suc 0))) = prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 132 | by (simp_tac (simpset() addsimps [qinv]) 1); | 
| 133 | qed "qinv_1"; | |
| 134 | ||
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 135 | Goal "!!(x1::pnat). [| x1 * y2 = x2 * y1 |] ==> \ | 
| 5078 | 136 | \ (x * y1 + x1 * ya) * (ya * y2) = (x * y2 + x2 * ya) * (ya * y1)"; | 
| 137 | by (auto_tac (claset() addSIs [pnat_same_multI2], | |
| 138 | simpset() addsimps [pnat_add_mult_distrib, | |
| 139 | pnat_mult_assoc])); | |
| 140 | by (res_inst_tac [("n1","y2")] (pnat_mult_commute RS subst) 1);
 | |
| 141 | by (auto_tac (claset() addIs [pnat_add_left_cancel RS iffD2],simpset() addsimps pnat_mult_ac)); | |
| 142 | by (res_inst_tac [("y1","x1")] (pnat_mult_left_commute RS subst) 1);
 | |
| 143 | by (res_inst_tac [("y1","x1")] (pnat_mult_left_commute RS ssubst) 1);
 | |
| 144 | by (auto_tac (claset(),simpset() addsimps [pnat_mult_assoc RS sym])); | |
| 145 | qed "prat_add_congruent2_lemma"; | |
| 146 | ||
| 7219 | 147 | Goal "congruent2 ratrel (%p1 p2. \ | 
| 10834 | 148 | \        (%(x1,y1). (%(x2,y2). ratrel``{(x1*y2 + x2*y1, y1*y2)}) p2) p1)";
 | 
| 5078 | 149 | by (rtac (equiv_ratrel RS congruent2_commuteI) 1); | 
| 10232 
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
 paulson parents: 
9969diff
changeset | 150 | by (auto_tac (claset() delrules [equalityI], | 
| 
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
 paulson parents: 
9969diff
changeset | 151 | simpset() addsimps [prat_add_congruent2_lemma])); | 
| 5078 | 152 | by (asm_simp_tac (simpset() addsimps [pnat_mult_commute,pnat_add_commute]) 1); | 
| 153 | qed "prat_add_congruent2"; | |
| 154 | ||
| 155 | Goalw [prat_add_def] | |
| 10834 | 156 |    "Abs_prat((ratrel``{(x1,y1)})) + Abs_prat((ratrel``{(x2,y2)})) =   \
 | 
| 157 | \   Abs_prat(ratrel `` {(x1*y2 + x2*y1, y1*y2)})";
 | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 158 | by (simp_tac (simpset() addsimps [UN_UN_split_split_eq, prat_add_congruent2, | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 159 | equiv_ratrel RS UN_equiv_class2]) 1); | 
| 5078 | 160 | qed "prat_add"; | 
| 161 | ||
| 162 | Goal "(z::prat) + w = w + z"; | |
| 163 | by (res_inst_tac [("z","z")] eq_Abs_prat 1);
 | |
| 164 | by (res_inst_tac [("z","w")] eq_Abs_prat 1);
 | |
| 5535 | 165 | by (asm_simp_tac | 
| 166 | (simpset() addsimps [prat_add] @ pnat_add_ac @ pnat_mult_ac) 1); | |
| 5078 | 167 | qed "prat_add_commute"; | 
| 168 | ||
| 169 | Goal "((z1::prat) + z2) + z3 = z1 + (z2 + z3)"; | |
| 170 | by (res_inst_tac [("z","z1")] eq_Abs_prat 1);
 | |
| 171 | by (res_inst_tac [("z","z2")] eq_Abs_prat 1);
 | |
| 172 | by (res_inst_tac [("z","z3")] eq_Abs_prat 1);
 | |
| 5535 | 173 | by (asm_simp_tac (simpset() addsimps [pnat_add_mult_distrib2,prat_add] @ | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 174 | pnat_add_ac @ pnat_mult_ac) 1); | 
| 5078 | 175 | qed "prat_add_assoc"; | 
| 176 | ||
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 177 | (*For AC rewriting*) | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 178 | Goal "(z1::prat) + (z2 + z3) = z2 + (z1 + z3)"; | 
| 13438 
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
 nipkow parents: 
12018diff
changeset | 179 | by(rtac ([prat_add_assoc,prat_add_commute] MRS | 
| 
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
 nipkow parents: 
12018diff
changeset | 180 |          read_instantiate[("f","op +")](thm"mk_left_commute")) 1);
 | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 181 | qed "prat_add_left_commute"; | 
| 5078 | 182 | |
| 183 | (* Positive Rational addition is an AC operator *) | |
| 9108 | 184 | bind_thms ("prat_add_ac", [prat_add_assoc, prat_add_commute, prat_add_left_commute]);
 | 
| 5078 | 185 | |
| 186 | ||
| 187 | (*** Congruence property for multiplication ***) | |
| 188 | ||
| 189 | Goalw [congruent2_def] | |
| 190 | "congruent2 ratrel (%p1 p2. \ | |
| 10834 | 191 | \         (%(x1,y1). (%(x2,y2). ratrel``{(x1*x2, y1*y2)}) p2) p1)";
 | 
| 5078 | 192 | (*Proof via congruent2_commuteI seems longer*) | 
| 10232 
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
 paulson parents: 
9969diff
changeset | 193 | by (Clarify_tac 1); | 
| 5078 | 194 | by (asm_simp_tac (simpset() addsimps [pnat_mult_assoc]) 1); | 
| 195 | (*The rest should be trivial, but rearranging terms is hard*) | |
| 196 | by (res_inst_tac [("x1","x1a")] (pnat_mult_left_commute RS ssubst) 1);
 | |
| 197 | by (asm_simp_tac (simpset() addsimps [pnat_mult_assoc RS sym]) 1); | |
| 198 | by (asm_simp_tac (simpset() addsimps pnat_mult_ac) 1); | |
| 199 | qed "pnat_mult_congruent2"; | |
| 200 | ||
| 201 | Goalw [prat_mult_def] | |
| 10834 | 202 |   "Abs_prat(ratrel``{(x1,y1)}) * Abs_prat(ratrel``{(x2,y2)}) = \
 | 
| 203 | \  Abs_prat(ratrel``{(x1*x2, y1*y2)})";
 | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 204 | by (asm_simp_tac | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 205 | (simpset() addsimps [UN_UN_split_split_eq, pnat_mult_congruent2, | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 206 | equiv_ratrel RS UN_equiv_class2]) 1); | 
| 5078 | 207 | qed "prat_mult"; | 
| 208 | ||
| 209 | Goal "(z::prat) * w = w * z"; | |
| 210 | by (res_inst_tac [("z","z")] eq_Abs_prat 1);
 | |
| 211 | by (res_inst_tac [("z","w")] eq_Abs_prat 1);
 | |
| 5535 | 212 | by (asm_simp_tac (simpset() addsimps pnat_mult_ac @ [prat_mult]) 1); | 
| 5078 | 213 | qed "prat_mult_commute"; | 
| 214 | ||
| 215 | Goal "((z1::prat) * z2) * z3 = z1 * (z2 * z3)"; | |
| 216 | by (res_inst_tac [("z","z1")] eq_Abs_prat 1);
 | |
| 217 | by (res_inst_tac [("z","z2")] eq_Abs_prat 1);
 | |
| 218 | by (res_inst_tac [("z","z3")] eq_Abs_prat 1);
 | |
| 219 | by (asm_simp_tac (simpset() addsimps [prat_mult, pnat_mult_assoc]) 1); | |
| 220 | qed "prat_mult_assoc"; | |
| 221 | ||
| 222 | (*For AC rewriting*) | |
| 223 | Goal "(x::prat)*(y*z)=y*(x*z)"; | |
| 13438 
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
 nipkow parents: 
12018diff
changeset | 224 | by(rtac ([prat_mult_assoc,prat_mult_commute] MRS | 
| 
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
 nipkow parents: 
12018diff
changeset | 225 |          read_instantiate[("f","op *")](thm"mk_left_commute")) 1);
 | 
| 5078 | 226 | qed "prat_mult_left_commute"; | 
| 227 | ||
| 228 | (*Positive Rational multiplication is an AC operator*) | |
| 9108 | 229 | bind_thms ("prat_mult_ac", [prat_mult_assoc,
 | 
| 230 | prat_mult_commute,prat_mult_left_commute]); | |
| 5078 | 231 | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 232 | Goalw [prat_of_pnat_def] | 
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 233 | "(prat_of_pnat (Abs_pnat (Suc 0))) * z = z"; | 
| 5078 | 234 | by (res_inst_tac [("z","z")] eq_Abs_prat 1);
 | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 235 | by (asm_full_simp_tac (simpset() addsimps [prat_mult] @ pnat_mult_ac) 1); | 
| 5078 | 236 | qed "prat_mult_1"; | 
| 237 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 238 | Goalw [prat_of_pnat_def] | 
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 239 | "z * (prat_of_pnat (Abs_pnat (Suc 0))) = z"; | 
| 5078 | 240 | by (res_inst_tac [("z","z")] eq_Abs_prat 1);
 | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 241 | by (asm_full_simp_tac (simpset() addsimps [prat_mult] @ pnat_mult_ac) 1); | 
| 5078 | 242 | qed "prat_mult_1_right"; | 
| 243 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 244 | Goalw [prat_of_pnat_def] | 
| 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 245 | "prat_of_pnat ((z1::pnat) + z2) = \ | 
| 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 246 | \ prat_of_pnat z1 + prat_of_pnat z2"; | 
| 5078 | 247 | by (asm_simp_tac (simpset() addsimps [prat_add, | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 248 | pnat_add_mult_distrib,pnat_mult_1]) 1); | 
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 249 | qed "prat_of_pnat_add"; | 
| 5078 | 250 | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 251 | Goalw [prat_of_pnat_def] | 
| 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 252 | "prat_of_pnat ((z1::pnat) * z2) = \ | 
| 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 253 | \ prat_of_pnat z1 * prat_of_pnat z2"; | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 254 | by (asm_simp_tac (simpset() addsimps [prat_mult, pnat_mult_1]) 1); | 
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 255 | qed "prat_of_pnat_mult"; | 
| 5078 | 256 | |
| 257 | (*** prat_mult and qinv ***) | |
| 258 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 259 | Goalw [prat_def,prat_of_pnat_def] | 
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 260 | "qinv (q) * q = prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 261 | by (res_inst_tac [("z","q")] eq_Abs_prat 1);
 | 
| 262 | by (asm_full_simp_tac (simpset() addsimps [qinv, | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 263 | prat_mult,pnat_mult_1,pnat_mult_1_left, pnat_mult_commute]) 1); | 
| 5078 | 264 | qed "prat_mult_qinv"; | 
| 265 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 266 | Goal "q * qinv (q) = prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 267 | by (rtac (prat_mult_commute RS subst) 1); | 
| 268 | by (simp_tac (simpset() addsimps [prat_mult_qinv]) 1); | |
| 269 | qed "prat_mult_qinv_right"; | |
| 270 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 271 | Goal "EX y. (x::prat) * y = prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 272 | by (fast_tac (claset() addIs [prat_mult_qinv_right]) 1); | 
| 273 | qed "prat_qinv_ex"; | |
| 274 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 275 | Goal "EX! y. (x::prat) * y = prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 276 | by (auto_tac (claset() addIs [prat_mult_qinv_right],simpset())); | 
| 277 | by (dres_inst_tac [("f","%x. ya*x")] arg_cong 1);
 | |
| 278 | by (asm_full_simp_tac (simpset() addsimps [prat_mult_assoc RS sym]) 1); | |
| 279 | by (asm_full_simp_tac (simpset() addsimps [prat_mult_commute, | |
| 280 | prat_mult_1,prat_mult_1_right]) 1); | |
| 281 | qed "prat_qinv_ex1"; | |
| 282 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 283 | Goal "EX! y. y * (x::prat) = prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 284 | by (auto_tac (claset() addIs [prat_mult_qinv],simpset())); | 
| 285 | by (dres_inst_tac [("f","%x. x*ya")] arg_cong 1);
 | |
| 286 | by (asm_full_simp_tac (simpset() addsimps [prat_mult_assoc]) 1); | |
| 287 | by (asm_full_simp_tac (simpset() addsimps [prat_mult_commute, | |
| 288 | prat_mult_1,prat_mult_1_right]) 1); | |
| 289 | qed "prat_qinv_left_ex1"; | |
| 290 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 291 | Goal "x * y = prat_of_pnat (Abs_pnat (Suc 0)) ==> x = qinv y"; | 
| 5078 | 292 | by (cut_inst_tac [("q","y")] prat_mult_qinv 1);
 | 
| 293 | by (res_inst_tac [("x1","y")] (prat_qinv_left_ex1 RS ex1E) 1);
 | |
| 294 | by (Blast_tac 1); | |
| 295 | qed "prat_mult_inv_qinv"; | |
| 296 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
7825diff
changeset | 297 | Goal "EX y. x = qinv y"; | 
| 5078 | 298 | by (cut_inst_tac [("x","x")] prat_qinv_ex 1);
 | 
| 299 | by (etac exE 1 THEN dtac prat_mult_inv_qinv 1); | |
| 300 | by (Fast_tac 1); | |
| 301 | qed "prat_as_inverse_ex"; | |
| 302 | ||
| 303 | Goal "qinv(x*y) = qinv(x)*qinv(y)"; | |
| 304 | by (res_inst_tac [("z","x")] eq_Abs_prat 1);
 | |
| 305 | by (res_inst_tac [("z","y")] eq_Abs_prat 1);
 | |
| 306 | by (auto_tac (claset(),simpset() addsimps [qinv,prat_mult])); | |
| 307 | qed "qinv_mult_eq"; | |
| 308 | ||
| 309 | (** Lemmas **) | |
| 310 | ||
| 311 | Goal "((z1::prat) + z2) * w = (z1 * w) + (z2 * w)"; | |
| 312 | by (res_inst_tac [("z","z1")] eq_Abs_prat 1);
 | |
| 313 | by (res_inst_tac [("z","z2")] eq_Abs_prat 1);
 | |
| 314 | by (res_inst_tac [("z","w")] eq_Abs_prat 1);
 | |
| 315 | by (asm_simp_tac | |
| 5535 | 316 | (simpset() addsimps [pnat_add_mult_distrib2, prat_add, prat_mult] @ | 
| 317 | pnat_add_ac @ pnat_mult_ac) 1); | |
| 5078 | 318 | qed "prat_add_mult_distrib"; | 
| 319 | ||
| 320 | val prat_mult_commute'= read_instantiate [("z","w")] prat_mult_commute;
 | |
| 321 | ||
| 322 | Goal "(w::prat) * (z1 + z2) = (w * z1) + (w * z2)"; | |
| 323 | by (simp_tac (simpset() addsimps [prat_mult_commute',prat_add_mult_distrib]) 1); | |
| 324 | qed "prat_add_mult_distrib2"; | |
| 325 | ||
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 326 | Addsimps [prat_mult_1, prat_mult_1_right, | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 327 | prat_mult_qinv, prat_mult_qinv_right]; | 
| 5078 | 328 | |
| 329 | (*** theorems for ordering ***) | |
| 330 | (* prove introduction and elimination rules for prat_less *) | |
| 331 | ||
| 332 | Goalw [prat_less_def] | |
| 11655 | 333 | "(Q1 < (Q2::prat)) = (EX Q3. Q1 + Q3 = Q2)"; | 
| 5078 | 334 | by (Fast_tac 1); | 
| 335 | qed "prat_less_iff"; | |
| 336 | ||
| 337 | Goalw [prat_less_def] | |
| 338 | "!!(Q1::prat). Q1 + Q3 = Q2 ==> Q1 < Q2"; | |
| 339 | by (Fast_tac 1); | |
| 340 | qed "prat_lessI"; | |
| 341 | ||
| 342 | (* ordering on positive fractions in terms of existence of sum *) | |
| 343 | Goalw [prat_less_def] | |
| 344 | "Q1 < (Q2::prat) --> (EX Q3. Q1 + Q3 = Q2)"; | |
| 345 | by (Fast_tac 1); | |
| 346 | qed "prat_lessE_lemma"; | |
| 347 | ||
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 348 | Goal "!!P. [| Q1 < (Q2::prat); \ | 
| 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 349 | \ !! (Q3::prat). Q1 + Q3 = Q2 ==> P |] \ | 
| 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 350 | \ ==> P"; | 
| 5078 | 351 | by (dtac (prat_lessE_lemma RS mp) 1); | 
| 352 | by Auto_tac; | |
| 353 | qed "prat_lessE"; | |
| 354 | ||
| 355 | (* qless is a strong order i.e nonreflexive and transitive *) | |
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 356 | Goal "!!(q1::prat). [| q1 < q2; q2 < q3 |] ==> q1 < q3"; | 
| 5078 | 357 | by (REPEAT(dtac (prat_lessE_lemma RS mp) 1)); | 
| 358 | by (REPEAT(etac exE 1)); | |
| 359 | by (hyp_subst_tac 1); | |
| 360 | by (res_inst_tac [("Q3.0","Q3 + Q3a")] prat_lessI 1);
 | |
| 361 | by (auto_tac (claset(),simpset() addsimps [prat_add_assoc])); | |
| 362 | qed "prat_less_trans"; | |
| 363 | ||
| 364 | Goal "~q < (q::prat)"; | |
| 365 | by (EVERY1[rtac notI, dtac (prat_lessE_lemma RS mp)]); | |
| 366 | by (res_inst_tac [("z","q")] eq_Abs_prat 1);
 | |
| 367 | by (res_inst_tac [("z","Q3")] eq_Abs_prat 1);
 | |
| 368 | by (etac exE 1 THEN res_inst_tac [("z","Q3a")] eq_Abs_prat 1);
 | |
| 369 | by (REPEAT(hyp_subst_tac 1)); | |
| 370 | by (asm_full_simp_tac (simpset() addsimps [prat_add, | |
| 371 | pnat_no_add_ident,pnat_add_mult_distrib2] @ pnat_mult_ac) 1); | |
| 372 | qed "prat_less_not_refl"; | |
| 373 | ||
| 374 | (*** y < y ==> P ***) | |
| 375 | bind_thm("prat_less_irrefl",prat_less_not_refl RS notE);
 | |
| 376 | ||
| 5459 | 377 | Goal "!! (q1::prat). q1 < q2 ==> ~ q2 < q1"; | 
| 378 | by (rtac notI 1); | |
| 5078 | 379 | by (dtac prat_less_trans 1 THEN assume_tac 1); | 
| 380 | by (asm_full_simp_tac (simpset() addsimps [prat_less_not_refl]) 1); | |
| 5459 | 381 | qed "prat_less_not_sym"; | 
| 5078 | 382 | |
| 5459 | 383 | (* [| x < y; ~P ==> y < x |] ==> P *) | 
| 10232 
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
 paulson parents: 
9969diff
changeset | 384 | bind_thm ("prat_less_asym", prat_less_not_sym RS contrapos_np);
 | 
| 5078 | 385 | |
| 386 | (* half of positive fraction exists- Gleason p. 120- Proposition 9-2.6(i)*) | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
7825diff
changeset | 387 | Goal "!(q::prat). EX x. x + x = q"; | 
| 5078 | 388 | by (rtac allI 1); | 
| 389 | by (res_inst_tac [("z","q")] eq_Abs_prat 1);
 | |
| 10834 | 390 | by (res_inst_tac [("x","Abs_prat (ratrel `` {(x, y+y)})")] exI 1);
 | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 391 | by (auto_tac (claset(), | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 392 | simpset() addsimps | 
| 5078 | 393 | [prat_add,pnat_mult_assoc RS sym,pnat_add_mult_distrib, | 
| 394 | pnat_add_mult_distrib2])); | |
| 395 | qed "lemma_prat_dense"; | |
| 396 | ||
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
7825diff
changeset | 397 | Goal "EX (x::prat). x + x = q"; | 
| 5078 | 398 | by (res_inst_tac [("z","q")] eq_Abs_prat 1);
 | 
| 10834 | 399 | by (res_inst_tac [("x","Abs_prat (ratrel `` {(x, y+y)})")] exI 1);
 | 
| 5078 | 400 | by (auto_tac (claset(),simpset() addsimps | 
| 401 | [prat_add,pnat_mult_assoc RS sym,pnat_add_mult_distrib, | |
| 402 | pnat_add_mult_distrib2])); | |
| 403 | qed "prat_lemma_dense"; | |
| 404 | ||
| 405 | (* there exists a number between any two positive fractions *) | |
| 406 | (* Gleason p. 120- Proposition 9-2.6(iv) *) | |
| 407 | Goalw [prat_less_def] | |
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
7825diff
changeset | 408 | "!! (q1::prat). q1 < q2 ==> EX x. q1 < x & x < q2"; | 
| 5078 | 409 | by (auto_tac (claset() addIs [lemma_prat_dense],simpset())); | 
| 410 | by (res_inst_tac [("x","T")] (lemma_prat_dense RS allE) 1);
 | |
| 411 | by (etac exE 1); | |
| 412 | by (res_inst_tac [("x","q1 + x")] exI 1);
 | |
| 413 | by (auto_tac (claset() addIs [prat_lemma_dense], | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 414 | simpset() addsimps [prat_add_assoc])); | 
| 5078 | 415 | qed "prat_dense"; | 
| 416 | ||
| 417 | (* ordering of addition for positive fractions *) | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 418 | Goalw [prat_less_def] "!!(q1::prat). q1 < q2 ==> q1 + x < q2 + x"; | 
| 5078 | 419 | by (Step_tac 1); | 
| 420 | by (res_inst_tac [("x","T")] exI 1);
 | |
| 421 | by (auto_tac (claset(),simpset() addsimps prat_add_ac)); | |
| 422 | qed "prat_add_less2_mono1"; | |
| 423 | ||
| 7219 | 424 | Goal "!!(q1::prat). q1 < q2 ==> x + q1 < x + q2"; | 
| 5078 | 425 | by (auto_tac (claset() addIs [prat_add_less2_mono1], | 
| 426 | simpset() addsimps [prat_add_commute])); | |
| 427 | qed "prat_add_less2_mono2"; | |
| 428 | ||
| 429 | (* ordering of multiplication for positive fractions *) | |
| 430 | Goalw [prat_less_def] | |
| 431 | "!!(q1::prat). q1 < q2 ==> q1 * x < q2 * x"; | |
| 432 | by (Step_tac 1); | |
| 433 | by (res_inst_tac [("x","T*x")] exI 1);
 | |
| 434 | by (auto_tac (claset(),simpset() addsimps [prat_add_mult_distrib])); | |
| 435 | qed "prat_mult_less2_mono1"; | |
| 436 | ||
| 437 | Goal "!!(q1::prat). q1 < q2 ==> x * q1 < x * q2"; | |
| 438 | by (auto_tac (claset() addDs [prat_mult_less2_mono1], | |
| 439 | simpset() addsimps [prat_mult_commute])); | |
| 440 | qed "prat_mult_left_less2_mono1"; | |
| 441 | ||
| 9426 | 442 | Goal "!!(a1::prat). a1 < a2 ==> a1 * b + a2 * c < a2 * (b + c)"; | 
| 443 | by (auto_tac (claset() addSIs [prat_add_less2_mono1,prat_mult_less2_mono1], | |
| 444 | simpset() addsimps [prat_add_mult_distrib2])); | |
| 445 | qed "lemma_prat_add_mult_mono"; | |
| 446 | ||
| 5078 | 447 | (* there is no smallest positive fraction *) | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
7825diff
changeset | 448 | Goalw [prat_less_def] "EX (x::prat). x < y"; | 
| 5078 | 449 | by (cut_facts_tac [lemma_prat_dense] 1); | 
| 450 | by (Fast_tac 1); | |
| 451 | qed "qless_Ex"; | |
| 452 | ||
| 453 | (* lemma for proving $< is linear *) | |
| 454 | Goalw [prat_def,prat_less_def] | |
| 10834 | 455 |       "ratrel `` {(x, y * ya)} : {p::(pnat*pnat).True}//ratrel";
 | 
| 5078 | 456 | by (asm_full_simp_tac (simpset() addsimps [ratrel_def,quotient_def]) 1); | 
| 457 | by (Blast_tac 1); | |
| 458 | qed "lemma_prat_less_linear"; | |
| 459 | ||
| 460 | (* linearity of < -- Gleason p. 120 - Proposition 9-2.6 *) | |
| 461 | (*** FIXME Proof long ***) | |
| 462 | Goalw [prat_less_def] | |
| 463 | "(q1::prat) < q2 | q1 = q2 | q2 < q1"; | |
| 464 | by (res_inst_tac [("z","q1")] eq_Abs_prat 1);
 | |
| 465 | by (res_inst_tac [("z","q2")] eq_Abs_prat 1);
 | |
| 466 | by (Step_tac 1 THEN REPEAT(dtac (not_ex RS iffD1) 1) | |
| 467 | THEN Auto_tac); | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 468 | by (cut_inst_tac  [("z1.0","x*ya"), ("z2.0","xa*y")] pnat_linear_Ex_eq 1);
 | 
| 5078 | 469 | by (EVERY1[etac disjE,etac exE]); | 
| 470 | by (eres_inst_tac | |
| 10834 | 471 |     [("x","Abs_prat(ratrel``{(xb,ya*y)})")] allE 1);
 | 
| 5078 | 472 | by (asm_full_simp_tac | 
| 473 | (simpset() addsimps [prat_add, pnat_mult_assoc | |
| 474 | RS sym,pnat_add_mult_distrib RS sym]) 1); | |
| 475 | by (EVERY1[asm_full_simp_tac (simpset() addsimps pnat_mult_ac), | |
| 476 | etac disjE, assume_tac, etac exE]); | |
| 10834 | 477 | by (thin_tac "!T. Abs_prat (ratrel `` {(x, y)}) + T ~= \
 | 
| 478 | \     Abs_prat (ratrel `` {(xa, ya)})" 1);
 | |
| 479 | by (eres_inst_tac [("x","Abs_prat(ratrel``{(xb,y*ya)})")] allE 1);
 | |
| 5078 | 480 | by (asm_full_simp_tac (simpset() addsimps [prat_add, | 
| 481 | pnat_mult_assoc RS sym,pnat_add_mult_distrib RS sym]) 1); | |
| 482 | by (asm_full_simp_tac (simpset() addsimps pnat_mult_ac) 1); | |
| 483 | qed "prat_linear"; | |
| 484 | ||
| 7219 | 485 | Goal "!!(q1::prat). [| q1 < q2 ==> P; q1 = q2 ==> P; \ | 
| 5078 | 486 | \ q2 < q1 ==> P |] ==> P"; | 
| 487 | by (cut_inst_tac [("q1.0","q1"),("q2.0","q2")] prat_linear 1);
 | |
| 488 | by Auto_tac; | |
| 489 | qed "prat_linear_less2"; | |
| 490 | ||
| 491 | (* Gleason p. 120 -- 9-2.6 (iv) *) | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 492 | Goal "[| q1 < q2; qinv(q1) = qinv(q2) |] ==> P"; | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 493 | by (cut_inst_tac [("x","qinv (q2)"),("q1.0","q1"), ("q2.0","q2")] 
 | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 494 | prat_mult_less2_mono1 1); | 
| 5078 | 495 | by (assume_tac 1); | 
| 496 | by (Asm_full_simp_tac 1 THEN dtac sym 1); | |
| 497 | by (auto_tac (claset(),simpset() addsimps [prat_less_not_refl])); | |
| 498 | qed "lemma1_qinv_prat_less"; | |
| 499 | ||
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 500 | Goal "[| q1 < q2; qinv(q1) < qinv(q2) |] ==> P"; | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 501 | by (cut_inst_tac [("x","qinv (q2)"),("q1.0","q1"), ("q2.0","q2")] 
 | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 502 | prat_mult_less2_mono1 1); | 
| 5078 | 503 | by (assume_tac 1); | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 504 | by (cut_inst_tac [("x","q1"),("q1.0","qinv (q1)"), ("q2.0","qinv (q2)")] 
 | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 505 | prat_mult_left_less2_mono1 1); | 
| 5078 | 506 | by Auto_tac; | 
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 507 | by (dres_inst_tac [("q2.0","prat_of_pnat (Abs_pnat (Suc 0))")] prat_less_trans 1);
 | 
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 508 | by (auto_tac (claset(),simpset() addsimps | 
| 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 509 | [prat_less_not_refl])); | 
| 5078 | 510 | qed "lemma2_qinv_prat_less"; | 
| 511 | ||
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 512 | Goal "q1 < q2 ==> qinv (q2) < qinv (q1)"; | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 513 | by (res_inst_tac [("q2.0","qinv q1"), ("q1.0","qinv q2")] prat_linear_less2 1);
 | 
| 5078 | 514 | by (auto_tac (claset() addEs [lemma1_qinv_prat_less, | 
| 515 | lemma2_qinv_prat_less],simpset())); | |
| 516 | qed "qinv_prat_less"; | |
| 517 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 518 | Goal "q1 < prat_of_pnat (Abs_pnat (Suc 0)) \ | 
| 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 519 | \ ==> prat_of_pnat (Abs_pnat (Suc 0)) < qinv(q1)"; | 
| 5078 | 520 | by (dtac qinv_prat_less 1); | 
| 521 | by (full_simp_tac (simpset() addsimps [qinv_1]) 1); | |
| 522 | qed "prat_qinv_gt_1"; | |
| 523 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 524 | Goalw [pnat_one_def] | 
| 12018 
ec054019c910
Numerals and simprocs for types real and hypreal.  The abstract
 paulson parents: 
11701diff
changeset | 525 | "q1 < prat_of_pnat 1 ==> prat_of_pnat 1 < qinv(q1)"; | 
| 5078 | 526 | by (etac prat_qinv_gt_1 1); | 
| 527 | qed "prat_qinv_is_gt_1"; | |
| 528 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 529 | Goalw [prat_less_def] | 
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 530 | "prat_of_pnat (Abs_pnat (Suc 0)) < prat_of_pnat (Abs_pnat (Suc 0)) \ | 
| 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 531 | \ + prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 532 | by (Fast_tac 1); | 
| 533 | qed "prat_less_1_2"; | |
| 534 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 535 | Goal "qinv(prat_of_pnat (Abs_pnat (Suc 0)) + \ | 
| 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 536 | \ prat_of_pnat (Abs_pnat (Suc 0))) < prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 537 | by (cut_facts_tac [prat_less_1_2 RS qinv_prat_less] 1); | 
| 538 | by (asm_full_simp_tac (simpset() addsimps [qinv_1]) 1); | |
| 539 | qed "prat_less_qinv_2_1"; | |
| 540 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 541 | Goal "!!(x::prat). x < y ==> x*qinv(y) < prat_of_pnat (Abs_pnat (Suc 0))"; | 
| 5078 | 542 | by (dres_inst_tac [("x","qinv(y)")] prat_mult_less2_mono1 1);
 | 
| 543 | by (Asm_full_simp_tac 1); | |
| 544 | qed "prat_mult_qinv_less_1"; | |
| 545 | ||
| 546 | Goal "(x::prat) < x + x"; | |
| 547 | by (cut_inst_tac [("x","x")] 
 | |
| 548 | (prat_less_1_2 RS prat_mult_left_less2_mono1) 1); | |
| 549 | by (asm_full_simp_tac (simpset() addsimps | |
| 550 | [prat_add_mult_distrib2]) 1); | |
| 551 | qed "prat_self_less_add_self"; | |
| 552 | ||
| 553 | Goalw [prat_less_def] "(x::prat) < y + x"; | |
| 554 | by (res_inst_tac [("x","y")] exI 1);
 | |
| 555 | by (simp_tac (simpset() addsimps [prat_add_commute]) 1); | |
| 556 | qed "prat_self_less_add_right"; | |
| 557 | ||
| 558 | Goal "(x::prat) < x + y"; | |
| 559 | by (rtac (prat_add_commute RS subst) 1); | |
| 560 | by (simp_tac (simpset() addsimps [prat_self_less_add_right]) 1); | |
| 561 | qed "prat_self_less_add_left"; | |
| 562 | ||
| 12018 
ec054019c910
Numerals and simprocs for types real and hypreal.  The abstract
 paulson parents: 
11701diff
changeset | 563 | Goalw [prat_less_def] "prat_of_pnat 1 < y ==> (x::prat) < x * y"; | 
| 5078 | 564 | by (auto_tac (claset(),simpset() addsimps [pnat_one_def, | 
| 565 | prat_add_mult_distrib2])); | |
| 566 | qed "prat_self_less_mult_right"; | |
| 567 | ||
| 568 | (*** Properties of <= ***) | |
| 569 | ||
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5078diff
changeset | 570 | Goalw [prat_le_def] "~(w < z) ==> z <= (w::prat)"; | 
| 5078 | 571 | by (assume_tac 1); | 
| 572 | qed "prat_leI"; | |
| 573 | ||
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5078diff
changeset | 574 | Goalw [prat_le_def] "z<=w ==> ~(w<(z::prat))"; | 
| 5078 | 575 | by (assume_tac 1); | 
| 576 | qed "prat_leD"; | |
| 577 | ||
| 9108 | 578 | bind_thm ("prat_leE", make_elim prat_leD);
 | 
| 5078 | 579 | |
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5078diff
changeset | 580 | Goal "(~(w < z)) = (z <= (w::prat))"; | 
| 5078 | 581 | by (fast_tac (claset() addSIs [prat_leI,prat_leD]) 1); | 
| 582 | qed "prat_less_le_iff"; | |
| 583 | ||
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5078diff
changeset | 584 | Goalw [prat_le_def] "~ z <= w ==> w<(z::prat)"; | 
| 5078 | 585 | by (Fast_tac 1); | 
| 586 | qed "not_prat_leE"; | |
| 587 | ||
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5078diff
changeset | 588 | Goalw [prat_le_def] "z < w ==> z <= (w::prat)"; | 
| 5078 | 589 | by (fast_tac (claset() addEs [prat_less_asym]) 1); | 
| 590 | qed "prat_less_imp_le"; | |
| 591 | ||
| 592 | Goalw [prat_le_def] "!!(x::prat). x <= y ==> x < y | x = y"; | |
| 593 | by (cut_facts_tac [prat_linear] 1); | |
| 594 | by (fast_tac (claset() addEs [prat_less_irrefl,prat_less_asym]) 1); | |
| 595 | qed "prat_le_imp_less_or_eq"; | |
| 596 | ||
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5078diff
changeset | 597 | Goalw [prat_le_def] "z<w | z=w ==> z <=(w::prat)"; | 
| 5078 | 598 | by (cut_facts_tac [prat_linear] 1); | 
| 599 | by (fast_tac (claset() addEs [prat_less_irrefl,prat_less_asym]) 1); | |
| 600 | qed "prat_less_or_eq_imp_le"; | |
| 601 | ||
| 602 | Goal "(x <= (y::prat)) = (x < y | x=y)"; | |
| 603 | by (REPEAT(ares_tac [iffI, prat_less_or_eq_imp_le, prat_le_imp_less_or_eq] 1)); | |
| 604 | qed "prat_le_eq_less_or_eq"; | |
| 605 | ||
| 606 | Goal "w <= (w::prat)"; | |
| 607 | by (simp_tac (simpset() addsimps [prat_le_eq_less_or_eq]) 1); | |
| 608 | qed "prat_le_refl"; | |
| 609 | ||
| 9969 | 610 | Goal "[| i <= j; j < k |] ==> i < (k::prat)"; | 
| 5078 | 611 | by (dtac prat_le_imp_less_or_eq 1); | 
| 612 | by (fast_tac (claset() addIs [prat_less_trans]) 1); | |
| 613 | qed "prat_le_less_trans"; | |
| 614 | ||
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5078diff
changeset | 615 | Goal "[| i <= j; j <= k |] ==> i <= (k::prat)"; | 
| 5078 | 616 | by (EVERY1 [dtac prat_le_imp_less_or_eq, dtac prat_le_imp_less_or_eq, | 
| 617 | rtac prat_less_or_eq_imp_le, fast_tac (claset() addIs [prat_less_trans])]); | |
| 618 | qed "prat_le_trans"; | |
| 619 | ||
| 5143 
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
 paulson parents: 
5078diff
changeset | 620 | Goal "[| ~ y < x; y ~= x |] ==> x < (y::prat)"; | 
| 5078 | 621 | by (rtac not_prat_leE 1); | 
| 622 | by (fast_tac (claset() addDs [prat_le_imp_less_or_eq]) 1); | |
| 623 | qed "not_less_not_eq_prat_less"; | |
| 624 | ||
| 625 | Goalw [prat_less_def] | |
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 626 | "[| x1 < y1; x2 < y2 |] ==> x1 + x2 < y1 + (y2::prat)"; | 
| 5078 | 627 | by (REPEAT(etac exE 1)); | 
| 628 | by (res_inst_tac [("x","T+Ta")] exI 1);
 | |
| 629 | by (auto_tac (claset(),simpset() addsimps prat_add_ac)); | |
| 630 | qed "prat_add_less_mono"; | |
| 631 | ||
| 632 | Goalw [prat_less_def] | |
| 5148 
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
 paulson parents: 
5143diff
changeset | 633 | "[| x1 < y1; x2 < y2 |] ==> x1 * x2 < y1 * (y2::prat)"; | 
| 5078 | 634 | by (REPEAT(etac exE 1)); | 
| 635 | by (res_inst_tac [("x","T*Ta+T*x2+x1*Ta")] exI 1);
 | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 636 | by (auto_tac (claset(), | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 637 | simpset() addsimps prat_add_ac @ | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 638 | [prat_add_mult_distrib,prat_add_mult_distrib2])); | 
| 5078 | 639 | qed "prat_mult_less_mono"; | 
| 640 | ||
| 641 | (* more prat_le *) | |
| 642 | Goal "!!(q1::prat). q1 <= q2 ==> x * q1 <= x * q2"; | |
| 643 | by (dtac prat_le_imp_less_or_eq 1); | |
| 644 | by (Step_tac 1); | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 645 | by (auto_tac (claset() addSIs [prat_le_refl, prat_less_imp_le, | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 646 | prat_mult_left_less2_mono1], | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 647 | simpset())); | 
| 5078 | 648 | qed "prat_mult_left_le2_mono1"; | 
| 649 | ||
| 650 | Goal "!!(q1::prat). q1 <= q2 ==> q1 * x <= q2 * x"; | |
| 651 | by (auto_tac (claset() addDs [prat_mult_left_le2_mono1], | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 652 | simpset() addsimps [prat_mult_commute])); | 
| 5078 | 653 | qed "prat_mult_le2_mono1"; | 
| 654 | ||
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 655 | Goal "q1 <= q2 ==> qinv (q2) <= qinv (q1)"; | 
| 5078 | 656 | by (dtac prat_le_imp_less_or_eq 1); | 
| 657 | by (Step_tac 1); | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 658 | by (auto_tac (claset() addSIs [prat_le_refl, prat_less_imp_le,qinv_prat_less], | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 659 | simpset())); | 
| 5078 | 660 | qed "qinv_prat_le"; | 
| 661 | ||
| 662 | Goal "!!(q1::prat). q1 <= q2 ==> x + q1 <= x + q2"; | |
| 663 | by (dtac prat_le_imp_less_or_eq 1); | |
| 664 | by (Step_tac 1); | |
| 665 | by (auto_tac (claset() addSIs [prat_le_refl, | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 666 | prat_less_imp_le,prat_add_less2_mono1], | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 667 | simpset() addsimps [prat_add_commute])); | 
| 5078 | 668 | qed "prat_add_left_le2_mono1"; | 
| 669 | ||
| 670 | Goal "!!(q1::prat). q1 <= q2 ==> q1 + x <= q2 + x"; | |
| 671 | by (auto_tac (claset() addDs [prat_add_left_le2_mono1], | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 672 | simpset() addsimps [prat_add_commute])); | 
| 5078 | 673 | qed "prat_add_le2_mono1"; | 
| 674 | ||
| 675 | Goal "!!k l::prat. [|i<=j; k<=l |] ==> i + k <= j + l"; | |
| 676 | by (etac (prat_add_le2_mono1 RS prat_le_trans) 1); | |
| 677 | by (simp_tac (simpset() addsimps [prat_add_commute]) 1); | |
| 678 | (*j moves to the end because it is free while k, l are bound*) | |
| 679 | by (etac prat_add_le2_mono1 1); | |
| 680 | qed "prat_add_le_mono"; | |
| 681 | ||
| 682 | Goal "!!(x::prat). x + y < z + y ==> x < z"; | |
| 683 | by (rtac ccontr 1); | |
| 684 | by (etac (prat_leI RS prat_le_imp_less_or_eq RS disjE) 1); | |
| 685 | by (dres_inst_tac [("x","y"),("q1.0","z")] prat_add_less2_mono1 1);
 | |
| 686 | by (auto_tac (claset() addIs [prat_less_asym], | |
| 687 | simpset() addsimps [prat_less_not_refl])); | |
| 688 | qed "prat_add_right_less_cancel"; | |
| 689 | ||
| 690 | Goal "!!(x::prat). y + x < y + z ==> x < z"; | |
| 691 | by (res_inst_tac [("y","y")] prat_add_right_less_cancel 1);
 | |
| 692 | by (asm_full_simp_tac (simpset() addsimps [prat_add_commute]) 1); | |
| 693 | qed "prat_add_left_less_cancel"; | |
| 694 | ||
| 695 | (*** lemmas required for lemma_gleason9_34 in PReal : w*y > y/z ***) | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 696 | Goalw [prat_of_pnat_def] | 
| 10834 | 697 |       "Abs_prat(ratrel``{(x,y)}) = (prat_of_pnat x)*qinv(prat_of_pnat y)";
 | 
| 5078 | 698 | by (auto_tac (claset(),simpset() addsimps [prat_mult,qinv,pnat_mult_1_left, | 
| 699 | pnat_mult_1])); | |
| 700 | qed "Abs_prat_mult_qinv"; | |
| 701 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 702 | Goal "Abs_prat(ratrel``{(x,y)}) <= Abs_prat(ratrel``{(x,Abs_pnat (Suc 0))})";
 | 
| 5078 | 703 | by (simp_tac (simpset() addsimps [Abs_prat_mult_qinv]) 1); | 
| 704 | by (rtac prat_mult_left_le2_mono1 1); | |
| 705 | by (rtac qinv_prat_le 1); | |
| 706 | by (pnat_ind_tac "y" 1); | |
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 707 | by (dres_inst_tac [("x","prat_of_pnat (Abs_pnat (Suc 0))")] prat_add_le2_mono1 2);
 | 
| 5078 | 708 | by (cut_facts_tac [prat_less_1_2 RS prat_less_imp_le] 2); | 
| 709 | by (auto_tac (claset() addIs [prat_le_trans], | |
| 710 | simpset() addsimps [prat_le_refl, | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 711 | pSuc_is_plus_one,pnat_one_def,prat_of_pnat_add])); | 
| 5078 | 712 | qed "lemma_Abs_prat_le1"; | 
| 713 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 714 | Goal "Abs_prat(ratrel``{(x,Abs_pnat (Suc 0))}) <= Abs_prat(ratrel``{(x*y,Abs_pnat (Suc 0))})";
 | 
| 5078 | 715 | by (simp_tac (simpset() addsimps [Abs_prat_mult_qinv]) 1); | 
| 716 | by (rtac prat_mult_le2_mono1 1); | |
| 717 | by (pnat_ind_tac "y" 1); | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 718 | by (dres_inst_tac [("x","prat_of_pnat x")] prat_add_le2_mono1 2);
 | 
| 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 719 | by (cut_inst_tac [("z","prat_of_pnat x")] (prat_self_less_add_self 
 | 
| 5078 | 720 | RS prat_less_imp_le) 2); | 
| 721 | by (auto_tac (claset() addIs [prat_le_trans], | |
| 722 | simpset() addsimps [prat_le_refl, | |
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 723 | pSuc_is_plus_one,pnat_one_def,prat_add_mult_distrib2, | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 724 | prat_of_pnat_add,prat_of_pnat_mult])); | 
| 5078 | 725 | qed "lemma_Abs_prat_le2"; | 
| 726 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 727 | Goal "Abs_prat(ratrel``{(x,z)}) <= Abs_prat(ratrel``{(x*y,Abs_pnat (Suc 0))})";
 | 
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 728 | by (fast_tac (claset() addIs [prat_le_trans, | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 729 | lemma_Abs_prat_le1,lemma_Abs_prat_le2]) 1); | 
| 5078 | 730 | qed "lemma_Abs_prat_le3"; | 
| 731 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 732 | Goal "Abs_prat(ratrel``{(x*y,Abs_pnat (Suc 0))}) * Abs_prat(ratrel``{(w,x)}) = \
 | 
| 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 733 | \         Abs_prat(ratrel``{(w*y,Abs_pnat (Suc 0))})";
 | 
| 5078 | 734 | by (full_simp_tac (simpset() addsimps [prat_mult, | 
| 735 | pnat_mult_1,pnat_mult_1_left] @ pnat_mult_ac) 1); | |
| 736 | qed "pre_lemma_gleason9_34"; | |
| 737 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 738 | Goal "Abs_prat(ratrel``{(y*x,Abs_pnat (Suc 0)*y)}) = \
 | 
| 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 739 | \         Abs_prat(ratrel``{(x,Abs_pnat (Suc 0))})";
 | 
| 7376 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 740 | by (auto_tac (claset(), | 
| 
46f92a120af9
tidied, allowing pattern-matching in defs of prat_add and prat_mult
 paulson parents: 
7219diff
changeset | 741 | simpset() addsimps [pnat_mult_1,pnat_mult_1_left] @ pnat_mult_ac)); | 
| 5078 | 742 | qed "pre_lemma_gleason9_34b"; | 
| 743 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 744 | Goal "(prat_of_pnat n < prat_of_pnat m) = (n < m)"; | 
| 5078 | 745 | by (auto_tac (claset(),simpset() addsimps [prat_less_def, | 
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 746 | pnat_less_iff,prat_of_pnat_add])); | 
| 5078 | 747 | by (res_inst_tac [("z","T")] eq_Abs_prat 1);
 | 
| 748 | by (auto_tac (claset() addDs [pnat_eq_lessI], | |
| 749 | simpset() addsimps [prat_add,pnat_mult_1, | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 750 | pnat_mult_1_left,prat_of_pnat_def,pnat_less_iff RS sym])); | 
| 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 751 | qed "prat_of_pnat_less_iff"; | 
| 5078 | 752 | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 753 | Addsimps [prat_of_pnat_less_iff]; | 
| 5078 | 754 | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 755 | (*------------------------------------------------------------------*) | 
| 5078 | 756 | |
| 757 | (*** prove witness that will be required to prove non-emptiness ***) | |
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 758 | (*** of preal type as defined using Dedekind Sections in PReal ***) | 
| 5078 | 759 | (*** Show that exists positive real `one' ***) | 
| 760 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 761 | Goal "EX q. q: {x::prat. x < prat_of_pnat (Abs_pnat (Suc 0))}";
 | 
| 5078 | 762 | by (fast_tac (claset() addIs [prat_less_qinv_2_1]) 1); | 
| 763 | qed "lemma_prat_less_1_memEx"; | |
| 764 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 765 | Goal "{x::prat. x < prat_of_pnat (Abs_pnat (Suc 0))} ~= {}";
 | 
| 5078 | 766 | by (rtac notI 1); | 
| 767 | by (cut_facts_tac [lemma_prat_less_1_memEx] 1); | |
| 768 | by (Asm_full_simp_tac 1); | |
| 769 | qed "lemma_prat_less_1_set_non_empty"; | |
| 770 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 771 | Goalw [psubset_def] "{} < {x::prat. x < prat_of_pnat (Abs_pnat (Suc 0))}";
 | 
| 5078 | 772 | by (asm_full_simp_tac (simpset() addsimps | 
| 773 | [lemma_prat_less_1_set_non_empty RS not_sym]) 1); | |
| 774 | qed "empty_set_psubset_lemma_prat_less_1_set"; | |
| 775 | ||
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 776 | (*** exists rational not in set --- prat_of_pnat (Abs_pnat 1) itself ***) | 
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 777 | Goal "EX q. q ~: {x::prat. x < prat_of_pnat (Abs_pnat (Suc 0))}";
 | 
| 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 778 | by (res_inst_tac [("x","prat_of_pnat (Abs_pnat (Suc 0))")] exI 1);
 | 
| 5078 | 779 | by (auto_tac (claset(),simpset() addsimps [prat_less_not_refl])); | 
| 780 | qed "lemma_prat_less_1_not_memEx"; | |
| 781 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 782 | Goal "{x::prat. x < prat_of_pnat (Abs_pnat (Suc 0))} ~= UNIV";
 | 
| 5078 | 783 | by (rtac notI 1); | 
| 784 | by (cut_facts_tac [lemma_prat_less_1_not_memEx] 1); | |
| 785 | by (Asm_full_simp_tac 1); | |
| 786 | qed "lemma_prat_less_1_set_not_rat_set"; | |
| 787 | ||
| 788 | Goalw [psubset_def,subset_def] | |
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 789 |       "{x::prat. x < prat_of_pnat (Abs_pnat (Suc 0))} < UNIV";
 | 
| 7825 
1be9b63e7d93
replaced {x. True} by UNIV to work with the new simprule, Collect_const
 paulson parents: 
7376diff
changeset | 790 | by (asm_full_simp_tac | 
| 
1be9b63e7d93
replaced {x. True} by UNIV to work with the new simprule, Collect_const
 paulson parents: 
7376diff
changeset | 791 | (simpset() addsimps [lemma_prat_less_1_set_not_rat_set, | 
| 
1be9b63e7d93
replaced {x. True} by UNIV to work with the new simprule, Collect_const
 paulson parents: 
7376diff
changeset | 792 | lemma_prat_less_1_not_memEx]) 1); | 
| 5078 | 793 | qed "lemma_prat_less_1_set_psubset_rat_set"; | 
| 794 | ||
| 795 | (*** prove non_emptiness of type ***) | |
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
11655diff
changeset | 796 | Goal "{x::prat. x < prat_of_pnat (Abs_pnat (Suc 0))} : {A. {} < A & \
 | 
| 7825 
1be9b63e7d93
replaced {x. True} by UNIV to work with the new simprule, Collect_const
 paulson parents: 
7376diff
changeset | 797 | \ A < UNIV & \ | 
| 7077 
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
 paulson parents: 
5535diff
changeset | 798 | \ (!y: A. ((!z. z < y --> z: A) & \ | 
| 9043 
ca761fe227d8
First round of changes, towards installation of simprocs
 paulson parents: 
7825diff
changeset | 799 | \ (EX u: A. y < u)))}"; | 
| 5078 | 800 | by (auto_tac (claset() addDs [prat_less_trans], | 
| 801 | simpset() addsimps [empty_set_psubset_lemma_prat_less_1_set, | |
| 802 | lemma_prat_less_1_set_psubset_rat_set])); | |
| 803 | by (dtac prat_dense 1); | |
| 804 | by (Fast_tac 1); | |
| 805 | qed "preal_1"; |