[STATEMENT]
lemma infsetsum_nonneg_is_SUPREMUM_ennreal:
  fixes f :: "'a \<Rightarrow> real"
  assumes summable: "f abs_summable_on A"
    and fnn: "\<And>x. x\<in>A \<Longrightarrow> f x \<ge> 0"
  shows "ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. (ennreal (sum f F)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have sum_F_A: "sum f F \<le> infsetsum f A"
    if "F \<in> {F. finite F \<and> F \<subseteq> A}"
    for F
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f F \<le> infsetsum f A
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f F \<le> infsetsum f A
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
F \<in> {F. finite F \<and> F \<subseteq> A}
[PROOF STEP]
have "finite F" and "F \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
F \<in> {F. finite F \<and> F \<subseteq> A}

goal (1 subgoal):
 1. finite F &&& F \<subseteq> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite F
F \<subseteq> A

goal (1 subgoal):
 1. sum f F \<le> infsetsum f A
[PROOF STEP]
from \<open>finite F\<close>
[PROOF STATE]
proof (chain)
picking this:
finite F
[PROOF STEP]
have "sum f F = infsetsum f F"
[PROOF STATE]
proof (prove)
using this:
finite F

goal (1 subgoal):
 1. sum f F = infsetsum f F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum f F = infsetsum f F

goal (1 subgoal):
 1. sum f F \<le> infsetsum f A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f F = infsetsum f F

goal (1 subgoal):
 1. sum f F \<le> infsetsum f A
[PROOF STEP]
have "\<dots> \<le> infsetsum f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f F \<le> infsetsum f A
[PROOF STEP]
proof (rule infsetsum_mono_neutral_left)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. f abs_summable_on F
 2. f abs_summable_on A
 3. \<And>x. x \<in> F \<Longrightarrow> f x \<le> f x
 4. F \<subseteq> A
 5. \<And>x. x \<in> A - F \<Longrightarrow> 0 \<le> f x
[PROOF STEP]
show "f abs_summable_on F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f abs_summable_on F
[PROOF STEP]
by (simp add: \<open>finite F\<close>)
[PROOF STATE]
proof (state)
this:
f abs_summable_on F

goal (4 subgoals):
 1. f abs_summable_on A
 2. \<And>x. x \<in> F \<Longrightarrow> f x \<le> f x
 3. F \<subseteq> A
 4. \<And>x. x \<in> A - F \<Longrightarrow> 0 \<le> f x
[PROOF STEP]
show "f abs_summable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f abs_summable_on A
[PROOF STEP]
by (simp add: local.summable)
[PROOF STATE]
proof (state)
this:
f abs_summable_on A

goal (3 subgoals):
 1. \<And>x. x \<in> F \<Longrightarrow> f x \<le> f x
 2. F \<subseteq> A
 3. \<And>x. x \<in> A - F \<Longrightarrow> 0 \<le> f x
[PROOF STEP]
show "f x \<le> f x"
        if "x \<in> F"
        for x :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<le> f x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?x \<in> F \<Longrightarrow> f ?x \<le> f ?x

goal (2 subgoals):
 1. F \<subseteq> A
 2. \<And>x. x \<in> A - F \<Longrightarrow> 0 \<le> f x
[PROOF STEP]
show "F \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<subseteq> A
[PROOF STEP]
by (simp add: \<open>F \<subseteq> A\<close>)
[PROOF STATE]
proof (state)
this:
F \<subseteq> A

goal (1 subgoal):
 1. \<And>x. x \<in> A - F \<Longrightarrow> 0 \<le> f x
[PROOF STEP]
show "0 \<le> f x"
        if "x \<in> A - F"
        for x :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> f x
[PROOF STEP]
using that fnn
[PROOF STATE]
proof (prove)
using this:
x \<in> A - F
?x \<in> A \<Longrightarrow> 0 \<le> f ?x

goal (1 subgoal):
 1. 0 \<le> f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> A - F \<Longrightarrow> 0 \<le> f ?x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
infsetsum f F \<le> infsetsum f A

goal (1 subgoal):
 1. sum f F \<le> infsetsum f A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f F \<le> infsetsum f A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum f F \<le> infsetsum f A

goal (1 subgoal):
 1. sum f F \<le> infsetsum f A
[PROOF STEP]
by assumption
[PROOF STATE]
proof (state)
this:
sum f F \<le> infsetsum f A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?F \<in> {F. finite F \<and> F \<subseteq> A} \<Longrightarrow> sum f ?F \<le> infsetsum f A

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
hence geq: "ennreal (infsetsum f A) \<ge> (SUP F\<in>{G. finite G \<and> G \<subseteq> A}. (ennreal (sum f F)))"
[PROOF STATE]
proof (prove)
using this:
?F \<in> {F. finite F \<and> F \<subseteq> A} \<Longrightarrow> sum f ?F \<le> infsetsum f A

goal (1 subgoal):
 1. (SUP F\<in>{G. finite G \<and> G \<subseteq> A}. ennreal (sum f F)) \<le> ennreal (infsetsum f A)
