[STATEMENT]
lemma nn_integral_substitution_aux:
  fixes f :: "real \<Rightarrow> ennreal"
  assumes Mf: "f \<in> borel_measurable borel"
  assumes nonnegf: "\<And>x. f x \<ge> 0"
  assumes derivg: "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_real_derivative g' x) (at x)"
  assumes contg': "continuous_on {a..b} g'"
  assumes derivg_nonneg: "\<And>x. x \<in> {a..b} \<Longrightarrow> g' x \<ge> 0"
  assumes "a < b"
  shows "(\<integral>\<^sup>+x. f x * indicator {g a..g b} x \<partial>lborel) =
             (\<integral>\<^sup>+x. f (g x) * g' x * indicator {a..b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from \<open>a < b\<close>
[PROOF STATE]
proof (chain)
picking this:
a < b
[PROOF STEP]
have [simp]: "a \<le> b"
[PROOF STATE]
proof (prove)
using this:
a < b

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

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from derivg
[PROOF STATE]
proof (chain)
picking this:
?x \<in> {a..b} \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x)
[PROOF STEP]
have contg: "continuous_on {a..b} g"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a..b} \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x)

goal (1 subgoal):
 1. continuous_on {a..b} g
[PROOF STEP]
by (rule has_real_derivative_imp_continuous_on)
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} g

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from this and contg'
[PROOF STATE]
proof (chain)
picking this:
continuous_on {a..b} g
continuous_on {a..b} g'
[PROOF STEP]
have Mg: "set_borel_measurable borel {a..b} g" and
                             Mg': "set_borel_measurable borel {a..b} g'"
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} g
continuous_on {a..b} g'

goal (1 subgoal):
 1. set_borel_measurable borel {a..b} g &&& set_borel_measurable borel {a..b} g'
[PROOF STEP]
by (simp_all only: set_measurable_continuous_on_ivl)
[PROOF STATE]
proof (state)
this:
set_borel_measurable borel {a..b} g
set_borel_measurable borel {a..b} g'

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from derivg
[PROOF STATE]
proof (chain)
picking this:
?x \<in> {a..b} \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x)
[PROOF STEP]
have derivg': "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a..b} \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x)

goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)
[PROOF STEP]
by (simp only: has_real_derivative_iff_has_vector_derivative)
[PROOF STATE]
proof (state)
this:
?x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative g' ?x) (at ?x)

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have real_ind[simp]: "\<And>A x. enn2real (indicator A x) = indicator A x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A x. enn2real (indicator A x) = indicat_real A x
[PROOF STEP]
by (auto split: split_indicator)
[PROOF STATE]
proof (state)
this:
enn2real (indicator ?A ?x) = indicat_real ?A ?x

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have ennreal_ind[simp]: "\<And>A x. ennreal (indicator A x) = indicator A x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A x. ennreal (indicat_real A x) = indicator A x
[PROOF STEP]
by (auto split: split_indicator)
[PROOF STATE]
proof (state)
this:
ennreal (indicat_real ?A1 ?x1) = indicator ?A1 ?x1

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have [simp]: "\<And>x A. indicator A (g x) = indicator (g -` A) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x A. indicator A (g x) = indicator (g -` A) x
[PROOF STEP]
by (auto split: split_indicator)
[PROOF STATE]
proof (state)
this:
indicator ?A2 (g ?x2) = indicator (g -` ?A2) ?x2

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from derivg derivg_nonneg
[PROOF STATE]
proof (chain)
picking this:
?x \<in> {a..b} \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x)
?x \<in> {a..b} \<Longrightarrow> 0 \<le> g' ?x
[PROOF STEP]
have monog: "\<And>x y. a \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> b \<Longrightarrow> g x \<le> g y"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a..b} \<Longrightarrow> (g has_real_derivative g' ?x) (at ?x)
?x \<in> {a..b} \<Longrightarrow> 0 \<le> g' ?x

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>a \<le> x; x \<le> y; y \<le> b\<rbrakk> \<Longrightarrow> g x \<le> g y
[PROOF STEP]
by (rule deriv_nonneg_imp_mono) simp_all
[PROOF STATE]
proof (state)
this:
\<lbrakk>a \<le> ?x3; ?x3 \<le> ?y3; ?y3 \<le> b\<rbrakk> \<Longrightarrow> g ?x3 \<le> g ?y3

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
with monog
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>a \<le> ?x3; ?x3 \<le> ?y3; ?y3 \<le> b\<rbrakk> \<Longrightarrow> g ?x3 \<le> g ?y3
\<lbrakk>a \<le> ?x3; ?x3 \<le> ?y3; ?y3 \<le> b\<rbrakk> \<Longrightarrow> g ?x3 \<le> g ?y3
[PROOF STEP]
have [simp]: "g a \<le> g b"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<le> ?x3; ?x3 \<le> ?y3; ?y3 \<le> b\<rbrakk> \<Longrightarrow> g ?x3 \<le> g ?y3
\<lbrakk>a \<le> ?x3; ?x3 \<le> ?y3; ?y3 \<le> b\<rbrakk> \<Longrightarrow> g ?x3 \<le> g ?y3

goal (1 subgoal):
 1. g a \<le> g b
[PROOF STEP]
by (auto intro: mono_onD)
[PROOF STATE]
proof (state)
this:
g a \<le> g b

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
proof (induction rule: borel_measurable_induct[OF Mf, case_names cong set mult add sup])
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>f ga. \<lbrakk>f \<in> borel_measurable borel; ga \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> f x = ga x; set_nn_integral lborel {g a..g b} ga = \<integral>\<^sup>+x\<in>{a..b}. (ga (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. A \<in> sets borel \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 4. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 5. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case (cong f1 f2)
[PROOF STATE]
proof (state)
this:
f1 \<in> borel_measurable borel
f2 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 = f2 ?x3
set_nn_integral lborel {g a..g b} f2 = \<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel

goal (5 subgoals):
 1. \<And>f ga. \<lbrakk>f \<in> borel_measurable borel; ga \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> f x = ga x; set_nn_integral lborel {g a..g b} ga = \<integral>\<^sup>+x\<in>{a..b}. (ga (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. A \<in> sets borel \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 4. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 5. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from cong.hyps(3)
[PROOF STATE]
proof (chain)
picking this:
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 = f2 ?x3
[PROOF STEP]
have "f1 = f2"
[PROOF STATE]
proof (prove)
using this:
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 = f2 ?x3

goal (1 subgoal):
 1. f1 = f2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f1 = f2

goal (5 subgoals):
 1. \<And>f ga. \<lbrakk>f \<in> borel_measurable borel; ga \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> f x = ga x; set_nn_integral lborel {g a..g b} ga = \<integral>\<^sup>+x\<in>{a..b}. (ga (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. A \<in> sets borel \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 4. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 5. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
with cong
[PROOF STATE]
proof (chain)
picking this:
f1 \<in> borel_measurable borel
f2 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 = f2 ?x3
set_nn_integral lborel {g a..g b} f2 = \<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel
f1 = f2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
f1 \<in> borel_measurable borel
f2 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 = f2 ?x3
set_nn_integral lborel {g a..g b} f2 = \<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel
f1 = f2

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} f1 = \<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} f1 = \<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel

goal (4 subgoals):
 1. \<And>A. A \<in> sets borel \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 4. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>A. A \<in> sets borel \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 4. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case (set A)
[PROOF STATE]
proof (state)
this:
A \<in> sets borel

goal (4 subgoals):
 1. \<And>A. A \<in> sets borel \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 4. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from set.hyps
[PROOF STATE]
proof (chain)
picking this:
A \<in> sets borel
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
A \<in> sets borel

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
proof (induction rule: borel_set_induct)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. set_nn_integral lborel {g a..g b} (indicator {}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 4. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (4 subgoals):
 1. set_nn_integral lborel {g a..g b} (indicator {}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 4. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (indicator {}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {} (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator {}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {} (g x) * ennreal (g' x))\<partial>lborel

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case (interval c d)
[PROOF STATE]
proof (state)
this:
c \<le> d

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
c \<le> d

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
fix u v :: real
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
assume asm: "{u..v} \<subseteq> {g a..g b}" "u \<le> v"
[PROOF STATE]
proof (state)
this:
{u..v} \<subseteq> {g a..g b}
u \<le> v

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
obtain u' v' where u'v': "{a..b} \<inter> g-`{u..v} = {u'..v'}" "u' \<le> v'" "g u' = u" "g v' = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u' v'. \<lbrakk>{a..b} \<inter> g -` {u..v} = {u'..v'}; u' \<le> v'; g u' = u; g v' = v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
{u..v} \<subseteq> {g a..g b}
u \<le> v

goal (1 subgoal):
 1. (\<And>u' v'. \<lbrakk>{a..b} \<inter> g -` {u..v} = {u'..v'}; u' \<le> v'; g u' = u; g v' = v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule_tac continuous_interval_vimage_Int[OF contg monog, of u v]) simp_all
