src/HOL/ex/HarmonicSeries.thy
changeset 72221 98ef41a82b73
parent 70113 c8deb8ba6d05
equal deleted inserted replaced
72220:bb29e4eb938d 72221:98ef41a82b73
   278   let ?s = "suminf ?f" \<comment> \<open>let ?s equal the sum of the harmonic series\<close>
   278   let ?s = "suminf ?f" \<comment> \<open>let ?s equal the sum of the harmonic series\<close>
   279   assume sf: "summable ?f"
   279   assume sf: "summable ?f"
   280   then obtain n::nat where ndef: "n = nat \<lceil>2 * ?s\<rceil>" by simp
   280   then obtain n::nat where ndef: "n = nat \<lceil>2 * ?s\<rceil>" by simp
   281   then have ngt: "1 + real n/2 > ?s" by linarith
   281   then have ngt: "1 + real n/2 > ?s" by linarith
   282   define j where "j = (2::nat)^n"
   282   define j where "j = (2::nat)^n"
   283   have "\<forall>m\<ge>j. 0 < ?f m" by simp
   283   have "(\<Sum>i<j. ?f i) < ?s" 
   284   with sf have "(\<Sum>i<j. ?f i) < ?s" by (rule sum_less_suminf)
   284     using sf by (simp add: sum_less_suminf)
   285   then have "(\<Sum>i\<in>{Suc 0..<Suc j}. 1/(real i)) < ?s"
   285   then have "(\<Sum>i\<in>{Suc 0..<Suc j}. 1/(real i)) < ?s"
   286     unfolding sum.shift_bounds_Suc_ivl by (simp add: atLeast0LessThan)
   286     unfolding sum.shift_bounds_Suc_ivl by (simp add: atLeast0LessThan)
   287   with j_def have
   287   with j_def have
   288     "(\<Sum>i\<in>{1..< Suc ((2::nat)^n)}. 1 / (real i)) < ?s" by simp
   288     "(\<Sum>i\<in>{1..< Suc ((2::nat)^n)}. 1 / (real i)) < ?s" by simp
   289   then have
   289   then have