[STATEMENT]
lemma gauge_integral_Fubini_curve_bounded_region_y:
  fixes f g :: "('a::euclidean_space * 'b::euclidean_space) \<Rightarrow> 'c::euclidean_space" and
    g1 g2:: "'b \<Rightarrow> 'a" and
    s:: "('a * 'b) set"
  assumes fun_lesbegue_integrable: "integrable lborel f" and
    y_axis_gauge_integrable: "\<And>x. (\<lambda>y. f(y, x)) integrable_on UNIV" and
    (*IS THIS redundant? NO IT IS NOT*)
    y_axis_integral_measurable: "(\<lambda>x. integral UNIV (\<lambda>y. f(y, x))) \<in> borel_measurable lborel" and
    f_is_g_indicator: "f = (\<lambda>x. if x \<in> s then g x else 0)" and
    s_is_bounded_by_g1_and_g2: "s = {(y, x). (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and>
                                                   (\<forall>i\<in>Basis. (g1 x) \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> (g2 x) \<bullet> i)}"
  shows "integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g(y, x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
have two_D_integral_to_one_D: "integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f(y, x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x)))
[PROOF STEP]
using gauge_integral_Fubini_universe_y and fun_lesbegue_integrable and y_axis_integral_measurable
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable lborel ?f; (\<lambda>x. integral UNIV (\<lambda>y. ?f (y, x))) \<in> borel_measurable lborel\<rbrakk> \<Longrightarrow> integral UNIV ?f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. ?f (y, x)))
\<lbrakk>integrable lborel ?f; (\<lambda>x. integral UNIV (\<lambda>y. ?f (y, x))) \<in> borel_measurable lborel\<rbrakk> \<Longrightarrow> (\<lambda>x. integral UNIV (\<lambda>y. ?f (y, x))) integrable_on UNIV
integrable lborel f
(\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) \<in> borel_measurable lborel

goal (1 subgoal):
 1. integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x)))

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
have one_d_integral_integrable: "(\<lambda>x. integral UNIV (\<lambda>y. f(y, x))) integrable_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) integrable_on UNIV
[PROOF STEP]
using gauge_integral_Fubini_universe_y(2) and assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable lborel ?f; (\<lambda>x. integral UNIV (\<lambda>y. ?f (y, x))) \<in> borel_measurable lborel\<rbrakk> \<Longrightarrow> (\<lambda>x. integral UNIV (\<lambda>y. ?f (y, x))) integrable_on UNIV
integrable lborel f
(\<lambda>y. f (y, ?x)) integrable_on UNIV
(\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) \<in> borel_measurable lborel
f = (\<lambda>x. if x \<in> s then g x else (0::'c))
s = {(y, x). (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i)}

goal (1 subgoal):
 1. (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) integrable_on UNIV
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) integrable_on UNIV

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
have case_y_in_range:
    "\<forall> x \<in> cbox a b. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g(y, x)) = integral UNIV (\<lambda>y. f(y, x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>cbox a b. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
fix x:: 'b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
assume within_range: "x \<in> (cbox a b)"
[PROOF STATE]
proof (state)
this:
x \<in> cbox a b

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
let ?f_one_D_spec = "(\<lambda>y. if y \<in> (cbox (g1 x) (g2 x)) then g(y, x) else 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
have f_one_D_region: "(\<lambda>y. f(y, x)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g(y, x) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. f (y, x)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. f (y, x) = (if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))
[PROOF STEP]
fix y::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. f (y, x) = (if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))
[PROOF STEP]
show "f (y, x) = (if y \<in> (cbox (g1 x) (g2 x)) then g (y, x) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (y, x) = (if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))
[PROOF STEP]
apply (simp add: f_is_g_indicator s_is_bounded_by_g1_and_g2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> g (y, x) = (0::'c)) \<and> ((\<exists>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<longrightarrow> \<not> x \<bullet> i \<le> b \<bullet> i) \<longrightarrow> y \<in> cbox (g1 x) (g2 x) \<longrightarrow> g (y, x) = (0::'c)) \<and> ((\<exists>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<longrightarrow> \<not> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> y \<in> cbox (g1 x) (g2 x) \<longrightarrow> g (y, x) = (0::'c))
[PROOF STEP]
using within_range
[PROOF STATE]
proof (prove)
using this:
x \<in> cbox a b

goal (1 subgoal):
 1. ((\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> g (y, x) = (0::'c)) \<and> ((\<exists>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<longrightarrow> \<not> x \<bullet> i \<le> b \<bullet> i) \<longrightarrow> y \<in> cbox (g1 x) (g2 x) \<longrightarrow> g (y, x) = (0::'c)) \<and> ((\<exists>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<longrightarrow> \<not> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> y \<in> cbox (g1 x) (g2 x) \<longrightarrow> g (y, x) = (0::'c))
[PROOF STEP]
apply (simp add: cbox_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i \<Longrightarrow> (\<exists>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<longrightarrow> \<not> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> g (y, x) = (0::'c)
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
f (y, x) = (if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>y. f (y, x)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
have zero_out_of_bound: "\<forall> y.  y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (y, x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (y, x) = (0::'c)
[PROOF STEP]
using f_is_g_indicator and s_is_bounded_by_g1_and_g2
[PROOF STATE]
proof (prove)
using this:
f = (\<lambda>x. if x \<in> s then g x else (0::'c))
s = {(y, x). (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i)}

goal (1 subgoal):
 1. \<forall>y. y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (y, x) = (0::'c)
[PROOF STEP]
by (auto simp add: cbox_def)
[PROOF STATE]
proof (state)
this:
\<forall>y. y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (y, x) = (0::'c)

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
have "(\<lambda>y. f(y, x)) integrable_on cbox (g1 x)  (g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
have "?f_one_D_spec integrable_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on UNIV
[PROOF STEP]
using f_one_D_region and y_axis_gauge_integrable
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. f (y, x)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))
(\<lambda>y. f (y, ?x)) integrable_on UNIV

goal (1 subgoal):
 1. (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on UNIV
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on UNIV

goal (1 subgoal):
 1. (\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on UNIV
[PROOF STEP]
have "?f_one_D_spec integrable_on cbox(g1 x) (g2 x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on UNIV

goal (1 subgoal):
 1. (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
using integrable_on_subcbox
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on UNIV
\<lbrakk>?f integrable_on ?S; cbox ?a ?b \<subseteq> ?S\<rbrakk> \<Longrightarrow> ?f integrable_on cbox ?a ?b

goal (1 subgoal):
 1. (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on cbox (g1 x) (g2 x)

goal (1 subgoal):
 1. (\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on cbox (g1 x) (g2 x)

goal (1 subgoal):
 1. (\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
using f_one_D_region
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c)) integrable_on cbox (g1 x) (g2 x)
(\<lambda>y. f (y, x)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))

goal (1 subgoal):
 1. (\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
have f_integrale_y: "((\<lambda>y. f(y, x)) has_integral (integral (cbox (g1 x) (g2 x)) (\<lambda>y. f(y,x)))) (cbox (g1 x) (g2 x))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)

goal (1 subgoal):
 1. ((\<lambda>y. f (y, x)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
[PROOF STEP]
using integrable_integral and within_range and y_axis_gauge_integrable
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. f (y, x)) integrable_on cbox (g1 x) (g2 x)
?f integrable_on ?i \<Longrightarrow> (?f has_integral integral ?i ?f) ?i
x \<in> cbox a b
(\<lambda>y. f (y, ?x)) integrable_on UNIV

goal (1 subgoal):
 1. ((\<lambda>y. f (y, x)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>y. f (y, x)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
have "integral (cbox (g1 x)  (g2 x)) (\<lambda>y. f (y, x)) = integral UNIV (\<lambda>y. f (y, x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
using has_integral_on_superset[OF f_integrale_y _ Set.subset_UNIV] zero_out_of_bound
[PROOF STATE]
proof (prove)
using this:
(\<And>xa. xa \<notin> cbox (g1 x) (g2 x) \<Longrightarrow> f (xa, x) = (0::'c)) \<Longrightarrow> ((\<lambda>y. f (y, x)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x))) UNIV
\<forall>y. y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (y, x) = (0::'c)

goal (1 subgoal):
 1. integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
by (simp add: integral_unique)
[PROOF STATE]
proof (state)
this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x)) = integral UNIV (\<lambda>y. f (y, x))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
have "((\<lambda>y. f(y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))"
[PROOF STATE]
proof (prove)
using this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x)) = integral UNIV (\<lambda>y. f (y, x))

goal (1 subgoal):
 1. ((\<lambda>y. f (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
[PROOF STEP]
using f_integrale_y
[PROOF STATE]
proof (prove)
using this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x)) = integral UNIV (\<lambda>y. f (y, x))
((\<lambda>y. f (y, x)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. ((\<lambda>y. f (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>y. f (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>y. f (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
[PROOF STEP]
have "((\<lambda>y. g(y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x)(g2 x))"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. f (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. ((\<lambda>y. g (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
[PROOF STEP]
using  Henstock_Kurzweil_Integration.has_integral_restrict [OF subset_refl ] and
        f_one_D_region
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. f (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
((\<lambda>x. if x \<in> ?S then ?f x else (0::?'b)) has_integral ?i) ?S = (?f has_integral ?i) ?S
(\<lambda>y. f (y, x)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (y, x) else (0::'c))

goal (1 subgoal):
 1. ((\<lambda>y. g (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
[PROOF STEP]
by (smt has_integral_eq)
[PROOF STATE]
proof (state)
this:
((\<lambda>y. g (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>y. g (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))
[PROOF STEP]
show "integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. g (y, x)) has_integral integral UNIV (\<lambda>y. f (y, x))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>cbox a b. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
have case_y_not_in_range:
    "\<forall> x. x \<notin> cbox a  b \<longrightarrow> integral UNIV (\<lambda>y. f(y, x)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = (0::'c)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = (0::'c)
[PROOF STEP]
fix x::'b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = (0::'c)
[PROOF STEP]
have "x \<notin> (cbox a b) \<longrightarrow> (\<forall>y. f(y, x) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> cbox a b \<longrightarrow> (\<forall>y. f (y, x) = (0::'c))
[PROOF STEP]
apply  (simp add: s_is_bounded_by_g1_and_g2 f_is_g_indicator cbox_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<longrightarrow> \<not> x \<bullet> i \<le> b \<bullet> i) \<longrightarrow> (\<forall>y. (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> g (y, x) = (0::'c))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<notin> cbox a b \<longrightarrow> (\<forall>y. f (y, x) = (0::'c))

goal (1 subgoal):
 1. \<And>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = (0::'c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> cbox a b \<longrightarrow> (\<forall>y. f (y, x) = (0::'c))
[PROOF STEP]
show "x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = 0"
[PROOF STATE]
proof (prove)
using this:
x \<notin> cbox a b \<longrightarrow> (\<forall>y. f (y, x) = (0::'c))

goal (1 subgoal):
 1. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = (0::'c)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = (0::'c)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = (0::'c)

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
have RHS: "integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f(y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g(y, x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
let ?first_integral = "(\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g(y, x)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
let ?x_integral_cases = "(\<lambda>x. if x \<in> cbox a b then  ?first_integral x else 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
have y_integral_cases_integral: "(\<lambda>x. integral UNIV (\<lambda>y. f(y, x))) = ?x_integral_cases"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = (\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c))
[PROOF STEP]
using case_y_in_range and case_y_not_in_range
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>cbox a b. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) = integral UNIV (\<lambda>y. f (y, x))
\<forall>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (y, x)) = (0::'c)

goal (1 subgoal):
 1. (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = (\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = (\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c))

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
have "((\<lambda>x. integral UNIV (\<lambda>y. f(y, x))) has_integral (integral UNIV f)) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) has_integral integral UNIV f) UNIV
[PROOF STEP]
using two_D_integral_to_one_D
        one_d_integral_integrable
[PROOF STATE]
proof (prove)
using this:
integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x)))
(\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) integrable_on UNIV

goal (1 subgoal):
 1. ((\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) has_integral integral UNIV f) UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) has_integral integral UNIV f) UNIV

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) has_integral integral UNIV f) UNIV
[PROOF STEP]
have "(?x_integral_cases has_integral (integral UNIV f)) UNIV"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) has_integral integral UNIV f) UNIV

goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c)) has_integral integral UNIV f) UNIV
[PROOF STEP]
using y_integral_cases_integral
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) has_integral integral UNIV f) UNIV
(\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = (\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c))

goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c)) has_integral integral UNIV f) UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c)) has_integral integral UNIV f) UNIV

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c)) has_integral integral UNIV f) UNIV
[PROOF STEP]
have "(?first_integral has_integral (integral UNIV f)) (cbox a b)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c)) has_integral integral UNIV f) UNIV

goal (1 subgoal):
 1. ((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x))) has_integral integral UNIV f) (cbox a b)
[PROOF STEP]
using has_integral_restrict_UNIV[of "cbox a b" "?first_integral" "integral UNIV f"]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c)) has_integral integral UNIV f) UNIV
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)) else (0::'c)) has_integral integral UNIV f) UNIV = ((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x))) has_integral integral UNIV f) (cbox a b)

goal (1 subgoal):
 1. ((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x))) has_integral integral UNIV f) (cbox a b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x))) has_integral integral UNIV f) (cbox a b)

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x))) has_integral integral UNIV f) (cbox a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x))) has_integral integral UNIV f) (cbox a b)

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
using two_D_integral_to_one_D
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x))) has_integral integral UNIV f) (cbox a b)
integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x)))

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
by (simp add: integral_unique)
[PROOF STATE]
proof (state)
this:
integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
have f_integrable:"f integrable_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on UNIV
[PROOF STEP]
using fun_lesbegue_integrable and integrable_on_lborel
[PROOF STATE]
proof (prove)
using this:
integrable lborel f
integrable lborel ?f \<Longrightarrow> ?f integrable_on UNIV

