
diff -r ad73fb6144cf -r c6eecde058e4 src/HOL/Hyperreal/HyperNat.thy
--- a/src/HOL/Hyperreal/HyperNat.thy	Tue Sep 06 23:16:48 2005 +0200
+++ b/src/HOL/Hyperreal/HyperNat.thy	Wed Sep 07 00:48:50 2005 +0200
@@ -11,6 +11,8 @@
 imports Star
 begin
 
+types hypnat = "nat star"
+(*
 constdefs
     hypnatrel :: "((nat=>nat)*(nat=>nat)) set"
     "hypnatrel == {p. \<exists>X Y. p = ((X::nat=>nat),Y) &
@@ -20,20 +22,26 @@
     by (auto simp add: quotient_def)
 
 instance hypnat :: "{ord, zero, one, plus, times, minus}" ..
-
+*)
 consts whn :: hypnat
 
 
-defs (overloaded)
+defs
+  (* omega is in fact an infinite hypernatural number = [<1,2,3,...>] *)
+  hypnat_omega_def:  "whn == Abs_star(starrel``{%n::nat. n})"
+
+lemma hypnat_zero_def:  "0 == Abs_star(starrel``{%n::nat. 0})"
+by (simp only: star_zero_def star_of_def star_n_def)
+
+lemma hypnat_one_def:   "1 == Abs_star(starrel``{%n::nat. 1})"
+by (simp only: star_one_def star_of_def star_n_def)
 
   (** hypernatural arithmetic **)
-
+(*
   hypnat_zero_def:  "0 == Abs_hypnat(hypnatrel``{%n::nat. 0})"
   hypnat_one_def:   "1 == Abs_hypnat(hypnatrel``{%n::nat. 1})"
-
-  (* omega is in fact an infinite hypernatural number = [<1,2,3,...>] *)
-  hypnat_omega_def:  "whn == Abs_hypnat(hypnatrel``{%n::nat. n})"
-
+*)
+(*
   hypnat_add_def:
   "P + Q == Abs_hypnat(\<Union>X \<in> Rep_hypnat(P). \<Union>Y \<in> Rep_hypnat(Q).
                 hypnatrel``{%n::nat. X n + Y n})"
@@ -45,15 +53,9 @@
   hypnat_minus_def:
   "P - Q == Abs_hypnat(\<Union>X \<in> Rep_hypnat(P). \<Union>Y \<in> Rep_hypnat(Q).
                 hypnatrel``{%n::nat. X n - Y n})"
-
-  hypnat_le_def:
-  "P \<le> (Q::hypnat) == \<exists>X Y. X \<in> Rep_hypnat(P) & Y \<in> Rep_hypnat(Q) &
-                            {n::nat. X n \<le> Y n} \<in> FreeUltrafilterNat"
+*)
 
-  hypnat_less_def: "(x < (y::hypnat)) == (x \<le> y & x \<noteq> y)"
-
-
-
+(*
 subsection{*Properties of @{term hypnatrel}*}
 
 text{*Proving that @{term hypnatrel} is an equivalence relation*}
@@ -78,8 +80,9 @@
 apply (simp add: equiv_def refl_def sym_def trans_def hypnatrel_refl)
 apply (blast intro: hypnatrel_sym hypnatrel_trans)
 done
-
+*)
 (* (hypnatrel `` {x} = hypnatrel `` {y}) = ((x,y) \<in> hypnatrel) *)
+(*
 lemmas equiv_hypnatrel_iff =
     eq_equiv_class_iff [OF equiv_hypnatrel UNIV_I UNIV_I, simp]
 
@@ -118,156 +121,124 @@
 theorem hypnat_cases [case_names Abs_hypnat, cases type: hypnat]:
     "(!!x. z = Abs_hypnat(hypnatrel``{x}) ==> P) ==> P"
 by (rule eq_Abs_hypnat [of z], blast)
-
+*)
 subsection{*Hypernat Addition*}
-
+(*
 lemma hypnat_add_congruent2:
      "(%X Y. hypnatrel``{%n. X n + Y n}) respects2 hypnatrel"
 by (simp add: congruent2_def, auto, ultra)
-
+*)
 lemma hypnat_add:
