195 |
195 |
196 (*** Properties of addition ***) |
196 (*** Properties of addition ***) |
197 |
197 |
198 Goalw [preal_add_def] "(x::preal) + y = y + x"; |
198 Goalw [preal_add_def] "(x::preal) + y = y + x"; |
199 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
199 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
200 by (rtac set_ext 1); |
|
201 by (blast_tac (claset() addIs [prat_add_commute RS subst]) 1); |
200 by (blast_tac (claset() addIs [prat_add_commute RS subst]) 1); |
202 qed "preal_add_commute"; |
201 qed "preal_add_commute"; |
203 |
202 |
204 (** addition of two positive reals gives a positive real **) |
203 (** addition of two positive reals gives a positive real **) |
205 (** lemmas for proving positive reals addition set in preal **) |
204 (** lemmas for proving positive reals addition set in preal **) |
263 by (rtac preal_add_set_lemma4 1); |
262 by (rtac preal_add_set_lemma4 1); |
264 qed "preal_mem_add_set"; |
263 qed "preal_mem_add_set"; |
265 |
264 |
266 Goalw [preal_add_def] "((x::preal) + y) + z = x + (y + z)"; |
265 Goalw [preal_add_def] "((x::preal) + y) + z = x + (y + z)"; |
267 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
266 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
268 by (rtac set_ext 1); |
267 by (simp_tac (simpset() addsimps [preal_mem_add_set RS Abs_preal_inverse]) 1); |
269 by (rtac (preal_mem_add_set RS Abs_preal_inverse RS ssubst) 1); |
|
270 by (rtac (preal_mem_add_set RS Abs_preal_inverse RS ssubst) 1); |
|
271 by (auto_tac (claset(),simpset() addsimps prat_add_ac)); |
268 by (auto_tac (claset(),simpset() addsimps prat_add_ac)); |
272 by (rtac bexI 1); |
269 by (rtac bexI 1); |
273 by (auto_tac (claset() addSIs [exI],simpset() addsimps prat_add_ac)); |
270 by (auto_tac (claset() addSIs [exI],simpset() addsimps prat_add_ac)); |
274 qed "preal_add_assoc"; |
271 qed "preal_add_assoc"; |
275 |
272 |
286 |
283 |
287 (** Proofs essentially same as for addition **) |
284 (** Proofs essentially same as for addition **) |
288 |
285 |
289 Goalw [preal_mult_def] "(x::preal) * y = y * x"; |
286 Goalw [preal_mult_def] "(x::preal) * y = y * x"; |
290 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
287 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
291 by (rtac set_ext 1); |
|
292 by (blast_tac (claset() addIs [prat_mult_commute RS subst]) 1); |
288 by (blast_tac (claset() addIs [prat_mult_commute RS subst]) 1); |
293 qed "preal_mult_commute"; |
289 qed "preal_mult_commute"; |
294 |
290 |
295 (** multiplication of two positive reals gives a positive real **) |
291 (** multiplication of two positive reals gives a positive real **) |
296 (** lemmas for proving positive reals multiplication set in preal **) |
292 (** lemmas for proving positive reals multiplication set in preal **) |
349 by (rtac preal_mult_set_lemma4 1); |
345 by (rtac preal_mult_set_lemma4 1); |
350 qed "preal_mem_mult_set"; |
346 qed "preal_mem_mult_set"; |
351 |
347 |
352 Goalw [preal_mult_def] "((x::preal) * y) * z = x * (y * z)"; |
348 Goalw [preal_mult_def] "((x::preal) * y) * z = x * (y * z)"; |
353 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
349 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
354 by (rtac set_ext 1); |
350 by (simp_tac (simpset() addsimps [preal_mem_mult_set RS Abs_preal_inverse]) 1); |
355 by (rtac (preal_mem_mult_set RS Abs_preal_inverse RS ssubst) 1); |
|
356 by (rtac (preal_mem_mult_set RS Abs_preal_inverse RS ssubst) 1); |
|
357 by (auto_tac (claset(),simpset() addsimps prat_mult_ac)); |
351 by (auto_tac (claset(),simpset() addsimps prat_mult_ac)); |
358 by (rtac bexI 1); |
352 by (rtac bexI 1); |
359 by (auto_tac (claset() addSIs [exI],simpset() addsimps prat_mult_ac)); |
353 by (auto_tac (claset() addSIs [exI],simpset() addsimps prat_mult_ac)); |
360 qed "preal_mult_assoc"; |
354 qed "preal_mult_assoc"; |
361 |
355 |
375 Goalw [preal_of_prat_def,preal_mult_def] |
369 Goalw [preal_of_prat_def,preal_mult_def] |
376 "(preal_of_prat (prat_of_pnat (Abs_pnat 1))) * z = z"; |
370 "(preal_of_prat (prat_of_pnat (Abs_pnat 1))) * z = z"; |
377 by (rtac (Rep_preal_inverse RS subst) 1); |
371 by (rtac (Rep_preal_inverse RS subst) 1); |
378 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
372 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
379 by (rtac (one_set_mem_preal RS Abs_preal_inverse RS ssubst) 1); |
373 by (rtac (one_set_mem_preal RS Abs_preal_inverse RS ssubst) 1); |
380 by (rtac set_ext 1); |
|
381 by (auto_tac(claset(),simpset() addsimps [Rep_preal_inverse])); |
374 by (auto_tac(claset(),simpset() addsimps [Rep_preal_inverse])); |
382 by (EVERY1[dtac (Rep_preal RS prealE_lemma4a),etac bexE]); |
375 by (EVERY1[dtac (Rep_preal RS prealE_lemma4a),etac bexE]); |
383 by (dtac prat_mult_less_mono 1); |
376 by (dtac prat_mult_less_mono 1); |
384 by (auto_tac (claset() addDs [Rep_preal RS prealE_lemma3a],simpset())); |
377 by (auto_tac (claset() addDs [Rep_preal RS prealE_lemma3a],simpset())); |
385 by (EVERY1[forward_tac [Rep_preal RS prealE_lemma4a],etac bexE]); |
378 by (EVERY1[forward_tac [Rep_preal RS prealE_lemma4a],etac bexE]); |
488 simpset() addsimps [prat_add_mult_distrib2])); |
481 simpset() addsimps [prat_add_mult_distrib2])); |
489 qed "lemma_preal_add_mult_distrib2"; |
482 qed "lemma_preal_add_mult_distrib2"; |
490 |
483 |
491 Goal "(w * ((z1::preal) + z2)) = (w * z1) + (w * z2)"; |
484 Goal "(w * ((z1::preal) + z2)) = (w * z1) + (w * z2)"; |
492 by (rtac (inj_Rep_preal RS injD) 1); |
485 by (rtac (inj_Rep_preal RS injD) 1); |
493 by (rtac set_ext 1); |
|
494 by (fast_tac (claset() addIs [lemma_preal_add_mult_distrib, |
486 by (fast_tac (claset() addIs [lemma_preal_add_mult_distrib, |
495 lemma_preal_add_mult_distrib2]) 1); |
487 lemma_preal_add_mult_distrib2]) 1); |
496 qed "preal_add_mult_distrib2"; |
488 qed "preal_add_mult_distrib2"; |
497 |
489 |
498 Goal "(((z1::preal) + z2) * w) = (z1 * w) + (z2 * w)"; |
490 Goal "(((z1::preal) + z2) * w) = (z1 * w) + (z2 * w)"; |
499 by (simp_tac (simpset() addsimps [preal_mult_commute, |
491 by (simp_tac (simpset() addsimps [preal_mult_commute, |
500 preal_add_mult_distrib2]) 1); |
492 preal_add_mult_distrib2]) 1); |
501 qed "preal_add_mult_distrib"; |
493 qed "preal_add_mult_distrib"; |
502 |
494 |
503 (*** Prove existence of inverse ***) |
495 (*** Prove existence of inverse ***) |
504 (*** Inverse is a positive real ***) |
496 (*** Inverse is a positive real ***) |
505 |
497 |
685 prat_mult_left_commute])); |
677 prat_mult_left_commute])); |
686 qed "preal_mem_mult_invI"; |
678 qed "preal_mem_mult_invI"; |
687 |
679 |
688 Goal "pinv(A)*A = (preal_of_prat (prat_of_pnat (Abs_pnat 1)))"; |
680 Goal "pinv(A)*A = (preal_of_prat (prat_of_pnat (Abs_pnat 1)))"; |
689 by (rtac (inj_Rep_preal RS injD) 1); |
681 by (rtac (inj_Rep_preal RS injD) 1); |
690 by (rtac set_ext 1); |
|
691 by (fast_tac (claset() addDs [preal_mem_mult_invD,preal_mem_mult_invI]) 1); |
682 by (fast_tac (claset() addDs [preal_mem_mult_invD,preal_mem_mult_invI]) 1); |
692 qed "preal_mult_inv"; |
683 qed "preal_mult_inv"; |
693 |
684 |
694 Goal "A*pinv(A) = (preal_of_prat (prat_of_pnat (Abs_pnat 1)))"; |
685 Goal "A*pinv(A) = (preal_of_prat (prat_of_pnat (Abs_pnat 1)))"; |
695 by (rtac (preal_mult_commute RS subst) 1); |
686 by (rtac (preal_mult_commute RS subst) 1); |
1197 by (blast_tac (claset() addDs [psubset_def RS meta_eq_to_obj_eq RS iffD1]) 1); |
1188 by (blast_tac (claset() addDs [psubset_def RS meta_eq_to_obj_eq RS iffD1]) 1); |
1198 by (rotate_tac 4 1); |
1189 by (rotate_tac 4 1); |
1199 by (asm_full_simp_tac (simpset() addsimps [psubset_def]) 1); |
1190 by (asm_full_simp_tac (simpset() addsimps [psubset_def]) 1); |
1200 by (dtac bspec 1 THEN assume_tac 1); |
1191 by (dtac bspec 1 THEN assume_tac 1); |
1201 by (REPEAT(etac conjE 1)); |
1192 by (REPEAT(etac conjE 1)); |
1202 by (EVERY1[rtac contrapos_np, assume_tac, rtac set_ext]); |
1193 by (EVERY1[rtac contrapos_np, assume_tac]); |
1203 by (auto_tac (claset() addSDs [lemma_psubset_mem],simpset())); |
1194 by (auto_tac (claset() addSDs [lemma_psubset_mem],simpset())); |
1204 by (cut_inst_tac [("r1.0","Xa"),("r2.0","Ya")] preal_linear 1); |
1195 by (cut_inst_tac [("r1.0","Xa"),("r2.0","Ya")] preal_linear 1); |
1205 by (auto_tac (claset() addDs [psubsetD],simpset() addsimps [preal_less_def])); |
1196 by (auto_tac (claset() addDs [psubsetD],simpset() addsimps [preal_less_def])); |
1206 qed "preal_complete"; |
1197 qed "preal_complete"; |
1207 |
1198 |
1222 |
1213 |
1223 Goalw [preal_of_prat_def,preal_add_def] |
1214 Goalw [preal_of_prat_def,preal_add_def] |
1224 "preal_of_prat ((z1::prat) + z2) = \ |
1215 "preal_of_prat ((z1::prat) + z2) = \ |
1225 \ preal_of_prat z1 + preal_of_prat z2"; |
1216 \ preal_of_prat z1 + preal_of_prat z2"; |
1226 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
1217 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
1227 by (auto_tac (claset() addIs [prat_add_less_mono] addSIs [set_ext],simpset() addsimps |
1218 by (auto_tac (claset() addIs [prat_add_less_mono], |
1228 [lemma_prat_less_set_mem_preal RS Abs_preal_inverse])); |
1219 simpset() addsimps [lemma_prat_less_set_mem_preal RS Abs_preal_inverse])); |
1229 by (res_inst_tac [("x","x*z1*qinv(z1+z2)")] exI 1 THEN rtac conjI 1); |
1220 by (res_inst_tac [("x","x*z1*qinv(z1+z2)")] exI 1 THEN rtac conjI 1); |
1230 by (etac lemma_preal_rat_less 1); |
1221 by (etac lemma_preal_rat_less 1); |
1231 by (res_inst_tac [("x","x*z2*qinv(z1+z2)")] exI 1 THEN rtac conjI 1); |
1222 by (res_inst_tac [("x","x*z2*qinv(z1+z2)")] exI 1 THEN rtac conjI 1); |
1232 by (etac lemma_preal_rat_less2 1); |
1223 by (etac lemma_preal_rat_less2 1); |
1233 by (asm_full_simp_tac (simpset() addsimps [prat_add_mult_distrib RS sym, |
1224 by (asm_full_simp_tac (simpset() addsimps [prat_add_mult_distrib RS sym, |
1248 |
1239 |
1249 Goalw [preal_of_prat_def,preal_mult_def] |
1240 Goalw [preal_of_prat_def,preal_mult_def] |
1250 "preal_of_prat ((z1::prat) * z2) = \ |
1241 "preal_of_prat ((z1::prat) * z2) = \ |
1251 \ preal_of_prat z1 * preal_of_prat z2"; |
1242 \ preal_of_prat z1 * preal_of_prat z2"; |
1252 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
1243 by (res_inst_tac [("f","Abs_preal")] arg_cong 1); |
1253 by (auto_tac (claset() addIs [prat_mult_less_mono] addSIs [set_ext],simpset() addsimps |
1244 by (auto_tac (claset() addIs [prat_mult_less_mono], |
1254 [lemma_prat_less_set_mem_preal RS Abs_preal_inverse])); |
1245 simpset() addsimps [lemma_prat_less_set_mem_preal RS Abs_preal_inverse])); |
1255 by (dtac prat_dense 1); |
1246 by (dtac prat_dense 1); |
1256 by (Step_tac 1); |
1247 by (Step_tac 1); |
1257 by (res_inst_tac [("x","x*z1*qinv(xa)")] exI 1 THEN rtac conjI 1); |
1248 by (res_inst_tac [("x","x*z1*qinv(xa)")] exI 1 THEN rtac conjI 1); |
1258 by (etac lemma_preal_rat_less3 1); |
1249 by (etac lemma_preal_rat_less3 1); |
1259 by (res_inst_tac [("x"," xa*z2*qinv(z1*z2)")] exI 1 THEN rtac conjI 1); |
1250 by (res_inst_tac [("x"," xa*z2*qinv(z1*z2)")] exI 1 THEN rtac conjI 1); |
1265 qed "preal_of_prat_mult"; |
1256 qed "preal_of_prat_mult"; |
1266 |
1257 |
1267 Goalw [preal_of_prat_def,preal_less_def] |
1258 Goalw [preal_of_prat_def,preal_less_def] |
1268 "(preal_of_prat p < preal_of_prat q) = (p < q)"; |
1259 "(preal_of_prat p < preal_of_prat q) = (p < q)"; |
1269 by (auto_tac (claset() addSDs [lemma_prat_set_eq] addEs [prat_less_trans], |
1260 by (auto_tac (claset() addSDs [lemma_prat_set_eq] addEs [prat_less_trans], |
1270 simpset() addsimps [lemma_prat_less_set_mem_preal, |
1261 simpset() addsimps [lemma_prat_less_set_mem_preal, |
1271 psubset_def,prat_less_not_refl])); |
1262 psubset_def,prat_less_not_refl])); |
1272 by (res_inst_tac [("q1.0","p"),("q2.0","q")] prat_linear_less2 1); |
1263 by (res_inst_tac [("q1.0","p"),("q2.0","q")] prat_linear_less2 1); |
1273 by (auto_tac (claset() addIs [prat_less_irrefl],simpset())); |
1264 by (auto_tac (claset() addIs [prat_less_irrefl],simpset())); |
1274 qed "preal_of_prat_less_iff"; |
1265 qed "preal_of_prat_less_iff"; |
1275 |
1266 |
1276 Addsimps [preal_of_prat_less_iff]; |
1267 Addsimps [preal_of_prat_less_iff]; |