302 by (rtac injI 1); |
302 by (rtac injI 1); |
303 by (dres_inst_tac [("f","uminus")] arg_cong 1); |
303 by (dres_inst_tac [("f","uminus")] arg_cong 1); |
304 by (asm_full_simp_tac (simpset() addsimps [hypreal_minus_minus]) 1); |
304 by (asm_full_simp_tac (simpset() addsimps [hypreal_minus_minus]) 1); |
305 qed "inj_hypreal_minus"; |
305 qed "inj_hypreal_minus"; |
306 |
306 |
307 Goalw [hypreal_zero_def] "-0 = (0::hypreal)"; |
307 Goalw [hypreal_zero_def] "- 0 = (0::hypreal)"; |
308 by (simp_tac (simpset() addsimps [hypreal_minus]) 1); |
308 by (simp_tac (simpset() addsimps [hypreal_minus]) 1); |
309 qed "hypreal_minus_zero"; |
309 qed "hypreal_minus_zero"; |
310 Addsimps [hypreal_minus_zero]; |
310 Addsimps [hypreal_minus_zero]; |
311 |
311 |
312 Goal "(-x = 0) = (x = (0::hypreal))"; |
312 Goal "(-x = 0) = (x = (0::hypreal))"; |
620 |
620 |
621 |
621 |
622 (**** multiplicative inverse on hypreal ****) |
622 (**** multiplicative inverse on hypreal ****) |
623 |
623 |
624 Goalw [congruent_def] |
624 Goalw [congruent_def] |
625 "congruent hyprel (%X. hyprel``{%n. if X n = #0 then #0 else inverse(X n)})"; |
625 "congruent hyprel (%X. hyprel``{%n. if X n = Numeral0 then Numeral0 else inverse(X n)})"; |
626 by (Auto_tac THEN Ultra_tac 1); |
626 by (Auto_tac THEN Ultra_tac 1); |
627 qed "hypreal_inverse_congruent"; |
627 qed "hypreal_inverse_congruent"; |
628 |
628 |
629 Goalw [hypreal_inverse_def] |
629 Goalw [hypreal_inverse_def] |
630 "inverse (Abs_hypreal(hyprel``{%n. X n})) = \ |
630 "inverse (Abs_hypreal(hyprel``{%n. X n})) = \ |
631 \ Abs_hypreal(hyprel `` {%n. if X n = #0 then #0 else inverse(X n)})"; |
631 \ Abs_hypreal(hyprel `` {%n. if X n = Numeral0 then Numeral0 else inverse(X n)})"; |
632 by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); |
632 by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); |
633 by (simp_tac (simpset() addsimps |
633 by (simp_tac (simpset() addsimps |
634 [hyprel_in_hypreal RS Abs_hypreal_inverse, |
634 [hyprel_in_hypreal RS Abs_hypreal_inverse, |
635 [equiv_hyprel, hypreal_inverse_congruent] MRS UN_equiv_class]) 1); |
635 [equiv_hyprel, hypreal_inverse_congruent] MRS UN_equiv_class]) 1); |
636 qed "hypreal_inverse"; |
636 qed "hypreal_inverse"; |
838 |
838 |
839 (*--------------------------------------------------------------------------------- |
839 (*--------------------------------------------------------------------------------- |
840 Trichotomy of the hyperreals |
840 Trichotomy of the hyperreals |
841 --------------------------------------------------------------------------------*) |
841 --------------------------------------------------------------------------------*) |
842 |
842 |
843 Goalw [hyprel_def] "EX x. x: hyprel `` {%n. #0}"; |
843 Goalw [hyprel_def] "EX x. x: hyprel `` {%n. Numeral0}"; |
844 by (res_inst_tac [("x","%n. #0")] exI 1); |
844 by (res_inst_tac [("x","%n. Numeral0")] exI 1); |
845 by (Step_tac 1); |
845 by (Step_tac 1); |
846 by (auto_tac (claset() addSIs [FreeUltrafilterNat_Nat_set], simpset())); |
846 by (auto_tac (claset() addSIs [FreeUltrafilterNat_Nat_set], simpset())); |
847 qed "lemma_hyprel_0r_mem"; |
847 qed "lemma_hyprel_0r_mem"; |
848 |
848 |
849 Goalw [hypreal_zero_def]"0 < x | x = 0 | x < (0::hypreal)"; |
849 Goalw [hypreal_zero_def]"0 < x | x = 0 | x < (0::hypreal)"; |
1099 Addsimps [hypreal_of_real_minus]; |
1099 Addsimps [hypreal_of_real_minus]; |
1100 |
1100 |
1101 (*DON'T insert this or the next one as default simprules. |
1101 (*DON'T insert this or the next one as default simprules. |
1102 They are used in both orientations and anyway aren't the ones we finally |
1102 They are used in both orientations and anyway aren't the ones we finally |
1103 need, which would use binary literals.*) |
1103 need, which would use binary literals.*) |
1104 Goalw [hypreal_of_real_def,hypreal_one_def] "hypreal_of_real #1 = 1hr"; |
1104 Goalw [hypreal_of_real_def,hypreal_one_def] "hypreal_of_real Numeral1 = 1hr"; |
1105 by (Step_tac 1); |
1105 by (Step_tac 1); |
1106 qed "hypreal_of_real_one"; |
1106 qed "hypreal_of_real_one"; |
1107 |
1107 |
1108 Goalw [hypreal_of_real_def,hypreal_zero_def] "hypreal_of_real #0 = 0"; |
1108 Goalw [hypreal_of_real_def,hypreal_zero_def] "hypreal_of_real Numeral0 = 0"; |
1109 by (Step_tac 1); |
1109 by (Step_tac 1); |
1110 qed "hypreal_of_real_zero"; |
1110 qed "hypreal_of_real_zero"; |
1111 |
1111 |
1112 Goal "(hypreal_of_real r = 0) = (r = #0)"; |
1112 Goal "(hypreal_of_real r = 0) = (r = Numeral0)"; |
1113 by (auto_tac (claset() addIs [FreeUltrafilterNat_P], |
1113 by (auto_tac (claset() addIs [FreeUltrafilterNat_P], |
1114 simpset() addsimps [hypreal_of_real_def, |
1114 simpset() addsimps [hypreal_of_real_def, |
1115 hypreal_zero_def,FreeUltrafilterNat_Nat_set])); |
1115 hypreal_zero_def,FreeUltrafilterNat_Nat_set])); |
1116 qed "hypreal_of_real_zero_iff"; |
1116 qed "hypreal_of_real_zero_iff"; |
1117 |
1117 |
1118 Goal "hypreal_of_real (inverse r) = inverse (hypreal_of_real r)"; |
1118 Goal "hypreal_of_real (inverse r) = inverse (hypreal_of_real r)"; |
1119 by (case_tac "r=#0" 1); |
1119 by (case_tac "r=Numeral0" 1); |
1120 by (asm_simp_tac (simpset() addsimps [REAL_DIVIDE_ZERO, INVERSE_ZERO, |
1120 by (asm_simp_tac (simpset() addsimps [REAL_DIVIDE_ZERO, INVERSE_ZERO, |
1121 HYPREAL_INVERSE_ZERO, hypreal_of_real_zero]) 1); |
1121 HYPREAL_INVERSE_ZERO, hypreal_of_real_zero]) 1); |
1122 by (res_inst_tac [("c1","hypreal_of_real r")] |
1122 by (res_inst_tac [("c1","hypreal_of_real r")] |
1123 (hypreal_mult_left_cancel RS iffD1) 1); |
1123 (hypreal_mult_left_cancel RS iffD1) 1); |
1124 by (stac (hypreal_of_real_mult RS sym) 2); |
1124 by (stac (hypreal_of_real_mult RS sym) 2); |