[PROOF STEP]
by (meson SUP_least ennreal_leI)
[PROOF STATE]
proof (state)
this:
(SUP F\<in>{G. finite G \<and> G \<subseteq> A}. ennreal (sum f F)) \<le> ennreal (infsetsum f A)

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
define fe where "fe x = ennreal (f x)" for x
[PROOF STATE]
proof (state)
this:
fe ?x = ennreal (f ?x)

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have sum_f_int: "infsetsum f A = \<integral>\<^sup>+ x. fe x \<partial>(count_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (infsetsum f A) = integral\<^sup>N (count_space A) fe
[PROOF STEP]
unfolding infsetsum_def fe_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (integral\<^sup>L (count_space A) f) = \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A
[PROOF STEP]
proof (rule nn_integral_eq_integral [symmetric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable (count_space A) f
 2. AE x in count_space A. 0 \<le> f x
[PROOF STEP]
show "integrable (count_space A) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (count_space A) f
[PROOF STEP]
using abs_summable_on_def local.summable
[PROOF STATE]
proof (prove)
using this:
(?f abs_summable_on ?A) = integrable (count_space ?A) ?f
f abs_summable_on A

goal (1 subgoal):
 1. integrable (count_space A) f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integrable (count_space A) f

goal (1 subgoal):
 1. AE x in count_space A. 0 \<le> f x
[PROOF STEP]
show "AE x in count_space A. 0 \<le> f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in count_space A. 0 \<le> f x
[PROOF STEP]
using fnn
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> 0 \<le> f ?x

goal (1 subgoal):
 1. AE x in count_space A. 0 \<le> f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in count_space A. 0 \<le> f x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ennreal (infsetsum f A) = integral\<^sup>N (count_space A) fe

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (infsetsum f A) = integral\<^sup>N (count_space A) fe

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "\<dots> = (SUP g \<in> {g. finite (g`A) \<and> g \<le> fe}. integral\<^sup>S (count_space A) g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space A) fe = Sup (integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe})
[PROOF STEP]
unfolding nn_integral_def simple_function_count_space
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe}) = Sup (integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space A) fe = Sup (integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe})

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space A) fe = Sup (integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe})

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "\<dots> \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. (ennreal (sum f F)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe}) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
proof (rule Sup_least)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
assume "x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe}"
[PROOF STATE]
proof (state)
this:
x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe}

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe}
[PROOF STEP]
obtain g where xg: "x = integral\<^sup>S (count_space A) g" and fin_gA: "finite (g`A)"
      and g_fe: "g \<le> fe"
[PROOF STATE]
proof (prove)
using this:
x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe}

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>x = integral\<^sup>S (count_space A) g; finite (g ` A); g \<le> fe\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = integral\<^sup>S (count_space A) g
finite (g ` A)
g \<le> fe

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
define F where "F = {z:A. g z \<noteq> 0}"
[PROOF STATE]
proof (state)
this:
F = {z \<in> A. g z \<noteq> 0}

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
hence "F \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
F = {z \<in> A. g z \<noteq> 0}

goal (1 subgoal):
 1. F \<subseteq> A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
F \<subseteq> A

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have fin: "finite {z:A. g z = t}" if "t \<noteq> 0" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {z \<in> A. g z = t}
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
assume inf: "infinite {z:A. g z = t}"
[PROOF STATE]
proof (state)
this:
infinite {z \<in> A. g z = t}

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
hence tgA: "t \<in> g ` A"
[PROOF STATE]
proof (prove)
using this:
infinite {z \<in> A. g z = t}

goal (1 subgoal):
 1. t \<in> g ` A
[PROOF STEP]
by (metis (mono_tags, lifting) image_eqI not_finite_existsD)
[PROOF STATE]
proof (state)
this:
t \<in> g ` A

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "x = (\<Sum>x \<in> g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (\<Sum>x\<in>g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A))
[PROOF STEP]
unfolding xg simple_integral_def space_count_space
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A)) = (\<Sum>x\<in>g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = (\<Sum>x\<in>g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A))

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = (\<Sum>x\<in>g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A))

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> \<ge> (\<Sum>x \<in> {t}. x * emeasure (count_space A) (g -` {x} \<inter> A))" (is "_ \<ge> \<dots>")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{t}. x * emeasure (count_space A) (g -` {x} \<inter> A)) \<le> (\<Sum>x\<in>g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A))
[PROOF STEP]
proof (rule sum_mono2)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite (g ` A)
 2. {t} \<subseteq> g ` A
 3. \<And>b. b \<in> g ` A - {t} \<Longrightarrow> 0 \<le> b * emeasure (count_space A) (g -` {b} \<inter> A)
[PROOF STEP]
show "finite (g ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (g ` A)
[PROOF STEP]
by (simp add: fin_gA)
[PROOF STATE]
proof (state)
this:
finite (g ` A)

goal (2 subgoals):
 1. {t} \<subseteq> g ` A
 2. \<And>b. b \<in> g ` A - {t} \<Longrightarrow> 0 \<le> b * emeasure (count_space A) (g -` {b} \<inter> A)