-  "Abs_hypnat(hypnatrel``{%n. X n}) + Abs_hypnat(hypnatrel``{%n. Y n}) =
-   Abs_hypnat(hypnatrel``{%n. X n + Y n})"
-by (simp add: hypnat_add_def 
-    UN_equiv_class2 [OF equiv_hypnatrel equiv_hypnatrel hypnat_add_congruent2])
+  "Abs_star(starrel``{%n. X n}) + Abs_star(starrel``{%n. Y n}) =
+   Abs_star(starrel``{%n. X n + Y n})"
+by (rule hypreal_add)
 
 lemma hypnat_add_commute: "(z::hypnat) + w = w + z"
-apply (cases z, cases w)
-apply (simp add: add_ac hypnat_add)
-done
+by (rule add_commute)
 
 lemma hypnat_add_assoc: "((z1::hypnat) + z2) + z3 = z1 + (z2 + z3)"
-apply (cases z1, cases z2, cases z3)
-apply (simp add: hypnat_add nat_add_assoc)
-done
+by (rule add_assoc)
 
 lemma hypnat_add_zero_left: "(0::hypnat) + z = z"
-apply (cases z)
-apply (simp add: hypnat_zero_def hypnat_add)
-done
+by (rule comm_monoid_add_class.add_0)
 
+(*
 instance hypnat :: comm_monoid_add
   by intro_classes
     (assumption |
       rule hypnat_add_commute hypnat_add_assoc hypnat_add_zero_left)+
-
+*)
 
 subsection{*Subtraction inverse on @{typ hypreal}*}
 
-
+(*
 lemma hypnat_minus_congruent2:
-    "(%X Y. hypnatrel``{%n. X n - Y n}) respects2 hypnatrel"
+    "(%X Y. starrel``{%n. X n - Y n}) respects2 starrel"
 by (simp add: congruent2_def, auto, ultra)
-
+*)
 lemma hypnat_minus:
-  "Abs_hypnat(hypnatrel``{%n. X n}) - Abs_hypnat(hypnatrel``{%n. Y n}) =
-   Abs_hypnat(hypnatrel``{%n. X n - Y n})"
-by (simp add: hypnat_minus_def 
-  UN_equiv_class2 [OF equiv_hypnatrel equiv_hypnatrel hypnat_minus_congruent2])
+  "Abs_star(starrel``{%n. X n}) - Abs_star(starrel``{%n. Y n}) =
+   Abs_star(starrel``{%n. X n - Y n})"
+by (rule hypreal_diff)
 
-lemma hypnat_minus_zero: "z - z = (0::hypnat)"
-apply (cases z)
-apply (simp add: hypnat_zero_def hypnat_minus)
-done
+lemma hypnat_minus_zero: "!!z. z - z = (0::hypnat)"
+by transfer (rule diff_self_eq_0)
 
-lemma hypnat_diff_0_eq_0: "(0::hypnat) - n = 0"
-apply (cases n)
-apply (simp add: hypnat_minus hypnat_zero_def)
-done
+lemma hypnat_diff_0_eq_0: "!!n. (0::hypnat) - n = 0"
+by transfer (rule diff_0_eq_0)
 
 declare hypnat_minus_zero [simp] hypnat_diff_0_eq_0 [simp]
 
-lemma hypnat_add_is_0: "(m+n = (0::hypnat)) = (m=0 & n=0)"
-apply (cases m, cases n)
-apply (auto intro: FreeUltrafilterNat_subset dest: FreeUltrafilterNat_Int simp add: hypnat_zero_def hypnat_add)
-done
+lemma hypnat_add_is_0: "!!m n. (m+n = (0::hypnat)) = (m=0 & n=0)"
+by transfer (rule add_is_0)
 
 declare hypnat_add_is_0 [iff]
 
-lemma hypnat_diff_diff_left: "(i::hypnat) - j - k = i - (j+k)"
-apply (cases i, cases j, cases k)
-apply (simp add: hypnat_minus hypnat_add diff_diff_left)
-done
+lemma hypnat_diff_diff_left: "!!i j k. (i::hypnat) - j - k = i - (j+k)"
+by transfer (rule diff_diff_left)
 
