[STATEMENT]
theorem equiintegrable_limit:
  fixes g :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
  assumes feq: "range f equiintegrable_on cbox a b"
      and to_g: "\<And>x. x \<in> cbox a b \<Longrightarrow> (\<lambda>n. f n x) \<longlonglongrightarrow> g x"
    shows "g integrable_on cbox a b \<and> (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> integral (cbox a b) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g integrable_on cbox a b \<and> (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> integral (cbox a b) g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g integrable_on cbox a b \<and> (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> integral (cbox a b) g
[PROOF STEP]
have "Cauchy (\<lambda>n. integral(cbox a b) (f n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cauchy (\<lambda>n. integral (cbox a b) (f n))
[PROOF STEP]
proof (clarsimp simp add: Cauchy_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
assume "0 < e"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
have e3: "0 < e/3"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 < e / 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < e / 3

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e / 3
[PROOF STEP]
obtain \<gamma> where "gauge \<gamma>"
         and \<gamma>: "\<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk>
                       \<Longrightarrow> norm((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) < e/3"
[PROOF STATE]
proof (prove)
using this:
0 < e / 3

goal (1 subgoal):
 1. (\<And>\<gamma>. \<lbrakk>gauge \<gamma>; \<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) < e / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using feq
[PROOF STATE]
proof (prove)
using this:
0 < e / 3
range f equiintegrable_on cbox a b

goal (1 subgoal):
 1. (\<And>\<gamma>. \<lbrakk>gauge \<gamma>; \<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) < e / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding equiintegrable_on_def
[PROOF STATE]
proof (prove)
using this:
0 < e / 3
(\<forall>f\<in>range f. f integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>fa \<D>. fa \<in> range f \<and> \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R fa x) - integral (cbox a b) fa) < e))

goal (1 subgoal):
 1. (\<And>\<gamma>. \<lbrakk>gauge \<gamma>; \<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) < e / 3\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson image_eqI iso_tuple_UNIV_I)
[PROOF STATE]
proof (state)
this:
gauge \<gamma>
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R f ?n x) - integral (cbox a b) (f ?n)) < e / 3

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
obtain \<D> where \<D>: "\<D> tagged_division_of (cbox a b)" and "\<gamma> fine \<D>"  "finite \<D>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>; finite \<D>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson \<open>gauge \<gamma>\<close> fine_division_exists tagged_division_of_finite)
[PROOF STATE]
proof (state)
this:
\<D> tagged_division_of cbox a b
\<gamma> fine \<D>
finite \<D>

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
with \<gamma>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R f ?n x) - integral (cbox a b) (f ?n)) < e / 3
\<D> tagged_division_of cbox a b
\<gamma> fine \<D>
finite \<D>
[PROOF STEP]
have \<delta>T: "\<And>n. dist ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f n x)) (integral (cbox a b) (f n)) < e/3"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R f ?n x) - integral (cbox a b) (f ?n)) < e / 3
\<D> tagged_division_of cbox a b
\<gamma> fine \<D>
finite \<D>

goal (1 subgoal):
 1. \<And>n. dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) (integral (cbox a b) (f n)) < e / 3
[PROOF STEP]
by (force simp: dist_norm)
[PROOF STATE]
proof (state)
this:
dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?n x) (integral (cbox a b) (f ?n)) < e / 3

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
have "(\<lambda>n. \<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f n x) \<longlonglongrightarrow> (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) \<longlonglongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x)
[PROOF STEP]
using \<D> to_g
[PROOF STATE]
proof (prove)
using this:
\<D> tagged_division_of cbox a b
?x \<in> cbox a b \<Longrightarrow> (\<lambda>n. f n ?x) \<longlonglongrightarrow> g ?x

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) \<longlonglongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x)
[PROOF STEP]
by (auto intro!: tendsto_sum tendsto_scaleR)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) \<longlonglongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) \<longlonglongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x)
[PROOF STEP]
have "Cauchy (\<lambda>n. \<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f n x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) \<longlonglongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x)

goal (1 subgoal):
 1. Cauchy (\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x)
[PROOF STEP]
by (meson convergent_eq_Cauchy)
[PROOF STATE]
proof (state)
this:
Cauchy (\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
with e3
[PROOF STATE]
proof (chain)
picking this:
0 < e / 3
Cauchy (\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x)
[PROOF STEP]
obtain M where
      M: "\<And>m n. \<lbrakk>m\<ge>M; n\<ge>M\<rbrakk> \<Longrightarrow> dist (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f m x) (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f n x)
                      < e/3"
[PROOF STATE]
proof (prove)
using this:
0 < e / 3
Cauchy (\<lambda>n. \<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x)

goal (1 subgoal):
 1. (\<And>M. (\<And>m n. \<lbrakk>M \<le> m; M \<le> n\<rbrakk> \<Longrightarrow> dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) < e / 3) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Cauchy_def
[PROOF STATE]
proof (prove)
using this:
0 < e / 3
\<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) < e

goal (1 subgoal):
 1. (\<And>M. (\<And>m n. \<lbrakk>M \<le> m; M \<le> n\<rbrakk> \<Longrightarrow> dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) < e / 3) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>M \<le> ?m; M \<le> ?n\<rbrakk> \<Longrightarrow> dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?n x) < e / 3

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
have "\<And>m n. \<lbrakk>m\<ge>M; n\<ge>M;
                 dist (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f m x) (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f n x) < e/3\<rbrakk>
                \<Longrightarrow> dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. \<lbrakk>M \<le> m; M \<le> n; dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) < e / 3\<rbrakk> \<Longrightarrow> dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
by (metis \<delta>T dist_commute dist_triangle_third [OF _ _ \<delta>T])
[PROOF STATE]
proof (state)
this:
\<lbrakk>M \<le> ?m; M \<le> ?n; dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?n x) < e / 3\<rbrakk> \<Longrightarrow> dist (integral (cbox a b) (f ?m)) (integral (cbox a b) (f ?n)) < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>M \<le> ?m; M \<le> ?n; dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?n x) < e / 3\<rbrakk> \<Longrightarrow> dist (integral (cbox a b) (f ?m)) (integral (cbox a b) (f ?n)) < e
[PROOF STEP]
show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>M \<le> ?m; M \<le> ?n; dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?n x) < e / 3\<rbrakk> \<Longrightarrow> dist (integral (cbox a b) (f ?m)) (integral (cbox a b) (f ?n)) < e

goal (1 subgoal):
 1. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
using M
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>M \<le> ?m; M \<le> ?n; dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?n x) < e / 3\<rbrakk> \<Longrightarrow> dist (integral (cbox a b) (f ?m)) (integral (cbox a b) (f ?n)) < e
\<lbrakk>M \<le> ?m; M \<le> ?n\<rbrakk> \<Longrightarrow> dist (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?m x) (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f ?n x) < e / 3

goal (1 subgoal):
 1. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (integral (cbox a b) (f m)) (integral (cbox a b) (f n)) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Cauchy (\<lambda>n. integral (cbox a b) (f n))