goal (1 subgoal):
 1. f integrable_on UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f integrable_on UNIV

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f integrable_on UNIV
[PROOF STEP]
have LHS: "integral UNIV f = integral s g"
[PROOF STATE]
proof (prove)
using this:
f integrable_on UNIV

goal (1 subgoal):
 1. integral UNIV f = integral s g
[PROOF STEP]
apply (simp add: f_is_g_indicator)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> s then g x else (0::'c)) integrable_on UNIV \<Longrightarrow> integral UNIV (\<lambda>x. if x \<in> s then g x else (0::'c)) = integral s g
[PROOF STEP]
using integrable_restrict_UNIV
      integral_restrict_UNIV
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x \<in> ?s then ?f x else (0::?'a)) integrable_on UNIV) = (?f integrable_on ?s)
integral UNIV (\<lambda>x. if x \<in> ?S then ?f x else (0::?'a)) = integral ?S ?f

goal (1 subgoal):
 1. (\<lambda>x. if x \<in> s then g x else (0::'c)) integrable_on UNIV \<Longrightarrow> integral UNIV (\<lambda>x. if x \<in> s then g x else (0::'c)) = integral s g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral UNIV f = integral s g

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral UNIV f = integral s g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral UNIV f = integral s g

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
using RHS and two_D_integral_to_one_D
[PROOF STATE]
proof (prove)
using this:
integral UNIV f = integral s g
integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (y, x)))

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (y, x)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pl_pl_rels: "a + b = c + d \<Longrightarrow> a \<ge> c \<and> b \<le> d \<or> a \<le> c \<and> b \<ge> d"
  for a b c d :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + b = c + d \<Longrightarrow> c \<le> a \<and> b \<le> d \<or> a \<le> c \<and> d \<le> b
[PROOF STEP]
by arith


[STATEMENT]
lemma Sum_any_lookup_times_eq:
  "(\<Sum>k. ((lookup (x::'a\<Rightarrow>\<^sub>0('b::comm_semiring_1)) (k::'a)) * ((f:: 'a\<Rightarrow>('b::comm_semiring_1)) k))) = (\<Sum>k\<in>keys
x. (lookup x (k::'a)) * (f k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k. lookup x k * f k) = (\<Sum>k\<in>keys x. lookup x k * f k)
[PROOF STEP]
by (subst Sum_any.conditionalize) (auto simp: in_keys_iff intro!:
      Sum_any.cong)


[STATEMENT]
lemma mset_filter: "(queue_to_multiset [t\<leftarrow>q . rank t = 0]) +
  queue_to_multiset [t\<leftarrow>q . 0 < rank t] =
  queue_to_multiset q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. queue_to_multiset (filter (\<lambda>t. rank t = 0) q) + queue_to_multiset (filter (\<lambda>t. 0 < rank t) q) = queue_to_multiset q
[PROOF STEP]
by (induct q) (auto simp add: union_ac)


[STATEMENT]
lemma continuous_on_min [continuous_intros]:
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
  shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. min (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>x. min (f x) (g x))
[PROOF STEP]
by (auto simp: continuous_on_def intro!: tendsto_min)


[STATEMENT]
lemma topological_basis_prod:
  assumes A: "topological_basis A"
    and B: "topological_basis B"
  shows "topological_basis ((\<lambda>(a, b). a \<times> b) ` (A \<times> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topological_basis ((\<lambda>(a, b). a \<times> b) ` (A \<times> B))
[PROOF STEP]
unfolding topological_basis_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ball ((\<lambda>(a, b). a \<times> b) ` (A \<times> B)) open \<and> (\<forall>x. open x \<longrightarrow> (\<exists>B'\<subseteq>(\<lambda>(a, b). a \<times> b) ` (A \<times> B). \<Union> B' = x))
[PROOF STEP]
proof (safe, simp_all del: ex_simps add: subset_image_iff ex_simps(1)[symmetric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> open (a \<times> b)
 2. \<And>x. open x \<Longrightarrow> \<exists>AA\<subseteq>A \<times> B. (\<Union>x\<in>AA. case x of (a, b) \<Rightarrow> a \<times> b) = x
[PROOF STEP]
fix S :: "('a \<times> 'b) set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> open (a \<times> b)
 2. \<And>x. open x \<Longrightarrow> \<exists>AA\<subseteq>A \<times> B. (\<Union>x\<in>AA. case x of (a, b) \<Rightarrow> a \<times> b) = x
[PROOF STEP]
assume "open S"
[PROOF STATE]
proof (state)
this:
open S

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> open (a \<times> b)
 2. \<And>x. open x \<Longrightarrow> \<exists>AA\<subseteq>A \<times> B. (\<Union>x\<in>AA. case x of (a, b) \<Rightarrow> a \<times> b) = x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open S
[PROOF STEP]
show "\<exists>X\<subseteq>A \<times> B. (\<Union>(a,b)\<in>X. a \<times> b) = S"
[PROOF STATE]
proof (prove)
using this:
open S

goal (1 subgoal):
 1. \<exists>X\<subseteq>A \<times> B. (\<Union>(a, b)\<in>X. a \<times> b) = S
[PROOF STEP]
proof (safe intro!: exI[of _ "{x\<in>A \<times> B. fst x \<times> snd x \<subseteq> S}"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
 2. \<And>a b. \<lbrakk>open S; (a, b) \<in> S\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
 2. \<And>a b. \<lbrakk>open S; (a, b) \<in> S\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
assume "(x, y) \<in> S"
[PROOF STATE]
proof (state)
this:
(x, y) \<in> S

goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
 2. \<And>a b. \<lbrakk>open S; (a, b) \<in> S\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
from open_prod_elim[OF \<open>open S\<close> this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>A B. \<lbrakk>open A; open B; (x, y) \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain a b where a: "open a""x \<in> a" and b: "open b" "y \<in> b" and "a \<times> b \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
(\<And>A B. \<lbrakk>open A; open B; (x, y) \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>open a; x \<in> a; open b; y \<in> b; a \<times> b \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis mem_Sigma_iff)
[PROOF STATE]
proof (state)
this:
open a
x \<in> a
open b
y \<in> b
a \<times> b \<subseteq> S

goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
 2. \<And>a b. \<lbrakk>open S; (a, b) \<in> S\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open a
x \<in> a
open b
y \<in> b
a \<times> b \<subseteq> S

goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
 2. \<And>a b. \<lbrakk>open S; (a, b) \<in> S\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
from A a
[PROOF STATE]
proof (chain)
picking this:
topological_basis A
open a
x \<in> a
[PROOF STEP]
obtain A0 where "A0 \<in> A" "x \<in> A0" "A0 \<subseteq> a"
[PROOF STATE]
proof (prove)
using this:
topological_basis A
open a
x \<in> a

goal (1 subgoal):
 1. (\<And>A0. \<lbrakk>A0 \<in> A; x \<in> A0; A0 \<subseteq> a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule topological_basisE)
[PROOF STATE]
proof (state)
this:
A0 \<in> A
x \<in> A0
A0 \<subseteq> a

goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
 2. \<And>a b. \<lbrakk>open S; (a, b) \<in> S\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A0 \<in> A
x \<in> A0
A0 \<subseteq> a

goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
 2. \<And>a b. \<lbrakk>open S; (a, b) \<in> S\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
from B b
[PROOF STATE]
proof (chain)
picking this:
topological_basis B
open b
y \<in> b
[PROOF STEP]
obtain B0 where "B0 \<in> B" "y \<in> B0" "B0 \<subseteq> b"
[PROOF STATE]
proof (prove)
using this:
topological_basis B
open b
y \<in> b

goal (1 subgoal):
 1. (\<And>B0. \<lbrakk>B0 \<in> B; y \<in> B0; B0 \<subseteq> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule topological_basisE)
[PROOF STATE]
proof (state)
this:
B0 \<in> B
y \<in> B0
B0 \<subseteq> b

goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
 2. \<And>a b. \<lbrakk>open S; (a, b) \<in> S\<rbrakk> \<Longrightarrow> (a, b) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
open a
x \<in> a
open b
y \<in> b
a \<times> b \<subseteq> S
A0 \<in> A
x \<in> A0
A0 \<subseteq> a
B0 \<in> B
y \<in> B0
B0 \<subseteq> b
[PROOF STEP]
show "(x, y) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)"
[PROOF STATE]
proof (prove)
using this:
open a
x \<in> a
open b
y \<in> b
a \<times> b \<subseteq> S
A0 \<in> A
x \<in> A0
A0 \<subseteq> a
B0 \<in> B
y \<in> B0
B0 \<subseteq> b

goal (1 subgoal):
 1. (x, y) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)
[PROOF STEP]
by (intro UN_I[of "(A0, B0)"]) auto
[PROOF STATE]
proof (state)
this:
(x, y) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>open S; a \<in> aa; b \<in> ba; fst (aa, ba) \<times> snd (aa, ba) \<subseteq> S; aa \<in> A; ba \<in> B\<rbrakk> \<Longrightarrow> (a, b) \<in> S
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<exists>X\<subseteq>A \<times> B. (\<Union>(a, b)\<in>X. a \<times> b) = S

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> open (a \<times> b)
[PROOF STEP]
qed (metis A B topological_basis_open open_Times)


[STATEMENT]
lemma stc_add:
  "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> stc (x + y) = stc(x) + stc(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> stc (x + y) = stc x + stc y
[PROOF STEP]
by (simp add: stc_unique stc_SComplex stc_approx_self approx_add)


[STATEMENT]
lemma primepow_gt_Suc_0: "primepow n \<Longrightarrow> n > Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primepow n \<Longrightarrow> Suc 0 < n
[PROOF STEP]
using one_less_power[of "p::nat" for p]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < ?p3; 0 < ?n\<rbrakk> \<Longrightarrow> 1 < ?p3 ^ ?n

goal (1 subgoal):
 1. primepow n \<Longrightarrow> Suc 0 < n
[PROOF STEP]
by (auto simp: primepow_def prime_nat_iff)


[STATEMENT]
lemma stable_Inter:
    "(!!A. A \<in> X ==> F \<in> stable A) ==> F \<in> stable (\<Inter>X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A. A \<in> X \<Longrightarrow> F \<in> UNITY.stable A) \<Longrightarrow> F \<in> UNITY.stable (\<Inter> X)
[PROOF STEP]
by (unfold stable_def constrains_def, blast)


[STATEMENT]
lemma qbs_morphism_Pair1':
  assumes "x \<in> qbs_space X"
      and "f \<in> X \<Otimes>\<^sub>Q Y \<rightarrow>\<^sub>Q Z"
    shows "(\<lambda>y. f (x,y)) \<in> Y \<rightarrow>\<^sub>Q Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) \<in> Y \<rightarrow>\<^sub>Q Z
[PROOF STEP]
using qbs_morphism_comp[OF qbs_morphism_Pair1[OF assms(1)] assms(2)]
[PROOF STATE]
proof (prove)
using this:
f \<circ> Pair x \<in> Y \<rightarrow>\<^sub>Q Z

goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) \<in> Y \<rightarrow>\<^sub>Q Z
[PROOF STEP]
by(simp add: comp_def)


[STATEMENT]
lemma semialg_complement:
  assumes "A \<in> semialg_sets n"
  shows "(carrier (Q\<^sub>p\<^bsup>n\<^esup>) - A) \<in> semialg_sets n "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (Q\<^sub>p\<^bsup>n\<^esup>) - A \<in> semialg_sets n
[PROOF STEP]
using assms gen_boolean_algebra.complement semialg_sets_def
[PROOF STATE]
proof (prove)
using this:
A \<in> semialg_sets n
?A \<in> gen_boolean_algebra ?S ?B \<Longrightarrow> ?S - ?A \<in> gen_boolean_algebra ?S ?B
semialg_sets ?n = gen_boolean_algebra (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) {S. is_basic_semialg ?n S}

goal (1 subgoal):
 1. carrier (Q\<^sub>p\<^bsup>n\<^esup>) - A \<in> semialg_sets n
[PROOF STEP]
by blast


[STATEMENT]
lemma equal_image_mset:
  assumes "\<forall>x \<in> E. (f x) = (g x)"
  shows "{# (f x). x \<in># (mset_set E) #} = {# (g x). x \<in># (mset_set E)  #}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f (mset_set E) = image_mset g (mset_set E)
[PROOF STEP]
by (meson assms count_eq_zero_iff count_mset_set(3) image_mset_cong)


[STATEMENT]
lemma even_inter_mod_2:
  assumes "CARD('b::prime_card) = 2"
  assumes "i < \<b>" and jlt: "j < \<b>" and ne: "i \<noteq> j"
  shows "of_nat ((\<B>s ! i) |\<inter>| (\<B>s ! j)) = (0 :: 'b mod_ring)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (\<B>s ! i |\<inter>| \<B>s ! j) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_nat (\<B>s ! i |\<inter>| \<B>s ! j) = 0
[PROOF STEP]
have cb2: "CARD('b) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('b) = 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
CARD('b) = 2
i < \<b>
j < \<b>
i \<noteq> j

goal (1 subgoal):
 1. CARD('b) = 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
CARD('b) = 2

goal (1 subgoal):
 1. of_nat (\<B>s ! i |\<inter>| \<B>s ! j) = 0
[PROOF STEP]
have "even ((\<B>s ! i) |\<inter>| (\<B>s ! j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (\<B>s ! i |\<inter>| \<B>s ! j)
[PROOF STEP]
using even_inters assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?bl1.0 \<in># \<B>; ?bl2.0 \<in># remove1_mset ?bl1.0 \<B>\<rbrakk> \<Longrightarrow> even (?bl1.0 |\<inter>| ?bl2.0)
CARD('b) = 2
i < \<b>
j < \<b>
i \<noteq> j

goal (1 subgoal):
 1. even (\<B>s ! i |\<inter>| \<B>s ! j)
[PROOF STEP]
using blocks_index_ne_belong blocks_list_length valid_blocks_index
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?bl1.0 \<in># \<B>; ?bl2.0 \<in># remove1_mset ?bl1.0 \<B>\<rbrakk> \<Longrightarrow> even (?bl1.0 |\<inter>| ?bl2.0)
CARD('b) = 2
i < \<b>
j < \<b>
i \<noteq> j
\<lbrakk>?i1.0 < length \<B>s; ?i2.0 < length \<B>s; ?i1.0 \<noteq> ?i2.0\<rbrakk> \<Longrightarrow> \<B>s ! ?i2.0 \<in># remove1_mset (\<B>s ! ?i1.0) \<B>
length \<B>s = \<b>
?j < \<b> \<Longrightarrow> \<B>s ! ?j \<in># \<B>

goal (1 subgoal):
 1. even (\<B>s ! i |\<inter>| \<B>s ! j)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
even (\<B>s ! i |\<inter>| \<B>s ! j)

goal (1 subgoal):
 1. of_nat (\<B>s ! i |\<inter>| \<B>s ! j) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even (\<B>s ! i |\<inter>| \<B>s ! j)
[PROOF STEP]
show "of_nat ((\<B>s ! i) |\<inter>| (\<B>s ! j)) = (0 :: 'b mod_ring)"
[PROOF STATE]
proof (prove)
using this:
even (\<B>s ! i |\<inter>| \<B>s ! j)

goal (1 subgoal):
 1. of_nat (\<B>s ! i |\<inter>| \<B>s ! j) = 0
[PROOF STEP]
by (transfer' fixing: i j \<B>s, simp add: cb2)
[PROOF STATE]
proof (state)
this:
of_nat (\<B>s ! i |\<inter>| \<B>s ! j) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closedin_subtopology: "closedin (subtopology U V) S \<longleftrightarrow> (\<exists>T. closedin U T \<and> S = T \<inter> V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (subtopology U V) S = (\<exists>T. closedin U T \<and> S = T \<inter> V)
[PROOF STEP]
unfolding closedin_def topspace_subtopology
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<subseteq> topspace U \<inter> V \<and> openin (subtopology U V) (topspace U \<inter> V - S)) = (\<exists>T. (T \<subseteq> topspace U \<and> openin U (topspace U - T)) \<and> S = T \<inter> V)
[PROOF STEP]
by (auto simp: openin_subtopology)


[STATEMENT]
lemma map_pair: "map_pmf (\<lambda>(a, b). (f a, g b)) (pair_pmf A B) = pair_pmf (map_pmf f A) (map_pmf g B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf (\<lambda>(a, b). (f a, g b)) (pair_pmf A B) = pair_pmf (map_pmf f A) (map_pmf g B)
[PROOF STEP]
by (simp add: pair_map_pmf2 pair_map_pmf1 map_pmf_comp split_beta')


[STATEMENT]
lemma fls_integral_linear:
  fixes f g :: "'a::division_ring fls"
  shows
    "fls_integral (fls_const a * f + fls_const b * g) =
      fls_const a * fls_integral f + fls_const b * fls_integral g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_integral (fls_const a * f + fls_const b * g) = fls_const a * fls_integral f + fls_const b * fls_integral g
[PROOF STEP]
by    (simp add: fls_integral_mult_const_left)


[STATEMENT]
lemma negligible_abs [simp]: "negligible (\<lambda>x. \<bar>f x\<bar>) \<longleftrightarrow> negligible f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (\<lambda>x. \<bar>f x\<bar>) = negligible f
[PROOF STEP]
by(simp add: negligible_def)


[STATEMENT]
lemma genPrefix_mono: "r<=s ==> genPrefix r <= genPrefix s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<subseteq> s \<Longrightarrow> genPrefix r \<subseteq> genPrefix s
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r \<subseteq> s; (a, b) \<in> genPrefix r\<rbrakk> \<Longrightarrow> (a, b) \<in> genPrefix s
[PROOF STEP]
apply (erule genPrefix.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a b. r \<subseteq> s \<Longrightarrow> ([], []) \<in> genPrefix s
 2. \<And>a b xs ys x y. \<lbrakk>r \<subseteq> s; (xs, ys) \<in> genPrefix r; (xs, ys) \<in> genPrefix s; (x, y) \<in> r\<rbrakk> \<Longrightarrow> (x # xs, y # ys) \<in> genPrefix s
 3. \<And>a b xs ys zs. \<lbrakk>r \<subseteq> s; (xs, ys) \<in> genPrefix r; (xs, ys) \<in> genPrefix s\<rbrakk> \<Longrightarrow> (xs, ys @ zs) \<in> genPrefix s
[PROOF STEP]
apply (auto intro: genPrefix.append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ell2_norm_triangle:
  assumes "has_ell2_norm x" and "has_ell2_norm y"
  shows "has_ell2_norm (\<lambda>i. x i + y i)" and "ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_ell2_norm (\<lambda>i. x i + y i) &&& ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. has_ell2_norm (\<lambda>i. x i + y i)
 2. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
have triangle: "L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F"
    (is "?lhs\<le>?rhs")
    if "finite F" for F
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F
[PROOF STEP]
have "?lhs \<le> L2_set (\<lambda>i. (cmod o x) i + (cmod o y) i) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (\<lambda>i. (cmod \<circ> x) i + (cmod \<circ> y) i) F
[PROOF STEP]
proof (rule L2_set_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> F \<Longrightarrow> (cmod \<circ> (\<lambda>i. x i + y i)) i \<le> (cmod \<circ> x) i + (cmod \<circ> y) i
 2. \<And>i. i \<in> F \<Longrightarrow> 0 \<le> (cmod \<circ> (\<lambda>i. x i + y i)) i
[PROOF STEP]
show "(cmod \<circ> (\<lambda>i. x i + y i)) i \<le> (cmod \<circ> x) i + (cmod \<circ> y) i"
        if "i \<in> F"
        for i :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod \<circ> (\<lambda>i. x i + y i)) i \<le> (cmod \<circ> x) i + (cmod \<circ> y) i
[PROOF STEP]
using that norm_triangle_ineq
[PROOF STATE]
proof (prove)
using this:
i \<in> F
norm (?x + ?y) \<le> norm ?x + norm ?y

goal (1 subgoal):
 1. (cmod \<circ> (\<lambda>i. x i + y i)) i \<le> (cmod \<circ> x) i + (cmod \<circ> y) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i \<in> F \<Longrightarrow> (cmod \<circ> (\<lambda>i. x i + y i)) ?i \<le> (cmod \<circ> x) ?i + (cmod \<circ> y) ?i

goal (1 subgoal):
 1. \<And>i. i \<in> F \<Longrightarrow> 0 \<le> (cmod \<circ> (\<lambda>i. x i + y i)) i
[PROOF STEP]
show "0 \<le> (cmod \<circ> (\<lambda>i. x i + y i)) i"
        if "i \<in> F"
        for i :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (cmod \<circ> (\<lambda>i. x i + y i)) i
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i \<in> F

goal (1 subgoal):
 1. 0 \<le> (cmod \<circ> (\<lambda>i. x i + y i)) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i \<in> F \<Longrightarrow> 0 \<le> (cmod \<circ> (\<lambda>i. x i + y i)) ?i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (\<lambda>i. (cmod \<circ> x) i + (cmod \<circ> y) i) F

goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (\<lambda>i. (cmod \<circ> x) i + (cmod \<circ> y) i) F

goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F
[PROOF STEP]
have "\<dots> \<le> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L2_set (\<lambda>i. (cmod \<circ> x) i + (cmod \<circ> y) i) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F
[PROOF STEP]
by (rule L2_set_triangle_ineq)
[PROOF STATE]
proof (state)
this:
L2_set (\<lambda>i. (cmod \<circ> x) i + (cmod \<circ> y) i) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F

goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F

goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ?F \<le> L2_set (cmod \<circ> x) ?F + L2_set (cmod \<circ> y) ?F

goal (2 subgoals):
 1. has_ell2_norm (\<lambda>i. x i + y i)
 2. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
obtain Mx My where Mx: "Mx \<ge> L2_set (cmod o x) F" and My: "My \<ge> L2_set (cmod o y) F"
    if "finite F" for F
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Mx My. \<lbrakk>\<And>F. finite F \<Longrightarrow> L2_set (cmod \<circ> x) F \<le> Mx; \<And>F. finite F \<Longrightarrow> L2_set (cmod \<circ> y) F \<le> My\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
has_ell2_norm x
has_ell2_norm y

goal (1 subgoal):
 1. (\<And>Mx My. \<lbrakk>\<And>F. finite F \<Longrightarrow> L2_set (cmod \<circ> x) F \<le> Mx; \<And>F. finite F \<Longrightarrow> L2_set (cmod \<circ> y) F \<le> My\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding has_ell2_norm_L2_set bdd_above_def
[PROOF STATE]
proof (prove)
using this:
\<exists>M. \<forall>x\<in>L2_set (cmod \<circ> x) ` Collect finite. x \<le> M
\<exists>M. \<forall>x\<in>L2_set (cmod \<circ> y) ` Collect finite. x \<le> M

goal (1 subgoal):
 1. (\<And>Mx My. \<lbrakk>\<And>F. finite F \<Longrightarrow> L2_set (cmod \<circ> x) F \<le> Mx; \<And>F. finite F \<Longrightarrow> L2_set (cmod \<circ> y) F \<le> My\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F \<le> Mx
finite ?F \<Longrightarrow> L2_set (cmod \<circ> y) ?F \<le> My

goal (2 subgoals):
 1. has_ell2_norm (\<lambda>i. x i + y i)
 2. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
hence MxMy: "Mx + My \<ge> L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F" if "finite F" for F
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F \<le> Mx
finite ?F \<Longrightarrow> L2_set (cmod \<circ> y) ?F \<le> My

goal (1 subgoal):
 1. L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F \<le> Mx + My
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F \<le> Mx
finite ?F \<Longrightarrow> L2_set (cmod \<circ> y) ?F \<le> My
finite F

goal (1 subgoal):
 1. L2_set (cmod \<circ> x) F + L2_set (cmod \<circ> y) F \<le> Mx + My
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F + L2_set (cmod \<circ> y) ?F \<le> Mx + My

goal (2 subgoals):
 1. has_ell2_norm (\<lambda>i. x i + y i)
 2. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
hence bdd_plus: "bdd_above ((\<lambda>xa. L2_set (cmod \<circ> x) xa + L2_set (cmod \<circ> y) xa) ` Collect finite)"
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F + L2_set (cmod \<circ> y) ?F \<le> Mx + My

goal (1 subgoal):
 1. bdd_above ((\<lambda>xa. L2_set (cmod \<circ> x) xa + L2_set (cmod \<circ> y) xa) ` Collect finite)
[PROOF STEP]
unfolding bdd_above_def
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F + L2_set (cmod \<circ> y) ?F \<le> Mx + My

goal (1 subgoal):
 1. \<exists>M. \<forall>x\<in>(\<lambda>xa. L2_set (cmod \<circ> x) xa + L2_set (cmod \<circ> y) xa) ` Collect finite. x \<le> M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bdd_above ((\<lambda>xa. L2_set (cmod \<circ> x) xa + L2_set (cmod \<circ> y) xa) ` Collect finite)

goal (2 subgoals):
 1. has_ell2_norm (\<lambda>i. x i + y i)
 2. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
from MxMy
[PROOF STATE]
proof (chain)
picking this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F + L2_set (cmod \<circ> y) ?F \<le> Mx + My
[PROOF STEP]
have MxMy': "Mx + My \<ge> L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F" if "finite F" for F
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F + L2_set (cmod \<circ> y) ?F \<le> Mx + My

goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> Mx + My
[PROOF STEP]
using triangle that
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> x) ?F + L2_set (cmod \<circ> y) ?F \<le> Mx + My
finite ?F \<Longrightarrow> L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ?F \<le> L2_set (cmod \<circ> x) ?F + L2_set (cmod \<circ> y) ?F
finite F

goal (1 subgoal):
 1. L2_set (cmod \<circ> (\<lambda>i. x i + y i)) F \<le> Mx + My
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ?F \<le> Mx + My

goal (2 subgoals):
 1. has_ell2_norm (\<lambda>i. x i + y i)
 2. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
thus has: "has_ell2_norm (\<lambda>i. x i + y i)"
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ?F \<le> Mx + My

goal (1 subgoal):
 1. has_ell2_norm (\<lambda>i. x i + y i)
[PROOF STEP]
unfolding has_ell2_norm_L2_set bdd_above_def
[PROOF STATE]
proof (prove)
using this:
finite ?F \<Longrightarrow> L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ?F \<le> Mx + My

goal (1 subgoal):
 1. \<exists>M. \<forall>x\<in>L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite. x \<le> M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
has_ell2_norm (\<lambda>i. x i + y i)

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
have SUP_plus: "(SUP x\<in>A. f x + g x) \<le> (SUP x\<in>A. f x) + (SUP x\<in>A. g x)"
    if notempty: "A\<noteq>{}" and bddf: "bdd_above (f`A)"and bddg: "bdd_above (g`A)"
    for f g :: "'a set \<Rightarrow> real" and A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>x\<in>A. f x + g x) \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Squnion>x\<in>A. f x + g x) \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
have xleq: "x \<le> (SUP x\<in>A. f x) + (SUP x\<in>A. g x)" if x: "x \<in> (\<lambda>x. f x + g x) ` A" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
obtain a where aA: "a:A" and ax: "x = f a + g a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> A; x = f a + g a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<in> (\<lambda>x. f x + g x) ` A

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> A; x = f a + g a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> A
x = f a + g a

goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
have fa: "f a \<le> (SUP x\<in>A. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<le> \<Squnion> (f ` A)
[PROOF STEP]
by (simp add: bddf aA cSUP_upper)
[PROOF STATE]
proof (state)
this:
f a \<le> \<Squnion> (f ` A)

goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f a \<le> \<Squnion> (f ` A)

goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
have "g a \<le> (SUP x\<in>A. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g a \<le> \<Squnion> (g ` A)
[PROOF STEP]
by (simp add: bddg aA cSUP_upper)
[PROOF STATE]
proof (state)
this:
g a \<le> \<Squnion> (g ` A)

goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f a \<le> \<Squnion> (f ` A)
g a \<le> \<Squnion> (g ` A)
[PROOF STEP]
have "f a + g a \<le> (SUP x\<in>A. f x) + (SUP x\<in>A. g x)"
[PROOF STATE]
proof (prove)
using this:
f a \<le> \<Squnion> (f ` A)
g a \<le> \<Squnion> (g ` A)

goal (1 subgoal):
 1. f a + g a \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f a + g a \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)

goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
with ax
[PROOF STATE]
proof (chain)
picking this:
x = f a + g a
f a + g a \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = f a + g a
f a + g a \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)

goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> (\<lambda>x. f x + g x) ` A \<Longrightarrow> ?x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)

goal (1 subgoal):
 1. (\<Squnion>x\<in>A. f x + g x) \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
have "(\<lambda>x. f x + g x) ` A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) ` A \<noteq> {}
[PROOF STEP]
using notempty
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) ` A \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) ` A \<noteq> {}

goal (1 subgoal):
 1. (\<Squnion>x\<in>A. f x + g x) \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) ` A \<noteq> {}

goal (1 subgoal):
 1. (\<Squnion>x\<in>A. f x + g x) \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
have "x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)"
      if "x \<in> (\<lambda>x. f x + g x) ` A"
      for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<in> (\<lambda>x. f x + g x) ` A

goal (1 subgoal):
 1. x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
by (simp add: xleq)
[PROOF STATE]
proof (state)
this:
?x \<in> (\<lambda>x. f x + g x) ` A \<Longrightarrow> ?x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)

goal (1 subgoal):
 1. (\<Squnion>x\<in>A. f x + g x) \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. f x + g x) ` A \<noteq> {}
?x \<in> (\<lambda>x. f x + g x) ` A \<Longrightarrow> ?x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f x + g x) ` A \<noteq> {}
?x \<in> (\<lambda>x. f x + g x) ` A \<Longrightarrow> ?x \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)

goal (1 subgoal):
 1. (\<Squnion>x\<in>A. f x + g x) \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)
[PROOF STEP]
by (meson bdd_above_def cSup_le_iff)
[PROOF STATE]
proof (state)
this:
(\<Squnion>x\<in>A. f x + g x) \<le> \<Squnion> (f ` A) + \<Squnion> (g ` A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?A \<noteq> {}; bdd_above (?f ` ?A); bdd_above (?g ` ?A)\<rbrakk> \<Longrightarrow> (\<Squnion>x\<in>?A. ?f x + ?g x) \<le> \<Squnion> (?f ` ?A) + \<Squnion> (?g ` ?A)

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
have a2: "bdd_above (L2_set (cmod \<circ> x) ` Collect finite)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (L2_set (cmod \<circ> x) ` Collect finite)
[PROOF STEP]
by (meson assms(1) has_ell2_norm_L2_set)
[PROOF STATE]
proof (state)
this:
bdd_above (L2_set (cmod \<circ> x) ` Collect finite)

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
have a3: "bdd_above (L2_set (cmod \<circ> y) ` Collect finite)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (L2_set (cmod \<circ> y) ` Collect finite)
[PROOF STEP]
by (meson assms(2) has_ell2_norm_L2_set)
[PROOF STATE]
proof (state)
this:
bdd_above (L2_set (cmod \<circ> y) ` Collect finite)

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
have a1: "Collect finite \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Collect finite \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Collect finite \<noteq> {}

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
have a4: "\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite)
    \<le> (SUP xa\<in>Collect finite.
           L2_set (cmod \<circ> x) xa + L2_set (cmod \<circ> y) xa)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> (\<Squnion>xa\<in>Collect finite. L2_set (cmod \<circ> x) xa + L2_set (cmod \<circ> y) xa)
[PROOF STEP]
by (metis (mono_tags, lifting) a1 bdd_plus cSUP_mono mem_Collect_eq triangle)
[PROOF STATE]
proof (state)
this:
\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> (\<Squnion>xa\<in>Collect finite. L2_set (cmod \<circ> x) xa + L2_set (cmod \<circ> y) xa)

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
have "\<forall>r. \<Squnion> (L2_set (cmod \<circ> (\<lambda>a. x a + y a)) ` Collect finite) \<le> r \<or> \<not> (SUP A\<in>Collect finite. L2_set (cmod \<circ> x) A + L2_set (cmod \<circ> y) A) \<le> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>r. \<Squnion> (L2_set (cmod \<circ> (\<lambda>a. x a + y a)) ` Collect finite) \<le> r \<or> \<not> (\<Squnion>A\<in>Collect finite. L2_set (cmod \<circ> x) A + L2_set (cmod \<circ> y) A) \<le> r
[PROOF STEP]
using a4
[PROOF STATE]
proof (prove)
using this:
\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> (\<Squnion>xa\<in>Collect finite. L2_set (cmod \<circ> x) xa + L2_set (cmod \<circ> y) xa)

goal (1 subgoal):
 1. \<forall>r. \<Squnion> (L2_set (cmod \<circ> (\<lambda>a. x a + y a)) ` Collect finite) \<le> r \<or> \<not> (\<Squnion>A\<in>Collect finite. L2_set (cmod \<circ> x) A + L2_set (cmod \<circ> y) A) \<le> r
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<forall>r. \<Squnion> (L2_set (cmod \<circ> (\<lambda>a. x a + y a)) ` Collect finite) \<le> r \<or> \<not> (\<Squnion>A\<in>Collect finite. L2_set (cmod \<circ> x) A + L2_set (cmod \<circ> y) A) \<le> r

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
hence "\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite)
    \<le> \<Squnion> (L2_set (cmod \<circ> x) ` Collect finite) +
       \<Squnion> (L2_set (cmod \<circ> y) ` Collect finite)"
[PROOF STATE]
proof (prove)
using this:
\<forall>r. \<Squnion> (L2_set (cmod \<circ> (\<lambda>a. x a + y a)) ` Collect finite) \<le> r \<or> \<not> (\<Squnion>A\<in>Collect finite. L2_set (cmod \<circ> x) A + L2_set (cmod \<circ> y) A) \<le> r

goal (1 subgoal):
 1. \<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> \<Squnion> (L2_set (cmod \<circ> x) ` Collect finite) + \<Squnion> (L2_set (cmod \<circ> y) ` Collect finite)
[PROOF STEP]
by (metis (no_types) SUP_plus a1 a2 a3)
[PROOF STATE]
proof (state)
this:
\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> \<Squnion> (L2_set (cmod \<circ> x) ` Collect finite) + \<Squnion> (L2_set (cmod \<circ> y) ` Collect finite)

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
hence "\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> ell2_norm x + ell2_norm y"
[PROOF STATE]
proof (prove)
using this:
\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> \<Squnion> (L2_set (cmod \<circ> x) ` Collect finite) + \<Squnion> (L2_set (cmod \<circ> y) ` Collect finite)

goal (1 subgoal):
 1. \<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
by (simp add: assms(1) assms(2) ell2_norm_L2_set)
[PROOF STATE]
proof (state)
this:
\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> ell2_norm x + ell2_norm y

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
thus "ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y"
[PROOF STATE]
proof (prove)
using this:
\<Squnion> (L2_set (cmod \<circ> (\<lambda>i. x i + y i)) ` Collect finite) \<le> ell2_norm x + ell2_norm y

goal (1 subgoal):
 1. ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y
[PROOF STEP]
by (simp add: ell2_norm_L2_set has)
[PROOF STATE]
proof (state)
this:
ell2_norm (\<lambda>i. x i + y i) \<le> ell2_norm x + ell2_norm y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lemma_3: assumes "i \<le> j"
  shows "K i j \<le> K i (j+1)" "K i (j+1) \<le> K (i+1) (j+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K i j \<le> K i (j + 1) &&& K i (j + 1) \<le> K (i + 1) (j + 1)
[PROOF STEP]
using assms lemma_3_1 lemma_3_2
[PROOF STATE]
proof (prove)
using this:
i \<le> j
?i \<le> ?j \<Longrightarrow> K ?i ?j \<le> K ?i (?j + 1)
?i \<le> ?j \<Longrightarrow> K ?i (?j + 1) \<le> K (?i + 1) (?j + 1)

goal (1 subgoal):
 1. K i j \<le> K i (j + 1) &&& K i (j + 1) \<le> K (i + 1) (j + 1)
[PROOF STEP]
by blast+


[STATEMENT]
lemma perp_foot_eq_implies_drop_perp_eq:
  assumes "a \<in> hyp2" and "b \<in> hyp2" and "proj2_incident a l"
  and "perp_foot b l = perp_foot c l"
  shows "drop_perp b l = drop_perp c l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop_perp b l = drop_perp c l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. drop_perp b l = drop_perp c l
[PROOF STEP]
from \<open>a \<in> hyp2\<close> and \<open>proj2_incident a l\<close> and \<open>b \<in> hyp2\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in> hyp2
proj2_incident a l
b \<in> hyp2
[PROOF STEP]
have "perp_foot b l \<in> hyp2"
[PROOF STATE]
proof (prove)
using this:
a \<in> hyp2
proj2_incident a l
b \<in> hyp2

goal (1 subgoal):
 1. perp_foot b l \<in> hyp2
[PROOF STEP]
by (rule perp_foot_hyp2)
[PROOF STATE]
proof (state)
this:
perp_foot b l \<in> hyp2

goal (1 subgoal):
 1. drop_perp b l = drop_perp c l
[PROOF STEP]
from \<open>perp_foot b l = perp_foot c l\<close>
[PROOF STATE]
proof (chain)
picking this:
perp_foot b l = perp_foot c l
[PROOF STEP]
have "proj2_incident (perp_foot b l) (drop_perp c l)"
[PROOF STATE]
proof (prove)
using this:
perp_foot b l = perp_foot c l

goal (1 subgoal):
 1. proj2_incident (perp_foot b l) (drop_perp c l)
[PROOF STEP]
by (simp add: perp_foot_incident)
[PROOF STATE]
proof (state)
this:
proj2_incident (perp_foot b l) (drop_perp c l)

goal (1 subgoal):
 1. drop_perp b l = drop_perp c l
[PROOF STEP]
with \<open>a \<in> hyp2\<close> and \<open>perp_foot b l \<in> hyp2\<close> and \<open>proj2_incident a l\<close>
    and perp_foot_incident(2) [of b l] and drop_perp_perp [of l]
[PROOF STATE]
proof (chain)
picking this:
a \<in> hyp2
perp_foot b l \<in> hyp2
proj2_incident a l
proj2_incident (perp_foot b l) (drop_perp b l)
M_perp l (drop_perp ?p l)
proj2_incident (perp_foot b l) (drop_perp c l)
[PROOF STEP]
show "drop_perp b l = drop_perp c l"
[PROOF STATE]
proof (prove)
using this:
a \<in> hyp2
perp_foot b l \<in> hyp2
proj2_incident a l
proj2_incident (perp_foot b l) (drop_perp b l)
M_perp l (drop_perp ?p l)
proj2_incident (perp_foot b l) (drop_perp c l)

goal (1 subgoal):
 1. drop_perp b l = drop_perp c l
[PROOF STEP]
by (simp add: M_perp_unique)
[PROOF STATE]
proof (state)
this:
drop_perp b l = drop_perp c l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_wlp_SetPC:
  "wlp (SetPC f p) P = (\<lambda>s. \<Sum>a\<in>supp (p s). p s a * wlp (f a) P s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wlp (SetPC f p) P = (\<lambda>s. \<Sum>a\<in>supp (p s). p s a * wlp (f a) P s)
[PROOF STEP]
unfolding wlp_def SetPC_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>s. \<Sum>a\<in>supp (p s). p s a * f a False P s) = (\<lambda>s. \<Sum>a\<in>supp (p s). p s a * f a False P s)
[PROOF STEP]
by(simp)


[STATEMENT]
lemma continuous_on_min [continuous_intros]:
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
  shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. min (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>x. min (f x) (g x))
[PROOF STEP]
by (auto simp: continuous_on_def intro!: tendsto_min)


[STATEMENT]
lemma sup_union_distrib_left:
  "A \<union># B + C = (A + C) \<union># (B + C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union># B + C = (A + C) \<union># (B + C)
[PROOF STEP]
by (simp add: multiset_eq_iff max_add_distrib_left)


[STATEMENT]
lemma swap: "F (\<lambda>i. F (g i) B) A = F (\<lambda>j. F (\<lambda>i. g i j) A) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F (\<lambda>i. F (g i) B) A = F (\<lambda>j. F (\<lambda>i. g i j) A) B
[PROOF STEP]
unfolding cartesian_product
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F (\<lambda>(i, y). g i y) (A \<times> B) = F (\<lambda>(j, i). g i j) (B \<times> A)
[PROOF STEP]
by (rule reindex_bij_witness [where i = "\<lambda>(i, j). (j, i)" and j = "\<lambda>(i, j). (j, i)"]) auto


[STATEMENT]
lemma (in Module) mem_single_l_span1:"\<lbrakk>ideal R A; h \<in> carrier M;
       x \<in> linear_span R M A {h}\<rbrakk> \<Longrightarrow> \<exists>a \<in> A. x = a \<cdot>\<^sub>s h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R A; h \<in> carrier M; x \<in> linear_span R M A {h}\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. x = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (simp add:linear_span_def, erule exE, (erule bexE)+, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f s. \<lbrakk>ideal R A; h \<in> carrier M; f \<in> {j. j \<le> n} \<rightarrow> {h}; s \<in> {j. j \<le> n} \<rightarrow> A; x = l_comb R M n s f\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. l_comb R M n s f = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (frule_tac s = s and n = n and f = f in mem_single_l_span[of A h],
       assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n f s. \<lbrakk>ideal R A; h \<in> carrier M; f \<in> {j. j \<le> n} \<rightarrow> {h}; s \<in> {j. j \<le> n} \<rightarrow> A; x = l_comb R M n s f\<rbrakk> \<Longrightarrow> l_comb R M n s f \<in> linear_span R M A {h}
 2. \<And>n f s. \<lbrakk>ideal R A; h \<in> carrier M; f \<in> {j. j \<le> n} \<rightarrow> {h}; s \<in> {j. j \<le> n} \<rightarrow> A; x = l_comb R M n s f; \<exists>a\<in>A. l_comb R M n s f = a \<cdot>\<^sub>s h\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. l_comb R M n s f = a \<cdot>\<^sub>s h
[PROOF STEP]
apply (frule singleton_sub[of h "carrier M"],
      rule_tac s = s and f = f in l_comb_mem_linear_span[of A "{h}"],
      assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sq_mtx_mult_diag_diag[simp]: "sq_mtx_diag f * sq_mtx_diag g = (\<d>\<i>\<a>\<g> i. f i * g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sq_mtx_diag f * sq_mtx_diag g = (\<d>\<i>\<a>\<g> i. f i * g i)
[PROOF STEP]
by (simp add: matrix_mul_diag_diag sq_mtx_diag.abs_eq times_sq_mtx.abs_eq)


[STATEMENT]
lemma partition_by_nth_nth_old:
  assumes "i < length (partition_by xs ys)"
    and "j < length (partition_by xs ys ! i)"
    and "sum_list ys = length xs"
  shows "partition_by xs ys ! i ! j = xs ! (sum_list (map length (take i (partition_by xs ys))) + j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_by xs ys ! i ! j = xs ! (sum_list (map length (take i (partition_by xs ys))) + j)
[PROOF STEP]
using concat_nth [OF assms(1, 2) refl]
[PROOF STATE]
proof (prove)
using this:
concat (partition_by xs ys) ! (sum_list (map length (take i (partition_by xs ys))) + j) = partition_by xs ys ! i ! j

goal (1 subgoal):
 1. partition_by xs ys ! i ! j = xs ! (sum_list (map length (take i (partition_by xs ys))) + j)
[PROOF STEP]
unfolding concat_partition_by [OF assms(3)]
[PROOF STATE]
proof (prove)
using this:
xs ! (sum_list (map length (take i (partition_by xs ys))) + j) = partition_by xs ys ! i ! j

goal (1 subgoal):
 1. partition_by xs ys ! i ! j = xs ! (sum_list (map length (take i (partition_by xs ys))) + j)
[PROOF STEP]
by simp


[STATEMENT]
lemma OF_match_fields_alt: "OF_match_fields m p =
  (if \<exists>f \<in> m. \<not>prerequisites f m then None else
    if \<forall>f \<in> m. match_no_prereq f p then Some True else Some False)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OF_match_fields m p = (if \<exists>f\<in>m. \<not> prerequisites f m then None else if \<forall>f\<in>m. match_no_prereq f p then Some True else Some False)
[PROOF STEP]
unfolding OF_match_fields_def all_true_def[abs_def] set_seq_def match_prereq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_option (\<lambda>s. \<forall>x\<in>s. x) (if \<forall>x\<in>(\<lambda>f. if prerequisites f m then Some (match_no_prereq f p) else None) ` m. x \<noteq> None then Some (the ` (\<lambda>f. if prerequisites f m then Some (match_no_prereq f p) else None) ` m) else None) = (if \<exists>f\<in>m. \<not> prerequisites f m then None else if \<forall>f\<in>m. match_no_prereq f p then Some True else Some False)
[PROOF STEP]
by(auto simp add: ball_Un)


[STATEMENT]
lemma Union_disjoint:
  assumes "\<forall>A\<in>C. finite A" "\<forall>A\<in>C. \<forall>B\<in>C. A \<noteq> B \<longrightarrow> A \<inter> B = {}"
  shows "F g (\<Union>C) = (F \<circ> F) g C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F g (\<Union> C) = (F \<circ> F) g C
[PROOF STEP]
proof (cases "finite C")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite C \<Longrightarrow> F g (\<Union> C) = (F \<circ> F) g C
 2. infinite C \<Longrightarrow> F g (\<Union> C) = (F \<circ> F) g C
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite C

goal (2 subgoals):
 1. finite C \<Longrightarrow> F g (\<Union> C) = (F \<circ> F) g C
 2. infinite C \<Longrightarrow> F g (\<Union> C) = (F \<circ> F) g C
[PROOF STEP]
from UNION_disjoint [OF this assms]
[PROOF STATE]
proof (chain)
picking this:
F ?g (\<Union>A\<in>C. A) = F (F ?g) C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
F ?g (\<Union>A\<in>C. A) = F (F ?g) C

goal (1 subgoal):
 1. F g (\<Union> C) = (F \<circ> F) g C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
F g (\<Union> C) = (F \<circ> F) g C

goal (1 subgoal):
 1. infinite C \<Longrightarrow> F g (\<Union> C) = (F \<circ> F) g C
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite C \<Longrightarrow> F g (\<Union> C) = (F \<circ> F) g C
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite C

goal (1 subgoal):
 1. infinite C \<Longrightarrow> F g (\<Union> C) = (F \<circ> F) g C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite C

goal (1 subgoal):
 1. F g (\<Union> C) = (F \<circ> F) g C
[PROOF STEP]
by (auto dest: finite_UnionD intro: infinite)
[PROOF STATE]
proof (state)
this:
F g (\<Union> C) = (F \<circ> F) g C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_concat_rev[simp]: "length (concat (rev xs)) = length (concat xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (concat (rev xs)) = length (concat xs)
[PROOF STEP]
by (induction xs) auto


[STATEMENT]
lemma (in VectorSpace) trivial_VectorSpaceHom :
  "(\<And>a. smult' a 0 = 0) \<Longrightarrow> VectorSpaceHom smult V smult' 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. smult' a (0::'a) = (0::'a)) \<Longrightarrow> VectorSpaceHom (\<cdot>) V smult' 0
[PROOF STEP]
using trivial_RModuleHom[of smult'] ModuleHom.intro VectorSpaceHom.intro
[PROOF STATE]
proof (prove)
using this:
\<forall>r\<in>UNIV. smult' r (0::'a) = (0::'a) \<Longrightarrow> RModuleHom UNIV (\<cdot>) V smult' 0
RModuleHom UNIV ?smult ?M ?smult' ?T \<Longrightarrow> ModuleHom ?smult ?M ?smult' ?T
ModuleHom ?smult ?V ?smult' ?T \<Longrightarrow> VectorSpaceHom ?smult ?V ?smult' ?T

goal (1 subgoal):
 1. (\<And>a. smult' a (0::'a) = (0::'a)) \<Longrightarrow> VectorSpaceHom (\<cdot>) V smult' 0
[PROOF STEP]
by    fast


[STATEMENT]
lemma ni_star_induct_sup:
  "ni(z \<squnion> x * y) \<le> ni(y) \<Longrightarrow> ni(x\<^sup>\<star> * z) \<le> ni(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ni (z \<squnion> x * y) \<le> ni y \<Longrightarrow> ni (x\<^sup>\<star> * z) \<le> ni y
[PROOF STEP]
by (simp add: ni_n_order n_star_induct_sup)


[STATEMENT]
lemma power_eq_abs:
  fixes a b :: "'a::linordered_idom"
  assumes "a^k = b^k" and "k > 0"
  shows "\<bar>a\<bar> = \<bar>b\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>b\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>b\<bar>
[PROOF STEP]
from \<open>a^k = b^k\<close>
[PROOF STATE]
proof (chain)
picking this:
a ^ k = b ^ k
[PROOF STEP]
have "\<bar>a\<bar>^k = \<bar>b\<bar>^k"
[PROOF STATE]
proof (prove)
using this:
a ^ k = b ^ k

goal (1 subgoal):
 1. \<bar>a\<bar> ^ k = \<bar>b\<bar> ^ k
[PROOF STEP]
using power_abs
[PROOF STATE]
proof (prove)
using this:
a ^ k = b ^ k
\<bar>?a ^ ?n\<bar> = \<bar>?a\<bar> ^ ?n

goal (1 subgoal):
 1. \<bar>a\<bar> ^ k = \<bar>b\<bar> ^ k
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<bar>a\<bar> ^ k = \<bar>b\<bar> ^ k

goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>b\<bar>
[PROOF STEP]
show "\<bar>a\<bar> = \<bar>b\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>a\<bar> = \<bar>b\<bar>
[PROOF STEP]
by (rule power_eq_imp_eq_base; fact?; auto)
[PROOF STATE]
proof (state)
this:
\<bar>a\<bar> = \<bar>b\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bal_def2[code]:
"bal n xs =
  (if n=0 then (Leaf,xs) else
  (let m = n div 2;
       (l, ys) = bal m xs;
       (r, zs) = bal (n-1-m) (tl ys)
   in (Node l (hd ys) r, zs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bal n xs = (if n = 0 then (\<langle>\<rangle>, xs) else let m = n div 2; (l, ys) = bal m xs; (r, zs) = bal (n - 1 - m) (tl ys) in (\<langle>l, hd ys, r\<rangle>, zs))
[PROOF STEP]
using val_cong[OF bal_tm.simps(1)]
[PROOF STATE]
proof (prove)
using this:
Time_Monad.val (bal_tm ?n1 ?xs1) = Time_Monad.val ((if ?n1 = 0 then return (\<langle>\<rangle>, ?xs1) else let m = ?n1 div 2 in bal_tm m ?xs1 \<bind> (\<lambda>(l, ys). bal_tm (?n1 - 1 - m) (tl ys) \<bind> (\<lambda>(r, zs). return (\<langle>l, hd ys, r\<rangle>, zs)))) \<bind> tick)

goal (1 subgoal):
 1. bal n xs = (if n = 0 then (\<langle>\<rangle>, xs) else let m = n div 2; (l, ys) = bal m xs; (r, zs) = bal (n - 1 - m) (tl ys) in (\<langle>l, hd ys, r\<rangle>, zs))
[PROOF STEP]
by(simp only: bal_def val_simps)