[PROOF STATE]
proof (state)
this:
{a..b} \<inter> g -` {u..v} = {u'..v'}
u' \<le> v'
g u' = u
g v' = v

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
hence "{u'..v'} \<subseteq> {a..b}" "{u'..v'} \<subseteq> g -` {u..v}"
[PROOF STATE]
proof (prove)
using this:
{a..b} \<inter> g -` {u..v} = {u'..v'}
u' \<le> v'
g u' = u
g v' = v

goal (1 subgoal):
 1. {u'..v'} \<subseteq> {a..b} &&& {u'..v'} \<subseteq> g -` {u..v}
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
{u'..v'} \<subseteq> {a..b}
{u'..v'} \<subseteq> g -` {u..v}

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
with u'v'(2)
[PROOF STATE]
proof (chain)
picking this:
u' \<le> v'
{u'..v'} \<subseteq> {a..b}
{u'..v'} \<subseteq> g -` {u..v}
[PROOF STEP]
have "u' \<in> g -` {u..v}" "v' \<in> g -` {u..v}"
[PROOF STATE]
proof (prove)
using this:
u' \<le> v'
{u'..v'} \<subseteq> {a..b}
{u'..v'} \<subseteq> g -` {u..v}

goal (1 subgoal):
 1. u' \<in> g -` {u..v} &&& v' \<in> g -` {u..v}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u' \<in> g -` {u..v}
v' \<in> g -` {u..v}

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from u'v'(1)
[PROOF STATE]
proof (chain)
picking this:
{a..b} \<inter> g -` {u..v} = {u'..v'}
[PROOF STEP]
have [simp]: "{a..b} \<inter> g -` {u..v} \<in> sets borel"
[PROOF STATE]
proof (prove)
using this:
{a..b} \<inter> g -` {u..v} = {u'..v'}

goal (1 subgoal):
 1. {a..b} \<inter> g -` {u..v} \<in> sets borel
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{a..b} \<inter> g -` {u..v} \<in> sets borel

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have A: "continuous_on {min u' v'..max u' v'} g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {min u' v'..max u' v'} g'
[PROOF STEP]
by (simp only: u'v' max_absorb2 min_absorb1)
               (intro continuous_on_subset[OF contg'], insert u'v', auto)
[PROOF STATE]
proof (state)
this:
continuous_on {min u' v'..max u' v'} g'

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "\<And>x. x \<in> {u'..v'} \<Longrightarrow> (g has_real_derivative g' x) (at x within {u'..v'})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {u'..v'} \<Longrightarrow> (g has_real_derivative g' x) (at x within {u'..v'})
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
{u..v} \<subseteq> {g a..g b}
u \<le> v

goal (1 subgoal):
 1. \<And>x. x \<in> {u'..v'} \<Longrightarrow> (g has_real_derivative g' x) (at x within {u'..v'})
[PROOF STEP]
by (intro has_field_derivative_subset[OF derivg] subsetD[OF \<open>{u'..v'} \<subseteq> {a..b}\<close>]) auto
[PROOF STATE]
proof (state)
this:
?x3 \<in> {u'..v'} \<Longrightarrow> (g has_real_derivative g' ?x3) (at ?x3 within {u'..v'})

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
hence B: "\<And>x. min u' v' \<le> x \<Longrightarrow> x \<le> max u' v' \<Longrightarrow>
                      (g has_vector_derivative g' x) (at x within {min u' v'..max u' v'})"
[PROOF STATE]
proof (prove)
using this:
?x3 \<in> {u'..v'} \<Longrightarrow> (g has_real_derivative g' ?x3) (at ?x3 within {u'..v'})

goal (1 subgoal):
 1. \<And>x. \<lbrakk>min u' v' \<le> x; x \<le> max u' v'\<rbrakk> \<Longrightarrow> (g has_vector_derivative g' x) (at x within {min u' v'..max u' v'})
[PROOF STEP]
by (simp only: u'v' max_absorb2 min_absorb1)
               (auto simp: has_real_derivative_iff_has_vector_derivative)
[PROOF STATE]
proof (state)
this:
\<lbrakk>min u' v' \<le> ?x3; ?x3 \<le> max u' v'\<rbrakk> \<Longrightarrow> (g has_vector_derivative g' ?x3) (at ?x3 within {min u' v'..max u' v'})

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "integrable lborel (\<lambda>x. indicator ({a..b} \<inter> g -` {u..v}) x *\<^sub>R g' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable lborel (\<lambda>x. indicat_real ({a..b} \<inter> g -` {u..v}) x *\<^sub>R g' x)
[PROOF STEP]
using set_integrable_subset borel_integrable_atLeastAtMost'[OF contg']
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set_integrable ?M ?A ?f; ?B \<in> sets ?M; ?B \<subseteq> ?A\<rbrakk> \<Longrightarrow> set_integrable ?M ?B ?f
set_integrable lborel {a..b} g'

