9 Blast.overloaded ("RealDef.real", domain_type); |
9 Blast.overloaded ("RealDef.real", domain_type); |
10 |
10 |
11 (*** Proving that realrel is an equivalence relation ***) |
11 (*** Proving that realrel is an equivalence relation ***) |
12 |
12 |
13 Goal "[| (x1::preal) + y2 = x2 + y1; x2 + y3 = x3 + y2 |] \ |
13 Goal "[| (x1::preal) + y2 = x2 + y1; x2 + y3 = x3 + y2 |] \ |
14 \ ==> x1 + y3 = x3 + y1"; |
14 \ ==> x1 + y3 = x3 + y1"; |
15 by (res_inst_tac [("C","y2")] preal_add_right_cancel 1); |
15 by (res_inst_tac [("C","y2")] preal_add_right_cancel 1); |
16 by (rotate_tac 1 1 THEN dtac sym 1); |
16 by (rotate_tac 1 1 THEN dtac sym 1); |
17 by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
17 by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
18 by (rtac (preal_add_left_commute RS subst) 1); |
18 by (rtac (preal_add_left_commute RS subst) 1); |
19 by (res_inst_tac [("x1","x1")] (preal_add_assoc RS subst) 1); |
19 by (res_inst_tac [("x1","x1")] (preal_add_assoc RS subst) 1); |
378 Goal "-(x * y) = x * (- y :: real)"; |
378 Goal "-(x * y) = x * (- y :: real)"; |
379 by (simp_tac (simpset() addsimps [inst "z" "x" real_mult_commute, |
379 by (simp_tac (simpset() addsimps [inst "z" "x" real_mult_commute, |
380 real_minus_mult_eq1]) 1); |
380 real_minus_mult_eq1]) 1); |
381 qed "real_minus_mult_eq2"; |
381 qed "real_minus_mult_eq2"; |
382 |
382 |
|
383 (*Pull negations out*) |
383 Addsimps [real_minus_mult_eq1 RS sym, real_minus_mult_eq2 RS sym]; |
384 Addsimps [real_minus_mult_eq1 RS sym, real_minus_mult_eq2 RS sym]; |
384 |
385 |
385 Goal "(- (1::real)) * z = -z"; |
386 Goal "(- (1::real)) * z = -z"; |
386 by (Simp_tac 1); |
387 by (Simp_tac 1); |
387 qed "real_mult_minus_1"; |
388 qed "real_mult_minus_1"; |
|
389 Addsimps [real_mult_minus_1]; |
388 |
390 |
389 Goal "z * (- (1::real)) = -z"; |
391 Goal "z * (- (1::real)) = -z"; |
390 by (stac real_mult_commute 1); |
392 by (stac real_mult_commute 1); |
391 by (Simp_tac 1); |
393 by (Simp_tac 1); |
392 qed "real_mult_minus_1_right"; |
394 qed "real_mult_minus_1_right"; |
393 |
|
394 Addsimps [real_mult_minus_1_right]; |
395 Addsimps [real_mult_minus_1_right]; |
395 |
396 |
396 Goal "(-x) * (-y) = x * (y::real)"; |
397 Goal "(-x) * (-y) = x * (y::real)"; |
397 by (full_simp_tac (simpset() addsimps [real_minus_mult_eq2 RS sym, |
398 by (full_simp_tac (simpset() addsimps [real_minus_mult_eq2 RS sym, |
398 real_minus_mult_eq1 RS sym]) 1); |
399 real_minus_mult_eq1 RS sym]) 1); |
456 "!!(x::real). x ~= 0 ==> EX y. x*y = (1::real)"; |
457 "!!(x::real). x ~= 0 ==> EX y. x*y = (1::real)"; |
457 by (res_inst_tac [("z","x")] eq_Abs_REAL 1); |
458 by (res_inst_tac [("z","x")] eq_Abs_REAL 1); |
458 by (cut_inst_tac [("r1.0","xa"),("r2.0","y")] preal_linear 1); |
459 by (cut_inst_tac [("r1.0","xa"),("r2.0","y")] preal_linear 1); |
459 by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
460 by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
460 simpset() addsimps [real_zero_iff RS sym])); |
461 simpset() addsimps [real_zero_iff RS sym])); |
461 by (res_inst_tac [("x","Abs_REAL (realrel `` \ |
462 by (res_inst_tac [("x", |
462 \ {(preal_of_prat(prat_of_pnat 1p),pinv(D)+\ |
463 "Abs_REAL (realrel `` \ |
463 \ preal_of_prat(prat_of_pnat 1p))})")] exI 1); |
464 \ {(preal_of_prat(prat_of_pnat 1), \ |
464 by (res_inst_tac [("x","Abs_REAL (realrel `` \ |
465 \ pinv(D) + preal_of_prat(prat_of_pnat 1))})")] exI 1); |
465 \ {(pinv(D)+preal_of_prat(prat_of_pnat 1p),\ |
466 by (res_inst_tac [("x", |
466 \ preal_of_prat(prat_of_pnat 1p))})")] exI 2); |
467 "Abs_REAL (realrel `` \ |
|
468 \ {(pinv(D) + preal_of_prat(prat_of_pnat 1),\ |
|
469 \ preal_of_prat(prat_of_pnat 1))})")] exI 2); |
467 by (auto_tac (claset(), |
470 by (auto_tac (claset(), |
468 simpset() addsimps [real_mult, |
471 simpset() addsimps [real_mult, |
469 pnat_one_def,preal_mult_1_right,preal_add_mult_distrib2, |
472 pnat_one_def,preal_mult_1_right,preal_add_mult_distrib2, |
470 preal_add_mult_distrib,preal_mult_1,preal_mult_inv_right] |
473 preal_add_mult_distrib,preal_mult_1,preal_mult_inv_right] |
471 @ preal_add_ac @ preal_mult_ac)); |
474 @ preal_add_ac @ preal_mult_ac)); |
983 by (auto_tac (claset(), |
986 by (auto_tac (claset(), |
984 simpset() addsimps [real_of_preal_not_minus_gt_zero, |
987 simpset() addsimps [real_of_preal_not_minus_gt_zero, |
985 real_of_preal_not_less_zero,real_of_preal_zero_less, |
988 real_of_preal_not_less_zero,real_of_preal_zero_less, |
986 real_of_preal_minus_less_zero])); |
989 real_of_preal_minus_less_zero])); |
987 qed "real_minus_zero_less_iff"; |
990 qed "real_minus_zero_less_iff"; |
988 |
|
989 Addsimps [real_minus_zero_less_iff]; |
991 Addsimps [real_minus_zero_less_iff]; |
990 |
992 |
991 Goal "(-R < 0) = ((0::real) < R)"; |
993 Goal "(-R < 0) = ((0::real) < R)"; |
992 by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
994 by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
993 by (auto_tac (claset(), |
995 by (auto_tac (claset(), |
994 simpset() addsimps [real_of_preal_not_minus_gt_zero, |
996 simpset() addsimps [real_of_preal_not_minus_gt_zero, |
995 real_of_preal_not_less_zero,real_of_preal_zero_less, |
997 real_of_preal_not_less_zero,real_of_preal_zero_less, |
996 real_of_preal_minus_less_zero])); |
998 real_of_preal_minus_less_zero])); |
997 qed "real_minus_zero_less_iff2"; |
999 qed "real_minus_zero_less_iff2"; |
|
1000 Addsimps [real_minus_zero_less_iff2]; |
998 |
1001 |
999 (*Alternative definition for real_less*) |
1002 (*Alternative definition for real_less*) |
1000 Goal "R < S ==> EX T::real. 0 < T & R + T = S"; |
1003 Goal "R < S ==> EX T::real. 0 < T & R + T = S"; |
1001 by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
1004 by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
1002 by (ALLGOALS(res_inst_tac [("x","S")] real_of_preal_trichotomyE)); |
1005 by (ALLGOALS(res_inst_tac [("x","S")] real_of_preal_trichotomyE)); |
1005 real_of_preal_add, real_of_preal_not_less_zero, |
1008 real_of_preal_add, real_of_preal_not_less_zero, |
1006 real_less_not_refl, |
1009 real_less_not_refl, |
1007 real_of_preal_not_minus_gt_zero])); |
1010 real_of_preal_not_minus_gt_zero])); |
1008 by (res_inst_tac [("x","real_of_preal D")] exI 1); |
1011 by (res_inst_tac [("x","real_of_preal D")] exI 1); |
1009 by (res_inst_tac [("x","real_of_preal m+real_of_preal ma")] exI 2); |
1012 by (res_inst_tac [("x","real_of_preal m+real_of_preal ma")] exI 2); |
1010 by (res_inst_tac [("x","real_of_preal m")] exI 3); |
1013 by (res_inst_tac [("x","real_of_preal D")] exI 3); |
1011 by (res_inst_tac [("x","real_of_preal D")] exI 4); |
|
1012 by (auto_tac (claset(), |
1014 by (auto_tac (claset(), |
1013 simpset() addsimps [real_of_preal_zero_less, |
1015 simpset() addsimps [real_of_preal_zero_less, |
1014 real_of_preal_sum_zero_less,real_add_assoc])); |
1016 real_of_preal_sum_zero_less,real_add_assoc])); |
1015 qed "real_less_add_positive_left_Ex"; |
1017 qed "real_less_add_positive_left_Ex"; |
1016 |
1018 |