-lemma hypnat_diff_commute: "(i::hypnat) - j - k = i-k-j"
-by (simp add: hypnat_diff_diff_left hypnat_add_commute)
+lemma hypnat_diff_commute: "!!i j k. (i::hypnat) - j - k = i-k-j"
+by transfer (rule diff_commute)
 
-lemma hypnat_diff_add_inverse: "((n::hypnat) + m) - n = m"
-apply (cases m, cases n)
-apply (simp add: hypnat_minus hypnat_add)
-done
+lemma hypnat_diff_add_inverse: "!!m n. ((n::hypnat) + m) - n = m"
+by transfer (rule diff_add_inverse)
 declare hypnat_diff_add_inverse [simp]
 
-lemma hypnat_diff_add_inverse2:  "((m::hypnat) + n) - n = m"
-apply (cases m, cases n)
-apply (simp add: hypnat_minus hypnat_add)
-done
+lemma hypnat_diff_add_inverse2:  "!!m n. ((m::hypnat) + n) - n = m"
+by transfer (rule diff_add_inverse2)
 declare hypnat_diff_add_inverse2 [simp]
 
-lemma hypnat_diff_cancel: "((k::hypnat) + m) - (k+n) = m - n"
-apply (cases k, cases m, cases n)
-apply (simp add: hypnat_minus hypnat_add)
-done
+lemma hypnat_diff_cancel: "!!k m n. ((k::hypnat) + m) - (k+n) = m - n"
+by transfer (rule diff_cancel)
 declare hypnat_diff_cancel [simp]
 
-lemma hypnat_diff_cancel2: "((m::hypnat) + k) - (n+k) = m - n"
-by (simp add: hypnat_add_commute [of _ k])
+lemma hypnat_diff_cancel2: "!!k m n. ((m::hypnat) + k) - (n+k) = m - n"
+by transfer (rule diff_cancel2)
 declare hypnat_diff_cancel2 [simp]
 
-lemma hypnat_diff_add_0: "(n::hypnat) - (n+m) = (0::hypnat)"
-apply (cases m, cases n)
-apply (simp add: hypnat_zero_def hypnat_minus hypnat_add)
-done
+lemma hypnat_diff_add_0: "!!m n. (n::hypnat) - (n+m) = (0::hypnat)"
+by transfer (rule diff_add_0)
 declare hypnat_diff_add_0 [simp]
 
 
 subsection{*Hyperreal Multiplication*}
-
+(*
 lemma hypnat_mult_congruent2:
-    "(%X Y. hypnatrel``{%n. X n * Y n}) respects2 hypnatrel"
+    "(%X Y. starrel``{%n. X n * Y n}) respects2 starrel"
 by (simp add: congruent2_def, auto, ultra)
-
+*)
 lemma hypnat_mult:
-  "Abs_hypnat(hypnatrel``{%n. X n}) * Abs_hypnat(hypnatrel``{%n. Y n}) =
-   Abs_hypnat(hypnatrel``{%n. X n * Y n})"
-by (simp add: hypnat_mult_def
-   UN_equiv_class2 [OF equiv_hypnatrel equiv_hypnatrel hypnat_mult_congruent2])
+  "Abs_star(starrel``{%n. X n}) * Abs_star(starrel``{%n. Y n}) =
+   Abs_star(starrel``{%n. X n * Y n})"
+by (rule hypreal_mult)
 
 lemma hypnat_mult_commute: "(z::hypnat) * w = w * z"
-by (cases z, cases w, simp add: hypnat_mult mult_ac)
+by (rule mult_commute)
 
 lemma hypnat_mult_assoc: "((z1::hypnat) * z2) * z3 = z1 * (z2 * z3)"
-apply (cases z1, cases z2, cases z3)
-apply (simp add: hypnat_mult mult_assoc)
-done
+by (rule mult_assoc)
 
 lemma hypnat_mult_1: "(1::hypnat) * z = z"
-apply (cases z)
-apply (simp add: hypnat_mult hypnat_one_def)
-done
+by (rule mult_1_left)
 
