equal
deleted
inserted
replaced
11 theory Extended_Real |
11 theory Extended_Real |
12 imports Complex_Main Extended_Nat Liminf_Limsup |
12 imports Complex_Main Extended_Nat Liminf_Limsup |
13 begin |
13 begin |
14 |
14 |
15 text \<open> |
15 text \<open> |
16 This should be part of @{theory "HOL-Library.Extended_Nat"} or @{theory |
16 This should be part of \<^theory>\<open>HOL-Library.Extended_Nat\<close> or \<^theory>\<open>HOL-Library.Order_Continuity\<close>, but then the AFP-entry \<open>Jinja_Thread\<close> fails, as it does overload |
17 "HOL-Library.Order_Continuity"}, but then the AFP-entry \<open>Jinja_Thread\<close> fails, as it does overload |
17 certain named from \<^theory>\<open>Complex_Main\<close>. |
18 certain named from @{theory Complex_Main}. |
|
19 \<close> |
18 \<close> |
20 |
19 |
21 lemma incseq_sumI2: |
20 lemma incseq_sumI2: |
22 fixes f :: "'i \<Rightarrow> nat \<Rightarrow> 'a::ordered_comm_monoid_add" |
21 fixes f :: "'i \<Rightarrow> nat \<Rightarrow> 'a::ordered_comm_monoid_add" |
23 shows "(\<And>n. n \<in> A \<Longrightarrow> mono (f n)) \<Longrightarrow> mono (\<lambda>i. \<Sum>n\<in>A. f n i)" |
22 shows "(\<And>n. n \<in> A \<Longrightarrow> mono (f n)) \<Longrightarrow> mono (\<lambda>i. \<Sum>n\<in>A. f n i)" |
466 shows "real_of_ereal (a + b) = |
465 shows "real_of_ereal (a + b) = |
467 (if (\<bar>a\<bar> = \<infinity>) \<and> (\<bar>b\<bar> = \<infinity>) \<or> (\<bar>a\<bar> \<noteq> \<infinity>) \<and> (\<bar>b\<bar> \<noteq> \<infinity>) then real_of_ereal a + real_of_ereal b else 0)" |
466 (if (\<bar>a\<bar> = \<infinity>) \<and> (\<bar>b\<bar> = \<infinity>) \<or> (\<bar>a\<bar> \<noteq> \<infinity>) \<and> (\<bar>b\<bar> \<noteq> \<infinity>) then real_of_ereal a + real_of_ereal b else 0)" |
468 by (cases rule: ereal2_cases[of a b]) auto |
467 by (cases rule: ereal2_cases[of a b]) auto |
469 |
468 |
470 |
469 |
471 subsubsection "Linear order on @{typ ereal}" |
470 subsubsection "Linear order on \<^typ>\<open>ereal\<close>" |
472 |
471 |
473 instantiation ereal :: linorder |
472 instantiation ereal :: linorder |
474 begin |
473 begin |
475 |
474 |
476 function less_ereal |
475 function less_ereal |
2538 |
2537 |
2539 lemma SUP_countable_SUP: |
2538 lemma SUP_countable_SUP: |
2540 "A \<noteq> {} \<Longrightarrow> \<exists>f::nat \<Rightarrow> ereal. range f \<subseteq> g`A \<and> Sup (g ` A) = Sup (f ` UNIV)" |
2539 "A \<noteq> {} \<Longrightarrow> \<exists>f::nat \<Rightarrow> ereal. range f \<subseteq> g`A \<and> Sup (g ` A) = Sup (f ` UNIV)" |
2541 using Sup_countable_SUP [of "g`A"] by auto |
2540 using Sup_countable_SUP [of "g`A"] by auto |
2542 |
2541 |
2543 subsection "Relation to @{typ enat}" |
2542 subsection "Relation to \<^typ>\<open>enat\<close>" |
2544 |
2543 |
2545 definition "ereal_of_enat n = (case n of enat n \<Rightarrow> ereal (real n) | \<infinity> \<Rightarrow> \<infinity>)" |
2544 definition "ereal_of_enat n = (case n of enat n \<Rightarrow> ereal (real n) | \<infinity> \<Rightarrow> \<infinity>)" |
2546 |
2545 |
2547 declare [[coercion "ereal_of_enat :: enat \<Rightarrow> ereal"]] |
2546 declare [[coercion "ereal_of_enat :: enat \<Rightarrow> ereal"]] |
2548 declare [[coercion "(\<lambda>n. ereal (real n)) :: nat \<Rightarrow> ereal"]] |
2547 declare [[coercion "(\<lambda>n. ereal (real n)) :: nat \<Rightarrow> ereal"]] |
2627 |
2626 |
2628 lemma ereal_of_enat_SUP: |
2627 lemma ereal_of_enat_SUP: |
2629 "A \<noteq> {} \<Longrightarrow> ereal_of_enat (SUP a\<in>A. f a) = (SUP a \<in> A. ereal_of_enat (f a))" |
2628 "A \<noteq> {} \<Longrightarrow> ereal_of_enat (SUP a\<in>A. f a) = (SUP a \<in> A. ereal_of_enat (f a))" |
2630 using ereal_of_enat_Sup[of "f`A"] by auto |
2629 using ereal_of_enat_Sup[of "f`A"] by auto |
2631 |
2630 |
2632 subsection "Limits on @{typ ereal}" |
2631 subsection "Limits on \<^typ>\<open>ereal\<close>" |
2633 |
2632 |
2634 lemma open_PInfty: "open A \<Longrightarrow> \<infinity> \<in> A \<Longrightarrow> (\<exists>x. {ereal x<..} \<subseteq> A)" |
2633 lemma open_PInfty: "open A \<Longrightarrow> \<infinity> \<in> A \<Longrightarrow> (\<exists>x. {ereal x<..} \<subseteq> A)" |
2635 unfolding open_ereal_generated |
2634 unfolding open_ereal_generated |
2636 proof (induct rule: generate_topology.induct) |
2635 proof (induct rule: generate_topology.induct) |
2637 case (Int A B) |
2636 case (Int A B) |