[PROOF STEP]
show "{t} \<subseteq> g ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {t} \<subseteq> g ` A
[PROOF STEP]
by (simp add: tgA)
[PROOF STATE]
proof (state)
this:
{t} \<subseteq> g ` A

goal (1 subgoal):
 1. \<And>b. b \<in> g ` A - {t} \<Longrightarrow> 0 \<le> b * emeasure (count_space A) (g -` {b} \<inter> A)
[PROOF STEP]
show "0 \<le> b * emeasure (count_space A) (g -` {b} \<inter> A)"
          if "b \<in> g ` A - {t}"
          for b :: ennreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> b * emeasure (count_space A) (g -` {b} \<inter> A)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
b \<in> g ` A - {t}

goal (1 subgoal):
 1. 0 \<le> b * emeasure (count_space A) (g -` {b} \<inter> A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?b \<in> g ` A - {t} \<Longrightarrow> 0 \<le> ?b * emeasure (count_space A) (g -` {?b} \<inter> A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{t}. x * emeasure (count_space A) (g -` {x} \<inter> A)) \<le> (\<Sum>x\<in>g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A))

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{t}. x * emeasure (count_space A) (g -` {x} \<inter> A)) \<le> (\<Sum>x\<in>g ` A. x * emeasure (count_space A) (g -` {x} \<inter> A))

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = t * emeasure (count_space A) (g -` {t} \<inter> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{t}. x * emeasure (count_space A) (g -` {x} \<inter> A)) = t * emeasure (count_space A) (g -` {t} \<inter> A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{t}. x * emeasure (count_space A) (g -` {x} \<inter> A)) = t * emeasure (count_space A) (g -` {t} \<inter> A)

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{t}. x * emeasure (count_space A) (g -` {x} \<inter> A)) = t * emeasure (count_space A) (g -` {t} \<inter> A)

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = t * \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t * emeasure (count_space A) (g -` {t} \<inter> A) = t * \<infinity>
[PROOF STEP]
proof (subst emeasure_count_space_infinite)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. g -` {t} \<inter> A \<subseteq> A
 2. infinite (g -` {t} \<inter> A)
 3. t * \<infinity> = t * \<infinity>
[PROOF STEP]
show "g -` {t} \<inter> A \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g -` {t} \<inter> A \<subseteq> A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g -` {t} \<inter> A \<subseteq> A

goal (2 subgoals):
 1. infinite (g -` {t} \<inter> A)
 2. t * \<infinity> = t * \<infinity>
[PROOF STEP]
have "{a \<in> A. g a = t} = {a \<in> g -` {t}. a \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a \<in> A. g a = t} = {a \<in> g -` {t}. a \<in> A}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a \<in> A. g a = t} = {a \<in> g -` {t}. a \<in> A}

goal (2 subgoals):
 1. infinite (g -` {t} \<inter> A)
 2. t * \<infinity> = t * \<infinity>
[PROOF STEP]
thus "infinite (g -` {t} \<inter> A)"
[PROOF STATE]
proof (prove)
using this:
{a \<in> A. g a = t} = {a \<in> g -` {t}. a \<in> A}

goal (1 subgoal):
 1. infinite (g -` {t} \<inter> A)
[PROOF STEP]
by (metis (full_types) Int_def inf)
[PROOF STATE]
proof (state)
this:
infinite (g -` {t} \<inter> A)

goal (1 subgoal):
 1. t * \<infinity> = t * \<infinity>
[PROOF STEP]
show "t * \<infinity> = t * \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t * \<infinity> = t * \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t * \<infinity> = t * \<infinity>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
t * emeasure (count_space A) (g -` {t} \<inter> A) = t * \<infinity>

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
t * emeasure (count_space A) (g -` {t} \<inter> A) = t * \<infinity>

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t * \<infinity> = \<infinity>
[PROOF STEP]
using \<open>t \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
t \<noteq> 0

goal (1 subgoal):
 1. t * \<infinity> = \<infinity>
[PROOF STEP]
by (simp add: ennreal_mult_eq_top_iff)
[PROOF STATE]
proof (state)
this:
t * \<infinity> = \<infinity>

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<infinity> \<le> x
[PROOF STEP]
have x_inf: "x = \<infinity>"
[PROOF STATE]
proof (prove)
using this:
\<infinity> \<le> x

goal (1 subgoal):
 1. x = \<infinity>
[PROOF STEP]
using neq_top_trans
[PROOF STATE]
proof (prove)
using this:
\<infinity> \<le> x
\<lbrakk>?y \<noteq> top; ?x \<le> ?y\<rbrakk> \<Longrightarrow> ?x \<noteq> top

goal (1 subgoal):
 1. x = \<infinity>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = \<infinity>

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "x = integral\<^sup>S (count_space A) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = integral\<^sup>S (count_space A) g
[PROOF STEP]
by (fact xg)
[PROOF STATE]
proof (state)
this:
x = integral\<^sup>S (count_space A) g

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = integral\<^sup>S (count_space A) g

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = integral\<^sup>N (count_space A) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>S (count_space A) g = integral\<^sup>N (count_space A) g
[PROOF STEP]
by (simp add: fin_gA nn_integral_eq_simple_integral)
[PROOF STATE]
proof (state)
this:
integral\<^sup>S (count_space A) g = integral\<^sup>N (count_space A) g

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>S (count_space A) g = integral\<^sup>N (count_space A) g

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> \<le> integral\<^sup>N (count_space A) fe"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space A) g \<le> integral\<^sup>N (count_space A) fe
[PROOF STEP]
using g_fe
[PROOF STATE]
proof (prove)
using this:
g \<le> fe

goal (1 subgoal):
 1. integral\<^sup>N (count_space A) g \<le> integral\<^sup>N (count_space A) fe
[PROOF STEP]
by (simp add: le_funD nn_integral_mono)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space A) g \<le> integral\<^sup>N (count_space A) fe

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space A) g \<le> integral\<^sup>N (count_space A) fe

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
have "\<dots> < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space A) fe < \<infinity>
[PROOF STEP]
by (metis sum_f_int ennreal_less_top infinity_ennreal_def)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space A) fe < \<infinity>

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x < \<infinity>
[PROOF STEP]
have x_fin: "x < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
x < \<infinity>

goal (1 subgoal):
 1. x < \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x < \<infinity>

goal (1 subgoal):
 1. infinite {z \<in> A. g z = t} \<Longrightarrow> False
[PROOF STEP]
from x_inf x_fin
[PROOF STATE]
proof (chain)
picking this:
x = \<infinity>
x < \<infinity>
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
x = \<infinity>
x < \<infinity>

goal (1 subgoal):
 1. False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?t \<noteq> 0 \<Longrightarrow> finite {z \<in> A. g z = ?t}

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have F: "F = (\<Union>t\<in>g`A-{0}. {z\<in>A. g z = t})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F = (\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t})
[PROOF STEP]
unfolding F_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {z \<in> A. g z \<noteq> 0} = (\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
F = (\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t})

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
hence "finite F"
[PROOF STATE]
proof (prove)
using this:
F = (\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t})

goal (1 subgoal):
 1. finite F
[PROOF STEP]
unfolding F
[PROOF STATE]
proof (prove)
using this:
(\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t}) = (\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t})

goal (1 subgoal):
 1. finite (\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t})