-lemma hypnat_diff_mult_distrib: "((m::hypnat) - n) * k = (m * k) - (n * k)"
-apply (cases k, cases m, cases n)
-apply (simp add: hypnat_mult hypnat_minus diff_mult_distrib)
-done
+lemma hypnat_diff_mult_distrib: "!!k m n. ((m::hypnat) - n) * k = (m * k) - (n * k)"
+by transfer (rule diff_mult_distrib)
 
-lemma hypnat_diff_mult_distrib2: "(k::hypnat) * (m - n) = (k * m) - (k * n)"
-by (simp add: hypnat_diff_mult_distrib hypnat_mult_commute [of k])
+lemma hypnat_diff_mult_distrib2: "!!k m n. (k::hypnat) * (m - n) = (k * m) - (k * n)"
+by transfer (rule diff_mult_distrib2)
 
 lemma hypnat_add_mult_distrib: "((z1::hypnat) + z2) * w = (z1 * w) + (z2 * w)"
-apply (cases z1, cases z2, cases w)
-apply (simp add: hypnat_mult hypnat_add add_mult_distrib)
-done
+by (rule left_distrib)
 
 lemma hypnat_add_mult_distrib2: "(w::hypnat) * (z1 + z2) = (w * z1) + (w * z2)"
-by (simp add: hypnat_mult_commute [of w] hypnat_add_mult_distrib)
+by (rule right_distrib)
 
 text{*one and zero are distinct*}
 lemma hypnat_zero_not_eq_one: "(0::hypnat) \<noteq> (1::hypnat)"
-by (auto simp add: hypnat_zero_def hypnat_one_def)
+by (rule zero_neq_one)
 declare hypnat_zero_not_eq_one [THEN not_sym, simp]
 
-
+(*
 text{*The hypernaturals form a @{text comm_semiring_1_cancel}: *}
 instance hypnat :: comm_semiring_1_cancel
 proof
@@ -281,64 +252,50 @@
   hence "(k+i) - k = (k+j) - k" by simp
   thus "i=j" by simp
 qed
-
+*)
 
 subsection{*Properties of The @{text "\<le>"} Relation*}
 
 lemma hypnat_le:
-      "(Abs_hypnat(hypnatrel``{%n. X n}) \<le> Abs_hypnat(hypnatrel``{%n. Y n})) =
+      "(Abs_star(starrel``{%n. X n}) \<le> Abs_star(starrel``{%n. Y n})) =
        ({n. X n \<le> Y n} \<in> FreeUltrafilterNat)"
-apply (simp add: hypnat_le_def)
-apply (auto intro!: lemma_hypnatrel_refl, ultra)
-done
+by (rule hypreal_le)
 
 lemma hypnat_le_refl: "w \<le> (w::hypnat)"
-apply (cases w)
-apply (simp add: hypnat_le)
-done
+by (rule order_refl)
 
 lemma hypnat_le_trans: "[| i \<le> j; j \<le> k |] ==> i \<le> (k::hypnat)"
-apply (cases i, cases j, cases k)
-apply (simp add: hypnat_le, ultra)
-done
+by (rule order_trans)
 
 lemma hypnat_le_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::hypnat)"
-apply (cases z, cases w)
-apply (simp add: hypnat_le, ultra)
-done
+by (rule order_antisym)
 
 (* Axiom 'order_less_le' of class 'order': *)
 lemma hypnat_less_le: "((w::hypnat) < z) = (w \<le> z & w \<noteq> z)"
-by (simp add: hypnat_less_def)
+by (rule order_less_le)
 
+(*
 instance hypnat :: order
   by intro_classes
     (assumption |
       rule hypnat_le_refl hypnat_le_trans hypnat_le_anti_sym hypnat_less_le)+
-
+*)
 (* Axiom 'linorder_linear' of class 'linorder': *)
 lemma hypnat_le_linear: "(z::hypnat) \<le> w | w \<le> z"
-apply (cases z, cases w)
-apply (auto simp add: hypnat_le, ultra)
-done
-
+by (rule linorder_linear)
+(*
 instance hypnat :: linorder
   by intro_classes (rule hypnat_le_linear)
-
+*)
 lemma hypnat_add_left_mono: "x \<le> y ==> z + x \<le> z + (y::hypnat)"