goal (1 subgoal):
 1. integrable lborel (\<lambda>x. indicat_real ({a..b} \<inter> g -` {u..v}) x *\<^sub>R g' x)
[PROOF STEP]
by (metis \<open>{u'..v'} \<subseteq> {a..b}\<close> eucl_ivals(5) set_integrable_def sets_lborel u'v'(1))
[PROOF STATE]
proof (state)
this:
integrable lborel (\<lambda>x. indicat_real ({a..b} \<inter> g -` {u..v}) x *\<^sub>R g' x)

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
hence "(\<integral>\<^sup>+x. ennreal (g' x) * indicator ({a..b} \<inter> g-` {u..v}) x \<partial>lborel) =
                   LBINT x:{a..b} \<inter> g-`{u..v}. g' x"
[PROOF STATE]
proof (prove)
using this:
integrable lborel (\<lambda>x. indicat_real ({a..b} \<inter> g -` {u..v}) x *\<^sub>R g' x)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {u..v}. ennreal (g' x)\<partial>lborel = ennreal (set_lebesgue_integral lborel ({a..b} \<inter> g -` {u..v}) g')
[PROOF STEP]
unfolding set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
using this:
integrable lborel (\<lambda>x. indicat_real ({a..b} \<inter> g -` {u..v}) x *\<^sub>R g' x)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {u..v}. ennreal (g' x)\<partial>lborel = ennreal (LBINT x. indicat_real ({a..b} \<inter> g -` {u..v}) x *\<^sub>R g' x)
[PROOF STEP]
by (subst nn_integral_eq_integral[symmetric])
             (auto intro!: derivg_nonneg nn_integral_cong split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {u..v}. ennreal (g' x)\<partial>lborel = ennreal (set_lebesgue_integral lborel ({a..b} \<inter> g -` {u..v}) g')

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {u..v}. ennreal (g' x)\<partial>lborel = ennreal (set_lebesgue_integral lborel ({a..b} \<inter> g -` {u..v}) g')

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from interval_integral_FTC_finite[OF A B]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x. \<lbrakk>min u' v' \<le> x; x \<le> max u' v'\<rbrakk> \<Longrightarrow> min u' v' \<le> x; \<And>x. \<lbrakk>min u' v' \<le> x; x \<le> max u' v'\<rbrakk> \<Longrightarrow> x \<le> max u' v'\<rbrakk> \<Longrightarrow> interval_lebesgue_integral lborel (ereal u') (ereal v') g' = g v' - g u'
[PROOF STEP]
have "LBINT x:{a..b} \<inter> g-`{u..v}. g' x = v - u"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. \<lbrakk>min u' v' \<le> x; x \<le> max u' v'\<rbrakk> \<Longrightarrow> min u' v' \<le> x; \<And>x. \<lbrakk>min u' v' \<le> x; x \<le> max u' v'\<rbrakk> \<Longrightarrow> x \<le> max u' v'\<rbrakk> \<Longrightarrow> interval_lebesgue_integral lborel (ereal u') (ereal v') g' = g v' - g u'

goal (1 subgoal):
 1. set_lebesgue_integral lborel ({a..b} \<inter> g -` {u..v}) g' = v - u
[PROOF STEP]
by (simp add: u'v' interval_integral_Icc \<open>u \<le> v\<close>)
[PROOF STATE]
proof (state)
this:
set_lebesgue_integral lborel ({a..b} \<inter> g -` {u..v}) g' = v - u

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {u..v}. ennreal (g' x)\<partial>lborel = ennreal (v - u)
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (g' x) * indicator ({a..b} \<inter> g -` {u..v}) x \<partial>lborel) =
                           ennreal (v - u)"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {u..v}. ennreal (g' x)\<partial>lborel = ennreal (v - u)

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {u..v}. ennreal (g' x)\<partial>lborel = ennreal (v - u)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {u..v}. ennreal (g' x)\<partial>lborel = ennreal (v - u)

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>{?u5..?v5} \<subseteq> {g a..g b}; ?u5 \<le> ?v5\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {?u5..?v5}. ennreal (g' x)\<partial>lborel = ennreal (?v5 - ?u5)

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
note A = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>{?u5..?v5} \<subseteq> {g a..g b}; ?u5 \<le> ?v5\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {?u5..?v5}. ennreal (g' x)\<partial>lborel = ennreal (?v5 - ?u5)

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+x. indicator {c..d} (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel) =
               (\<integral>\<^sup>+ x. ennreal (g' x) * indicator ({a..b} \<inter> g -` {c..d}) x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{a..b}. (indicator {c..d} (g x) * ennreal (g' x))\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {c..d}. ennreal (g' x)\<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{a..b}. (indicator {c..d} (g x) * ennreal (g' x))\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {c..d}. ennreal (g' x)\<partial>lborel

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{a..b}. (indicator {c..d} (g x) * ennreal (g' x))\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {c..d}. ennreal (g' x)\<partial>lborel

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "{a..b} \<inter> g-`{c..d} = {a..b} \<inter> g-`{max (g a) c..min (g b) d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..b} \<inter> g -` {c..d} = {a..b} \<inter> g -` {max (g a) c..min (g b) d}
[PROOF STEP]
using \<open>a \<le> b\<close> \<open>c \<le> d\<close>
[PROOF STATE]
proof (prove)
using this:
a \<le> b
c \<le> d

goal (1 subgoal):
 1. {a..b} \<inter> g -` {c..d} = {a..b} \<inter> g -` {max (g a) c..min (g b) d}
[PROOF STEP]
by (auto intro!: monog intro: order.trans)
[PROOF STATE]
proof (state)
this:
{a..b} \<inter> g -` {c..d} = {a..b} \<inter> g -` {max (g a) c..min (g b) d}

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{a..b} \<inter> g -` {c..d} = {a..b} \<inter> g -` {max (g a) c..min (g b) d}

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (g' x) * indicator ... x \<partial>lborel) =
        (if max (g a) c \<le> min (g b) d then min (g b) d - max (g a) c else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {max (g a) c..min (g b) d}. ennreal (g' x)\<partial>lborel = ennreal (if max (g a) c \<le> min (g b) d then min (g b) d - max (g a) c else 0)
[PROOF STEP]
using \<open>c \<le> d\<close>
[PROOF STATE]
proof (prove)
using this:
c \<le> d

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {max (g a) c..min (g b) d}. ennreal (g' x)\<partial>lborel = ennreal (if max (g a) c \<le> min (g b) d then min (g b) d - max (g a) c else 0)
[PROOF STEP]
by (simp add: A)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {max (g a) c..min (g b) d}. ennreal (g' x)\<partial>lborel = ennreal (if max (g a) c \<le> min (g b) d then min (g b) d - max (g a) c else 0)

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{a..b} \<inter> g -` {max (g a) c..min (g b) d}. ennreal (g' x)\<partial>lborel = ennreal (if max (g a) c \<le> min (g b) d then min (g b) d - max (g a) c else 0)

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. indicator ({g a..g b} \<inter> {c..d}) x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (if max (g a) c \<le> min (g b) d then min (g b) d - max (g a) c else 0) = integral\<^sup>N lborel (indicator ({g a..g b} \<inter> {c..d}))
[PROOF STEP]
by (subst nn_integral_indicator) (auto intro!: measurable_sets Mg simp:)
[PROOF STATE]
proof (state)
this:
ennreal (if max (g a) c \<le> min (g b) d then min (g b) d - max (g a) c else 0) = integral\<^sup>N lborel (indicator ({g a..g b} \<inter> {c..d}))

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (if max (g a) c \<le> min (g b) d then min (g b) d - max (g a) c else 0) = integral\<^sup>N lborel (indicator ({g a..g b} \<inter> {c..d}))

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. indicator {c..d} x * indicator {g a..g b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N lborel (indicator ({g a..g b} \<inter> {c..d})) = set_nn_integral lborel {g a..g b} (indicator {c..d})
[PROOF STEP]
by (intro nn_integral_cong) (auto split: split_indicator)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N lborel (indicator ({g a..g b} \<inter> {c..d})) = set_nn_integral lborel {g a..g b} (indicator {c..d})

goal (3 subgoals):
 1. \<And>aa ba. aa \<le> ba \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator {aa..ba}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {aa..ba} (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 3. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>{a..b}. (indicator {c..d} (g x) * ennreal (g' x))\<partial>lborel = set_nn_integral lborel {g a..g b} (indicator {c..d})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>{a..b}. (indicator {c..d} (g x) * ennreal (g' x))\<partial>lborel = set_nn_integral lborel {g a..g b} (indicator {c..d})

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (indicator {c..d}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {c..d} (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator {c..d}) = \<integral>\<^sup>+x\<in>{a..b}. (indicator {c..d} (g x) * ennreal (g' x))\<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case (compl A)
[PROOF STATE]
proof (state)
this:
A \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
note \<open>A \<in> sets borel\<close>[measurable]
[PROOF STATE]
proof (state)
this:
A \<in> sets borel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from emeasure_mono[of "A \<inter> {g a..g b}" "{g a..g b}" lborel]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>A \<inter> {g a..g b} \<subseteq> {g a..g b}; {g a..g b} \<in> sets lborel\<rbrakk> \<Longrightarrow> emeasure lborel (A \<inter> {g a..g b}) \<le> emeasure lborel {g a..g b}
[PROOF STEP]
have [simp]: "emeasure lborel (A \<inter> {g a..g b}) \<noteq> top"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<inter> {g a..g b} \<subseteq> {g a..g b}; {g a..g b} \<in> sets lborel\<rbrakk> \<Longrightarrow> emeasure lborel (A \<inter> {g a..g b}) \<le> emeasure lborel {g a..g b}

goal (1 subgoal):
 1. emeasure lborel (A \<inter> {g a..g b}) \<noteq> top
[PROOF STEP]
by (auto simp: top_unique)
[PROOF STATE]
proof (state)
this:
emeasure lborel (A \<inter> {g a..g b}) \<noteq> top

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have [simp]: "g -` A \<inter> {a..b} \<in> sets borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g -` A \<inter> {a..b} \<in> sets borel
[PROOF STEP]
by (rule set_borel_measurable_sets[OF Mg]) auto
[PROOF STATE]
proof (state)
this:
g -` A \<inter> {a..b} \<in> sets borel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have [simp]: "g -` (-A) \<inter> {a..b} \<in> sets borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g -` (- A) \<inter> {a..b} \<in> sets borel
[PROOF STEP]
by (rule set_borel_measurable_sets[OF Mg]) auto
[PROOF STATE]
proof (state)
this:
g -` (- A) \<inter> {a..b} \<in> sets borel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+x. indicator (-A) x * indicator {g a..g b} x \<partial>lborel) =
                (\<integral>\<^sup>+x. indicator (-A \<inter> {g a..g b}) x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (indicator (- A)) = integral\<^sup>N lborel (indicator (- A \<inter> {g a..g b}))
[PROOF STEP]
by (rule nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator (- A)) = integral\<^sup>N lborel (indicator (- A \<inter> {g a..g b}))

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator (- A)) = integral\<^sup>N lborel (indicator (- A \<inter> {g a..g b}))

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from compl
[PROOF STATE]
proof (chain)
picking this:
A \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = emeasure lborel ({g a..g b} - A)"
[PROOF STATE]
proof (prove)
using this:
A \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. integral\<^sup>N lborel (indicator (- A \<inter> {g a..g b})) = emeasure lborel ({g a..g b} - A)
[PROOF STEP]
using derivg_nonneg
[PROOF STATE]
proof (prove)
using this:
A \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel
?x \<in> {a..b} \<Longrightarrow> 0 \<le> g' ?x

goal (1 subgoal):
 1. integral\<^sup>N lborel (indicator (- A \<inter> {g a..g b})) = emeasure lborel ({g a..g b} - A)
[PROOF STEP]
by (simp add: vimage_Compl diff_eq Int_commute[of "-A"])
[PROOF STATE]
proof (state)
this:
integral\<^sup>N lborel (indicator (- A \<inter> {g a..g b})) = emeasure lborel ({g a..g b} - A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N lborel (indicator (- A \<inter> {g a..g b})) = emeasure lborel ({g a..g b} - A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "{g a..g b} - A = {g a..g b} - A \<inter> {g a..g b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {g a..g b} - A = {g a..g b} - A \<inter> {g a..g b}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{g a..g b} - A = {g a..g b} - A \<inter> {g a..g b}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{g a..g b} - A = {g a..g b} - A \<inter> {g a..g b}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "emeasure lborel ... = g b - g a - emeasure lborel (A \<inter> {g a..g b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel ({g a..g b} - A \<inter> {g a..g b}) = ennreal (g b - g a) - emeasure lborel (A \<inter> {g a..g b})
[PROOF STEP]
using \<open>A \<in> sets borel\<close>
[PROOF STATE]
proof (prove)
using this:
A \<in> sets borel

goal (1 subgoal):
 1. emeasure lborel ({g a..g b} - A \<inter> {g a..g b}) = ennreal (g b - g a) - emeasure lborel (A \<inter> {g a..g b})
[PROOF STEP]
by (subst emeasure_Diff) auto
[PROOF STATE]
proof (state)
this:
emeasure lborel ({g a..g b} - A \<inter> {g a..g b}) = ennreal (g b - g a) - emeasure lborel (A \<inter> {g a..g b})

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel ({g a..g b} - A \<inter> {g a..g b}) = ennreal (g b - g a) - emeasure lborel (A \<inter> {g a..g b})

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "emeasure lborel (A \<inter> {g a..g b}) =
                    \<integral>\<^sup>+x. indicator A x * indicator {g a..g b} x \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel (A \<inter> {g a..g b}) = set_nn_integral lborel {g a..g b} (indicator A)
[PROOF STEP]
using \<open>A \<in> sets borel\<close>
[PROOF STATE]
proof (prove)
using this:
A \<in> sets borel

goal (1 subgoal):
 1. emeasure lborel (A \<inter> {g a..g b}) = set_nn_integral lborel {g a..g b} (indicator A)
[PROOF STEP]
by (subst nn_integral_indicator[symmetric], simp, intro nn_integral_cong)
          (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
emeasure lborel (A \<inter> {g a..g b}) = set_nn_integral lborel {g a..g b} (indicator A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel (A \<inter> {g a..g b}) = set_nn_integral lborel {g a..g b} (indicator A)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = \<integral>\<^sup>+ x. indicator (g-`A \<inter> {a..b}) x * ennreal (g' x * indicator {a..b} x) \<partial>lborel" (is "_ = ?I")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel
[PROOF STEP]
by (subst compl.IH, intro nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "g b - g a = LBINT x:{a..b}. g' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g b - g a = set_lebesgue_integral lborel {a..b} g'
[PROOF STEP]
using derivg'
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative g' ?x) (at ?x)

goal (1 subgoal):
 1. g b - g a = set_lebesgue_integral lborel {a..b} g'
[PROOF STEP]
unfolding set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative g' ?x) (at ?x)

goal (1 subgoal):
 1. g b - g a = LBINT x. indicat_real {a..b} x *\<^sub>R g' x
[PROOF STEP]
by (intro integral_FTC_atLeastAtMost[symmetric])
           (auto intro: continuous_on_subset[OF contg'] has_field_derivative_subset[OF derivg]
                 has_vector_derivative_at_within)
[PROOF STATE]
proof (state)
this:
g b - g a = set_lebesgue_integral lborel {a..b} g'

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g b - g a = set_lebesgue_integral lborel {a..b} g'

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "ennreal ... = \<integral>\<^sup>+ x. g' x * indicator {a..b} x \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (set_lebesgue_integral lborel {a..b} g') = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) \<partial>lborel
[PROOF STEP]
using borel_integrable_atLeastAtMost'[OF contg']
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel {a..b} g'

goal (1 subgoal):
 1. ennreal (set_lebesgue_integral lborel {a..b} g') = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) \<partial>lborel
[PROOF STEP]
unfolding set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel {a..b} g'

goal (1 subgoal):
 1. ennreal (LBINT x. indicat_real {a..b} x *\<^sub>R g' x) = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) \<partial>lborel
[PROOF STEP]
by (subst nn_integral_eq_integral)
           (simp_all add: mult.commute derivg_nonneg set_integrable_def split: split_indicator)
[PROOF STATE]
proof (state)
this:
ennreal (set_lebesgue_integral lborel {a..b} g') = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) \<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (set_lebesgue_integral lborel {a..b} g') = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) \<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have Mg'': "(\<lambda>x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicator {a..b} x))
                            \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel
[PROOF STEP]
using Mg'
[PROOF STATE]
proof (prove)
using this:
set_borel_measurable borel {a..b} g'

goal (1 subgoal):
 1. (\<lambda>x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel
[PROOF STEP]
by (intro borel_measurable_times_ennreal borel_measurable_indicator)
           (simp_all add: mult.commute set_borel_measurable_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have le: "(\<integral>\<^sup>+x. indicator (g-`A \<inter> {a..b}) x * ennreal (g' x * indicator {a..b} x) \<partial>lborel) \<le>
                        (\<integral>\<^sup>+x. ennreal (g' x) * indicator {a..b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<le> \<integral>\<^sup>+x\<in>{a..b}. ennreal (g' x)\<partial>lborel
[PROOF STEP]
by (intro nn_integral_mono) (simp split: split_indicator add: derivg_nonneg)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<le> \<integral>\<^sup>+x\<in>{a..b}. ennreal (g' x)\<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
note integrable = borel_integrable_atLeastAtMost'[OF contg']
[PROOF STATE]
proof (state)
this:
set_integrable lborel {a..b} g'

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
with le
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<le> \<integral>\<^sup>+x\<in>{a..b}. ennreal (g' x)\<partial>lborel
set_integrable lborel {a..b} g'
[PROOF STEP]
have notinf: "(\<integral>\<^sup>+x. indicator (g-`A \<inter> {a..b}) x * ennreal (g' x * indicator {a..b} x) \<partial>lborel) \<noteq> top"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<le> \<integral>\<^sup>+x\<in>{a..b}. ennreal (g' x)\<partial>lborel
set_integrable lborel {a..b} g'

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<noteq> top
[PROOF STEP]
by (auto simp: real_integrable_def nn_integral_set_ennreal mult.commute top_unique set_integrable_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<noteq> top

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+ x. g' x * indicator {a..b} x \<partial>lborel) - ?I =
                  \<integral>\<^sup>+ x. ennreal (g' x * indicator {a..b} x) -
                        indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicator {a..b} x) \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) \<partial>lborel - \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) - indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel
[PROOF STEP]
apply (intro nn_integral_diff[symmetric])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. (\<lambda>x. ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable lborel
 2. (\<lambda>x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable lborel
 3. \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<noteq> \<infinity>
 4. AE x in lborel. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<le> ennreal (g' x * indicat_real {a..b} x)
[PROOF STEP]
apply (insert Mg', simp add: mult.commute set_borel_measurable_def) []
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable lborel
 2. \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<noteq> \<infinity>
 3. AE x in lborel. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<le> ennreal (g' x * indicat_real {a..b} x)
[PROOF STEP]
apply (insert Mg'', simp) []
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<noteq> \<infinity>
 2. AE x in lborel. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<le> ennreal (g' x * indicat_real {a..b} x)
[PROOF STEP]
apply (simp split: split_indicator add: derivg_nonneg)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel \<noteq> top
 2. AE x in lborel. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<le> ennreal (g' x * indicat_real {a..b} x)
[PROOF STEP]
apply (rule notinf)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in lborel. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<le> ennreal (g' x * indicat_real {a..b} x)
[PROOF STEP]
apply (simp split: split_indicator add: derivg_nonneg)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) \<partial>lborel - \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) - indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) \<partial>lborel - \<integral>\<^sup>+ x. indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) - indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = \<integral>\<^sup>+ x. indicator (-A) (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) - indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) - indicator (g -` A \<inter> {a..b}) x * ennreal (g' x * indicat_real {a..b} x) \<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel

goal (2 subgoals):
 1. \<And>A. \<lbrakk>A \<in> sets borel; set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator (- A)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (- A) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case (union f)
[PROOF STATE]
proof (state)
this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have [simp]: "\<And>i. {a..b} \<inter> g -` f i \<in> sets borel"
[PROOF STATE]
proof (prove)
using this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<And>i. {a..b} \<inter> g -` f i \<in> sets borel
[PROOF STEP]
by (subst Int_commute, intro set_borel_measurable_sets[OF Mg]) auto
[PROOF STATE]
proof (state)
this:
{a..b} \<inter> g -` f ?i3 \<in> sets borel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "g -` (\<Union>i. f i) \<inter> {a..b} = (\<Union>i. {a..b} \<inter> g -` f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g -` \<Union> (range f) \<inter> {a..b} = (\<Union>i. {a..b} \<inter> g -` f i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g -` \<Union> (range f) \<inter> {a..b} = (\<Union>i. {a..b} \<inter> g -` f i)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
hence "g -` (\<Union>i. f i) \<inter> {a..b} \<in> sets borel"
[PROOF STATE]
proof (prove)
using this:
g -` \<Union> (range f) \<inter> {a..b} = (\<Union>i. {a..b} \<inter> g -` f i)

goal (1 subgoal):
 1. g -` \<Union> (range f) \<inter> {a..b} \<in> sets borel
[PROOF STEP]
by (auto simp del: UN_simps)
[PROOF STATE]
proof (state)
this:
g -` \<Union> (range f) \<inter> {a..b} \<in> sets borel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+x. indicator (\<Union>i. f i) x * indicator {g a..g b} x \<partial>lborel) =
                \<integral>\<^sup>+x. indicator (\<Union>i. {g a..g b} \<inter> f i) x \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = integral\<^sup>N lborel (indicator (\<Union>i. {g a..g b} \<inter> f i))
[PROOF STEP]
by (intro nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = integral\<^sup>N lborel (indicator (\<Union>i. {g a..g b} \<inter> f i))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = integral\<^sup>N lborel (indicator (\<Union>i. {g a..g b} \<inter> f i))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from union
[PROOF STATE]
proof (chain)
picking this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = emeasure lborel (\<Union>i. {g a..g b} \<inter> f i)"
[PROOF STATE]
proof (prove)
using this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. integral\<^sup>N lborel (indicator (\<Union>i. {g a..g b} \<inter> f i)) = emeasure lborel (\<Union>i. {g a..g b} \<inter> f i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>N lborel (indicator (\<Union>i. {g a..g b} \<inter> f i)) = emeasure lborel (\<Union>i. {g a..g b} \<inter> f i)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N lborel (indicator (\<Union>i. {g a..g b} \<inter> f i)) = emeasure lborel (\<Union>i. {g a..g b} \<inter> f i)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from union
[PROOF STATE]
proof (chain)
picking this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = (\<Sum>i. emeasure lborel ({g a..g b} \<inter> f i))"
[PROOF STATE]
proof (prove)
using this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. emeasure lborel (\<Union>i. {g a..g b} \<inter> f i) = (\<Sum>i. emeasure lborel ({g a..g b} \<inter> f i))
[PROOF STEP]
by (intro suminf_emeasure[symmetric]) (auto simp: disjoint_family_on_def)
[PROOF STATE]
proof (state)
this:
emeasure lborel (\<Union>i. {g a..g b} \<inter> f i) = (\<Sum>i. emeasure lborel ({g a..g b} \<inter> f i))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel (\<Union>i. {g a..g b} \<inter> f i) = (\<Sum>i. emeasure lborel ({g a..g b} \<inter> f i))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from union
[PROOF STATE]
proof (chain)
picking this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = (\<Sum>i. \<integral>\<^sup>+x. indicator ({g a..g b} \<inter> f i) x \<partial>lborel)"
[PROOF STATE]
proof (prove)
using this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. (\<Sum>i. emeasure lborel ({g a..g b} \<inter> f i)) = (\<Sum>i. integral\<^sup>N lborel (indicator ({g a..g b} \<inter> f i)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i. emeasure lborel ({g a..g b} \<inter> f i)) = (\<Sum>i. integral\<^sup>N lborel (indicator ({g a..g b} \<inter> f i)))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i. emeasure lborel ({g a..g b} \<inter> f i)) = (\<Sum>i. integral\<^sup>N lborel (indicator ({g a..g b} \<inter> f i)))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>i. \<integral>\<^sup>+x. indicator ({g a..g b} \<inter> f i) x \<partial>lborel) =
                           (\<lambda>i. \<integral>\<^sup>+x. indicator (f i) x * indicator {g a..g b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. integral\<^sup>N lborel (indicator ({g a..g b} \<inter> f i))) = (\<lambda>i. set_nn_integral lborel {g a..g b} (indicator (f i)))
[PROOF STEP]
by (intro ext nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. integral\<^sup>N lborel (indicator ({g a..g b} \<inter> f i))) = (\<lambda>i. set_nn_integral lborel {g a..g b} (indicator (f i)))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. integral\<^sup>N lborel (indicator ({g a..g b} \<inter> f i))) = (\<lambda>i. set_nn_integral lborel {g a..g b} (indicator (f i)))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from union.IH
[PROOF STATE]
proof (chain)
picking this:
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<Sum>i. \<integral>\<^sup>+x. indicator (f i) x * indicator {g a..g b} x \<partial>lborel) =
          (\<Sum>i. \<integral>\<^sup>+ x. indicator (f i) (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
using this:
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. (\<Sum>i. set_nn_integral lborel {g a..g b} (indicator (f i))) = (\<Sum>i. \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i. set_nn_integral lborel {g a..g b} (indicator (f i))) = (\<Sum>i. \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i. set_nn_integral lborel {g a..g b} (indicator (f i))) = (\<Sum>i. \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>i. \<integral>\<^sup>+ x. indicator (f i) (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel) =
                         (\<lambda>i. \<integral>\<^sup>+ x. ennreal (g' x * indicator {a..b} x) * indicator ({a..b} \<inter> g -` f i) x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel) = (\<lambda>i. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` f i. ennreal (g' x * indicat_real {a..b} x)\<partial>lborel)
[PROOF STEP]
by (intro ext nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel) = (\<lambda>i. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` f i. ennreal (g' x * indicat_real {a..b} x)\<partial>lborel)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel) = (\<lambda>i. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` f i. ennreal (g' x * indicat_real {a..b} x)\<partial>lborel)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<Sum>i. ... i) = \<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicator {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` f i. ennreal (g' x * indicat_real {a..b} x)\<partial>lborel) = \<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicat_real {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) \<partial>lborel
[PROOF STEP]
using Mg'
[PROOF STATE]
proof (prove)
using this:
set_borel_measurable borel {a..b} g'

goal (1 subgoal):
 1. (\<Sum>i. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` f i. ennreal (g' x * indicat_real {a..b} x)\<partial>lborel) = \<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicat_real {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) \<partial>lborel
[PROOF STEP]
apply (intro nn_integral_suminf[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. set_borel_measurable borel {a..b} g' \<Longrightarrow> (\<lambda>x. ennreal (g' x * indicat_real {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) \<in> borel_measurable lborel
[PROOF STEP]
apply (rule borel_measurable_times_ennreal, simp add: mult.commute set_borel_measurable_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. set_borel_measurable borel {a..b} g' \<Longrightarrow> indicator ({a..b} \<inter> g -` f i) \<in> borel_measurable lborel
[PROOF STEP]
apply (rule borel_measurable_indicator, subst sets_lborel)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. set_borel_measurable borel {a..b} g' \<Longrightarrow> {a..b} \<inter> g -` f i \<in> sets borel
[PROOF STEP]
apply (simp_all split: split_indicator add: derivg_nonneg)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<Sum>i. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` f i. ennreal (g' x * indicat_real {a..b} x)\<partial>lborel) = \<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicat_real {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) \<partial>lborel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i. \<integral>\<^sup>+x\<in>{a..b} \<inter> g -` f i. ennreal (g' x * indicat_real {a..b} x)\<partial>lborel) = \<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicat_real {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) \<partial>lborel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>x i. ennreal (g' x * indicator {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) =
                      (\<lambda>x i. ennreal (g' x * indicator {a..b} x) * indicator (g -` f i) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x i. ennreal (g' x * indicat_real {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) = (\<lambda>x i. ennreal (g' x * indicat_real {a..b} x) * indicator (g -` f i) x)
[PROOF STEP]
by (intro ext) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
(\<lambda>x i. ennreal (g' x * indicat_real {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) = (\<lambda>x i. ennreal (g' x * indicat_real {a..b} x) * indicator (g -` f i) x)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x i. ennreal (g' x * indicat_real {a..b} x) * indicator ({a..b} \<inter> g -` f i) x) = (\<lambda>x i. ennreal (g' x * indicat_real {a..b} x) * indicator (g -` f i) x)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicator {a..b} x) * indicator (g -` f i) x) \<partial>lborel) =
                     \<integral>\<^sup>+ x. ennreal (g' x * indicator {a..b} x) * (\<Sum>i. indicator (g -` f i) x) \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicat_real {a..b} x) * indicator (g -` f i) x) \<partial>lborel = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) * (\<Sum>i. indicator (g -` f i) x) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (auto split: split_indicator simp: derivg_nonneg)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicat_real {a..b} x) * indicator (g -` f i) x) \<partial>lborel = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) * (\<Sum>i. indicator (g -` f i) x) \<partial>lborel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (\<Sum>i. ennreal (g' x * indicat_real {a..b} x) * indicator (g -` f i) x) \<partial>lborel = \<integral>\<^sup>+ x. ennreal (g' x * indicat_real {a..b} x) * (\<Sum>i. indicator (g -` f i) x) \<partial>lborel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from union
[PROOF STATE]
proof (chain)
picking this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>x. \<Sum>i. indicator (g -` f i) x :: ennreal) = (\<lambda>x. indicator (\<Union>i. g -` f i) x)"
[PROOF STATE]
proof (prove)
using this:
disjoint_family f
f ?i3 \<in> sets borel
set_nn_integral lborel {g a..g b} (indicator (f ?i3)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f ?i3) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>i. indicator (g -` f i) x) = indicator (\<Union>i. g -` f i)
[PROOF STEP]
by (intro ext suminf_indicator) (auto simp: disjoint_family_on_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<Sum>i. indicator (g -` f i) x) = indicator (\<Union>i. g -` f i)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<Sum>i. indicator (g -` f i) x) = indicator (\<Union>i. g -` f i)

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+x. ennreal (g' x * indicator {a..b} x) * ... x \<partial>lborel) =
                    (\<integral>\<^sup>+x. indicator (\<Union>i. f i) (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>(\<Union>i. g -` f i). ennreal (g' x * indicat_real {a..b} x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>(\<Union>i. g -` f i). ennreal (g' x * indicat_real {a..b} x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<And>f. \<lbrakk>disjoint_family f; \<And>i. f i \<in> sets borel; \<And>i. set_nn_integral lborel {g a..g b} (indicator (f i)) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (f i) (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator (\<Union> (range f))) = \<integral>\<^sup>+x\<in>{a..b}. (indicator (\<Union> (range f)) (g x) * ennreal (g' x))\<partial>lborel

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (indicator A) = \<integral>\<^sup>+x\<in>{a..b}. (indicator A (g x) * ennreal (g' x))\<partial>lborel

goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case (mult f c)
[PROOF STATE]
proof (state)
this:
c < top
f \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f ?x3 < top
set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel

goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
note Mf[measurable] = \<open>f \<in> borel_measurable borel\<close>
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable borel

goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
let ?I = "indicator {a..b}"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>x. f (g x * ?I x) * ennreal (g' x * ?I x)) \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel
[PROOF STEP]
using Mg Mg'
[PROOF STATE]
proof (prove)
using this:
set_borel_measurable borel {a..b} g
set_borel_measurable borel {a..b} g'

goal (1 subgoal):
 1. (\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel
[PROOF STEP]
by (intro borel_measurable_times_ennreal measurable_compose[OF _ Mf])
         (simp_all add: mult.commute set_borel_measurable_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel

goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel

goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>x. f (g x * ?I x) * ennreal (g' x * ?I x)) = (\<lambda>x. f (g x) * ennreal (g' x) * ?I x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) = (\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x)
[PROOF STEP]
by (intro ext) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) = (\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x)

goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel
[PROOF STEP]
have Mf': "(\<lambda>x. f (g x) * ennreal (g' x) * ?I x) \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (1 subgoal):
 1. (\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (3 subgoals):
 1. \<And>u c. \<lbrakk>c < top; u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (c * u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * u (g x) * ennreal (g' x))\<partial>lborel
 2. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 3. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
with mult
[PROOF STATE]
proof (chain)
picking this:
c < top
f \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f ?x3 < top
set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
(\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
c < top
f \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f ?x3 < top
set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel
(\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{g a..g b}. (c * f x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * f (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
by (subst (1 2 3) mult_ac, subst (1 2) nn_integral_cmult) (simp_all add: mult_ac)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{g a..g b}. (c * f x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. (c * f (g x) * ennreal (g' x))\<partial>lborel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case (add f2 f1)
[PROOF STATE]
proof (state)
this:
f2 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 < top
f1 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 < top
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 = 0 \<or> f1 ?x3 = 0
set_nn_integral lborel {g a..g b} f2 = \<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel
set_nn_integral lborel {g a..g b} f1 = \<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
let ?I = "indicator {a..b}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
fix f :: "real \<Rightarrow> ennreal"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
assume Mf: "f \<in> borel_measurable borel"
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable borel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>x. f (g x * ?I x) * ennreal (g' x * ?I x)) \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel
[PROOF STEP]
using Mg Mg'
[PROOF STATE]
proof (prove)
using this:
set_borel_measurable borel {a..b} g
set_borel_measurable borel {a..b} g'

goal (1 subgoal):
 1. (\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel
[PROOF STEP]
by (intro borel_measurable_times_ennreal measurable_compose[OF _ Mf])
           (simp_all add:  mult.commute set_borel_measurable_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>x. f (g x * ?I x) * ennreal (g' x * ?I x)) = (\<lambda>x. f (g x) * ennreal (g' x) * ?I x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) = (\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x)
[PROOF STEP]
by (intro ext) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) = (\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x)

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel
[PROOF STEP]
have "(\<lambda>x. f (g x) * ennreal (g' x) * ?I x) \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (1 subgoal):
 1. (\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?fa6 \<in> borel_measurable borel \<Longrightarrow> (\<lambda>x. ?fa6 (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
note Mf' = this[OF \<open>f1 \<in> borel_measurable borel\<close>] this[OF \<open>f2 \<in> borel_measurable borel\<close>]
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f1 (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel
(\<lambda>x. f2 (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+ x. (f1 x + f2 x) * indicator {g a..g b} x \<partial>lborel) =
             (\<integral>\<^sup>+ x. f1 x * indicator {g a..g b} x + f2 x * indicator {g a..g b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{g a..g b}. (f1 x + f2 x)\<partial>lborel = \<integral>\<^sup>+ x. f1 x * indicator {g a..g b} x + f2 x * indicator {g a..g b} x \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{g a..g b}. (f1 x + f2 x)\<partial>lborel = \<integral>\<^sup>+ x. f1 x * indicator {g a..g b} x + f2 x * indicator {g a..g b} x \<partial>lborel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{g a..g b}. (f1 x + f2 x)\<partial>lborel = \<integral>\<^sup>+ x. f1 x * indicator {g a..g b} x + f2 x * indicator {g a..g b} x \<partial>lborel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from add
[PROOF STATE]
proof (chain)
picking this:
f2 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 < top
f1 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 < top
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 = 0 \<or> f1 ?x3 = 0
set_nn_integral lborel {g a..g b} f2 = \<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel
set_nn_integral lborel {g a..g b} f1 = \<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f1 (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel) +
                                (\<integral>\<^sup>+ x. f2 (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
using this:
f2 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 < top
f1 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 < top
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 = 0 \<or> f1 ?x3 = 0
set_nn_integral lborel {g a..g b} f2 = \<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel
set_nn_integral lborel {g a..g b} f1 = \<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f1 x * indicator {g a..g b} x + f2 x * indicator {g a..g b} x \<partial>lborel = (\<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel) + (\<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel)
[PROOF STEP]
by (simp_all add: nn_integral_add)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f1 x * indicator {g a..g b} x + f2 x * indicator {g a..g b} x \<partial>lborel = (\<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel) + (\<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel)

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f1 x * indicator {g a..g b} x + f2 x * indicator {g a..g b} x \<partial>lborel = (\<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel) + (\<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel)

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from add
[PROOF STATE]
proof (chain)
picking this:
f2 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 < top
f1 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 < top
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 = 0 \<or> f1 ?x3 = 0
set_nn_integral lborel {g a..g b} f2 = \<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel
set_nn_integral lborel {g a..g b} f1 = \<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f1 (g x) * ennreal (g' x) * indicator {a..b} x +
                                      f2 (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
using this:
f2 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 < top
f1 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> f1 ?x3 < top
?x3 \<in> space borel \<Longrightarrow> f2 ?x3 = 0 \<or> f1 ?x3 = 0
set_nn_integral lborel {g a..g b} f2 = \<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel
set_nn_integral lborel {g a..g b} f1 = \<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. (\<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel) + (\<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel) = \<integral>\<^sup>+ x. f1 (g x) * ennreal (g' x) * indicator {a..b} x + f2 (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel
[PROOF STEP]
by (intro nn_integral_add[symmetric])
         (auto simp add: Mf' derivg_nonneg split: split_indicator)
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel) + (\<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel) = \<integral>\<^sup>+ x. f1 (g x) * ennreal (g' x) * indicator {a..b} x + f2 (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+x\<in>{a..b}. (f1 (g x) * ennreal (g' x))\<partial>lborel) + (\<integral>\<^sup>+x\<in>{a..b}. (f2 (g x) * ennreal (g' x))\<partial>lborel) = \<integral>\<^sup>+ x. f1 (g x) * ennreal (g' x) * indicator {a..b} x + f2 (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = \<integral>\<^sup>+ x. (f1 (g x) + f2 (g x)) * ennreal (g' x) * indicator {a..b} x \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f1 (g x) * ennreal (g' x) * indicator {a..b} x + f2 (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((f1 (g x) + f2 (g x)) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (simp split: split_indicator add: distrib_right)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f1 (g x) * ennreal (g' x) * indicator {a..b} x + f2 (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((f1 (g x) + f2 (g x)) * ennreal (g' x))\<partial>lborel

goal (2 subgoals):
 1. \<And>u v. \<lbrakk>u \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> u x < top; set_nn_integral lborel {g a..g b} u = \<integral>\<^sup>+x\<in>{a..b}. (u (g x) * ennreal (g' x))\<partial>lborel; v \<in> borel_measurable borel; \<And>x. x \<in> space borel \<Longrightarrow> v x < top; \<And>x. x \<in> space borel \<Longrightarrow> u x = 0 \<or> v x = 0; set_nn_integral lborel {g a..g b} v = \<integral>\<^sup>+x\<in>{a..b}. (v (g x) * ennreal (g' x))\<partial>lborel\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+x\<in>{g a..g b}. (v x + u x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((v (g x) + u (g x)) * ennreal (g' x))\<partial>lborel
 2. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>{g a..g b}. (f1 x + f2 x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((f1 (g x) + f2 (g x)) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>{g a..g b}. (f1 x + f2 x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((f1 (g x) + f2 (g x)) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{g a..g b}. (f1 x + f2 x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((f1 (g x) + f2 (g x)) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{g a..g b}. (f1 x + f2 x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((f1 (g x) + f2 (g x)) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
case (sup F)
[PROOF STATE]
proof (state)
this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
let ?I = "indicator {a..b}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>x. F i (g x * ?I x) * ennreal (g' x * ?I x)) \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. F i (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel
[PROOF STEP]
using Mg Mg'
[PROOF STATE]
proof (prove)
using this:
set_borel_measurable borel {a..b} g
set_borel_measurable borel {a..b} g'

goal (1 subgoal):
 1. (\<lambda>x. F i (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel
[PROOF STEP]
by (rule_tac borel_measurable_times_ennreal, rule_tac measurable_compose[OF _ sup.hyps(1)])
         (simp_all add: mult.commute set_borel_measurable_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. F i (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. F i (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) \<in> borel_measurable borel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<lambda>x. F i (g x * ?I x) * ennreal (g' x * ?I x)) = (\<lambda>x. F i (g x) * ennreal (g' x) * ?I x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. F i (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) = (\<lambda>x. F i (g x) * ennreal (g' x) * indicator {a..b} x)
[PROOF STEP]
by (intro ext) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. F i (g x * indicat_real {a..b} x) * ennreal (g' x * indicat_real {a..b} x)) = (\<lambda>x. F i (g x) * ennreal (g' x) * indicator {a..b} x)

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel
[PROOF STEP]
have "... \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (1 subgoal):
 1. (\<lambda>x. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<lambda>x. F ?i5 (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
note Mf' = this
[PROOF STATE]
proof (state)
this:
(\<lambda>x. F ?i5 (g x) * ennreal (g' x) * indicator {a..b} x) \<in> borel_measurable borel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "(\<integral>\<^sup>+x. (SUP i. F i x) * indicator {g a..g b} x \<partial>lborel) =
               \<integral>\<^sup>+x. (SUP i. F i x* indicator {g a..g b} x) \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{g a..g b}. (SUP i. F i x)\<partial>lborel = \<integral>\<^sup>+ x. (SUP i. F i x * indicator {g a..g b} x) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (simp split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{g a..g b}. (SUP i. F i x)\<partial>lborel = \<integral>\<^sup>+ x. (SUP i. F i x * indicator {g a..g b} x) \<partial>lborel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{g a..g b}. (SUP i. F i x)\<partial>lborel = \<integral>\<^sup>+ x. (SUP i. F i x * indicator {g a..g b} x) \<partial>lborel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from sup
[PROOF STATE]
proof (chain)
picking this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = (SUP i. \<integral>\<^sup>+x. F i x* indicator {g a..g b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
using this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i. F i x * indicator {g a..g b} x) \<partial>lborel = (SUP i. set_nn_integral lborel {g a..g b} (F i))
[PROOF STEP]
by (intro nn_integral_monotone_convergence_SUP)
         (auto simp: incseq_def le_fun_def split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i. F i x * indicator {g a..g b} x) \<partial>lborel = (SUP i. set_nn_integral lborel {g a..g b} (F i))

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i. F i x * indicator {g a..g b} x) \<partial>lborel = (SUP i. set_nn_integral lborel {g a..g b} (F i))

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from sup
[PROOF STATE]
proof (chain)
picking this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = (SUP i. \<integral>\<^sup>+x. F i (g x) * ennreal (g' x) * indicator {a..b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
using this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. (SUP i. set_nn_integral lborel {g a..g b} (F i)) = (SUP i. \<integral>\<^sup>+x\<in>{a..b}. (F i (g x) * ennreal (g' x))\<partial>lborel)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(SUP i. set_nn_integral lborel {g a..g b} (F i)) = (SUP i. \<integral>\<^sup>+x\<in>{a..b}. (F i (g x) * ennreal (g' x))\<partial>lborel)

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(SUP i. set_nn_integral lborel {g a..g b} (F i)) = (SUP i. \<integral>\<^sup>+x\<in>{a..b}. (F i (g x) * ennreal (g' x))\<partial>lborel)

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from sup
[PROOF STATE]
proof (chain)
picking this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... =  \<integral>\<^sup>+x. (SUP i. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<partial>lborel"
[PROOF STATE]
proof (prove)
using this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. (SUP i. \<integral>\<^sup>+x\<in>{a..b}. (F i (g x) * ennreal (g' x))\<partial>lborel) = \<integral>\<^sup>+ x. (SUP i. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_monotone_convergence_SUP[symmetric])
         (auto simp: incseq_def le_fun_def derivg_nonneg Mf' split: split_indicator
               intro!: mult_right_mono)
[PROOF STATE]
proof (state)
this:
(SUP i. \<integral>\<^sup>+x\<in>{a..b}. (F i (g x) * ennreal (g' x))\<partial>lborel) = \<integral>\<^sup>+ x. (SUP i. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<partial>lborel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(SUP i. \<integral>\<^sup>+x\<in>{a..b}. (F i (g x) * ennreal (g' x))\<partial>lborel) = \<integral>\<^sup>+ x. (SUP i. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<partial>lborel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
from sup
[PROOF STATE]
proof (chain)
picking this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
have "... = \<integral>\<^sup>+x. (SUP i. F i (g x)) * ennreal (g' x) * indicator {a..b} x \<partial>lborel"
[PROOF STATE]
proof (prove)
using this:
F ?i3 \<in> borel_measurable borel
?x3 \<in> space borel \<Longrightarrow> F ?i3 ?x3 < top
incseq F
f = Sup (range F)
set_nn_integral lborel {g a..g b} (F ?i3) = \<integral>\<^sup>+x\<in>{a..b}. (F ?i3 (g x) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((SUP i. F i (g x)) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
by (subst mult.assoc, subst mult.commute, subst SUP_mult_left_ennreal)
         (auto split: split_indicator simp: derivg_nonneg mult_ac)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i. F i (g x) * ennreal (g' x) * indicator {a..b} x) \<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((SUP i. F i (g x)) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. \<And>U. \<lbrakk>\<And>i. U i \<in> borel_measurable borel; \<And>i x. x \<in> space borel \<Longrightarrow> U i x < top; \<And>i. set_nn_integral lborel {g a..g b} (U i) = \<integral>\<^sup>+x\<in>{a..b}. (U i (g x) * ennreal (g' x))\<partial>lborel; incseq U; f = Sup (range U)\<rbrakk> \<Longrightarrow> set_nn_integral lborel {g a..g b} (Sup (range U)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range U) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>{g a..g b}. (SUP i. F i x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((SUP i. F i (g x)) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>{g a..g b}. (SUP i. F i x)\<partial>lborel = \<integral>\<^sup>+x\<in>{a..b}. ((SUP i. F i (g x)) * ennreal (g' x))\<partial>lborel

goal (1 subgoal):
 1. set_nn_integral lborel {g a..g b} (Sup (range F)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range F) (g x) * ennreal (g' x))\<partial>lborel
[PROOF STEP]
by (simp add: image_comp)
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} (Sup (range F)) = \<integral>\<^sup>+x\<in>{a..b}. (Sup (range F) (g x) * ennreal (g' x))\<partial>lborel

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_nn_integral lborel {g a..g b} f = \<integral>\<^sup>+x\<in>{a..b}. (f (g x) * ennreal (g' x))\<partial>lborel

goal:
No subgoals!
[PROOF STEP]
qed