[PROOF STEP]
using fin_gA fin
[PROOF STATE]
proof (prove)
using this:
(\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t}) = (\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t})
finite (g ` A)
?t \<noteq> 0 \<Longrightarrow> finite {z \<in> A. g z = ?t}

goal (1 subgoal):
 1. finite (\<Union>t\<in>g ` A - {0}. {z \<in> A. g z = t})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite F

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "x = integral\<^sup>N (count_space A) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = integral\<^sup>N (count_space A) g
[PROOF STEP]
unfolding xg
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>S (count_space A) g = integral\<^sup>N (count_space A) g
[PROOF STEP]
by (simp add: fin_gA nn_integral_eq_simple_integral)
[PROOF STATE]
proof (state)
this:
x = integral\<^sup>N (count_space A) g

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = integral\<^sup>N (count_space A) g

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "\<dots> = set_nn_integral (count_space UNIV) A g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space A) g = set_nn_integral (count_space UNIV) A g
[PROOF STEP]
by (simp add: nn_integral_restrict_space[symmetric] restrict_count_space)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space A) g = set_nn_integral (count_space UNIV) A g

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space A) g = set_nn_integral (count_space UNIV) A g

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "\<dots> = set_nn_integral (count_space UNIV) F g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral (count_space UNIV) A g = set_nn_integral (count_space UNIV) F g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_nn_integral (count_space UNIV) A g = set_nn_integral (count_space UNIV) F g
[PROOF STEP]
have "\<forall>a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) = g a * (if a \<in> A then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) = g a * (if a \<in> A then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) = g a * (if a \<in> A then 1 else 0)

goal (1 subgoal):
 1. set_nn_integral (count_space UNIV) A g = set_nn_integral (count_space UNIV) F g
[PROOF STEP]
hence "(\<integral>\<^sup>+ a. g a * (if a \<in> A then 1 else 0) \<partial>count_space UNIV)
           = (\<integral>\<^sup>+ a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
using this:
\<forall>a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) = g a * (if a \<in> A then 1 else 0)

goal (1 subgoal):
 1. \<integral>\<^sup>+ a. g a * (if a \<in> A then 1 else 0) \<partial>count_space UNIV = \<integral>\<^sup>+ a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) \<partial>count_space UNIV
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ a. g a * (if a \<in> A then 1 else 0) \<partial>count_space UNIV = \<integral>\<^sup>+ a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) \<partial>count_space UNIV

goal (1 subgoal):
 1. set_nn_integral (count_space UNIV) A g = set_nn_integral (count_space UNIV) F g
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ a. g a * (if a \<in> A then 1 else 0) \<partial>count_space UNIV = \<integral>\<^sup>+ a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) \<partial>count_space UNIV

goal (1 subgoal):
 1. set_nn_integral (count_space UNIV) A g = set_nn_integral (count_space UNIV) F g
[PROOF STEP]
unfolding F_def indicator_def
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ a. g a * (if a \<in> A then 1 else 0) \<partial>count_space UNIV = \<integral>\<^sup>+ a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) \<partial>count_space UNIV

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. g x * of_bool (x \<in> A) \<partial>count_space UNIV = \<integral>\<^sup>+ x. g x * of_bool (x \<in> {z \<in> A. g z \<noteq> 0}) \<partial>count_space UNIV
[PROOF STEP]
using mult.right_neutral mult_zero_right nn_integral_cong
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ a. g a * (if a \<in> A then 1 else 0) \<partial>count_space UNIV = \<integral>\<^sup>+ a. g a * (if a \<in> {a \<in> A. g a \<noteq> 0} then 1 else 0) \<partial>count_space UNIV
?a * (1::?'a) = ?a
?a * (0::?'a) = (0::?'a)
(\<And>x. x \<in> space ?M \<Longrightarrow> ?u x = ?v x) \<Longrightarrow> integral\<^sup>N ?M ?u = integral\<^sup>N ?M ?v

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. g x * of_bool (x \<in> A) \<partial>count_space UNIV = \<integral>\<^sup>+ x. g x * of_bool (x \<in> {z \<in> A. g z \<noteq> 0}) \<partial>count_space UNIV
[PROOF STEP]
by (simp add: of_bool_def)
[PROOF STATE]
proof (state)
this:
set_nn_integral (count_space UNIV) A g = set_nn_integral (count_space UNIV) F g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_nn_integral (count_space UNIV) A g = set_nn_integral (count_space UNIV) F g

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_nn_integral (count_space UNIV) A g = set_nn_integral (count_space UNIV) F g

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "\<dots> = integral\<^sup>N (count_space F) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral (count_space UNIV) F g = integral\<^sup>N (count_space F) g
[PROOF STEP]
by (simp add: nn_integral_restrict_space[symmetric] restrict_count_space)
[PROOF STATE]
proof (state)
this:
set_nn_integral (count_space UNIV) F g = integral\<^sup>N (count_space F) g

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_nn_integral (count_space UNIV) F g = integral\<^sup>N (count_space F) g

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "\<dots> = sum g F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space F) g = sum g F
[PROOF STEP]
using \<open>finite F\<close>
[PROOF STATE]
proof (prove)
using this:
finite F

goal (1 subgoal):
 1. integral\<^sup>N (count_space F) g = sum g F
[PROOF STEP]
by (rule nn_integral_count_space_finite)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space F) g = sum g F

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space F) g = sum g F

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "sum g F \<le> sum fe F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum g F \<le> sum fe F
[PROOF STEP]
using g_fe
[PROOF STATE]
proof (prove)
using this:
g \<le> fe