goal (1 subgoal):
 1. g integrable_on cbox a b \<and> (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> integral (cbox a b) g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Cauchy (\<lambda>n. integral (cbox a b) (f n))
[PROOF STEP]
obtain L where L: "(\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> L"
[PROOF STATE]
proof (prove)
using this:
Cauchy (\<lambda>n. integral (cbox a b) (f n))

goal (1 subgoal):
 1. (\<And>L. (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> L \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson convergent_eq_Cauchy)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> L

goal (1 subgoal):
 1. g integrable_on cbox a b \<and> (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> integral (cbox a b) g
[PROOF STEP]
have "(g has_integral L) (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_integral L) (cbox a b)
[PROOF STEP]
proof (clarsimp simp: has_integral)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>x\<in>\<D>. case x of (x, k) \<Rightarrow> content k *\<^sub>R g x) - L) < e)
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>x\<in>\<D>. case x of (x, k) \<Rightarrow> content k *\<^sub>R g x) - L) < e)
[PROOF STEP]
assume "0 < e"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>x\<in>\<D>. case x of (x, k) \<Rightarrow> content k *\<^sub>R g x) - L) < e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
have e2: "0 < e/2"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 < e / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>x\<in>\<D>. case x of (x, k) \<Rightarrow> content k *\<^sub>R g x) - L) < e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e / 2
[PROOF STEP]
obtain \<gamma> where "gauge \<gamma>"
      and \<gamma>: "\<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk>
                    \<Longrightarrow> norm((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) < e/2"
[PROOF STATE]
proof (prove)
using this:
0 < e / 2

goal (1 subgoal):
 1. (\<And>\<gamma>. \<lbrakk>gauge \<gamma>; \<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) < e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using feq
[PROOF STATE]
proof (prove)
using this:
0 < e / 2
range f equiintegrable_on cbox a b

goal (1 subgoal):
 1. (\<And>\<gamma>. \<lbrakk>gauge \<gamma>; \<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) < e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding equiintegrable_on_def
[PROOF STATE]
proof (prove)
using this:
0 < e / 2
(\<forall>f\<in>range f. f integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>fa \<D>. fa \<in> range f \<and> \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R fa x) - integral (cbox a b) fa) < e))

goal (1 subgoal):
 1. (\<And>\<gamma>. \<lbrakk>gauge \<gamma>; \<And>n \<D>. \<lbrakk>\<D> tagged_division_of cbox a b; \<gamma> fine \<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) < e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson image_eqI iso_tuple_UNIV_I)
[PROOF STATE]
proof (state)
this:
gauge \<gamma>
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R f ?n x) - integral (cbox a b) (f ?n)) < e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>x\<in>\<D>. case x of (x, k) \<Rightarrow> content k *\<^sub>R g x) - L) < e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
gauge \<gamma>
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R f ?n x) - integral (cbox a b) (f ?n)) < e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>x\<in>\<D>. case x of (x, k) \<Rightarrow> content k *\<^sub>R g x) - L) < e)
[PROOF STEP]
have "norm ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R g x) - L) < e"
              if "\<D> tagged_division_of cbox a b" "\<gamma> fine \<D>" for \<D>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) < e
[PROOF STEP]
have "norm ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R g x) - L) \<le> e/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) \<le> e / 2
[PROOF STEP]
proof (rule Lim_norm_ubound)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?net \<noteq> bot
 2. (?f \<longlongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) ?net
 3. \<forall>\<^sub>F x in ?net. norm (?f x) \<le> e / 2
[PROOF STEP]
show "(\<lambda>n. (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) \<longlonglongrightarrow> (\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R g x) - L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) \<longlonglongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L
[PROOF STEP]
using to_g that L
[PROOF STATE]
proof (prove)
using this:
?x \<in> cbox a b \<Longrightarrow> (\<lambda>n. f n ?x) \<longlonglongrightarrow> g ?x
\<D> tagged_division_of cbox a b
\<gamma> fine \<D>
(\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> L

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) \<longlonglongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L
[PROOF STEP]
by (intro tendsto_diff tendsto_sum) (auto simp: tag_in_interval tendsto_scaleR)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) \<longlonglongrightarrow> (\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L

goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. \<forall>\<^sub>F x in sequentially. norm ((\<Sum>(xa, K)\<in>\<D>. content K *\<^sub>R f x xa) - integral (cbox a b) (f x)) \<le> e / 2
[PROOF STEP]
show "\<forall>\<^sub>F n in sequentially.
                norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) \<le> e/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) \<le> e / 2
[PROOF STEP]
by (intro eventuallyI less_imp_le \<gamma> that)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f n x) - integral (cbox a b) (f n)) \<le> e / 2

goal (1 subgoal):
 1. sequentially \<noteq> bot
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) \<le> e / 2

goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) < e
[PROOF STEP]
with \<open>0 < e\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < e
norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) \<le> e / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < e
norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) \<le> e / 2

goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) < e
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R g x) - L) < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>x\<in>\<D>. case x of (x, k) \<Rightarrow> content k *\<^sub>R g x) - L) < e)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
gauge \<gamma>
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R f ?n x) - integral (cbox a b) (f ?n)) < e / 2
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R g x) - L) < e
[PROOF STEP]
show "\<exists>\<gamma>. gauge \<gamma> \<and>
             (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow>
                  norm ((\<Sum>(x,K)\<in>\<D>. content K *\<^sub>R g x) - L) < e)"
[PROOF STATE]
proof (prove)
using this:
gauge \<gamma>
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R f ?n x) - integral (cbox a b) (f ?n)) < e / 2
\<lbrakk>?\<D> tagged_division_of cbox a b; \<gamma> fine ?\<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R g x) - L) < e

goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) < e)
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
\<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox a b \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R g x) - L) < e)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(g has_integral L) (cbox a b)

