225 |
225 |
226 subsection{*Properties of @{term hyprel}*} |
226 subsection{*Properties of @{term hyprel}*} |
227 |
227 |
228 text{*Proving that @{term hyprel} is an equivalence relation*} |
228 text{*Proving that @{term hyprel} is an equivalence relation*} |
229 |
229 |
230 lemma hyprel_iff: "((X,Y): hyprel) = ({n. X n = Y n}: FreeUltrafilterNat)" |
230 lemma hyprel_iff: "((X,Y) \<in> hyprel) = ({n. X n = Y n}: FreeUltrafilterNat)" |
231 by (unfold hyprel_def, fast) |
231 by (unfold hyprel_def, fast) |
232 |
232 |
233 lemma hyprel_refl: "(x,x): hyprel" |
233 lemma hyprel_refl: "(x,x) \<in> hyprel" |
234 apply (unfold hyprel_def) |
234 apply (unfold hyprel_def) |
235 apply (auto simp add: FreeUltrafilterNat_Nat_set) |
235 apply (auto simp add: FreeUltrafilterNat_Nat_set) |
236 done |
236 done |
237 |
237 |
238 lemma hyprel_sym [rule_format (no_asm)]: "(x,y): hyprel --> (y,x):hyprel" |
238 lemma hyprel_sym [rule_format (no_asm)]: "(x,y) \<in> hyprel --> (y,x) \<in> hyprel" |
239 by (simp add: hyprel_def eq_commute) |
239 by (simp add: hyprel_def eq_commute) |
240 |
240 |
241 lemma hyprel_trans: |
241 lemma hyprel_trans: |
242 "[|(x,y): hyprel; (y,z):hyprel|] ==> (x,z):hyprel" |
242 "[|(x,y) \<in> hyprel; (y,z) \<in> hyprel|] ==> (x,z) \<in> hyprel" |
243 apply (unfold hyprel_def, auto, ultra) |
243 by (unfold hyprel_def, auto, ultra) |
244 done |
|
245 |
244 |
246 lemma equiv_hyprel: "equiv UNIV hyprel" |
245 lemma equiv_hyprel: "equiv UNIV hyprel" |
247 apply (simp add: equiv_def refl_def sym_def trans_def hyprel_refl) |
246 apply (simp add: equiv_def refl_def sym_def trans_def hyprel_refl) |
248 apply (blast intro: hyprel_sym hyprel_trans) |
247 apply (blast intro: hyprel_sym hyprel_trans) |
249 done |
248 done |
586 done |
585 done |
587 |
586 |
588 lemma hypreal_neq_iff: "((w::hypreal) \<noteq> z) = (w<z | z<w)" |
587 lemma hypreal_neq_iff: "((w::hypreal) \<noteq> z) = (w<z | z<w)" |
589 by (cut_tac hypreal_linear, blast) |
588 by (cut_tac hypreal_linear, blast) |
590 |
589 |
591 lemma hypreal_linear_less2: "!!(x::hypreal). [| x < y ==> P; x = y ==> P; |
|
592 y < x ==> P |] ==> P" |
|
593 apply (cut_tac x = x and y = y in hypreal_linear, auto) |
|
594 done |
|
595 |
|
596 |
590 |
597 subsection{*Properties of The @{text "\<le>"} Relation*} |
591 subsection{*Properties of The @{text "\<le>"} Relation*} |
598 |
592 |
599 lemma hypreal_le: |
593 lemma hypreal_le: |
600 "(Abs_hypreal(hyprel``{%n. X n}) <= |
594 "(Abs_hypreal(hyprel``{%n. X n}) \<le> Abs_hypreal(hyprel``{%n. Y n})) = |
601 Abs_hypreal(hyprel``{%n. Y n})) = |
595 ({n. X n \<le> Y n} \<in> FreeUltrafilterNat)" |
602 ({n. X n <= Y n} \<in> FreeUltrafilterNat)" |
596 apply (auto simp add: hypreal_less hypreal_le_def linorder_not_less[symmetric]) |
603 apply (unfold hypreal_le_def real_le_def) |
|
604 apply (auto simp add: hypreal_less) |
|
605 apply (ultra+) |
597 apply (ultra+) |
606 done |
598 done |
607 |
599 |
608 lemma hypreal_le_imp_less_or_eq: "!!(x::hypreal). x <= y ==> x < y | x = y" |
600 lemma hypreal_le_imp_less_or_eq: "!!(x::hypreal). x \<le> y ==> x < y | x = y" |
609 apply (unfold hypreal_le_def) |
601 apply (unfold hypreal_le_def) |
610 apply (cut_tac hypreal_linear) |
602 apply (cut_tac hypreal_linear) |
611 apply (fast elim: hypreal_less_irrefl hypreal_less_asym) |
603 apply (fast elim: hypreal_less_irrefl hypreal_less_asym) |
612 done |
604 done |
613 |
605 |
614 lemma hypreal_less_or_eq_imp_le: "z<w | z=w ==> z <=(w::hypreal)" |
606 lemma hypreal_less_or_eq_imp_le: "z<w | z=w ==> z \<le>(w::hypreal)" |
615 apply (unfold hypreal_le_def) |
607 apply (unfold hypreal_le_def) |
616 apply (cut_tac hypreal_linear) |
608 apply (cut_tac hypreal_linear) |
617 apply (fast elim: hypreal_less_irrefl hypreal_less_asym) |
609 apply (fast elim: hypreal_less_irrefl hypreal_less_asym) |
618 done |
610 done |
619 |
611 |
620 lemma hypreal_le_eq_less_or_eq: "(x <= (y::hypreal)) = (x < y | x=y)" |
612 lemma hypreal_le_eq_less_or_eq: "(x \<le> (y::hypreal)) = (x < y | x=y)" |
621 by (blast intro!: hypreal_less_or_eq_imp_le dest: hypreal_le_imp_less_or_eq) |
613 by (blast intro!: hypreal_less_or_eq_imp_le dest: hypreal_le_imp_less_or_eq) |
622 |
614 |
623 lemmas hypreal_le_less = hypreal_le_eq_less_or_eq |
615 lemmas hypreal_le_less = hypreal_le_eq_less_or_eq |
624 |
616 |
625 lemma hypreal_le_refl: "w <= (w::hypreal)" |
617 lemma hypreal_le_refl: "w \<le> (w::hypreal)" |
626 by (simp add: hypreal_le_eq_less_or_eq) |
618 by (simp add: hypreal_le_eq_less_or_eq) |
627 |
619 |
628 (* Axiom 'linorder_linear' of class 'linorder': *) |
620 (* Axiom 'linorder_linear' of class 'linorder': *) |
629 lemma hypreal_le_linear: "(z::hypreal) <= w | w <= z" |
621 lemma hypreal_le_linear: "(z::hypreal) \<le> w | w \<le> z" |
630 apply (simp add: hypreal_le_less) |
622 apply (simp add: hypreal_le_less) |
631 apply (cut_tac hypreal_linear, blast) |
623 apply (cut_tac hypreal_linear, blast) |
632 done |
624 done |
633 |
625 |
634 lemma hypreal_le_trans: "[| i <= j; j <= k |] ==> i <= (k::hypreal)" |
626 lemma hypreal_le_trans: "[| i \<le> j; j \<le> k |] ==> i \<le> (k::hypreal)" |
635 apply (drule hypreal_le_imp_less_or_eq) |
627 apply (drule hypreal_le_imp_less_or_eq) |
636 apply (drule hypreal_le_imp_less_or_eq) |
628 apply (drule hypreal_le_imp_less_or_eq) |
637 apply (rule hypreal_less_or_eq_imp_le) |
629 apply (rule hypreal_less_or_eq_imp_le) |
638 apply (blast intro: hypreal_less_trans) |
630 apply (blast intro: hypreal_less_trans) |
639 done |
631 done |
640 |
632 |
641 lemma hypreal_le_anti_sym: "[| z <= w; w <= z |] ==> z = (w::hypreal)" |
633 lemma hypreal_le_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::hypreal)" |
642 apply (drule hypreal_le_imp_less_or_eq) |
634 apply (drule hypreal_le_imp_less_or_eq) |
643 apply (drule hypreal_le_imp_less_or_eq) |
635 apply (drule hypreal_le_imp_less_or_eq) |
644 apply (fast elim: hypreal_less_irrefl hypreal_less_asym) |
636 apply (fast elim: hypreal_less_irrefl hypreal_less_asym) |
645 done |
637 done |
646 |
638 |
647 (* Axiom 'order_less_le' of class 'order': *) |
639 (* Axiom 'order_less_le' of class 'order': *) |
648 lemma hypreal_less_le: "((w::hypreal) < z) = (w <= z & w \<noteq> z)" |
640 lemma hypreal_less_le: "((w::hypreal) < z) = (w \<le> z & w \<noteq> z)" |
649 apply (simp add: hypreal_le_def hypreal_neq_iff) |
641 apply (simp add: hypreal_le_def hypreal_neq_iff) |
650 apply (blast intro: hypreal_less_asym) |
642 apply (blast intro: hypreal_less_asym) |
651 done |
643 done |
652 |
644 |
653 instance hypreal :: order |
645 instance hypreal :: order |
792 apply (rule_tac [3] x = "%n. z2" in exI, auto) |
784 apply (rule_tac [3] x = "%n. z2" in exI, auto) |
793 apply (rule FreeUltrafilterNat_P, ultra) |
785 apply (rule FreeUltrafilterNat_P, ultra) |
794 done |
786 done |
795 |
787 |
796 lemma hypreal_of_real_le_iff [simp]: |
788 lemma hypreal_of_real_le_iff [simp]: |
797 "(hypreal_of_real z1 <= hypreal_of_real z2) = (z1 <= z2)" |
789 "(hypreal_of_real z1 \<le> hypreal_of_real z2) = (z1 \<le> z2)" |
798 apply (unfold hypreal_le_def real_le_def, auto) |
790 by (force simp add: hypreal_less hypreal_le_def linorder_not_less[symmetric]) |
799 done |
|
800 |
791 |
801 lemma hypreal_of_real_eq_iff [simp]: |
792 lemma hypreal_of_real_eq_iff [simp]: |
802 "(hypreal_of_real z1 = hypreal_of_real z2) = (z1 = z2)" |
793 "(hypreal_of_real z1 = hypreal_of_real z2) = (z1 = z2)" |
803 by (force intro: order_antisym hypreal_of_real_le_iff [THEN iffD1]) |
794 by (force intro: order_antisym hypreal_of_real_le_iff [THEN iffD1]) |
804 |
795 |
950 val hypreal_eq_minus_iff = thm "hypreal_eq_minus_iff"; |
941 val hypreal_eq_minus_iff = thm "hypreal_eq_minus_iff"; |
951 val hypreal_eq_minus_iff2 = thm "hypreal_eq_minus_iff2"; |
942 val hypreal_eq_minus_iff2 = thm "hypreal_eq_minus_iff2"; |
952 val hypreal_eq_minus_iff3 = thm "hypreal_eq_minus_iff3"; |
943 val hypreal_eq_minus_iff3 = thm "hypreal_eq_minus_iff3"; |
953 val hypreal_not_eq_minus_iff = thm "hypreal_not_eq_minus_iff"; |
944 val hypreal_not_eq_minus_iff = thm "hypreal_not_eq_minus_iff"; |
954 val hypreal_linear = thm "hypreal_linear"; |
945 val hypreal_linear = thm "hypreal_linear"; |
955 val hypreal_neq_iff = thm "hypreal_neq_iff"; |
|
956 val hypreal_linear_less2 = thm "hypreal_linear_less2"; |
|
957 val hypreal_le = thm "hypreal_le"; |
946 val hypreal_le = thm "hypreal_le"; |
958 val hypreal_le_imp_less_or_eq = thm "hypreal_le_imp_less_or_eq"; |
947 val hypreal_le_imp_less_or_eq = thm "hypreal_le_imp_less_or_eq"; |
959 val hypreal_le_eq_less_or_eq = thm "hypreal_le_eq_less_or_eq"; |
948 val hypreal_le_eq_less_or_eq = thm "hypreal_le_eq_less_or_eq"; |
960 val hypreal_le_refl = thm "hypreal_le_refl"; |
949 val hypreal_le_refl = thm "hypreal_le_refl"; |
961 val hypreal_le_linear = thm "hypreal_le_linear"; |
950 val hypreal_le_linear = thm "hypreal_le_linear"; |