goal (1 subgoal):
 1. sum g F \<le> sum fe F
[PROOF STEP]
unfolding le_fun_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x. g x \<le> fe x

goal (1 subgoal):
 1. sum g F \<le> sum fe F
[PROOF STEP]
by (simp add: sum_mono)
[PROOF STATE]
proof (state)
this:
sum g F \<le> sum fe F

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum g F \<le> sum fe F

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "\<dots> \<le> (SUP F \<in> {G. finite G \<and> G \<subseteq> A}. (sum fe F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum fe F \<le> Sup (sum fe ` {G. finite G \<and> G \<subseteq> A})
[PROOF STEP]
using \<open>finite F\<close> \<open>F\<subseteq>A\<close>
[PROOF STATE]
proof (prove)
using this:
finite F
F \<subseteq> A

goal (1 subgoal):
 1. sum fe F \<le> Sup (sum fe ` {G. finite G \<and> G \<subseteq> A})
[PROOF STEP]
by (simp add: SUP_upper)
[PROOF STATE]
proof (state)
this:
sum fe F \<le> Sup (sum fe ` {G. finite G \<and> G \<subseteq> A})

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum fe F \<le> Sup (sum fe ` {G. finite G \<and> G \<subseteq> A})

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have "\<dots> = (SUP F \<in> {F. finite F \<and> F \<subseteq> A}. (ennreal (sum f F)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (sum fe ` {G. finite G \<and> G \<subseteq> A}) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
proof (rule SUP_cong [OF refl])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {G. finite G \<and> G \<subseteq> A} \<Longrightarrow> sum fe x = ennreal (sum f x)
[PROOF STEP]
have "finite x \<Longrightarrow> x \<subseteq> A \<Longrightarrow> (\<Sum>x\<in>x. ennreal (f x)) = ennreal (sum f x)"
        for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite x; x \<subseteq> A\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>x. ennreal (f x)) = ennreal (sum f x)
[PROOF STEP]
by (metis fnn subsetCE sum_ennreal)
[PROOF STATE]
proof (state)
this:
\<lbrakk>finite ?x; ?x \<subseteq> A\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>?x. ennreal (f x)) = ennreal (sum f ?x)

goal (1 subgoal):
 1. \<And>x. x \<in> {G. finite G \<and> G \<subseteq> A} \<Longrightarrow> sum fe x = ennreal (sum f x)
[PROOF STEP]
thus "sum fe x = ennreal (sum f x)"
        if "x \<in> {G. finite G \<and> G \<subseteq> A}"
        for x :: "'a set"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?x; ?x \<subseteq> A\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>?x. ennreal (f x)) = ennreal (sum f ?x)

goal (1 subgoal):
 1. sum fe x = ennreal (sum f x)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?x; ?x \<subseteq> A\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>?x. ennreal (f x)) = ennreal (sum f ?x)
x \<in> {G. finite G \<and> G \<subseteq> A}

goal (1 subgoal):
 1. sum fe x = ennreal (sum f x)
[PROOF STEP]
unfolding fe_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?x; ?x \<subseteq> A\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>?x. ennreal (f x)) = ennreal (sum f ?x)
x \<in> {G. finite G \<and> G \<subseteq> A}