-apply (cases x, cases y, cases z)
-apply (auto simp add: hypnat_le hypnat_add)
-done
+by (rule add_left_mono)
 
 lemma hypnat_mult_less_mono2: "[| (0::hypnat)<z; x<y |] ==> z*x<z*y"
-apply (cases x, cases y, cases z)
-apply (simp add: hypnat_zero_def  hypnat_mult linorder_not_le [symmetric])
-apply (auto simp add: hypnat_le, ultra)
-done
+by (rule mult_strict_left_mono)
 
 
 subsection{*The Hypernaturals Form an Ordered @{text comm_semiring_1_cancel} *}
-
+(*
 instance hypnat :: ordered_semidom
 proof
   fix x y z :: hypnat
@@ -350,62 +307,48 @@
   show "x < y ==> 0 < z ==> z * x < z * y"
     by (simp add: hypnat_mult_less_mono2)
 qed
-
-lemma hypnat_le_zero_cancel [iff]: "(n \<le> (0::hypnat)) = (n = 0)"
-apply (cases n)
-apply (simp add: hypnat_zero_def hypnat_le)
-done
+*)
+lemma hypnat_le_zero_cancel [iff]: "!!n. (n \<le> (0::hypnat)) = (n = 0)"
+by transfer (rule le_0_eq)
 
-lemma hypnat_mult_is_0 [simp]: "(m*n = (0::hypnat)) = (m=0 | n=0)"
-apply (cases m, cases n)
-apply (auto simp add: hypnat_zero_def hypnat_mult, ultra+)
-done
+lemma hypnat_mult_is_0 [simp]: "!!m n. (m*n = (0::hypnat)) = (m=0 | n=0)"
+by transfer (rule mult_is_0)
 
-lemma hypnat_diff_is_0_eq [simp]: "((m::hypnat) - n = 0) = (m \<le> n)"
-apply (cases m, cases n)
-apply (simp add: hypnat_le hypnat_minus hypnat_zero_def)
-done
+lemma hypnat_diff_is_0_eq [simp]: "!!m n. ((m::hypnat) - n = 0) = (m \<le> n)"
+by transfer (rule diff_is_0_eq)
 
 
 
 subsection{*Theorems for Ordering*}
 
 lemma hypnat_less:
-      "(Abs_hypnat(hypnatrel``{%n. X n}) < Abs_hypnat(hypnatrel``{%n. Y n})) =
+      "(Abs_star(starrel``{%n. X n}) < Abs_star(starrel``{%n. Y n})) =
        ({n. X n < Y n} \<in> FreeUltrafilterNat)"
-apply (auto simp add: hypnat_le  linorder_not_le [symmetric])
-apply (ultra+)
-done
+by (rule hypreal_less)
 
-lemma hypnat_not_less0 [iff]: "~ n < (0::hypnat)"
-apply (cases n)
-apply (auto simp add: hypnat_zero_def hypnat_less)
-done
+lemma hypnat_not_less0 [iff]: "!!n. ~ n < (0::hypnat)"
+by transfer (rule not_less0)
 
 lemma hypnat_less_one [iff]:
-      "(n < (1::hypnat)) = (n=0)"
-apply (cases n)
-apply (auto simp add: hypnat_zero_def hypnat_one_def hypnat_less)
-done
+      "!!n. (n < (1::hypnat)) = (n=0)"
+by transfer (rule less_one)
+
+lemma hypnat_add_diff_inverse: "!!m n. ~ m<n ==> n+(m-n) = (m::hypnat)"
+by transfer (rule add_diff_inverse)
 
-lemma hypnat_add_diff_inverse: "~ m<n ==> n+(m-n) = (m::hypnat)"
-apply (cases m, cases n)
-apply (simp add: hypnat_minus hypnat_add hypnat_less split: nat_diff_split, ultra)
-done
+lemma hypnat_le_add_diff_inverse [simp]: "!!m n. n \<le> m ==> n+(m-n) = (m::hypnat)"
+by transfer (rule le_add_diff_inverse)
 
