src/HOL/Hyperreal/HyperDef.thy
changeset 14369 c50188fe6366
parent 14365 3d4df8c166ae
child 14370 b0064703967b
equal deleted inserted replaced
14368:2763da611ad9 14369:c50188fe6366
   764 
   764 
   765 
   765 
   766 subsection{*@{term hypreal_of_real} Preserves Field and Order Properties*}
   766 subsection{*@{term hypreal_of_real} Preserves Field and Order Properties*}
   767 
   767 
   768 lemma hypreal_of_real_add [simp]: 
   768 lemma hypreal_of_real_add [simp]: 
   769      "hypreal_of_real (z1 + z2) = hypreal_of_real z1 + hypreal_of_real z2"
   769      "hypreal_of_real (w + z) = hypreal_of_real w + hypreal_of_real z"
   770 apply (unfold hypreal_of_real_def)
   770 apply (unfold hypreal_of_real_def)
   771 apply (simp add: hypreal_add left_distrib)
   771 apply (simp add: hypreal_add left_distrib)
   772 done
   772 done
   773 
   773 
   774 lemma hypreal_of_real_mult [simp]: 
   774 lemma hypreal_of_real_mult [simp]: 
   775      "hypreal_of_real (z1 * z2) = hypreal_of_real z1 * hypreal_of_real z2"
   775      "hypreal_of_real (w * z) = hypreal_of_real w * hypreal_of_real z"
   776 apply (unfold hypreal_of_real_def)
   776 apply (unfold hypreal_of_real_def)
   777 apply (simp add: hypreal_mult right_distrib)
   777 apply (simp add: hypreal_mult right_distrib)
   778 done
   778 done
   779 
   779 
       
   780 lemma hypreal_of_real_one [simp]: "hypreal_of_real 1 = (1::hypreal)"
       
   781 by (unfold hypreal_of_real_def hypreal_one_def, simp)
       
   782 
       
   783 lemma hypreal_of_real_zero [simp]: "hypreal_of_real 0 = 0"
       
   784 by (unfold hypreal_of_real_def hypreal_zero_def, simp)
       
   785 
   780 lemma hypreal_of_real_less_iff [simp]: 
   786 lemma hypreal_of_real_less_iff [simp]: 
   781      "(hypreal_of_real z1 <  hypreal_of_real z2) = (z1 < z2)"
   787      "(hypreal_of_real w <  hypreal_of_real z) = (w < z)"
   782 apply (unfold hypreal_less_def hypreal_of_real_def, auto)
   788 apply (unfold hypreal_less_def hypreal_of_real_def, auto)
   783 apply (rule_tac [2] x = "%n. z1" in exI, safe)
   789 apply (rule_tac [2] x = "%n. w" in exI, safe)
   784 apply (rule_tac [3] x = "%n. z2" in exI, auto)
   790 apply (rule_tac [3] x = "%n. z" in exI, auto)
   785 apply (rule FreeUltrafilterNat_P, ultra)
   791 apply (rule FreeUltrafilterNat_P, ultra)
   786 done
   792 done
   787 
   793 
   788 lemma hypreal_of_real_le_iff [simp]: 
   794 lemma hypreal_of_real_le_iff [simp]: 
   789      "(hypreal_of_real z1 \<le> hypreal_of_real z2) = (z1 \<le> z2)"
   795      "(hypreal_of_real w \<le> hypreal_of_real z) = (w \<le> z)"
   790 by (force simp add: hypreal_less hypreal_le_def linorder_not_less[symmetric])
   796 by (force simp add: hypreal_less hypreal_le_def linorder_not_less[symmetric])
   791 
   797 
   792 lemma hypreal_of_real_eq_iff [simp]:
   798 lemma hypreal_of_real_eq_iff [simp]:
   793      "(hypreal_of_real z1 = hypreal_of_real z2) = (z1 = z2)"
   799      "(hypreal_of_real w = hypreal_of_real z) = (w = z)"
   794 by (force intro: order_antisym hypreal_of_real_le_iff [THEN iffD1])
   800 by (force intro: order_antisym hypreal_of_real_le_iff [THEN iffD1])
       
   801 
       
   802 text{*As above, for 0*}
       
   803 
       
   804 declare hypreal_of_real_less_iff [of 0, simplified, simp]
       
   805 declare hypreal_of_real_le_iff   [of 0, simplified, simp]
       
   806 declare hypreal_of_real_eq_iff   [of 0, simplified, simp]
       
   807 
       
   808 declare hypreal_of_real_less_iff [of _ 0, simplified, simp]
       
   809 declare hypreal_of_real_le_iff   [of _ 0, simplified, simp]
       
   810 declare hypreal_of_real_eq_iff   [of _ 0, simplified, simp]
       
   811 
       
   812 text{*As above, for 1*}
       
   813 
       
   814 declare hypreal_of_real_less_iff [of 1, simplified, simp]
       
   815 declare hypreal_of_real_le_iff   [of 1, simplified, simp]
       
   816 declare hypreal_of_real_eq_iff   [of 1, simplified, simp]
       
   817 
       
   818 declare hypreal_of_real_less_iff [of _ 1, simplified, simp]
       
   819 declare hypreal_of_real_le_iff   [of _ 1, simplified, simp]
       
   820 declare hypreal_of_real_eq_iff   [of _ 1, simplified, simp]
   795 
   821 
   796 lemma hypreal_of_real_minus [simp]:
   822 lemma hypreal_of_real_minus [simp]:
   797      "hypreal_of_real (-r) = - hypreal_of_real  r"
   823      "hypreal_of_real (-r) = - hypreal_of_real  r"
   798 apply (unfold hypreal_of_real_def)
   824 apply (unfold hypreal_of_real_def)
   799 apply (auto simp add: hypreal_minus)
   825 apply (auto simp add: hypreal_minus)
   800 done
   826 done
   801 
       
   802 lemma hypreal_of_real_one [simp]: "hypreal_of_real 1 = (1::hypreal)"
       
   803 by (unfold hypreal_of_real_def hypreal_one_def, simp)
       
   804 
       
   805 lemma hypreal_of_real_zero [simp]: "hypreal_of_real 0 = 0"
       
   806 by (unfold hypreal_of_real_def hypreal_zero_def, simp)
       
   807 
       
   808 lemma hypreal_of_real_zero_iff: "(hypreal_of_real r = 0) = (r = 0)"
       
   809 by (auto intro: FreeUltrafilterNat_P simp add: hypreal_of_real_def hypreal_zero_def FreeUltrafilterNat_Nat_set)
       
   810 
   827 
   811 lemma hypreal_of_real_inverse [simp]:
   828 lemma hypreal_of_real_inverse [simp]:
   812      "hypreal_of_real (inverse r) = inverse (hypreal_of_real r)"
   829      "hypreal_of_real (inverse r) = inverse (hypreal_of_real r)"
   813 apply (case_tac "r=0")
   830 apply (case_tac "r=0")
   814 apply (simp add: DIVISION_BY_ZERO INVERSE_ZERO HYPREAL_INVERSE_ZERO)
   831 apply (simp add: DIVISION_BY_ZERO INVERSE_ZERO HYPREAL_INVERSE_ZERO)
   815 apply (rule_tac c1 = "hypreal_of_real r" in hypreal_mult_left_cancel [THEN iffD1])
   832 apply (rule_tac c1 = "hypreal_of_real r" in hypreal_mult_left_cancel [THEN iffD1])
   816 apply (auto simp add: hypreal_of_real_zero_iff hypreal_of_real_mult [symmetric])
   833 apply (auto simp add: hypreal_of_real_mult [symmetric])
   817 done
   834 done
   818 
   835 
   819 lemma hypreal_of_real_divide [simp]:
   836 lemma hypreal_of_real_divide [simp]:
   820      "hypreal_of_real (z1 / z2) = hypreal_of_real z1 / hypreal_of_real z2"
   837      "hypreal_of_real (w / z) = hypreal_of_real w / hypreal_of_real z"
   821 by (simp add: hypreal_divide_def real_divide_def)
   838 by (simp add: hypreal_divide_def real_divide_def)
   822 
   839 
   823 
   840 
   824 subsection{*Misc Others*}
   841 subsection{*Misc Others*}
   825 
   842 
   957 val hypreal_of_real_le_iff = thm "hypreal_of_real_le_iff";
   974 val hypreal_of_real_le_iff = thm "hypreal_of_real_le_iff";
   958 val hypreal_of_real_eq_iff = thm "hypreal_of_real_eq_iff";
   975 val hypreal_of_real_eq_iff = thm "hypreal_of_real_eq_iff";
   959 val hypreal_of_real_minus = thm "hypreal_of_real_minus";
   976 val hypreal_of_real_minus = thm "hypreal_of_real_minus";
   960 val hypreal_of_real_one = thm "hypreal_of_real_one";
   977 val hypreal_of_real_one = thm "hypreal_of_real_one";
   961 val hypreal_of_real_zero = thm "hypreal_of_real_zero";
   978 val hypreal_of_real_zero = thm "hypreal_of_real_zero";
   962 val hypreal_of_real_zero_iff = thm "hypreal_of_real_zero_iff";
       
   963 val hypreal_of_real_inverse = thm "hypreal_of_real_inverse";
   979 val hypreal_of_real_inverse = thm "hypreal_of_real_inverse";
   964 val hypreal_of_real_divide = thm "hypreal_of_real_divide";
   980 val hypreal_of_real_divide = thm "hypreal_of_real_divide";
   965 val hypreal_divide_one = thm "hypreal_divide_one";
   981 val hypreal_divide_one = thm "hypreal_divide_one";
   966 val hypreal_add_divide_distrib = thm "hypreal_add_divide_distrib";
   982 val hypreal_add_divide_distrib = thm "hypreal_add_divide_distrib";
   967 val hypreal_inverse_add = thm "hypreal_inverse_add";
   983 val hypreal_inverse_add = thm "hypreal_inverse_add";