goal (1 subgoal):
 1. (\<Sum>x\<in>x. ennreal (f x)) = ennreal (sum f x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> {G. finite G \<and> G \<subseteq> A} \<Longrightarrow> sum fe ?x = ennreal (sum f ?x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sup (sum fe ` {G. finite G \<and> G \<subseteq> A}) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal (1 subgoal):
 1. \<And>x. x \<in> integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe} \<Longrightarrow> x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
show "x \<le> \<dots>"
[PROOF STATE]
proof (prove)
using this:
x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal (1 subgoal):
 1. x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sup (integral\<^sup>S (count_space A) ` {g. finite (g ` A) \<and> g \<le> fe}) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (infsetsum f A) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have leq: "ennreal (infsetsum f A) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. (ennreal (sum f F)))"
[PROOF STATE]
proof (prove)
using this:
ennreal (infsetsum f A) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal (1 subgoal):
 1. ennreal (infsetsum f A) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
by assumption
[PROOF STATE]
proof (state)
this:
ennreal (infsetsum f A) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
from leq geq
[PROOF STATE]
proof (chain)
picking this:
ennreal (infsetsum f A) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
(SUP F\<in>{G. finite G \<and> G \<subseteq> A}. ennreal (sum f F)) \<le> ennreal (infsetsum f A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (infsetsum f A) \<le> (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
(SUP F\<in>{G. finite G \<and> G \<subseteq> A}. ennreal (sum f F)) \<le> ennreal (infsetsum f A)

goal (1 subgoal):
 1. ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ennreal (infsetsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_exp_cancel [simp]: "\<bar>exp x\<bar> = exp x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>exp x\<bar> = exp x
[PROOF STEP]
by simp


[STATEMENT]
lemma dropWhile_rsorted_eq_filter:
  "rsorted (map fst xs) \<Longrightarrow> dropWhile (\<lambda>(i, x). i \<ge> (m::nat)) xs = filter (\<lambda>(i, x). i < m) xs"
  (is "_ \<Longrightarrow> ?lhs xs = ?rhs xs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rsorted (map fst xs) \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) xs = filter (\<lambda>(i, x). i < m) xs
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rsorted (map fst []) \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) [] = filter (\<lambda>(i, x). i < m) []
 2. \<And>a xs. \<lbrakk>rsorted (map fst xs) \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) xs = filter (\<lambda>(i, x). i < m) xs; rsorted (map fst (a # xs))\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) (a # xs) = filter (\<lambda>(i, x). i < m) (a # xs)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
rsorted (map fst xs) \<Longrightarrow> dropWhile (\<lambda>a. case a of (i, x) \<Rightarrow> m \<le> i) xs = filter (\<lambda>a. case a of (i, x) \<Rightarrow> i < m) xs
rsorted (map fst (x # xs))

goal (2 subgoals):
 1. rsorted (map fst []) \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) [] = filter (\<lambda>(i, x). i < m) []
 2. \<And>a xs. \<lbrakk>rsorted (map fst xs) \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) xs = filter (\<lambda>(i, x). i < m) xs; rsorted (map fst (a # xs))\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) (a # xs) = filter (\<lambda>(i, x). i < m) (a # xs)
[PROOF STEP]
hence "?rhs (x#xs) = ?lhs (x#xs)"
[PROOF STATE]
proof (prove)
using this:
rsorted (map fst xs) \<Longrightarrow> dropWhile (\<lambda>a. case a of (i, x) \<Rightarrow> m \<le> i) xs = filter (\<lambda>a. case a of (i, x) \<Rightarrow> i < m) xs
rsorted (map fst (x # xs))

goal (1 subgoal):
 1. filter (\<lambda>a. case a of (i, x) \<Rightarrow> i < m) (x # xs) = dropWhile (\<lambda>a. case a of (i, x) \<Rightarrow> m \<le> i) (x # xs)
[PROOF STEP]
by (auto simp: sorted_append filter_id_conv intro: sym)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>a. case a of (i, x) \<Rightarrow> i < m) (x # xs) = dropWhile (\<lambda>a. case a of (i, x) \<Rightarrow> m \<le> i) (x # xs)

goal (2 subgoals):
 1. rsorted (map fst []) \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) [] = filter (\<lambda>(i, x). i < m) []
 2. \<And>a xs. \<lbrakk>rsorted (map fst xs) \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) xs = filter (\<lambda>(i, x). i < m) xs; rsorted (map fst (a # xs))\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) (a # xs) = filter (\<lambda>(i, x). i < m) (a # xs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>a. case a of (i, x) \<Rightarrow> i < m) (x # xs) = dropWhile (\<lambda>a. case a of (i, x) \<Rightarrow> m \<le> i) (x # xs)

goal (1 subgoal):
 1. dropWhile (\<lambda>a. case a of (i, x) \<Rightarrow> m \<le> i) (x # xs) = filter (\<lambda>a. case a of (i, x) \<Rightarrow> i < m) (x # xs)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
dropWhile (\<lambda>a. case a of (i, x) \<Rightarrow> m \<le> i) (x # xs) = filter (\<lambda>a. case a of (i, x) \<Rightarrow> i < m) (x # xs)

goal (1 subgoal):
 1. rsorted (map fst []) \<Longrightarrow> dropWhile (\<lambda>(i, x). m \<le> i) [] = filter (\<lambda>(i, x). i < m) []
[PROOF STEP]
qed simp


[STATEMENT]
lemma Inf_as_limit:
  fixes A::"'a::{linorder_topology, first_countable_topology, complete_linorder} set"
  assumes "A \<noteq> {}"
  shows "\<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
proof (cases "Inf A \<in> A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Inf A \<in> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
 2. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Inf A \<in> A

goal (2 subgoals):
 1. Inf A \<in> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
 2. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
by (rule exI[of _ "\<lambda>n. Inf A"], auto simp add: True)
[PROOF STATE]
proof (state)
this:
\<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
Inf A \<notin> A

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
obtain y where "y \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. y \<in> A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. (\<And>y. y \<in> A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> A

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> A
[PROOF STEP]
have "Inf A < y"
[PROOF STATE]
proof (prove)
using this:
y \<in> A

goal (1 subgoal):
 1. Inf A < y
[PROOF STEP]
using False Inf_lower less_le
[PROOF STATE]
proof (prove)
using this:
y \<in> A
Inf A \<notin> A
?x \<in> ?A \<Longrightarrow> Inf ?A \<le> ?x
(?x < ?y) = (?x \<le> ?y \<and> ?x \<noteq> ?y)

goal (1 subgoal):
 1. Inf A < y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf A < y

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
obtain F :: "nat \<Rightarrow> 'a set" where F: "\<And>i. open (F i)" "\<And>i. Inf A \<in> F i"
                                       "\<And>u. (\<forall>n. u n \<in> F n) \<Longrightarrow> u \<longlonglongrightarrow> Inf A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>F. \<lbrakk>\<And>i. open (F i); \<And>i. Inf A \<in> F i; \<And>u. \<forall>n. u n \<in> F n \<Longrightarrow> u \<longlonglongrightarrow> Inf A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis first_countable_topology_class.countable_basis)
[PROOF STATE]
proof (state)
this:
open (F ?i)
Inf A \<in> F ?i
\<forall>n. ?u n \<in> F n \<Longrightarrow> ?u \<longlonglongrightarrow> Inf A

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
define u where "u = (\<lambda>n. SOME z. z \<in> F n \<and> z \<in> A)"
[PROOF STATE]
proof (state)
this:
u = (\<lambda>n. SOME z. z \<in> F n \<and> z \<in> A)

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
have "\<exists>z. z \<in> U \<and> z \<in> A" if "Inf A \<in> U" "open U" for U
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. z \<in> U \<and> z \<in> A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>z. z \<in> U \<and> z \<in> A
[PROOF STEP]
obtain b where "b > Inf A" "{Inf A ..<b} \<subseteq> U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. \<lbrakk>Inf A < b; {Inf A..<b} \<subseteq> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using open_right[OF \<open>open U\<close> \<open>Inf A \<in> U\<close> \<open>Inf A < y\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>b>Inf A. {Inf A..<b} \<subseteq> U

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>Inf A < b; {Inf A..<b} \<subseteq> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf A < b
{Inf A..<b} \<subseteq> U

goal (1 subgoal):
 1. \<exists>z. z \<in> U \<and> z \<in> A
[PROOF STEP]
obtain z where "z < b" "z \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z < b; z \<in> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>Inf A < b\<close> Inf_less_iff
[PROOF STATE]
proof (prove)
using this:
Inf A < b
(Inf ?S < ?a) = (\<exists>x\<in>?S. x < ?a)

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z < b; z \<in> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z < b
z \<in> A

goal (1 subgoal):
 1. \<exists>z. z \<in> U \<and> z \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z < b
z \<in> A
[PROOF STEP]
have "z \<in> {Inf A ..<b}"
[PROOF STATE]
proof (prove)
using this:
z < b
z \<in> A

goal (1 subgoal):
 1. z \<in> {Inf A..<b}
[PROOF STEP]
by (simp add: Inf_lower)
[PROOF STATE]
proof (state)
this:
z \<in> {Inf A..<b}

goal (1 subgoal):
 1. \<exists>z. z \<in> U \<and> z \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> {Inf A..<b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> {Inf A..<b}

goal (1 subgoal):
 1. \<exists>z. z \<in> U \<and> z \<in> A
[PROOF STEP]
using \<open>z \<in> A\<close> \<open>{Inf A ..<b} \<subseteq> U\<close>
[PROOF STATE]
proof (prove)
using this:
z \<in> {Inf A..<b}
z \<in> A
{Inf A..<b} \<subseteq> U

goal (1 subgoal):
 1. \<exists>z. z \<in> U \<and> z \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z. z \<in> U \<and> z \<in> A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Inf A \<in> ?U; open ?U\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> ?U \<and> z \<in> A

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>Inf A \<in> ?U; open ?U\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> ?U \<and> z \<in> A
[PROOF STEP]
have *: "u n \<in> F n \<and> u n \<in> A" for n
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Inf A \<in> ?U; open ?U\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> ?U \<and> z \<in> A

goal (1 subgoal):
 1. u n \<in> F n \<and> u n \<in> A
[PROOF STEP]
using \<open>Inf A \<in> F n\<close> \<open>open (F n)\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Inf A \<in> ?U; open ?U\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> ?U \<and> z \<in> A
Inf A \<in> F n
open (F n)

goal (1 subgoal):
 1. u n \<in> F n \<and> u n \<in> A
[PROOF STEP]
unfolding u_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Inf A \<in> ?U; open ?U\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> ?U \<and> z \<in> A
Inf A \<in> F n
open (F n)

goal (1 subgoal):
 1. (SOME z. z \<in> F n \<and> z \<in> A) \<in> F n \<and> (SOME z. z \<in> F n \<and> z \<in> A) \<in> A
[PROOF STEP]
by (metis (no_types, lifting) someI_ex)
[PROOF STATE]
proof (state)
this:
u ?n \<in> F ?n \<and> u ?n \<in> A

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u ?n \<in> F ?n \<and> u ?n \<in> A
[PROOF STEP]
have "u \<longlonglongrightarrow> Inf A"
[PROOF STATE]
proof (prove)
using this:
u ?n \<in> F ?n \<and> u ?n \<in> A

goal (1 subgoal):
 1. u \<longlonglongrightarrow> Inf A
[PROOF STEP]
using F(3)
[PROOF STATE]
proof (prove)
using this:
u ?n \<in> F ?n \<and> u ?n \<in> A
\<forall>n. ?u n \<in> F n \<Longrightarrow> ?u \<longlonglongrightarrow> Inf A

goal (1 subgoal):
 1. u \<longlonglongrightarrow> Inf A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u \<longlonglongrightarrow> Inf A

goal (1 subgoal):
 1. Inf A \<notin> A \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<longlonglongrightarrow> Inf A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u \<longlonglongrightarrow> Inf A

goal (1 subgoal):
 1. \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
u \<longlonglongrightarrow> Inf A
u ?n \<in> F ?n \<and> u ?n \<in> A

goal (1 subgoal):
 1. \<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filterlim_times_pos:
  "LIM x F1. c * f x :> at_right l"
  if "filterlim f (at_right p) F1" "0 < c" "l = c * p"
  for c::"'a::{linordered_field, linorder_topology}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F1. c * f x :> at_right l
[PROOF STEP]
unfolding filterlim_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P. eventually P (at_right l) \<longrightarrow> (\<forall>\<^sub>F x in F1. P (c * f x))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>P. eventually P (at_right l) \<Longrightarrow> \<forall>\<^sub>F x in F1. P (c * f x)
[PROOF STEP]
fix P
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>P. eventually P (at_right l) \<Longrightarrow> \<forall>\<^sub>F x in F1. P (c * f x)
[PROOF STEP]
assume "\<forall>\<^sub>F x in at_right l. P x"
[PROOF STATE]
proof (state)
this:
eventually P (at_right l)

goal (1 subgoal):
 1. \<And>P. eventually P (at_right l) \<Longrightarrow> \<forall>\<^sub>F x in F1. P (c * f x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eventually P (at_right l)
[PROOF STEP]
obtain d where "c * p < d" "\<And>y. y > c * p \<Longrightarrow> y < d \<Longrightarrow> P y"
[PROOF STATE]
proof (prove)
using this:
eventually P (at_right l)

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>c * p < d; \<And>y. \<lbrakk>c * p < y; y < d\<rbrakk> \<Longrightarrow> P y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>l = _ \<close> eventually_at_right_field
[PROOF STATE]
proof (prove)
using this:
\<exists>b>c * p. \<forall>y>c * p. y < b \<longrightarrow> P y

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>c * p < d; \<And>y. \<lbrakk>c * p < y; y < d\<rbrakk> \<Longrightarrow> P y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c * p < d
\<lbrakk>c * p < ?y; ?y < d\<rbrakk> \<Longrightarrow> P ?y

goal (1 subgoal):
 1. \<And>P. eventually P (at_right l) \<Longrightarrow> \<forall>\<^sub>F x in F1. P (c * f x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * p < d
\<lbrakk>c * p < ?y; ?y < d\<rbrakk> \<Longrightarrow> P ?y
[PROOF STEP]
have "\<forall>\<^sub>F a in at_right p. P (c * a)"
[PROOF STATE]
proof (prove)
using this:
c * p < d
\<lbrakk>c * p < ?y; ?y < d\<rbrakk> \<Longrightarrow> P ?y

goal (1 subgoal):
 1. \<forall>\<^sub>F a in at_right p. P (c * a)
[PROOF STEP]
by (auto simp: eventually_at_right_field \<open>0 < c\<close> field_simps intro!: exI[where x="d/c"])
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F a in at_right p. P (c * a)

goal (1 subgoal):
 1. \<And>P. eventually P (at_right l) \<Longrightarrow> \<forall>\<^sub>F x in F1. P (c * f x)
[PROOF STEP]
from that(1)[unfolded filterlim_iff, rule_format, OF this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F1. P (c * f x)
[PROOF STEP]
show "\<forall>\<^sub>F x in F1. P (c * f x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F1. P (c * f x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F1. P (c * f x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F1. P (c * f x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma range_prod:
  "range f \<subseteq> (range (fst \<circ> f)) \<times> (range (snd \<circ> f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range f \<subseteq> range (fst \<circ> f) \<times> range (snd \<circ> f)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> range f \<Longrightarrow> x \<in> range (fst \<circ> f) \<times> range (snd \<circ> f)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> range f \<Longrightarrow> x \<in> range (fst \<circ> f) \<times> range (snd \<circ> f)
[PROOF STEP]
assume "y \<in> range f"
[PROOF STATE]
proof (state)
this:
y \<in> range f

goal (1 subgoal):
 1. \<And>x. x \<in> range f \<Longrightarrow> x \<in> range (fst \<circ> f) \<times> range (snd \<circ> f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> range f
[PROOF STEP]
obtain x where y: "y = f x"
[PROOF STATE]
proof (prove)
using this:
y \<in> range f

goal (1 subgoal):
 1. (\<And>x. y = f x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y = f x

goal (1 subgoal):
 1. \<And>x. x \<in> range f \<Longrightarrow> x \<in> range (fst \<circ> f) \<times> range (snd \<circ> f)
[PROOF STEP]
hence "y = (fst(f x), snd(f x))"
[PROOF STATE]
proof (prove)
using this:
y = f x

goal (1 subgoal):
 1. y = (fst (f x), snd (f x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y = (fst (f x), snd (f x))

goal (1 subgoal):
 1. \<And>x. x \<in> range f \<Longrightarrow> x \<in> range (fst \<circ> f) \<times> range (snd \<circ> f)
[PROOF STEP]
thus "y \<in> (range (fst \<circ> f)) \<times> (range (snd \<circ> f))"
[PROOF STATE]
proof (prove)
using this:
y = (fst (f x), snd (f x))

goal (1 subgoal):
 1. y \<in> range (fst \<circ> f) \<times> range (snd \<circ> f)
[PROOF STEP]
by (fastforce simp add: image_def)
[PROOF STATE]
proof (state)
this:
y \<in> range (fst \<circ> f) \<times> range (snd \<circ> f)

goal:
No subgoals!
[PROOF STEP]
qed