-lemma hypnat_le_add_diff_inverse [simp]: "n \<le> m ==> n+(m-n) = (m::hypnat)"
-by (simp add: hypnat_add_diff_inverse linorder_not_less [symmetric])
-
-lemma hypnat_le_add_diff_inverse2 [simp]: "n\<le>m ==> (m-n)+n = (m::hypnat)"
-by (simp add: hypnat_le_add_diff_inverse hypnat_add_commute)
+lemma hypnat_le_add_diff_inverse2 [simp]: "!!m n. n\<le>m ==> (m-n)+n = (m::hypnat)"
+by transfer (rule le_add_diff_inverse2)
 
 declare hypnat_le_add_diff_inverse2 [OF order_less_imp_le]
 
-lemma hypnat_le0 [iff]: "(0::hypnat) \<le> n"
-by (simp add: linorder_not_less [symmetric])
+lemma hypnat_le0 [iff]: "!!n. (0::hypnat) \<le> n"
+by transfer (rule le0)
 
-lemma hypnat_add_self_le [simp]: "(x::hypnat) \<le> n + x"
-by (insert add_right_mono [of 0 n x], simp)
+lemma hypnat_add_self_le [simp]: "!!x n. (x::hypnat) \<le> n + x"
+by transfer (rule le_add2)
 
 lemma hypnat_add_one_self_less [simp]: "(x::hypnat) < x + (1::hypnat)"
 by (insert add_strict_left_mono [OF zero_less_one], auto)
@@ -494,10 +437,10 @@
 
 subsection{*Existence of an infinite hypernatural number*}
 
-lemma hypnat_omega: "hypnatrel``{%n::nat. n} \<in> hypnat"
+lemma hypnat_omega: "starrel``{%n::nat. n} \<in> star"
 by auto
 
