src/HOL/Library/Extended_Real.thy
changeset 63968 4359400adfe7
parent 63952 354808e9f44b
child 64267 b9a1486e79be
equal deleted inserted replaced
63967:2aa42596edc3 63968:4359400adfe7
  2104   apply (subst SUP_ereal_add_left[symmetric, OF UNIV_not_empty assms(3)])
  2104   apply (subst SUP_ereal_add_left[symmetric, OF UNIV_not_empty assms(3)])
  2105   apply (subst (2) add.commute)
  2105   apply (subst (2) add.commute)
  2106   apply (rule SUP_combine[symmetric] ereal_add_mono inc[THEN monoD] | assumption)+
  2106   apply (rule SUP_combine[symmetric] ereal_add_mono inc[THEN monoD] | assumption)+
  2107   done
  2107   done
  2108 
  2108 
       
  2109 lemma INF_eq_minf: "(INF i:I. f i::ereal) \<noteq> -\<infinity> \<longleftrightarrow> (\<exists>b>-\<infinity>. \<forall>i\<in>I. b \<le> f i)"
       
  2110   unfolding bot_ereal_def[symmetric] INF_eq_bot_iff by (auto simp: not_less)
       
  2111 
       
  2112 lemma INF_ereal_add_left:
       
  2113   assumes "I \<noteq> {}" "c \<noteq> -\<infinity>" "\<And>x. x \<in> I \<Longrightarrow> 0 \<le> f x"
       
  2114   shows "(INF i:I. f i + c :: ereal) = (INF i:I. f i) + c"
       
  2115 proof -
       
  2116   have "(INF i:I. f i) \<noteq> -\<infinity>"
       
  2117     unfolding INF_eq_minf using assms by (intro exI[of _ 0]) auto
       
  2118   then show ?thesis
       
  2119     by (subst continuous_at_Inf_mono[where f="\<lambda>x. x + c"])
       
  2120        (auto simp: mono_def ereal_add_mono \<open>I \<noteq> {}\<close> \<open>c \<noteq> -\<infinity>\<close> continuous_at_imp_continuous_at_within continuous_at)
       
  2121 qed
       
  2122 
       
  2123 lemma INF_ereal_add_right:
       
  2124   assumes "I \<noteq> {}" "c \<noteq> -\<infinity>" "\<And>x. x \<in> I \<Longrightarrow> 0 \<le> f x"
       
  2125   shows "(INF i:I. c + f i :: ereal) = c + (INF i:I. f i)"
       
  2126   using INF_ereal_add_left[OF assms] by (simp add: ac_simps)
       
  2127 
       
  2128 lemma INF_ereal_add_directed:
       
  2129   fixes f g :: "'a \<Rightarrow> ereal"
       
  2130   assumes nonneg: "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i" "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> g i"
       
  2131   assumes directed: "\<And>i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> \<exists>k\<in>I. f i + g j \<ge> f k + g k"
       
  2132   shows "(INF i:I. f i + g i) = (INF i:I. f i) + (INF i:I. g i)"
       
  2133 proof cases
       
  2134   assume "I = {}" then show ?thesis
       
  2135     by (simp add: top_ereal_def)
       
  2136 next
       
  2137   assume "I \<noteq> {}"
       
  2138   show ?thesis
       
  2139   proof (rule antisym)
       
  2140     show "(INF i:I. f i) + (INF i:I. g i) \<le> (INF i:I. f i + g i)"
       
  2141       by (rule INF_greatest; intro ereal_add_mono INF_lower)
       
  2142   next
       
  2143     have "(INF i:I. f i + g i) \<le> (INF i:I. (INF j:I. f i + g j))"
       
  2144       using directed by (intro INF_greatest) (blast intro: INF_lower2)
       
  2145     also have "\<dots> = (INF i:I. f i + (INF i:I. g i))"
       
  2146       using nonneg by (intro INF_cong refl INF_ereal_add_right \<open>I \<noteq> {}\<close>) (auto simp: INF_eq_minf intro!: exI[of _ 0])
       
  2147     also have "\<dots> = (INF i:I. f i) + (INF i:I. g i)"
       
  2148       using nonneg by (intro INF_ereal_add_left \<open>I \<noteq> {}\<close>) (auto simp: INF_eq_minf intro!: exI[of _ 0])
       
  2149     finally show "(INF i:I. f i + g i) \<le> (INF i:I. f i) + (INF i:I. g i)" .
       
  2150   qed
       
  2151 qed
       
  2152 
  2109 lemma INF_ereal_add:
  2153 lemma INF_ereal_add:
  2110   fixes f :: "nat \<Rightarrow> ereal"
  2154   fixes f :: "nat \<Rightarrow> ereal"
  2111   assumes "decseq f" "decseq g"
  2155   assumes "decseq f" "decseq g"
  2112     and fin: "\<And>i. f i \<noteq> \<infinity>" "\<And>i. g i \<noteq> \<infinity>"
  2156     and fin: "\<And>i. f i \<noteq> \<infinity>" "\<And>i. g i \<noteq> \<infinity>"
  2113   shows "(INF i. f i + g i) = INFIMUM UNIV f + INFIMUM UNIV g"
  2157   shows "(INF i. f i + g i) = INFIMUM UNIV f + INFIMUM UNIV g"