goal (1 subgoal):
 1. g integrable_on cbox a b \<and> (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> integral (cbox a b) g
[PROOF STEP]
with L
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> L
(g has_integral L) (cbox a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> L
(g has_integral L) (cbox a b)

goal (1 subgoal):
 1. g integrable_on cbox a b \<and> (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> integral (cbox a b) g
[PROOF STEP]
by (simp add: \<open>(\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> L\<close> has_integral_integrable_integral)
[PROOF STATE]
proof (state)
this:
g integrable_on cbox a b \<and> (\<lambda>n. integral (cbox a b) (f n)) \<longlonglongrightarrow> integral (cbox a b) g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in order_topology) nhds_order:
  "nhds x = inf (INF a\<in>{x <..}. principal {..< a}) (INF a\<in>{..< x}. principal {a <..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nhds x = inf (INF a\<in>{x<..}. principal {..<a}) (INF a\<in>{..<x}. principal {a<..})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nhds x = inf (INF a\<in>{x<..}. principal {..<a}) (INF a\<in>{..<x}. principal {a<..})
[PROOF STEP]
have 1: "{S \<in> range lessThan \<union> range greaterThan. x \<in> S} =
      (\<lambda>a. {..< a}) ` {x <..} \<union> (\<lambda>a. {a <..}) ` {..< x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {S \<in> range lessThan \<union> range greaterThan. x \<in> S} = lessThan ` {x<..} \<union> greaterThan ` {..<x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{S \<in> range lessThan \<union> range greaterThan. x \<in> S} = lessThan ` {x<..} \<union> greaterThan ` {..<x}

goal (1 subgoal):
 1. nhds x = inf (INF a\<in>{x<..}. principal {..<a}) (INF a\<in>{..<x}. principal {a<..})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nhds x = inf (INF a\<in>{x<..}. principal {..<a}) (INF a\<in>{..<x}. principal {a<..})
[PROOF STEP]
by (simp only: nhds_generated_topology[OF open_generated_order] INF_union 1 INF_image comp_def)
[PROOF STATE]
proof (state)
this:
nhds x = inf (INF a\<in>{x<..}. principal {..<a}) (INF a\<in>{..<x}. principal {a<..})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_mono_lt [rule_format]:
  fixes xs::"real list"
  shows "xs \<noteq> [] \<and> (\<forall>x\<in> set xs. x < m)
         \<longrightarrow> ((\<Sum>:xs) < (m*(real (length xs))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs)
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [] \<noteq> [] \<and> (\<forall>x\<in>set []. x < m) \<longrightarrow> sum_list [] < m * real (length [])
 2. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. [] \<noteq> [] \<and> (\<forall>x\<in>set []. x < m) \<longrightarrow> sum_list [] < m * real (length [])
 2. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<noteq> [] \<and> (\<forall>x\<in>set []. x < m) \<longrightarrow> sum_list [] < m * real (length [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[] \<noteq> [] \<and> (\<forall>x\<in>set []. x < m) \<longrightarrow> sum_list [] < m * real (length [])

goal (1 subgoal):
 1. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
case (Cons y ys)
[PROOF STATE]
proof (state)
this:
ys \<noteq> [] \<and> (\<forall>x\<in>set ys. x < m) \<longrightarrow> sum_list ys < m * real (length ys)

goal (1 subgoal):
 1. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
ys \<noteq> [] \<and> (\<forall>x\<in>set ys. x < m) \<longrightarrow> sum_list ys < m * real (length ys)

goal (1 subgoal):
 1. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
assume ant: "y#ys \<noteq> [] \<and> (\<forall>x\<in>set(y#ys). x < m)"
[PROOF STATE]
proof (state)
this:
y # ys \<noteq> [] \<and> (\<forall>x\<in>set (y # ys). x < m)

goal (1 subgoal):
 1. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
hence ylm: "y < m"
[PROOF STATE]
proof (prove)
using this:
y # ys \<noteq> [] \<and> (\<forall>x\<in>set (y # ys). x < m)

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

goal (1 subgoal):
 1. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
have "\<Sum>:(y#ys) < m * real (length (y#ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
assume "ys \<noteq> []"
[PROOF STATE]
proof (state)
this:
ys \<noteq> []

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ys \<noteq> []

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
with ant
[PROOF STATE]
proof (chain)
picking this:
y # ys \<noteq> [] \<and> (\<forall>x\<in>set (y # ys). x < m)
ys \<noteq> []
[PROOF STEP]
have "\<forall>x\<in>set ys. x < m"
[PROOF STATE]
proof (prove)
using this:
y # ys \<noteq> [] \<and> (\<forall>x\<in>set (y # ys). x < m)
ys \<noteq> []

goal (1 subgoal):
 1. \<forall>x\<in>set ys. x < m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set ys. x < m

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set ys. x < m

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
with calculation Cons
[PROOF STATE]
proof (chain)
picking this:
ys \<noteq> []
\<forall>x\<in>set ys. x < m
ys \<noteq> [] \<and> (\<forall>x\<in>set ys. x < m) \<longrightarrow> sum_list ys < m * real (length ys)
\<forall>x\<in>set ys. x < m
[PROOF STEP]
have "\<Sum>:ys < m*real (length ys)"
[PROOF STATE]
proof (prove)
using this:
ys \<noteq> []
\<forall>x\<in>set ys. x < m
ys \<noteq> [] \<and> (\<forall>x\<in>set ys. x < m) \<longrightarrow> sum_list ys < m * real (length ys)
\<forall>x\<in>set ys. x < m

goal (1 subgoal):
 1. sum_list ys < m * real (length ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list ys < m * real (length ys)

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
hence "\<Sum>:ys + y < m*real(length ys) + y"
[PROOF STATE]
proof (prove)
using this:
sum_list ys < m * real (length ys)

goal (1 subgoal):
 1. sum_list ys + y < m * real (length ys) + y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list ys + y < m * real (length ys) + y

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
with ylm
[PROOF STATE]
proof (chain)
picking this:
y < m
sum_list ys + y < m * real (length ys) + y
[PROOF STEP]
have "\<Sum>:(y#ys) < m*(real(length ys) + 1)"
[PROOF STATE]
proof (prove)
using this:
y < m
sum_list ys + y < m * real (length ys) + y

goal (1 subgoal):
 1. sum_list (y # ys) < m * (real (length ys) + 1)
[PROOF STEP]
by(simp add:field_simps)
[PROOF STATE]
proof (state)
this:
sum_list (y # ys) < m * (real (length ys) + 1)

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum_list (y # ys) < m * (real (length ys) + 1)
[PROOF STEP]
have "\<Sum>:(y#ys) < m*(real(length ys + 1))"
[PROOF STATE]
proof (prove)
using this:
sum_list (y # ys) < m * (real (length ys) + 1)

goal (1 subgoal):
 1. sum_list (y # ys) < m * real (length ys + 1)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
sum_list (y # ys) < m * real (length ys + 1)

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
hence "\<Sum>:(y#ys) < m*(real (length(y#ys)))"
[PROOF STATE]
proof (prove)
using this:
sum_list (y # ys) < m * real (length ys + 1)

goal (1 subgoal):
 1. sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (y # ys) < m * real (length (y # ys))

goal (2 subgoals):
 1. ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
 2. \<not> ?P \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_list (y # ys) < m * real (length (y # ys))

goal (1 subgoal):
 1. sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_list (y # ys) < m * real (length (y # ys))

goal (1 subgoal):
 1. \<not> ys \<noteq> [] \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> ys \<noteq> [] \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
assume "\<not> (ys \<noteq> [])"
[PROOF STATE]
proof (state)
this:
\<not> ys \<noteq> []

goal (1 subgoal):
 1. \<not> ys \<noteq> [] \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
hence "ys = []"
[PROOF STATE]
proof (prove)
using this:
\<not> ys \<noteq> []

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

goal (1 subgoal):
 1. \<not> ys \<noteq> [] \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
with ylm
[PROOF STATE]
proof (chain)
picking this:
y < m
ys = []
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y < m
ys = []

goal (1 subgoal):
 1. sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (y # ys) < m * real (length (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum_list (y # ys) < m * real (length (y # ys))

goal (1 subgoal):
 1. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
y # ys \<noteq> [] \<and> (\<forall>x\<in>set (y # ys). x < m) \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))

goal (1 subgoal):
 1. \<And>a xs. xs \<noteq> [] \<and> (\<forall>x\<in>set xs. x < m) \<longrightarrow> sum_list xs < m * real (length xs) \<Longrightarrow> a # xs \<noteq> [] \<and> (\<forall>x\<in>set (a # xs). x < m) \<longrightarrow> sum_list (a # xs) < m * real (length (a # xs))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
y # ys \<noteq> [] \<and> (\<forall>x\<in>set (y # ys). x < m) \<Longrightarrow> sum_list (y # ys) < m * real (length (y # ys))

goal (1 subgoal):
 1. y # ys \<noteq> [] \<and> (\<forall>x\<in>set (y # ys). x < m) \<longrightarrow> sum_list (y # ys) < m * real (length (y # ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y # ys \<noteq> [] \<and> (\<forall>x\<in>set (y # ys). x < m) \<longrightarrow> sum_list (y # ys) < m * real (length (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma passive_subset_union[simp]: "passive_subset (M \<union> N) = passive_subset M \<union> passive_subset N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. passive_subset (M \<union> N) = passive_subset M \<union> passive_subset N
[PROOF STEP]
unfolding passive_subset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {CL \<in> M \<union> N. snd CL \<noteq> active} = {CL \<in> M. snd CL \<noteq> active} \<union> {CL \<in> N. snd CL \<noteq> active}
[PROOF STEP]
by auto


[STATEMENT]
lemma preserve_mat_block_size:
  assumes "inj_on_01_hom f"
  assumes "j < dim_col M"
  shows "mat_block_size M j = mat_block_size (map_mat f M) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_block_size M j = mat_block_size (map_mat f M) j
[PROOF STEP]
unfolding mat_block_size_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_vec (col M j) (1::'b) = count_vec (col (map_mat f M) j) (1::'a)
[PROOF STEP]
using injective_lim.lim_inj_hom_count_vec inj_on_01_hom_def col_map_mat
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>injective_lim ?A ?f; set\<^sub>v ?v \<subseteq> ?A; ?x \<in> ?A\<rbrakk> \<Longrightarrow> count_vec ?v ?x = count_vec (map_vec ?f ?v) (?f ?x)
inj_on_01_hom ?hom \<equiv> zero_hom ?hom \<and> one_hom ?hom \<and> injective_lim {0::?'a, 1::?'a} ?hom
?j < dim_col ?A \<Longrightarrow> col (map_mat ?f ?A) ?j = map_vec ?f (col ?A ?j)

goal (1 subgoal):
 1. count_vec (col M j) (1::'b) = count_vec (col (map_mat f M) j) (1::'a)
[PROOF STEP]
by (metis assms(1) assms(2) inj_on_01_hom.inj_1_iff insert_iff col_elems_ss01)


[STATEMENT]
lemma valofd_neq_valofn:
  fixes x y :: "('e, 'f) float"
  assumes "exponent y \<noteq> 0"
  shows "valofd x \<noteq> valofn y" "valofn y \<noteq> valofd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valofd x \<noteq> valofn y &&& valofn y \<noteq> valofd x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. valofd x \<noteq> valofn y
 2. valofn y \<noteq> valofd x
[PROOF STEP]
have "valofd x < 2 / 2^bias TYPE(('e, 'f) float)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valofd x < 2 / 2 ^ bias TYPE(('e, 'f) IEEE.float)
[PROOF STEP]
by (rule valofd_less_2p)
[PROOF STATE]
proof (state)
this:
valofd x < 2 / 2 ^ bias TYPE(('e, 'f) IEEE.float)

goal (2 subgoals):
 1. valofd x \<noteq> valofn y
 2. valofn y \<noteq> valofd x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
valofd x < 2 / 2 ^ bias TYPE(('e, 'f) IEEE.float)

goal (2 subgoals):
 1. valofd x \<noteq> valofn y
 2. valofn y \<noteq> valofd x
[PROOF STEP]
have "... \<le> 2 ^ IEEE.exponent y / 2 ^ bias TYPE(('e, 'f) IEEE.float)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 / 2 ^ bias TYPE(('e, 'f) IEEE.float) \<le> 2 ^ IEEE.exponent y / 2 ^ bias TYPE(('e, 'f) IEEE.float)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
IEEE.exponent y \<noteq> 0

goal (1 subgoal):
 1. 2 / 2 ^ bias TYPE(('e, 'f) IEEE.float) \<le> 2 ^ IEEE.exponent y / 2 ^ bias TYPE(('e, 'f) IEEE.float)
[PROOF STEP]
by (simp add: self_le_power field_simps)
[PROOF STATE]
proof (state)
this:
2 / 2 ^ bias TYPE(('e, 'f) IEEE.float) \<le> 2 ^ IEEE.exponent y / 2 ^ bias TYPE(('e, 'f) IEEE.float)

goal (2 subgoals):
 1. valofd x \<noteq> valofn y
 2. valofn y \<noteq> valofd x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 / 2 ^ bias TYPE(('e, 'f) IEEE.float) \<le> 2 ^ IEEE.exponent y / 2 ^ bias TYPE(('e, 'f) IEEE.float)

goal (2 subgoals):
 1. valofd x \<noteq> valofn y
 2. valofn y \<noteq> valofd x
[PROOF STEP]
have "... \<le> valofn y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ IEEE.exponent y / 2 ^ bias TYPE(('e, 'f) IEEE.float) \<le> valofn y
[PROOF STEP]
by (rule valofn_ge_2p)
[PROOF STATE]
proof (state)
this:
2 ^ IEEE.exponent y / 2 ^ bias TYPE(('e, 'f) IEEE.float) \<le> valofn y

goal (2 subgoals):
 1. valofd x \<noteq> valofn y
 2. valofn y \<noteq> valofd x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
valofd x < valofn y
[PROOF STEP]
show "valofd x \<noteq> valofn y" "valofn y \<noteq> valofd x"
[PROOF STATE]
proof (prove)
using this:
valofd x < valofn y

goal (1 subgoal):
 1. valofd x \<noteq> valofn y &&& valofn y \<noteq> valofd x
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
valofd x \<noteq> valofn y
valofn y \<noteq> valofd x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conway_monoid_one:
  assumes "conway_assm2 x"
  shows "x\<^bsub>1\<^esub> = 1 + x\<^bsub>1\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsub>1::'a\<^esub> = (1::'b) + x\<^bsub>1::'a\<^esub>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^bsub>1::'a\<^esub> = (1::'b) + x\<^bsub>1::'a\<^esub>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
conway_assm2 x
[PROOF STEP]
have "x\<^bsub>1\<^esub> = x\<^bsub>1\<^esub>\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
conway_assm2 x

goal (1 subgoal):
 1. x\<^bsub>1::'a\<^esub> = x\<^bsub>1::'a\<^esub>\<^sup>\<star>
[PROOF STEP]
by (metis pair_star)
[PROOF STATE]
proof (state)
this:
x\<^bsub>1::'a\<^esub> = x\<^bsub>1::'a\<^esub>\<^sup>\<star>

goal (1 subgoal):
 1. x\<^bsub>1::'a\<^esub> = (1::'b) + x\<^bsub>1::'a\<^esub>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<^bsub>1::'a\<^esub> = x\<^bsub>1::'a\<^esub>\<^sup>\<star>

goal (1 subgoal):
 1. x\<^bsub>1::'a\<^esub> = (1::'b) + x\<^bsub>1::'a\<^esub>
[PROOF STEP]
by (metis star_plus_one)
[PROOF STATE]
proof (state)
this:
x\<^bsub>1::'a\<^esub> = (1::'b) + x\<^bsub>1::'a\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_of_nat_div: "d dvd n \<Longrightarrow> real(n div d) = real n / real d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d dvd n \<Longrightarrow> real (n div d) = real n / real d
[PROOF STEP]
by (subst real_of_nat_div_aux) (auto simp add: dvd_eq_mod_eq_0 [symmetric])


[STATEMENT]
lemma vintersectionD1[dest]:
  assumes "x \<in>\<^sub>\<circ> A \<inter>\<^sub>\<circ> B"
  shows "x \<in>\<^sub>\<circ> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in>\<^sub>\<circ> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> A \<inter>\<^sub>\<circ> B

goal (1 subgoal):
 1. x \<in>\<^sub>\<circ> A
[PROOF STEP]
by simp


[STATEMENT]
theorem residue_primroot_iff_Carmichael:
  "(\<exists>g. residue_primroot n g) \<longleftrightarrow> Carmichael n = totient n \<and> n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>g. residue_primroot n g) = (Carmichael n = totient n \<and> 0 < n)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>g. residue_primroot n g \<Longrightarrow> Carmichael n = totient n
 2. \<And>g. residue_primroot n g \<Longrightarrow> 0 < n
 3. \<lbrakk>Carmichael n = totient n; 0 < n\<rbrakk> \<Longrightarrow> \<exists>g. residue_primroot n g
[PROOF STEP]
fix g
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>g. residue_primroot n g \<Longrightarrow> Carmichael n = totient n
 2. \<And>g. residue_primroot n g \<Longrightarrow> 0 < n
 3. \<lbrakk>Carmichael n = totient n; 0 < n\<rbrakk> \<Longrightarrow> \<exists>g. residue_primroot n g
[PROOF STEP]
assume g: "residue_primroot n g"
[PROOF STATE]
proof (state)
this:
residue_primroot n g

goal (3 subgoals):
 1. \<And>g. residue_primroot n g \<Longrightarrow> Carmichael n = totient n
 2. \<And>g. residue_primroot n g \<Longrightarrow> 0 < n
 3. \<lbrakk>Carmichael n = totient n; 0 < n\<rbrakk> \<Longrightarrow> \<exists>g. residue_primroot n g
[PROOF STEP]
thus "n > 0"
[PROOF STATE]
proof (prove)
using this:
residue_primroot n g

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by (auto simp: residue_primroot_def)
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. \<And>g. residue_primroot n g \<Longrightarrow> Carmichael n = totient n
 2. \<lbrakk>Carmichael n = totient n; 0 < n\<rbrakk> \<Longrightarrow> \<exists>g. residue_primroot n g
[PROOF STEP]
have "coprime n g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime n g
[PROOF STEP]
by (rule ccontr) (use g in \<open>auto simp: residue_primroot_def\<close>)
[PROOF STATE]
proof (state)
this:
coprime n g

goal (2 subgoals):
 1. \<And>g. residue_primroot n g \<Longrightarrow> Carmichael n = totient n
 2. \<lbrakk>Carmichael n = totient n; 0 < n\<rbrakk> \<Longrightarrow> \<exists>g. residue_primroot n g
[PROOF STEP]
show "Carmichael n = totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael n = totient n
[PROOF STEP]
proof (cases "n = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 1 \<Longrightarrow> Carmichael n = totient n
 2. n \<noteq> 1 \<Longrightarrow> Carmichael n = totient n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 1

goal (2 subgoals):
 1. n = 1 \<Longrightarrow> Carmichael n = totient n
 2. n \<noteq> 1 \<Longrightarrow> Carmichael n = totient n
[PROOF STEP]
with \<open>n > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < n
n \<noteq> 1
[PROOF STEP]
have "n > 1"
[PROOF STATE]
proof (prove)
using this:
0 < n
n \<noteq> 1

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

goal (2 subgoals):
 1. n = 1 \<Longrightarrow> Carmichael n = totient n
 2. n \<noteq> 1 \<Longrightarrow> Carmichael n = totient n
[PROOF STEP]
with \<open>coprime n g\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime n g
1 < n
[PROOF STEP]
have "ord n g dvd Carmichael n"
[PROOF STATE]
proof (prove)
using this:
coprime n g
1 < n

goal (1 subgoal):
 1. ord n g dvd Carmichael n
[PROOF STEP]
by (intro ord_dvd_Carmichael) auto
[PROOF STATE]
proof (state)
this:
ord n g dvd Carmichael n

goal (2 subgoals):
 1. n = 1 \<Longrightarrow> Carmichael n = totient n
 2. n \<noteq> 1 \<Longrightarrow> Carmichael n = totient n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ord n g dvd Carmichael n

goal (1 subgoal):
 1. Carmichael n = totient n
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
ord n g dvd Carmichael n
residue_primroot n g

goal (1 subgoal):
 1. Carmichael n = totient n
[PROOF STEP]
by (intro dvd_antisym Carmichael_dvd_totient)
                            (auto simp: residue_primroot_def)
[PROOF STATE]
proof (state)
this:
Carmichael n = totient n

goal (1 subgoal):
 1. n = 1 \<Longrightarrow> Carmichael n = totient n
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
Carmichael n = totient n

goal (1 subgoal):
 1. \<lbrakk>Carmichael n = totient n; 0 < n\<rbrakk> \<Longrightarrow> \<exists>g. residue_primroot n g
[PROOF STEP]
qed (use Carmichael_eq_totient_imp_primroot[of n] in auto)


[STATEMENT]
lemma independent_strict_incl:
  assumes "independent K (u # Us)" shows "Span K Us \<subset> Span K (u # Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Span K Us \<subset> Span K (u # Us)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Span K Us \<subset> Span K (u # Us)
[PROOF STEP]
have "u \<in> Span K (u # Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> Span K (u # Us)
[PROOF STEP]
using Span_base_incl[OF independent_in_carrier[OF assms]]
[PROOF STATE]
proof (prove)
using this:
set (u # Us) \<subseteq> Span K (u # Us)

goal (1 subgoal):
 1. u \<in> Span K (u # Us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<in> Span K (u # Us)

goal (1 subgoal):
 1. Span K Us \<subset> Span K (u # Us)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
u \<in> Span K (u # Us)

goal (1 subgoal):
 1. Span K Us \<subset> Span K (u # Us)
[PROOF STEP]
have "Span K Us \<subseteq> Span K (u # Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Span K Us \<subseteq> Span K (u # Us)
[PROOF STEP]
using mono_Span independent_in_carrier[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?Us \<subseteq> carrier R; ?u \<in> carrier R\<rbrakk> \<Longrightarrow> Span K ?Us \<subseteq> Span K (?u # ?Us)
set (u # Us) \<subseteq> carrier R

goal (1 subgoal):
 1. Span K Us \<subseteq> Span K (u # Us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Span K Us \<subseteq> Span K (u # Us)

goal (1 subgoal):
 1. Span K Us \<subset> Span K (u # Us)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
u \<in> Span K (u # Us)
Span K Us \<subseteq> Span K (u # Us)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u \<in> Span K (u # Us)
Span K Us \<subseteq> Span K (u # Us)

goal (1 subgoal):
 1. Span K Us \<subset> Span K (u # Us)
[PROOF STEP]
using independent_backwards(1)[OF assms]
[PROOF STATE]
proof (prove)
using this:
u \<in> Span K (u # Us)
Span K Us \<subseteq> Span K (u # Us)
u \<notin> Span K Us

goal (1 subgoal):
 1. Span K Us \<subset> Span K (u # Us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Span K Us \<subset> Span K (u # Us)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma offset_suc:
  assumes A: "offset k x xs \<noteq> None"
  shows "offset (Suc n) x xs = Some (Suc (the (offset n x xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
have "offset (Suc n) x xs = offset (n + Suc 0) x xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. offset (Suc n) x xs = offset (n + Suc 0) x xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
offset (Suc n) x xs = offset (n + Suc 0) x xs

goal (1 subgoal):
 1. offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
offset (Suc n) x xs = offset (n + Suc 0) x xs

goal (1 subgoal):
 1. offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
have "\<dots> = Some (the (offset n x xs) + Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. offset (n + Suc 0) x xs = Some (the (offset n x xs) + Suc 0)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
offset k x xs \<noteq> None

goal (1 subgoal):
 1. offset (n + Suc 0) x xs = Some (the (offset n x xs) + Suc 0)
[PROOF STEP]
by (rule offset_addition)
[PROOF STATE]
proof (state)
this:
offset (n + Suc 0) x xs = Some (the (offset n x xs) + Suc 0)

goal (1 subgoal):
 1. offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
offset (n + Suc 0) x xs = Some (the (offset n x xs) + Suc 0)

goal (1 subgoal):
 1. offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
have "\<dots> = Some (Suc (the (offset n x xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Some (the (offset n x xs) + Suc 0) = Some (Suc (the (offset n x xs)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Some (the (offset n x xs) + Suc 0) = Some (Suc (the (offset n x xs)))

goal (1 subgoal):
 1. offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
offset (Suc n) x xs = Some (Suc (the (offset n x xs)))

goal (1 subgoal):
 1. offset (Suc n) x xs = Some (Suc (the (offset n x xs)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
offset (Suc n) x xs = Some (Suc (the (offset n x xs)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_imp_genPrefix:
  "length xs <= length ys \<Longrightarrow>
     (\<forall>i. i < length xs \<longrightarrow> (xs ! i, ys ! i) \<in> r) \<Longrightarrow>
     (xs, ys) \<in> genPrefix r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs \<le> length ys; \<forall>i<length xs. (xs ! i, ys ! i) \<in> r\<rbrakk> \<Longrightarrow> (xs, ys) \<in> genPrefix r
[PROOF STEP]
apply (induct xs arbitrary: ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys. \<lbrakk>length [] \<le> length ys; \<forall>i<length []. ([] ! i, ys ! i) \<in> r\<rbrakk> \<Longrightarrow> ([], ys) \<in> genPrefix r
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>length xs \<le> length ys; \<forall>i<length xs. (xs ! i, ys ! i) \<in> r\<rbrakk> \<Longrightarrow> (xs, ys) \<in> genPrefix r; length (a # xs) \<le> length ys; \<forall>i<length (a # xs). ((a # xs) ! i, ys ! i) \<in> r\<rbrakk> \<Longrightarrow> (a # xs, ys) \<in> genPrefix r
[PROOF STEP]
apply (simp_all add: less_Suc_eq_0_disj all_conj_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>length xs \<le> length ys; \<forall>i<length xs. (xs ! i, ys ! i) \<in> r\<rbrakk> \<Longrightarrow> (xs, ys) \<in> genPrefix r; Suc (length xs) \<le> length ys; (a, ys ! 0) \<in> r \<and> (\<forall>i. (\<exists>j. i = Suc j \<and> j < length xs) \<longrightarrow> ((a # xs) ! i, ys ! i) \<in> r)\<rbrakk> \<Longrightarrow> (a # xs, ys) \<in> genPrefix r
[PROOF STEP]
apply (case_tac ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>length xs \<le> length ys; \<forall>i<length xs. (xs ! i, ys ! i) \<in> r\<rbrakk> \<Longrightarrow> (xs, ys) \<in> genPrefix r; Suc (length xs) \<le> length ys; (a, ys ! 0) \<in> r \<and> (\<forall>i. (\<exists>j. i = Suc j \<and> j < length xs) \<longrightarrow> ((a # xs) ! i, ys ! i) \<in> r); ys = []\<rbrakk> \<Longrightarrow> (a # xs, ys) \<in> genPrefix r
 2. \<And>a xs ys aa list. \<lbrakk>\<And>ys. \<lbrakk>length xs \<le> length ys; \<forall>i<length xs. (xs ! i, ys ! i) \<in> r\<rbrakk> \<Longrightarrow> (xs, ys) \<in> genPrefix r; Suc (length xs) \<le> length ys; (a, ys ! 0) \<in> r \<and> (\<forall>i. (\<exists>j. i = Suc j \<and> j < length xs) \<longrightarrow> ((a # xs) ! i, ys ! i) \<in> r); ys = aa # list\<rbrakk> \<Longrightarrow> (a # xs, ys) \<in> genPrefix r
[PROOF STEP]
apply (force+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma th_lm_2: "\<lbrakk>k>0; (\<forall> u. c_fold (c_unfold k u) = u)\<rbrakk> \<Longrightarrow> (\<forall> u. c_fold (c_unfold (Suc k) u) = u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
assume A1: "k>0"
[PROOF STATE]
proof (state)
this:
0 < k

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
assume A2: "\<forall> u. c_fold (c_unfold k u) = u"
[PROOF STATE]
proof (state)
this:
\<forall>u. c_fold (c_unfold k u) = u

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
fix u
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
0 < k
[PROOF STEP]
have S1: "c_unfold (Suc k) u = (c_fst u) # (c_unfold k (c_snd u))"
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. c_unfold (Suc k) u = c_fst u # c_unfold k (c_snd u)
[PROOF STEP]
by (rule c_unfold_4)
[PROOF STATE]
proof (state)
this:
c_unfold (Suc k) u = c_fst u # c_unfold k (c_snd u)

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
let ?ls = "c_unfold k (c_snd u)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
0 < k
[PROOF STEP]
have S2: "?ls \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. c_unfold k (c_snd u) \<noteq> []
[PROOF STEP]
by (rule c_unfold_6)
[PROOF STATE]
proof (state)
this:
c_unfold k (c_snd u) \<noteq> []

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
from S2
[PROOF STATE]
proof (chain)
picking this:
c_unfold k (c_snd u) \<noteq> []
[PROOF STEP]
have S3: "c_fold ( (c_fst u) # ?ls) = c_pair (c_fst u) (c_fold ?ls)"
[PROOF STATE]
proof (prove)
using this:
c_unfold k (c_snd u) \<noteq> []

goal (1 subgoal):
 1. c_fold (c_fst u # c_unfold k (c_snd u)) = c_pair (c_fst u) (c_fold (c_unfold k (c_snd u)))
[PROOF STEP]
by (rule c_fold_0)
[PROOF STATE]
proof (state)
this:
c_fold (c_fst u # c_unfold k (c_snd u)) = c_pair (c_fst u) (c_fold (c_unfold k (c_snd u)))

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
from A2
[PROOF STATE]
proof (chain)
picking this:
\<forall>u. c_fold (c_unfold k u) = u
[PROOF STEP]
have S4: "c_fold ?ls = c_snd u"
[PROOF STATE]
proof (prove)
using this:
\<forall>u. c_fold (c_unfold k u) = u

goal (1 subgoal):
 1. c_fold (c_unfold k (c_snd u)) = c_snd u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_fold (c_unfold k (c_snd u)) = c_snd u

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
from S3 S4
[PROOF STATE]
proof (chain)
picking this:
c_fold (c_fst u # c_unfold k (c_snd u)) = c_pair (c_fst u) (c_fold (c_unfold k (c_snd u)))
c_fold (c_unfold k (c_snd u)) = c_snd u
[PROOF STEP]
have S5: "c_fold ( (c_fst u) # ?ls) = c_pair (c_fst u) (c_snd u)"
[PROOF STATE]
proof (prove)
using this:
c_fold (c_fst u # c_unfold k (c_snd u)) = c_pair (c_fst u) (c_fold (c_unfold k (c_snd u)))
c_fold (c_unfold k (c_snd u)) = c_snd u

goal (1 subgoal):
 1. c_fold (c_fst u # c_unfold k (c_snd u)) = c_pair (c_fst u) (c_snd u)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_fold (c_fst u # c_unfold k (c_snd u)) = c_pair (c_fst u) (c_snd u)

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
from S5
[PROOF STATE]
proof (chain)
picking this:
c_fold (c_fst u # c_unfold k (c_snd u)) = c_pair (c_fst u) (c_snd u)
[PROOF STEP]
have S6: "c_fold ( (c_fst u) # ?ls) = u"
[PROOF STATE]
proof (prove)
using this:
c_fold (c_fst u # c_unfold k (c_snd u)) = c_pair (c_fst u) (c_snd u)

goal (1 subgoal):
 1. c_fold (c_fst u # c_unfold k (c_snd u)) = u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_fold (c_fst u # c_unfold k (c_snd u)) = u

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
from S1 S6
[PROOF STATE]
proof (chain)
picking this:
c_unfold (Suc k) u = c_fst u # c_unfold k (c_snd u)
c_fold (c_fst u # c_unfold k (c_snd u)) = u
[PROOF STEP]
have S7: "c_fold (c_unfold (Suc k) u) = u"
[PROOF STATE]
proof (prove)
using this:
c_unfold (Suc k) u = c_fst u # c_unfold k (c_snd u)
c_fold (c_fst u # c_unfold k (c_snd u)) = u

goal (1 subgoal):
 1. c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_fold (c_unfold (Suc k) u) = u

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 < k; \<forall>u. c_fold (c_unfold k u) = u\<rbrakk> \<Longrightarrow> c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
thus "c_fold (c_unfold (Suc k) u) = u"
[PROOF STATE]
proof (prove)
using this:
c_fold (c_unfold (Suc k) u) = u

goal (1 subgoal):
 1. c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
c_fold (c_unfold (Suc k) u) = u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dotprod_Nil [simp]: "[] \<bullet> [] = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<bullet> [] = 0
[PROOF STEP]
by (simp add: dotprod_def)


[STATEMENT]
theorem diff_const_axiom_valid: "valid diff_const_axiom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid diff_const_axiom
[PROOF STEP]
apply(simp only: valid_def diff_const_axiom_def equals_sem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>I \<nu>. is_interp I \<longrightarrow> dterm_sem I (Differential ($f fid1 local.empty)) \<nu> = dterm_sem I (Const 0) \<nu>
[PROOF STEP]
apply(rule allI | rule impI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>I \<nu>. is_interp I \<Longrightarrow> dterm_sem I (Differential ($f fid1 local.empty)) \<nu> = dterm_sem I (Const 0) \<nu>
[PROOF STEP]
apply(simp only: dterm_sem.simps constant_deriv_zero sterm_sem.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma permutes_insert: "{p. p permutes (insert a S)} =
  (\<lambda>(b, p). transpose a b \<circ> p) ` {(b, p). b \<in> insert a S \<and> p \<in> {p. p permutes S}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. p permutes insert a S} = (\<lambda>(b, p). Transposition.transpose a b \<circ> p) ` {(b, p). b \<in> insert a S \<and> p \<in> {p. p permutes S}}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {p. p permutes insert a S} = (\<lambda>(b, p). Transposition.transpose a b \<circ> p) ` {(b, p). b \<in> insert a S \<and> p \<in> {p. p permutes S}}
[PROOF STEP]
have "p permutes insert a S \<longleftrightarrow>
    (\<exists>b q. p = transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p permutes insert a S) = (\<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p permutes insert a S) = (\<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)
[PROOF STEP]
have "\<exists>b q. p = transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S"
      if p: "p permutes insert a S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
[PROOF STEP]
let ?b = "p a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
[PROOF STEP]
let ?q = "transpose a (p a) \<circ> p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
[PROOF STEP]
have *: "p = transpose a ?b \<circ> ?q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = Transposition.transpose a (p a) \<circ> (Transposition.transpose a (p a) \<circ> p)
[PROOF STEP]
by (simp add: fun_eq_iff o_assoc)
[PROOF STATE]
proof (state)
this:
p = Transposition.transpose a (p a) \<circ> (Transposition.transpose a (p a) \<circ> p)

goal (1 subgoal):
 1. \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
[PROOF STEP]
have **: "?b \<in> insert a S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p a \<in> insert a S
[PROOF STEP]
unfolding permutes_in_image[OF p]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> insert a S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p a \<in> insert a S

goal (1 subgoal):
 1. \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
[PROOF STEP]
from permutes_insert_lemma[OF p] * **
[PROOF STATE]
proof (chain)
picking this:
Transposition.transpose a (p a) \<circ> p permutes S
p = Transposition.transpose a (p a) \<circ> (Transposition.transpose a (p a) \<circ> p)
p a \<in> insert a S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Transposition.transpose a (p a) \<circ> p permutes S
p = Transposition.transpose a (p a) \<circ> (Transposition.transpose a (p a) \<circ> p)
p a \<in> insert a S

goal (1 subgoal):
 1. \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p permutes insert a S \<Longrightarrow> \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S

goal (1 subgoal):
 1. (p permutes insert a S) = (\<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p permutes insert a S \<Longrightarrow> \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S

goal (1 subgoal):
 1. (p permutes insert a S) = (\<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)
[PROOF STEP]
have "p permutes insert a S"
      if bq: "p = transpose a b \<circ> q" "b \<in> insert a S" "q permutes S" for b q
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p permutes insert a S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p permutes insert a S
[PROOF STEP]
from permutes_subset[OF bq(3), of "insert a S"]
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> insert a S \<Longrightarrow> q permutes insert a S
[PROOF STEP]
have q: "q permutes insert a S"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> insert a S \<Longrightarrow> q permutes insert a S

goal (1 subgoal):
 1. q permutes insert a S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q permutes insert a S

goal (1 subgoal):
 1. p permutes insert a S
[PROOF STEP]
have a: "a \<in> insert a S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> insert a S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<in> insert a S

goal (1 subgoal):
 1. p permutes insert a S
[PROOF STEP]
from bq(1) permutes_compose[OF q permutes_swap_id[OF a bq(2)]]
[PROOF STATE]
proof (chain)
picking this:
p = Transposition.transpose a b \<circ> q
Transposition.transpose a b \<circ> q permutes insert a S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = Transposition.transpose a b \<circ> q
Transposition.transpose a b \<circ> q permutes insert a S

goal (1 subgoal):
 1. p permutes insert a S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p permutes insert a S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>p = Transposition.transpose a ?b \<circ> ?q; ?b \<in> insert a S; ?q permutes S\<rbrakk> \<Longrightarrow> p permutes insert a S

goal (1 subgoal):
 1. (p permutes insert a S) = (\<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p permutes insert a S \<Longrightarrow> \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
\<lbrakk>p = Transposition.transpose a ?b \<circ> ?q; ?b \<in> insert a S; ?q permutes S\<rbrakk> \<Longrightarrow> p permutes insert a S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p permutes insert a S \<Longrightarrow> \<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S
\<lbrakk>p = Transposition.transpose a ?b \<circ> ?q; ?b \<in> insert a S; ?q permutes S\<rbrakk> \<Longrightarrow> p permutes insert a S

goal (1 subgoal):
 1. (p permutes insert a S) = (\<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(p permutes insert a S) = (\<exists>b q. p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(?p permutes insert a S) = (\<exists>b q. ?p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)

goal (1 subgoal):
 1. {p. p permutes insert a S} = (\<lambda>(b, p). Transposition.transpose a b \<circ> p) ` {(b, p). b \<in> insert a S \<and> p \<in> {p. p permutes S}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?p permutes insert a S) = (\<exists>b q. ?p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(?p permutes insert a S) = (\<exists>b q. ?p = Transposition.transpose a b \<circ> q \<and> b \<in> insert a S \<and> q permutes S)

goal (1 subgoal):
 1. {p. p permutes insert a S} = (\<lambda>(b, p). Transposition.transpose a b \<circ> p) ` {(b, p). b \<in> insert a S \<and> p \<in> {p. p permutes S}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{p. p permutes insert a S} = (\<lambda>(b, p). Transposition.transpose a b \<circ> p) ` {(b, p). b \<in> insert a S \<and> p \<in> {p. p permutes S}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in information_space)
  fixes Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real" and Pxy :: "('b \<times> 'c) \<Rightarrow> real"
  assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"
  assumes Px: "finite_entropy S X Px" and Py: "finite_entropy T Y Py"
  assumes Pxy: "finite_entropy (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"
  shows "conditional_entropy b S T X Y \<le> entropy b S X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conditional_entropy b S T X Y \<le> entropy b S X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. conditional_entropy b S T X Y \<le> entropy b S X
[PROOF STEP]
have "0 \<le> mutual_information b S T X Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> mutual_information b S T X Y
[PROOF STEP]
by (rule mutual_information_nonneg') fact+
[PROOF STATE]
proof (state)
this:
0 \<le> mutual_information b S T X Y

goal (1 subgoal):
 1. conditional_entropy b S T X Y \<le> entropy b S X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 \<le> mutual_information b S T X Y

goal (1 subgoal):
 1. conditional_entropy b S T X Y \<le> entropy b S X
[PROOF STEP]
have "\<dots> = entropy b S X - conditional_entropy b S T X Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mutual_information b S T X Y = entropy b S X - conditional_entropy b S T X Y
[PROOF STEP]
apply (rule mutual_information_eq_entropy_conditional_entropy')
[PROOF STATE]
proof (prove)
goal (11 subgoals):
 1. sigma_finite_measure S
 2. sigma_finite_measure T
 3. distributed M S X (\<lambda>x. ennreal (?Px x))
 4. \<And>x. x \<in> space S \<Longrightarrow> 0 \<le> ?Px x
 5. distributed M T Y (\<lambda>x. ennreal (?Py x))
 6. \<And>x. x \<in> space T \<Longrightarrow> 0 \<le> ?Py x
 7. distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>x. ennreal (?Pxy x))
 8. \<And>x. x \<in> space (S \<Otimes>\<^sub>M T) \<Longrightarrow> 0 \<le> ?Pxy x
 9. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. ?Pxy x * log b (?Px (fst x)))
 10. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. ?Pxy x * log b (?Py (snd x)))
A total of 11 subgoals...
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sigma_finite_measure S
sigma_finite_measure T
finite_entropy S X Px
finite_entropy T Y Py
finite_entropy (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy

goal (11 subgoals):
 1. sigma_finite_measure S
 2. sigma_finite_measure T
 3. distributed M S X (\<lambda>x. ennreal (?Px x))
 4. \<And>x. x \<in> space S \<Longrightarrow> 0 \<le> ?Px x
 5. distributed M T Y (\<lambda>x. ennreal (?Py x))
 6. \<And>x. x \<in> space T \<Longrightarrow> 0 \<le> ?Py x
 7. distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>x. ennreal (?Pxy x))
 8. \<And>x. x \<in> space (S \<Otimes>\<^sub>M T) \<Longrightarrow> 0 \<le> ?Pxy x
 9. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. ?Pxy x * log b (?Px (fst x)))
 10. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. ?Pxy x * log b (?Py (snd x)))
A total of 11 subgoals...
[PROOF STEP]
by (auto intro!: finite_entropy_integrable finite_entropy_distributed
      finite_entropy_integrable_transform[OF Px]
      finite_entropy_integrable_transform[OF Py]
      intro: finite_entropy_nn)
[PROOF STATE]
proof (state)
this:
mutual_information b S T X Y = entropy b S X - conditional_entropy b S T X Y

goal (1 subgoal):
 1. conditional_entropy b S T X Y \<le> entropy b S X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<le> entropy b S X - conditional_entropy b S T X Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> entropy b S X - conditional_entropy b S T X Y

goal (1 subgoal):
 1. conditional_entropy b S T X Y \<le> entropy b S X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
conditional_entropy b S T X Y \<le> entropy b S X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma qbs_prob_eq3_dest:
  assumes "qbs_prob_eq3 (X,\<alpha>,\<mu>) (Y,\<beta>,\<nu>)"
  shows "qbs_prob X \<alpha> \<mu>"
        "qbs_prob Y \<beta> \<nu>"
        "Y = X"
    and "\<And>f. f \<in> qbs_to_measure X \<rightarrow>\<^sub>M real_borel \<Longrightarrow> (\<forall> k \<in> qbs_space X. 0 \<le> f k)
        \<Longrightarrow> (\<integral>x. f (\<alpha> x) \<partial> \<mu>) = (\<integral>x. f (\<beta> x) \<partial> \<nu>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (qbs_prob X \<alpha> \<mu> &&& qbs_prob Y \<beta> \<nu> &&& Y = X) &&& (\<And>f. \<lbrakk>f \<in> borel_measurable (qbs_to_measure X); \<forall>k\<in>qbs_space X. 0 \<le> f k\<rbrakk> \<Longrightarrow> LINT x|\<mu>. f (\<alpha> x) = LINT x|\<nu>. f (\<beta> x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
qbs_prob_eq3 (X, \<alpha>, \<mu>) (Y, \<beta>, \<nu>)

goal (1 subgoal):
 1. (qbs_prob X \<alpha> \<mu> &&& qbs_prob Y \<beta> \<nu> &&& Y = X) &&& (\<And>f. \<lbrakk>f \<in> borel_measurable (qbs_to_measure X); \<forall>k\<in>qbs_space X. 0 \<le> f k\<rbrakk> \<Longrightarrow> LINT x|\<mu>. f (\<alpha> x) = LINT x|\<nu>. f (\<beta> x))
[PROOF STEP]
by(auto simp: qbs_prob_eq3_def)


[STATEMENT]
lemma (in Corps) Pseq_decompos:"\<lbrakk>valuation K v; PolynRg R (Vr K v) X;
      F n \<in> carrier R; deg R (Vr K v) X (F n) \<le> an (Suc d)\<rbrakk>
      \<Longrightarrow> F n = ((Pseql\<^bsub>R X K v d\<^esub> F) n) \<plusminus>\<^bsub>R\<^esub> ((Pseqh\<^bsub>R X K v d\<^esub> F) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; PolynRg R (Vr K v) X; F n \<in> carrier R; deg R (Vr K v) X (F n) \<le> an (Suc d)\<rbrakk> \<Longrightarrow> F n = (Pseql\<^bsub>R  X K v d \<^esub>F) n \<plusminus>\<^bsub>R\<^esub> (Pseqh\<^bsub> R X K v d \<^esub>F) n
[PROOF STEP]
apply (frule PolynRg.is_Ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; PolynRg R (Vr K v) X; F n \<in> carrier R; deg R (Vr K v) X (F n) \<le> an (Suc d); Ring R\<rbrakk> \<Longrightarrow> F n = (Pseql\<^bsub>R  X K v d \<^esub>F) n \<plusminus>\<^bsub>R\<^esub> (Pseqh\<^bsub> R X K v d \<^esub>F) n
[PROOF STEP]
apply (simp del:npow_suc add:Pseql_def Pseqh_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; PolynRg R (Vr K v) X; F n \<in> carrier R; deg R (Vr K v) X (F n) \<le> an (Suc d); Ring R\<rbrakk> \<Longrightarrow> F n = ldeg_p R (Vr K v) X d (F n) \<plusminus>\<^bsub>R\<^esub> hdeg_p R (Vr K v) X (Suc d) (F n)
[PROOF STEP]
apply (frule Vr_ring[of v])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; PolynRg R (Vr K v) X; F n \<in> carrier R; deg R (Vr K v) X (F n) \<le> an (Suc d); Ring R; Ring (Vr K v)\<rbrakk> \<Longrightarrow> F n = ldeg_p R (Vr K v) X d (F n) \<plusminus>\<^bsub>R\<^esub> hdeg_p R (Vr K v) X (Suc d) (F n)
[PROOF STEP]
apply (frule PolynRg.subring[of "R" "Vr K v" "X"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; PolynRg R (Vr K v) X; F n \<in> carrier R; deg R (Vr K v) X (F n) \<le> an (Suc d); Ring R; Ring (Vr K v); Subring R (Vr K v)\<rbrakk> \<Longrightarrow> F n = ldeg_p R (Vr K v) X d (F n) \<plusminus>\<^bsub>R\<^esub> hdeg_p R (Vr K v) X (Suc d) (F n)
[PROOF STEP]
apply (rule PolynRg.decompos_p[of "R" "Vr K v" "X" "F n" "d"], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma map_qbs_closed1:
 "qbs_closed1 {\<beta>. \<exists>\<alpha>\<in> qbs_Mx X. \<beta> = f \<circ> \<alpha>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_closed1 {\<beta>. \<exists>\<alpha>\<in>qbs_Mx X. \<beta> = f \<circ> \<alpha>}
[PROOF STEP]
unfolding qbs_closed1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a\<in>{\<beta>. \<exists>\<alpha>\<in>qbs_Mx X. \<beta> = f \<circ> \<alpha>}. \<forall>fa\<in>borel_measurable real_borel. a \<circ> fa \<in> {\<beta>. \<exists>\<alpha>\<in>qbs_Mx X. \<beta> = f \<circ> \<alpha>}
[PROOF STEP]
using qbs_closed1_dest
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<alpha> \<in> qbs_Mx ?X; ?f \<in> borel_measurable real_borel\<rbrakk> \<Longrightarrow> ?\<alpha> \<circ> ?f \<in> qbs_Mx ?X

goal (1 subgoal):
 1. \<forall>a\<in>{\<beta>. \<exists>\<alpha>\<in>qbs_Mx X. \<beta> = f \<circ> \<alpha>}. \<forall>fa\<in>borel_measurable real_borel. a \<circ> fa \<in> {\<beta>. \<exists>\<alpha>\<in>qbs_Mx X. \<beta> = f \<circ> \<alpha>}
[PROOF STEP]
by(fastforce simp: comp_def)