equal
deleted
inserted
replaced
129 lemma ereal_infinity_cases: "(a::ereal) \<noteq> \<infinity> \<Longrightarrow> a \<noteq> -\<infinity> \<Longrightarrow> \<bar>a\<bar> \<noteq> \<infinity>" |
129 lemma ereal_infinity_cases: "(a::ereal) \<noteq> \<infinity> \<Longrightarrow> a \<noteq> -\<infinity> \<Longrightarrow> \<bar>a\<bar> \<noteq> \<infinity>" |
130 by auto |
130 by auto |
131 |
131 |
132 subsubsection "Addition" |
132 subsubsection "Addition" |
133 |
133 |
134 instantiation ereal :: comm_monoid_add |
134 instantiation ereal :: "{one, comm_monoid_add}" |
135 begin |
135 begin |
136 |
136 |
137 definition "0 = ereal 0" |
137 definition "0 = ereal 0" |
|
138 definition "1 = ereal 1" |
138 |
139 |
139 function plus_ereal where |
140 function plus_ereal where |
140 "ereal r + ereal p = ereal (r + p)" | |
141 "ereal r + ereal p = ereal (r + p)" | |
141 "\<infinity> + a = (\<infinity>::ereal)" | |
142 "\<infinity> + a = (\<infinity>::ereal)" | |
142 "a + \<infinity> = (\<infinity>::ereal)" | |
143 "a + \<infinity> = (\<infinity>::ereal)" | |
171 show "a + b + c = a + (b + c)" |
172 show "a + b + c = a + (b + c)" |
172 by (cases rule: ereal3_cases[of a b c]) simp_all |
173 by (cases rule: ereal3_cases[of a b c]) simp_all |
173 qed |
174 qed |
174 end |
175 end |
175 |
176 |
|
177 instance ereal :: numeral .. |
|
178 |
176 lemma real_of_ereal_0[simp]: "real (0::ereal) = 0" |
179 lemma real_of_ereal_0[simp]: "real (0::ereal) = 0" |
177 unfolding real_of_ereal_def zero_ereal_def by simp |
180 unfolding real_of_ereal_def zero_ereal_def by simp |
178 |
181 |
179 lemma abs_ereal_zero[simp]: "\<bar>0\<bar> = (0::ereal)" |
182 lemma abs_ereal_zero[simp]: "\<bar>0\<bar> = (0::ereal)" |
180 unfolding zero_ereal_def abs_ereal.simps by simp |
183 unfolding zero_ereal_def abs_ereal.simps by simp |
472 subsubsection "Multiplication" |
475 subsubsection "Multiplication" |
473 |
476 |
474 instantiation ereal :: "{comm_monoid_mult, sgn}" |
477 instantiation ereal :: "{comm_monoid_mult, sgn}" |
475 begin |
478 begin |
476 |
479 |
477 definition "1 = ereal 1" |
480 function sgn_ereal :: "ereal \<Rightarrow> ereal" where |
478 |
|
479 function sgn_ereal where |
|
480 "sgn (ereal r) = ereal (sgn r)" |
481 "sgn (ereal r) = ereal (sgn r)" |
481 | "sgn (\<infinity>::ereal) = 1" |
482 | "sgn (\<infinity>::ereal) = 1" |
482 | "sgn (-\<infinity>::ereal) = -1" |
483 | "sgn (-\<infinity>::ereal) = -1" |
483 by (auto intro: ereal_cases) |
484 by (auto intro: ereal_cases) |
484 termination proof qed (rule wf_empty) |
485 termination proof qed (rule wf_empty) |
658 fixes a b c :: ereal |
659 fixes a b c :: ereal |
659 assumes "a \<noteq> \<infinity> \<or> b \<noteq> -\<infinity>" "a \<noteq> -\<infinity> \<or> b \<noteq> \<infinity>" "\<bar>c\<bar> \<noteq> \<infinity>" |
660 assumes "a \<noteq> \<infinity> \<or> b \<noteq> -\<infinity>" "a \<noteq> -\<infinity> \<or> b \<noteq> \<infinity>" "\<bar>c\<bar> \<noteq> \<infinity>" |
660 shows "(a + b) * c = a * c + b * c" |
661 shows "(a + b) * c = a * c + b * c" |
661 using assms |
662 using assms |
662 by (cases rule: ereal3_cases[of a b c]) (simp_all add: field_simps) |
663 by (cases rule: ereal3_cases[of a b c]) (simp_all add: field_simps) |
663 |
|
664 instance ereal :: numeral .. |
|
665 |
664 |
666 lemma numeral_eq_ereal [simp]: "numeral w = ereal (numeral w)" |
665 lemma numeral_eq_ereal [simp]: "numeral w = ereal (numeral w)" |
667 apply (induct w rule: num_induct) |
666 apply (induct w rule: num_induct) |
668 apply (simp only: numeral_One one_ereal_def) |
667 apply (simp only: numeral_One one_ereal_def) |
669 apply (simp only: numeral_inc ereal_plus_1) |
668 apply (simp only: numeral_inc ereal_plus_1) |
1809 |
1808 |
1810 lemma Lim_bounded_PInfty2: |
1809 lemma Lim_bounded_PInfty2: |
1811 "f ----> l \<Longrightarrow> ALL n>=N. f n <= ereal B \<Longrightarrow> l ~= \<infinity>" |
1810 "f ----> l \<Longrightarrow> ALL n>=N. f n <= ereal B \<Longrightarrow> l ~= \<infinity>" |
1812 using LIMSEQ_le_const2[of f l "ereal B"] by fastforce |
1811 using LIMSEQ_le_const2[of f l "ereal B"] by fastforce |
1813 |
1812 |
1814 lemma Lim_bounded_ereal: "f ----> (l :: ereal) \<Longrightarrow> ALL n>=M. f n <= C \<Longrightarrow> l<=C" |
1813 lemma Lim_bounded_ereal: "f ----> (l :: 'a::linorder_topology) \<Longrightarrow> ALL n>=M. f n <= C \<Longrightarrow> l<=C" |
1815 by (intro LIMSEQ_le_const2) auto |
1814 by (intro LIMSEQ_le_const2) auto |
|
1815 |
|
1816 lemma Lim_bounded2_ereal: |
|
1817 assumes lim:"f ----> (l :: 'a::linorder_topology)" and ge: "ALL n>=N. f n >= C" |
|
1818 shows "l>=C" |
|
1819 using ge |
|
1820 by (intro tendsto_le[OF trivial_limit_sequentially lim tendsto_const]) |
|
1821 (auto simp: eventually_sequentially) |
1816 |
1822 |
1817 lemma real_of_ereal_mult[simp]: |
1823 lemma real_of_ereal_mult[simp]: |
1818 fixes a b :: ereal shows "real (a * b) = real a * real b" |
1824 fixes a b :: ereal shows "real (a * b) = real a * real b" |
1819 by (cases rule: ereal2_cases[of a b]) auto |
1825 by (cases rule: ereal2_cases[of a b]) auto |
1820 |
1826 |