-lemma Rep_hypnat_omega: "Rep_hypnat(whn) \<in> hypnat"
+lemma Rep_star_omega: "Rep_star(whn) \<in> star"
 by (simp add: hypnat_omega_def)
 
 text{*Existence of infinite number not corresponding to any natural number
@@ -530,7 +473,7 @@
 
 
 lemma hypnat_of_nat_eq:
-     "hypnat_of_nat m  = Abs_hypnat(hypnatrel``{%n::nat. m})"
+     "hypnat_of_nat m  = Abs_star(starrel``{%n::nat. m})"
 apply (induct m) 
 apply (simp_all add: hypnat_zero_def hypnat_one_def hypnat_add) 
 done
@@ -540,13 +483,7 @@
 
 lemma hypnat_omega_gt_SHNat:
      "n \<in> Nats ==> n < whn"
-apply (auto simp add: hypnat_of_nat_eq hypnat_less_def hypnat_le_def
-                      hypnat_omega_def SHNat_eq)
- prefer 2 apply (force dest: FreeUltrafilterNat_not_finite)
-apply (auto intro!: exI)
-apply (rule cofinite_mem_FreeUltrafilterNat)
-apply (simp add: Compl_Collect_le finite_nat_segment) 
-done
+by (auto simp add: hypnat_of_nat_eq hypnat_less hypnat_omega_def SHNat_eq)
 
 (* Infinite hypernatural not in embedded Nats *)
 lemma SHNAT_omega_not_mem [simp]: "whn \<notin> Nats"
@@ -595,7 +532,7 @@
 
 lemma HNatInfinite_iff: "HNatInfinite = {N. \<forall>n \<in> Nats. n < N}"
 apply (auto simp add: HNatInfinite_def SHNat_eq hypnat_of_nat_eq)
-apply (rule_tac z = x in eq_Abs_hypnat)
+apply (rule_tac z = x in eq_Abs_star)
 apply (auto elim: HNatInfinite_FreeUltrafilterNat_lemma 
             simp add: hypnat_less FreeUltrafilterNat_Compl_iff1 
                       Collect_neg_eq [symmetric])
@@ -607,24 +544,24 @@
 
 lemma HNatInfinite_FreeUltrafilterNat:
      "x \<in> HNatInfinite 
-      ==> \<exists>X \<in> Rep_hypnat x. \<forall>u. {n. u < X n}:  FreeUltrafilterNat"
-apply (cases x)
+      ==> \<exists>X \<in> Rep_star x. \<forall>u. {n. u < X n}:  FreeUltrafilterNat"
+apply (rule_tac z=x in eq_Abs_star)
 apply (auto simp add: HNatInfinite_iff SHNat_eq hypnat_of_nat_eq)
-apply (rule bexI [OF _ lemma_hypnatrel_refl], clarify) 
+apply (rule bexI [OF _ lemma_starrel_refl], clarify) 
 apply (auto simp add: hypnat_of_nat_def hypnat_less)
 done
 
 lemma FreeUltrafilterNat_HNatInfinite:
-     "\<exists>X \<in> Rep_hypnat x. \<forall>u. {n. u < X n}:  FreeUltrafilterNat
+     "\<exists>X \<in> Rep_star x. \<forall>u. {n. u < X n}:  FreeUltrafilterNat
       ==> x \<in> HNatInfinite"
-apply (cases x)
+apply (rule_tac z=x in eq_Abs_star)
 apply (auto simp add: hypnat_less HNatInfinite_iff SHNat_eq hypnat_of_nat_eq)
 apply (drule spec, ultra, auto) 
 done
 
 lemma HNatInfinite_FreeUltrafilterNat_iff:
      "(x \<in> HNatInfinite) = 
-      (\<exists>X \<in> Rep_hypnat x. \<forall>u. {n. u < X n}:  FreeUltrafilterNat)"
+      (\<exists>X \<in> Rep_star x. \<forall>u. {n. u < X n}:  FreeUltrafilterNat)"
 by (blast intro: HNatInfinite_FreeUltrafilterNat 
                  FreeUltrafilterNat_HNatInfinite)
 
@@ -692,7 +629,7 @@
 constdefs
   hypreal_of_hypnat :: "hypnat => hypreal"
    "hypreal_of_hypnat N  == 
-      Abs_star(\<Union>X \<in> Rep_hypnat(N). starrel``{%n::nat. real (X n)})"
+      Abs_star(\<Union>X \<in> Rep_star(N). starrel``{%n::nat. real (X n)})"
 
 
 lemma HNat_hypreal_of_nat [simp]: "hypreal_of_nat N \<in> Nats"
@@ -704,7 +641,7 @@
 by force
 
 lemma hypreal_of_hypnat:
-      "hypreal_of_hypnat (Abs_hypnat(hypnatrel``{%n. X n})) =
+      "hypreal_of_hypnat (Abs_star(starrel``{%n. X n})) =
        Abs_star(starrel `` {%n. real (X n)})"
 apply (simp add: hypreal_of_hypnat_def)
 apply (rule_tac f = Abs_star in arg_cong)
@@ -714,7 +651,7 @@
 
 lemma hypreal_of_hypnat_inject [simp]:
      "(hypreal_of_hypnat m = hypreal_of_hypnat n) = (m=n)"
-apply (cases m, cases n)
+apply (rule_tac z=m in eq_Abs_star, rule_tac z=n in eq_Abs_star)
 apply (auto simp add: hypreal_of_hypnat)
 done
 
@@ -726,19 +663,19 @@
 
 lemma hypreal_of_hypnat_add [simp]:
      "hypreal_of_hypnat (m + n) = hypreal_of_hypnat m + hypreal_of_hypnat n"
-apply (cases m, cases n)
+apply (rule_tac z=m in eq_Abs_star, rule_tac z=n in eq_Abs_star)
 apply (simp add: hypreal_of_hypnat hypreal_add hypnat_add real_of_nat_add)
 done
 
 lemma hypreal_of_hypnat_mult [simp]:
      "hypreal_of_hypnat (m * n) = hypreal_of_hypnat m * hypreal_of_hypnat n"
-apply (cases m, cases n)
+apply (rule_tac z=m in eq_Abs_star, rule_tac z=n in eq_Abs_star)
 apply (simp add: hypreal_of_hypnat hypreal_mult hypnat_mult real_of_nat_mult)
 done
 
 lemma hypreal_of_hypnat_less_iff [simp]:
      "(hypreal_of_hypnat n < hypreal_of_hypnat m) = (n < m)"
-apply (cases m, cases n)
+apply (rule_tac z=m in eq_Abs_star, rule_tac z=n in eq_Abs_star)
 apply (simp add: hypreal_of_hypnat hypreal_less hypnat_less)
 done
 
@@ -747,13 +684,13 @@
 declare hypreal_of_hypnat_eq_zero_iff [simp]
 
 lemma hypreal_of_hypnat_ge_zero [simp]: "0 \<le> hypreal_of_hypnat n"
-apply (cases n)
+apply (rule_tac z=n in eq_Abs_star)
 apply (simp add: hypreal_of_hypnat hypreal_zero_num hypreal_le)
 done
 
 lemma HNatInfinite_inverse_Infinitesimal [simp]:
      "n \<in> HNatInfinite ==> inverse (hypreal_of_hypnat n) \<in> Infinitesimal"
-apply (cases n)
+apply (rule_tac z=n in eq_Abs_star)
 apply (auto simp add: hypreal_of_hypnat hypreal_inverse 
       HNatInfinite_FreeUltrafilterNat_iff Infinitesimal_FreeUltrafilterNat_iff2)
 apply (rule bexI, rule_tac [2] lemma_starrel_refl, auto)
@@ -776,17 +713,17 @@
 val hypnat_one_def = thm"hypnat_one_def";
 val hypnat_omega_def = thm"hypnat_omega_def";
 
-val hypnatrel_iff = thm "hypnatrel_iff";
-val hypnatrel_in_hypnat = thm "hypnatrel_in_hypnat";
-val lemma_hypnatrel_refl = thm "lemma_hypnatrel_refl";
-val hypnat_empty_not_mem = thm "hypnat_empty_not_mem";
-val Rep_hypnat_nonempty = thm "Rep_hypnat_nonempty";
-val eq_Abs_hypnat = thm "eq_Abs_hypnat";
+val starrel_iff = thm "starrel_iff";
+(* val starrel_in_hypnat = thm "starrel_in_hypnat"; *)
+val lemma_starrel_refl = thm "lemma_starrel_refl";
+(* val hypnat_empty_not_mem = thm "hypnat_empty_not_mem"; *)
+(* val Rep_star_nonempty = thm "Rep_star_nonempty"; *)
+val eq_Abs_star = thm "eq_Abs_star";
 val hypnat_add = thm "hypnat_add";
 val hypnat_add_commute = thm "hypnat_add_commute";
 val hypnat_add_assoc = thm "hypnat_add_assoc";
 val hypnat_add_zero_left = thm "hypnat_add_zero_left";
-val hypnat_minus_congruent2 = thm "hypnat_minus_congruent2";
+(* val hypnat_minus_congruent2 = thm "hypnat_minus_congruent2"; *)
 val hypnat_minus = thm "hypnat_minus";
 val hypnat_minus_zero = thm "hypnat_minus_zero";
 val hypnat_diff_0_eq_0 = thm "hypnat_diff_0_eq_0";
@@ -798,7 +735,7 @@
 val hypnat_diff_cancel = thm "hypnat_diff_cancel";
 val hypnat_diff_cancel2 = thm "hypnat_diff_cancel2";
 val hypnat_diff_add_0 = thm "hypnat_diff_add_0";
-val hypnat_mult_congruent2 = thm "hypnat_mult_congruent2";
+(* val hypnat_mult_congruent2 = thm "hypnat_mult_congruent2"; *)
 val hypnat_mult = thm "hypnat_mult";
 val hypnat_mult_commute = thm "hypnat_mult_commute";
 val hypnat_mult_assoc = thm "hypnat_mult_assoc";
@@ -841,7 +778,7 @@
 val hypnat_of_nat_zero_iff = thm "hypnat_of_nat_zero_iff";
 val hypnat_of_nat_Suc = thm "hypnat_of_nat_Suc";
 val hypnat_omega = thm "hypnat_omega";
-val Rep_hypnat_omega = thm "Rep_hypnat_omega";
+val Rep_star_omega = thm "Rep_star_omega";
 val SHNAT_omega_not_mem = thm "SHNAT_omega_not_mem";
 val cofinite_mem_FreeUltrafilterNat = thm "cofinite_mem_FreeUltrafilterNat";
 val hypnat_omega_gt_SHNat = thm "hypnat_omega_gt_SHNat";




