[STATEMENT]
lemma adder_helper:
  assumes lw: "0 < max (length w1) (length w2)"
  shows   "((2::int) ^ (length w1 - 1)) + (2 ^ (length w2 - 1)) \<le> 2 ^ max (length w1) (length w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)
[PROOF STEP]
have "((2::int) ^ (length w1 - 1)) + (2 ^ (length w2 - 1)) \<le>
      2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1)
[PROOF STEP]
by (auto simp:max_def)
[PROOF STATE]
proof (state)
this:
2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1)

goal (1 subgoal):
 1. 2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1)

goal (1 subgoal):
 1. 2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)
[PROOF STEP]
have "... = 2 ^ max (length w1) (length w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1) = 2 ^ max (length w1) (length w2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1) = 2 ^ max (length w1) (length w2)
[PROOF STEP]
from lw
[PROOF STATE]
proof (chain)
picking this:
0 < max (length w1) (length w2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < max (length w1) (length w2)

goal (1 subgoal):
 1. 2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1) = 2 ^ max (length w1) (length w2)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < max (length w1) (length w2) \<Longrightarrow> 2 * 2 ^ (max (length w1) (length w2) - Suc 0) = 2 ^ max (length w1) (length w2)
[PROOF STEP]
apply (subst power_Suc [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < max (length w1) (length w2) \<Longrightarrow> 2 ^ Suc (max (length w1) (length w2) - Suc 0) = 2 ^ max (length w1) (length w2)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1) = 2 ^ max (length w1) (length w2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
2 ^ (max (length w1) (length w2) - 1) + 2 ^ (max (length w1) (length w2) - 1) = 2 ^ max (length w1) (length w2)

goal (1 subgoal):
 1. 2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)

goal (1 subgoal):
 1. 2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 ^ (length w1 - 1) + 2 ^ (length w2 - 1) \<le> 2 ^ max (length w1) (length w2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_icard_seteq: "\<exists>(A::nat set) B. (A \<subseteq> B \<and> icard B \<le> icard A \<and> \<not> A = B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A B. A \<subseteq> B \<and> icard B \<le> icard A \<and> A \<noteq> B
[PROOF STEP]
apply (rule_tac x="{1..}" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B. {1..} \<subseteq> B \<and> icard B \<le> icard {1..} \<and> {1..} \<noteq> B
[PROOF STEP]
apply (rule_tac x="{0..}" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..} \<subseteq> {0..} \<and> icard {0..} \<le> icard {1..} \<and> {1..} \<noteq> {0..}
[PROOF STEP]
apply (fastforce simp add: infinite_atLeast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ennreal_SUP:
  "\<lbrakk> (SUP a\<in>A. ennreal (f a)) \<noteq> \<top>; A \<noteq> {} \<rbrakk> \<Longrightarrow> ennreal (SUP a\<in>A. f a) = (SUP a\<in>A. ennreal (f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<Squnion>a\<in>A. ennreal (f a)) \<noteq> \<top>; A \<noteq> {}\<rbrakk> \<Longrightarrow> ennreal (\<Squnion> (f ` A)) = (\<Squnion>a\<in>A. ennreal (f a))
[PROOF STEP]
using ennreal_Sup[of "f ` A"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<Squnion> (ennreal ` f ` A) \<noteq> \<top>; f ` A \<noteq> {}\<rbrakk> \<Longrightarrow> ennreal (\<Squnion> (f ` A)) = \<Squnion> (ennreal ` f ` A)

goal (1 subgoal):
 1. \<lbrakk>(\<Squnion>a\<in>A. ennreal (f a)) \<noteq> \<top>; A \<noteq> {}\<rbrakk> \<Longrightarrow> ennreal (\<Squnion> (f ` A)) = (\<Squnion>a\<in>A. ennreal (f a))
[PROOF STEP]
by (auto simp add: image_comp)


[STATEMENT]
lemma card_bijections_range_permutation:
  assumes "finite A" "finite B"
  shows "card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B) = iverson (card A = card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B) = iverson (card A = card B)
[PROOF STEP]
using assms card_bijections_range_permutation_eq_0 card_bijections_range_permutation_eq_1
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card ?A \<noteq> card ?B \<Longrightarrow> card ({f \<in> ?A \<rightarrow>\<^sub>E ?B. bij_betw f ?A ?B} // range_permutation ?A ?B) = 0
\<lbrakk>finite ?A; finite ?B; card ?A = card ?B\<rbrakk> \<Longrightarrow> card ({f \<in> ?A \<rightarrow>\<^sub>E ?B. bij_betw f ?A ?B} // range_permutation ?A ?B) = 1

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B) = iverson (card A = card B)
[PROOF STEP]
unfolding iverson_def
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card ?A \<noteq> card ?B \<Longrightarrow> card ({f \<in> ?A \<rightarrow>\<^sub>E ?B. bij_betw f ?A ?B} // range_permutation ?A ?B) = 0
\<lbrakk>finite ?A; finite ?B; card ?A = card ?B\<rbrakk> \<Longrightarrow> card ({f \<in> ?A \<rightarrow>\<^sub>E ?B. bij_betw f ?A ?B} // range_permutation ?A ?B) = 1

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B) = (if card A = card B then 1 else 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma fInf_unfold: "(f::nat \<Rightarrow> 'a) 0 \<sqinter> (\<Sqinter>n. f (Suc n)) = (\<Sqinter>n. f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) = \<Sqinter> range f
[PROOF STEP]
apply (intro order.antisym inf_greatest)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> \<Sqinter> range f
 2. \<Sqinter> range f \<le> f 0
 3. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply (rule Inf_greatest, safe)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x n. n \<in> UNIV \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f n
 2. \<Sqinter> range f \<le> f 0
 3. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply (case_tac n)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x n. \<lbrakk>n \<in> UNIV; n = 0\<rbrakk> \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f n
 2. \<And>x n nat. \<lbrakk>n \<in> UNIV; n = Suc nat\<rbrakk> \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f n
 3. \<Sqinter> range f \<le> f 0
 4. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n nat. n = Suc nat \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f (Suc nat)
 2. \<Sqinter> range f \<le> f 0
 3. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
using Inf_lower inf.coboundedI2
[PROOF STATE]
proof (prove)
using this:
?x \<in> ?A \<Longrightarrow> \<Sqinter> ?A \<le> ?x
?b \<le> ?c \<Longrightarrow> ?a \<sqinter> ?b \<le> ?c

goal (3 subgoals):
 1. \<And>n nat. n = Suc nat \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f (Suc nat)
 2. \<Sqinter> range f \<le> f 0
 3. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Sqinter> range f \<le> f 0
 2. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply (simp add: Inf_lower)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
by (auto intro: Inf_mono)


[STATEMENT]
lemma atLeastLessThan_less_eq3:
"(\<exists>f. inj_on f {0..<(m::nat)} \<and> f ` {0..<m} \<le> {0..<n}) = (m \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>f. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n}) = (m \<le> n)
[PROOF STEP]
using atLeastLessThan_less_eq2
[PROOF STATE]
proof (prove)
using this:
inj_on ?f {0..<?m} \<and> ?f ` {0..<?m} \<subseteq> {0..<?n} \<Longrightarrow> ?m \<le> ?n

goal (1 subgoal):
 1. (\<exists>f. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n}) = (m \<le> n)
[PROOF STEP]
proof(auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>f m n. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n} \<Longrightarrow> m \<le> n; m \<le> n\<rbrakk> \<Longrightarrow> \<exists>f. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n}
[PROOF STEP]
assume "m \<le> n"
[PROOF STATE]
proof (state)
this:
m \<le> n

goal (1 subgoal):
 1. \<lbrakk>\<And>f m n. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n} \<Longrightarrow> m \<le> n; m \<le> n\<rbrakk> \<Longrightarrow> \<exists>f. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n}
[PROOF STEP]
hence "inj_on id {0..<m} \<and> id ` {0..<m} \<subseteq> {0..<n}"
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. inj_on id {0..<m} \<and> id ` {0..<m} \<subseteq> {0..<n}
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. (\<forall>x\<in>{0..<m}. \<forall>y\<in>{0..<m}. id x = id y \<longrightarrow> x = y) \<and> id ` {0..<m} \<subseteq> {0..<n}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
inj_on id {0..<m} \<and> id ` {0..<m} \<subseteq> {0..<n}

goal (1 subgoal):
 1. \<lbrakk>\<And>f m n. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n} \<Longrightarrow> m \<le> n; m \<le> n\<rbrakk> \<Longrightarrow> \<exists>f. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n}
[PROOF STEP]
thus "\<exists>f. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n}"
[PROOF STATE]
proof (prove)
using this:
inj_on id {0..<m} \<and> id ` {0..<m} \<subseteq> {0..<n}

goal (1 subgoal):
 1. \<exists>f. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>f. inj_on f {0..<m} \<and> f ` {0..<m} \<subseteq> {0..<n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lemma_interval_lt:
  fixes a b x :: real
  assumes "a < x" "x < b"
  shows "\<exists>d. 0 < d \<and> (\<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
using linorder_linear [of "x - a" "b - x"]
[PROOF STATE]
proof (prove)
using this:
x - a \<le> b - x \<or> b - x \<le> x - a

goal (1 subgoal):
 1. \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x - a \<le> b - x \<Longrightarrow> \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
 2. b - x \<le> x - a \<Longrightarrow> \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
assume "x - a \<le> b - x"
[PROOF STATE]
proof (state)
this:
x - a \<le> b - x

goal (2 subgoals):
 1. x - a \<le> b - x \<Longrightarrow> \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
 2. b - x \<le> x - a \<Longrightarrow> \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
a < x
x < b
x - a \<le> b - x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a < x
x < b
x - a \<le> b - x

goal (1 subgoal):
 1. \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
by (rule_tac x = "x - a" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b

goal (1 subgoal):
 1. b - x \<le> x - a \<Longrightarrow> \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b - x \<le> x - a \<Longrightarrow> \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
assume "b - x \<le> x - a"
[PROOF STATE]
proof (state)
this:
b - x \<le> x - a

goal (1 subgoal):
 1. b - x \<le> x - a \<Longrightarrow> \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
a < x
x < b
b - x \<le> x - a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a < x
x < b
b - x \<le> x - a

goal (1 subgoal):
 1. \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b
[PROOF STEP]
by (rule_tac x = "b - x" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a < y \<and> y < b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_bfun_le_norm_vec: "norm (bfun.Bfun (($) (x :: real^'c :: finite))) \<le> norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (bfun.Bfun (($) x)) \<le> norm x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (bfun.Bfun (($) x)) \<le> norm x
[PROOF STEP]
have "norm (bfun.Bfun (($) (x :: real^'c :: finite))) \<le> (\<Squnion>xa. \<bar>x $ xa\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (bfun.Bfun (($) x)) \<le> (\<Squnion>xa. \<bar>x $ xa\<bar>)
[PROOF STEP]
unfolding norm_bfun_def dist_bfun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_fun apply_bfun (map_fun apply_bfun id) (\<lambda>f g. \<Squnion>x. dist (f x) (g x)) (bfun.Bfun (($) x)) 0 \<le> (\<Squnion>xa. \<bar>x $ xa\<bar>)
[PROOF STEP]
by (auto simp: Bfun_inverse)
[PROOF STATE]
proof (state)
this:
norm (bfun.Bfun (($) x)) \<le> (\<Squnion>xa. \<bar>x $ xa\<bar>)

goal (1 subgoal):
 1. norm (bfun.Bfun (($) x)) \<le> norm x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (bfun.Bfun (($) x)) \<le> (\<Squnion>xa. \<bar>x $ xa\<bar>)

goal (1 subgoal):
 1. norm (bfun.Bfun (($) x)) \<le> norm x
[PROOF STEP]
have "\<dots> \<le> norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>xa. \<bar>x $ xa\<bar>) \<le> norm x
[PROOF STEP]
using component_le_norm_cart
[PROOF STATE]
proof (prove)
using this:
\<bar>?x $ ?i\<bar> \<le> norm ?x

goal (1 subgoal):
 1. (\<Squnion>xa. \<bar>x $ xa\<bar>) \<le> norm x
[PROOF STEP]
by (auto intro: cSUP_least)
[PROOF STATE]
proof (state)
this:
(\<Squnion>xa. \<bar>x $ xa\<bar>) \<le> norm x

goal (1 subgoal):
 1. norm (bfun.Bfun (($) x)) \<le> norm x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (bfun.Bfun (($) x)) \<le> norm x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (bfun.Bfun (($) x)) \<le> norm x

goal (1 subgoal):
 1. norm (bfun.Bfun (($) x)) \<le> norm x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (bfun.Bfun (($) x)) \<le> norm x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_powr_eq_mult_powr_iff:
  "\<not> 2 dvd m1 \<Longrightarrow> \<not> 2 dvd m2 \<Longrightarrow> m1 * 2 powr e1 = m2 * 2 powr e2 \<longleftrightarrow> m1 = m2 \<and> e1 = e2"
  for m1 m2 e1 e2 :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>odd m1; odd m2\<rbrakk> \<Longrightarrow> (real_of_int m1 * 2 powr real_of_int e1 = real_of_int m2 * 2 powr real_of_int e2) = (m1 = m2 \<and> e1 = e2)
[PROOF STEP]
using mult_powr_eq_mult_powr_iff_asym[of m1 e1 e2 m2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>odd m1; e1 \<le> e2\<rbrakk> \<Longrightarrow> (real_of_int m1 * 2 powr real_of_int e1 = real_of_int m2 * 2 powr real_of_int e2) = (m1 = m2 \<and> e1 = e2)

goal (1 subgoal):
 1. \<lbrakk>odd m1; odd m2\<rbrakk> \<Longrightarrow> (real_of_int m1 * 2 powr real_of_int e1 = real_of_int m2 * 2 powr real_of_int e2) = (m1 = m2 \<and> e1 = e2)
[PROOF STEP]
using mult_powr_eq_mult_powr_iff_asym[of m2 e2 e1 m1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>odd m1; e1 \<le> e2\<rbrakk> \<Longrightarrow> (real_of_int m1 * 2 powr real_of_int e1 = real_of_int m2 * 2 powr real_of_int e2) = (m1 = m2 \<and> e1 = e2)
\<lbrakk>odd m2; e2 \<le> e1\<rbrakk> \<Longrightarrow> (real_of_int m2 * 2 powr real_of_int e2 = real_of_int m1 * 2 powr real_of_int e1) = (m2 = m1 \<and> e2 = e1)

goal (1 subgoal):
 1. \<lbrakk>odd m1; odd m2\<rbrakk> \<Longrightarrow> (real_of_int m1 * 2 powr real_of_int e1 = real_of_int m2 * 2 powr real_of_int e2) = (m1 = m2 \<and> e1 = e2)
[PROOF STEP]
by (cases e1 e2 rule: linorder_le_cases) auto


[STATEMENT]
lemma absolutely_integrable_reflect[simp]:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  shows "(\<lambda>x. f(-x)) absolutely_integrable_on cbox (-b) (-a) \<longleftrightarrow> f absolutely_integrable_on cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (- x)) absolutely_integrable_on cbox (- b) (- a)) = (f absolutely_integrable_on cbox a b)
[PROOF STEP]
unfolding absolutely_integrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (- x)) integrable_on cbox (- b) (- a) \<and> (\<lambda>x. norm (f (- x))) integrable_on cbox (- b) (- a)) = (f integrable_on cbox a b \<and> (\<lambda>x. norm (f x)) integrable_on cbox a b)
[PROOF STEP]
by (metis (mono_tags, lifting) integrable_eq integrable_reflect)


[STATEMENT]
lemma measure_finite_Union:
  "finite S \<Longrightarrow> A`S \<subseteq> sets M \<Longrightarrow> disjoint_family_on A S \<Longrightarrow> (\<And>i. i \<in> S \<Longrightarrow> emeasure M (A i) \<noteq> \<infinity>) \<Longrightarrow>
    measure M (\<Union>i\<in>S. A i) = (\<Sum>i\<in>S. measure M (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; A ` S \<subseteq> sets M; disjoint_family_on A S; \<And>i. i \<in> S \<Longrightarrow> emeasure M (A i) \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union> (A ` S)) = (\<Sum>i\<in>S. Sigma_Algebra.measure M (A i))
[PROOF STEP]
by (induction S rule: finite_induct)
     (auto simp: disjoint_family_on_insert measure_Union sum_emeasure[symmetric] sets.countable_UN'[OF countable_finite])


[STATEMENT]
lemma convex_sums:
  assumes "convex S"
    and "convex T"
  shows "convex (\<Union>x\<in> S. \<Union>y \<in> T. {x + y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
have "linear (\<lambda>(x, y). x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (\<lambda>(x, y). x + y)
[PROOF STEP]
by (auto intro: linearI simp: scaleR_add_right)
[PROOF STATE]
proof (state)
this:
linear (\<lambda>(x, y). x + y)

goal (1 subgoal):
 1. convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
convex S
convex T
linear (\<lambda>(x, y). x + y)
[PROOF STEP]
have "convex ((\<lambda>(x, y). x + y) ` (S \<times> T))"
[PROOF STATE]
proof (prove)
using this:
convex S
convex T
linear (\<lambda>(x, y). x + y)

goal (1 subgoal):
 1. convex ((\<lambda>(x, y). x + y) ` (S \<times> T))
[PROOF STEP]
by (intro convex_linear_image convex_Times)
[PROOF STATE]
proof (state)
this:
convex ((\<lambda>(x, y). x + y) ` (S \<times> T))

goal (1 subgoal):
 1. convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convex ((\<lambda>(x, y). x + y) ` (S \<times> T))

goal (1 subgoal):
 1. convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
have "((\<lambda>(x, y). x + y) ` (S \<times> T)) = (\<Union>x\<in> S. \<Union>y \<in> T. {x + y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). x + y) ` (S \<times> T) = (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). x + y) ` (S \<times> T) = (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})

goal (1 subgoal):
 1. convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})

goal (1 subgoal):
 1. convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
convex (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sumset_stabilizer_eq:
  shows "sumset (stabilizer A) (stabilizer A) = stabilizer A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset (stabilizer A) (stabilizer A) = stabilizer A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sumset (stabilizer A) (stabilizer A) \<subseteq> stabilizer A
 2. stabilizer A \<subseteq> sumset (stabilizer A) (stabilizer A)
[PROOF STEP]
show "sumset (stabilizer A) (stabilizer A) \<subseteq> stabilizer A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset (stabilizer A) (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
using stabilizer_is_subgroup subgroup.axioms(1) subsetI
[PROOF STATE]
proof (prove)
using this:
subgroup (stabilizer ?S) G (\<oplus>) \<zero>
subgroup ?G ?M ?composition ?unit \<Longrightarrow> submonoid ?G ?M ?composition ?unit
(\<And>x. x \<in> ?A \<Longrightarrow> x \<in> ?B) \<Longrightarrow> ?A \<subseteq> ?B

goal (1 subgoal):
 1. sumset (stabilizer A) (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
by (metis (mono_tags, lifting) additive_abelian_group.sumset.simps additive_abelian_group_axioms
      submonoid.sub_composition_closed)
[PROOF STATE]
proof (state)
this:
sumset (stabilizer A) (stabilizer A) \<subseteq> stabilizer A

goal (1 subgoal):
 1. stabilizer A \<subseteq> sumset (stabilizer A) (stabilizer A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. stabilizer A \<subseteq> sumset (stabilizer A) (stabilizer A)
[PROOF STEP]
show "stabilizer A \<subseteq> sumset (stabilizer A) (stabilizer A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stabilizer A \<subseteq> sumset (stabilizer A) (stabilizer A)
[PROOF STEP]
using Left_Coset_eq_sumset stabilizer_is_nonempty
      stabilizer_subset_group sub_unit_closed additive_abelian_group_axioms right_unit
      subset_iff sumsetI
[PROOF STATE]
proof (prove)
using this:
?x \<in> G \<Longrightarrow> sumset {?x} (stabilizer ?A) = ?x \<cdot>| stabilizer ?A
stabilizer ?S \<noteq> {}
stabilizer ?S \<subseteq> G
\<zero> \<in> stabilizer ?A
additive_abelian_group G (\<oplus>) \<zero>
?a \<in> G \<Longrightarrow> ?a \<oplus> \<zero> = ?a
(?A \<subseteq> ?B) = (\<forall>t. t \<in> ?A \<longrightarrow> t \<in> ?B)
\<lbrakk>?a \<in> ?A; ?a \<in> G; ?b \<in> ?B; ?b \<in> G\<rbrakk> \<Longrightarrow> ?a \<oplus> ?b \<in> sumset ?A ?B

goal (1 subgoal):
 1. stabilizer A \<subseteq> sumset (stabilizer A) (stabilizer A)
[PROOF STEP]
by (smt (verit, best))
[PROOF STATE]
proof (state)
this:
stabilizer A \<subseteq> sumset (stabilizer A) (stabilizer A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quadratic_form_mat:
  fixes A :: "complex mat" and v :: "complex vec" and m :: nat
  assumes dimv: "dim_vec v = m" and dimA: "A \<in> carrier_mat m m"
  shows "inner_prod v (A *\<^sub>v v) = (\<Sum>i=0..<m. (\<Sum>j=0..<m. conjugate (v$i) * A$$(i, j) * v$j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
have  "inner_prod v (A *\<^sub>v v) = (\<Sum>i=0..<m. (\<Sum>j=0..<m.
                conjugate (v$i) * A$$(i, j) * v$j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate v). (A *\<^sub>v v) $ i * conjugate v $ i) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
using dimv dimA
[PROOF STATE]
proof (prove)
using this:
dim_vec v = m
A \<in> carrier_mat m m

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate v). (A *\<^sub>v v) $ i * conjugate v $ i) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
apply (simp add: scalar_prod_def sum_distrib_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dim_vec v = m; A \<in> carrier_mat m m\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<m. \<Sum>n = 0..<m. A $$ (i, n) * v $ n * cnj (v $ i)) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. cnj (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
apply (rule sum.cong, auto, rule sum.cong, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)

goal (1 subgoal):
 1. inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)

goal (1 subgoal):
 1. inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inner_prod v (A *\<^sub>v v) = (\<Sum>i = 0..<m. \<Sum>j = 0..<m. conjugate (v $ i) * A $$ (i, j) * v $ j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma log_inverse: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> log a (inverse x) = - log a x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1; 0 < x\<rbrakk> \<Longrightarrow> log a (inverse x) = - log a x
[PROOF STEP]
using ln_inverse log_def
[PROOF STATE]
proof (prove)
using this:
0 < ?x \<Longrightarrow> ln (inverse ?x) = - ln ?x
log ?a ?x = ln ?x / ln ?a

goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1; 0 < x\<rbrakk> \<Longrightarrow> log a (inverse x) = - log a x
[PROOF STEP]
by auto


[STATEMENT]
lemma connected_space_iff_components_eq:
   "connected_space X \<longleftrightarrow> (\<forall>C \<in> connected_components_of X. \<forall>C' \<in> connected_components_of X. C = C')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_space X = (\<forall>C\<in>connected_components_of X. \<forall>C'\<in>connected_components_of X. C = C')
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. connected_space X \<Longrightarrow> \<forall>C\<in>connected_components_of X. \<forall>C'\<in>connected_components_of X. C = C'
 2. \<forall>C\<in>connected_components_of X. \<forall>C'\<in>connected_components_of X. C = C' \<Longrightarrow> connected_space X
[PROOF STEP]
apply (force simp: connected_components_of_def connected_space_connected_component_set image_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>C\<in>connected_components_of X. \<forall>C'\<in>connected_components_of X. C = C' \<Longrightarrow> connected_space X
[PROOF STEP]
by (metis connected_component_in_connected_components_of connected_component_of_refl connected_space_iff_connected_component mem_Collect_eq)


[STATEMENT]
lemma orthonormal_Fourier_partial_sum_diff_squared:
  assumes os: "orthonormal_system S w" and w: "\<And>i. (w i) square_integrable S"
    and f: "f square_integrable S" and "finite I"
  shows "(l2norm S (\<lambda>x. f x -(\<Sum>i\<in>I. orthonormal_coeff S w f i * w i x)))\<^sup>2 =
         (l2norm S f)\<^sup>2 - (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l2norm S (\<lambda>x. f x - (\<Sum>i\<in>I. orthonormal_coeff S w f i * w i x)))\<^sup>2 = (l2norm S f)\<^sup>2 - (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2)
[PROOF STEP]
using orthonormal_partial_sum_diff [OF assms, where a = "orthonormal_coeff S w f"]
[PROOF STATE]
proof (prove)
using this:
(l2norm S (\<lambda>x. f x - (\<Sum>i\<in>I. orthonormal_coeff S w f i * w i x)))\<^sup>2 = (l2norm S f)\<^sup>2 + (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2) - 2 * (\<Sum>i\<in>I. orthonormal_coeff S w f i * orthonormal_coeff S w f i)

goal (1 subgoal):
 1. (l2norm S (\<lambda>x. f x - (\<Sum>i\<in>I. orthonormal_coeff S w f i * w i x)))\<^sup>2 = (l2norm S f)\<^sup>2 - (\<Sum>i\<in>I. (orthonormal_coeff S w f i)\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma bezout_ring_imp_diagonal_2x2_admits_SNF_JNF:
  assumes c: "OFCLASS('a::comm_ring_1, bezout_ring_class)"
  shows "\<forall>A. (A::'a mat) \<in> carrier_mat 2 2 \<and> isDiagonal_mat A
  \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat 2 2 \<and> Q \<in> carrier_mat 2 2
      \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P*A*Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A. A \<in> carrier_mat 2 2 \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat 2 2 \<and> Q \<in> carrier_mat 2 2 \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
using bezout_ring_imp_diagonal_admits_SNF_JNF
      [OF OFCLASS_bezout_ring_imp_class_bezout_ring[where ?'a='a, OF c]]
[PROOF STATE]
proof (prove)
using this:
\<forall>A. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A. A \<in> carrier_mat 2 2 \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat 2 2 \<and> Q \<in> carrier_mat 2 2 \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
unfolding admits_SNF_JNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. square_mat A \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_row A) (dim_row A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))

goal (1 subgoal):
 1. \<forall>A. A \<in> carrier_mat 2 2 \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat 2 2 \<and> Q \<in> carrier_mat 2 2 \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
using \<open>\<forall>A. admits_SNF_JNF A\<close> admits_SNF_JNF_alt_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. square_mat A \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_row A) (dim_row A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
\<forall>A. admits_SNF_JNF A
(\<forall>A. admits_SNF_JNF A) = (\<forall>A n. A \<in> carrier_mat n n \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat n n \<and> Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q)))

goal (1 subgoal):
 1. \<forall>A. A \<in> carrier_mat 2 2 \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat 2 2 \<and> Q \<in> carrier_mat 2 2 \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
by blast


[STATEMENT]
lemma  effective_row_formula:
 fixes M1 and M2
 assumes "i < (row_length M1)*(row_length M2)"
     and "(mat (row_length M1) (length M1) M1)"
     and "(mat (row_length M2) (length M2) M2)"
 shows "row (M1 \<otimes> M2) i
               =  vec_vec_Tensor
                       (row M1 (i div row_length M2))
                       (row M2 (i mod row_length M2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (M1 \<otimes> M2) i = vec_vec_Tensor (row M1 (i div row_length M2)) (row M2 (i mod row_length M2))
[PROOF STEP]
using assms row_formula
[PROOF STATE]
proof (prove)
using this:
i < row_length M1 * row_length M2
mat (row_length M1) (length M1) M1
mat (row_length M2) (length M2) M2
\<forall>i. i < row_length ?M1.0 * row_length ?M2.0 \<and> mat (row_length ?M1.0) (length ?M1.0) ?M1.0 \<and> mat (row_length ?M2.0) (length ?M2.0) ?M2.0 \<longrightarrow> row (?M1.0 \<otimes> ?M2.0) i = vec_vec_Tensor (row ?M1.0 (i div row_length ?M2.0)) (row ?M2.0 (i mod row_length ?M2.0))

goal (1 subgoal):
 1. row (M1 \<otimes> M2) i = vec_vec_Tensor (row M1 (i div row_length M2)) (row M2 (i mod row_length M2))
[PROOF STEP]
by auto


[STATEMENT]
lemma poly_mult_in_carrier:
  "\<lbrakk> set p1 \<subseteq> carrier R; set p2 \<subseteq> carrier R \<rbrakk> \<Longrightarrow> set (poly_mult p1 p2) \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set p1 \<subseteq> carrier R; set p2 \<subseteq> carrier R\<rbrakk> \<Longrightarrow> set (poly_mult p1 p2) \<subseteq> carrier R
[PROOF STEP]
using poly_mult_is_polynomial polynomial_in_carrier carrier_is_subring
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subring ?K R; set ?p1.0 \<subseteq> ?K; set ?p2.0 \<subseteq> ?K\<rbrakk> \<Longrightarrow> polynomial ?K (poly_mult ?p1.0 ?p2.0)
\<lbrakk>subring ?K R; polynomial ?K ?p\<rbrakk> \<Longrightarrow> set ?p \<subseteq> carrier R
subring (carrier R) R

goal (1 subgoal):
 1. \<lbrakk>set p1 \<subseteq> carrier R; set p2 \<subseteq> carrier R\<rbrakk> \<Longrightarrow> set (poly_mult p1 p2) \<subseteq> carrier R
[PROOF STEP]
by simp


[STATEMENT]
lemma onorm_sum:
  assumes "finite S"
  assumes "\<And>s. s \<in> S \<Longrightarrow> bounded_linear (f s)"
  shows "onorm (\<lambda>x. sum (\<lambda>s. f s x) S) \<le> sum (\<lambda>s. onorm (f s)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. \<Sum>s\<in>S. f s x) \<le> (\<Sum>s\<in>S. onorm (f s))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
?s \<in> S \<Longrightarrow> bounded_linear (f ?s)

goal (1 subgoal):
 1. onorm (\<lambda>x. \<Sum>s\<in>S. f s x) \<le> (\<Sum>s\<in>S. onorm (f s))
[PROOF STEP]
by (induction) (auto simp: onorm_zero intro!: onorm_triangle_le bounded_linear_sum)


[STATEMENT]
lemma measure_preservingE:
  assumes "f \<in> measure_preserving M N"
  shows "f \<in> measurable M N"
        "\<And>A. A \<in> sets N \<Longrightarrow> emeasure M (f-`A \<inter> space M) = emeasure N A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M N &&& (\<And>A. A \<in> sets N \<Longrightarrow> emeasure M (f -` A \<inter> space M) = emeasure N A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> measure_preserving M N

goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M N &&& (\<And>A. A \<in> sets N \<Longrightarrow> emeasure M (f -` A \<inter> space M) = emeasure N A)
[PROOF STEP]
unfolding measure_preserving_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> M \<rightarrow>\<^sub>M N. \<forall>A\<in>sets N. emeasure M (f -` A \<inter> space M) = emeasure N A}

goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M N &&& (\<And>A. A \<in> sets N \<Longrightarrow> emeasure M (f -` A \<inter> space M) = emeasure N A)
[PROOF STEP]
by auto


[STATEMENT]
lemma eln_mult_add:
  assumes "\<not>((a = \<infinity> \<and> b = 0) \<or> (a = 0 \<and> b = \<infinity>))"
  shows "eln(a * b) = eln a + eln b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eln (a * b) = eln a + eln b
[PROOF STEP]
by (smt assms ennexp.simps(2) ennexp.simps(3) ennexp_add_mult ennexp_eln eln_ennexp)


[STATEMENT]
lemma hom_paired2:
  assumes "group G" "group H"
  shows "(\<lambda>(x,y). (f x,g y)) \<in> hom (DirProd G H) (DirProd G' H') \<longleftrightarrow> f \<in> hom G G' \<and> g \<in> hom H H'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>(x, y). (f x, g y)) \<in> hom (G \<times>\<times> H) (G' \<times>\<times> H')) = (f \<in> hom G G' \<and> g \<in> hom H H')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Group.group G
Group.group H

goal (1 subgoal):
 1. ((\<lambda>(x, y). (f x, g y)) \<in> hom (G \<times>\<times> H) (G' \<times>\<times> H')) = (f \<in> hom G G' \<and> g \<in> hom H H')
[PROOF STEP]
by (fastforce simp: hom_def Pi_def dest!: group.is_monoid)


[STATEMENT]
lemma norm_sq_mtx_diag: "\<parallel>sq_mtx_diag f\<parallel> = Max {\<bar>f i\<bar> |i. i \<in> UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>sq_mtx_diag f\<parallel> = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
unfolding norm_sq_mtx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>to_vec (sq_mtx_diag f)\<parallel>\<^sub>o\<^sub>p = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. \<parallel>diag_mat f\<parallel>\<^sub>o\<^sub>p = Max {\<bar>f i\<bar> |i. i \<in> UNIV}
[PROOF STEP]
by (rule op_norm_diag_mat_eq)


[STATEMENT]
lemma fermat_little_theorem:
  assumes "prime (P :: nat)"
  shows "[x^P = x] (mod P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ P = x] (mod P)
[PROOF STEP]
proof(cases "P dvd x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
P dvd x

goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
hence "x mod P = 0"
[PROOF STATE]
proof (prove)
using this:
P dvd x

goal (1 subgoal):
 1. x mod P = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x mod P = 0

goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x mod P = 0

goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
have "x ^ P mod P = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ P mod P = 0
[PROOF STEP]
by (simp add: True assms prime_dvd_power_nat_iff prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
x ^ P mod P = 0

goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x mod P = 0
x ^ P mod P = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x mod P = 0
x ^ P mod P = 0

goal (1 subgoal):
 1. [x ^ P = x] (mod P)
[PROOF STEP]
by (simp add: cong_def)
[PROOF STATE]
proof (state)
this:
[x ^ P = x] (mod P)

goal (1 subgoal):
 1. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> P dvd x

goal (1 subgoal):
 1. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
hence "[x ^ (P - 1) = 1] (mod P)"
[PROOF STATE]
proof (prove)
using this:
\<not> P dvd x

goal (1 subgoal):
 1. [x ^ (P - 1) = 1] (mod P)
[PROOF STEP]
using fermat_theorem assms
[PROOF STATE]
proof (prove)
using this:
\<not> P dvd x
\<lbrakk>prime ?p; \<not> ?p dvd ?a\<rbrakk> \<Longrightarrow> [?a ^ (?p - 1) = 1] (mod ?p)
prime P

goal (1 subgoal):
 1. [x ^ (P - 1) = 1] (mod P)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[x ^ (P - 1) = 1] (mod P)

goal (1 subgoal):
 1. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[x ^ (P - 1) = 1] (mod P)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[x ^ (P - 1) = 1] (mod P)

goal (1 subgoal):
 1. [x ^ P = x] (mod P)
[PROOF STEP]
by (metis Suc_diff_1 assms cong_scalar_left nat_mult_1_right not_gr_zero not_prime_0 power_Suc)
[PROOF STATE]
proof (state)
this:
[x ^ P = x] (mod P)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NatMultiples_product_multiple: "
  \<lbrakk> a \<in> NatMultiples F; b \<in> NatMultiples F \<rbrakk> \<Longrightarrow> a * b \<in> NatMultiples F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> NatMultiples F; b \<in> NatMultiples F\<rbrakk> \<Longrightarrow> a * b \<in> NatMultiples F
[PROOF STEP]
apply (induct a rule: NatMultiples.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k. \<lbrakk>k \<in> F; b \<in> NatMultiples F\<rbrakk> \<Longrightarrow> k * b \<in> NatMultiples F
 2. \<And>k m. \<lbrakk>k \<in> F; m \<in> NatMultiples F; b \<in> NatMultiples F \<Longrightarrow> m * b \<in> NatMultiples F; b \<in> NatMultiples F\<rbrakk> \<Longrightarrow> k * m * b \<in> NatMultiples F
[PROOF STEP]
apply (simp add: NatMultiples_Product)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k m. \<lbrakk>k \<in> F; m \<in> NatMultiples F; b \<in> NatMultiples F \<Longrightarrow> m * b \<in> NatMultiples F; b \<in> NatMultiples F\<rbrakk> \<Longrightarrow> k * m * b \<in> NatMultiples F
[PROOF STEP]
apply (simp add: mult.assoc[of _ _ b] NatMultiples_Product)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ivl_integral_nonneg:
  fixes f :: "real \<Rightarrow> real"
  assumes "f integrable_on (closed_segment a b)"
    and "\<And>x. a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow> 0 \<le> f x"
    and "\<And>x. b \<le> x \<Longrightarrow> x \<le> a \<Longrightarrow> f x \<le> 0"
  shows "0 \<le> ivl_integral a b f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> ivl_integral a b f
[PROOF STEP]
by (rule has_ivl_integral_nonneg[OF assms(1)[unfolded has_ivl_integral_ivl_integral] assms(2-3)])


[STATEMENT]
lemma matrix_vector_mult_diff_distrib [algebra_simps]:
  fixes A :: "'a::ring_1^'n^'m"
  shows "A *v (x - y) = A *v x - A *v y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v (x - y) = A *v x - A *v y
[PROOF STEP]
by (vector matrix_vector_mult_def sum_subtractf right_diff_distrib)


[STATEMENT]
lemma card_Un_le:
  "\<lbrakk> finite A; finite B \<rbrakk> \<Longrightarrow> card (A \<union> B) \<le> card A + card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B\<rbrakk> \<Longrightarrow> card (A \<union> B) \<le> card A + card B
[PROOF STEP]
by(simp only: card_Un_Int)


[STATEMENT]
lemma has_integral_add_cbox:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
  assumes "(f has_integral k) (cbox a b)" "(g has_integral l) (cbox a b)"
  shows "((\<lambda>x. f x + g x) has_integral (k + l)) (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x + g x) has_integral k + l) (cbox a b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f has_integral k) (cbox a b)
(g has_integral l) (cbox a b)

goal (1 subgoal):
 1. ((\<lambda>x. f x + g x) has_integral k + l) (cbox a b)
[PROOF STEP]
unfolding has_integral_cbox
[PROOF STATE]
proof (prove)
using this:
(sum (\<lambda>(x, k). content k *\<^sub>R f x) \<longlongrightarrow> k) (division_filter (cbox a b))
(sum (\<lambda>(x, k). content k *\<^sub>R g x) \<longlongrightarrow> l) (division_filter (cbox a b))

goal (1 subgoal):
 1. (sum (\<lambda>(x, k). content k *\<^sub>R (f x + g x)) \<longlongrightarrow> k + l) (division_filter (cbox a b))
[PROOF STEP]
by (simp add: split_beta' scaleR_add_right sum.distrib[abs_def] tendsto_add)


[STATEMENT]
lemma integral_sin_and_cos_N [simp]:
  fixes m n::real
  assumes "m \<in> \<nat>" "n \<in> \<nat>"
  shows "integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. sin (m * x) * sin (n * x)) = (if m = n \<and> n \<noteq> 0 then pi else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|lebesgue_on {- pi..pi}. sin (m * x) * sin (n * x) = (if m = n \<and> n \<noteq> 0 then pi else 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m \<in> \<nat>
n \<in> \<nat>

goal (1 subgoal):
 1. LINT x|lebesgue_on {- pi..pi}. sin (m * x) * sin (n * x) = (if m = n \<and> n \<noteq> 0 then pi else 0)
[PROOF STEP]
unfolding Nats_altdef1
[PROOF STATE]
proof (prove)
using this:
m \<in> {real_of_int n |n. 0 \<le> n}
n \<in> {real_of_int n |n. 0 \<le> n}

goal (1 subgoal):
 1. LINT x|lebesgue_on {- pi..pi}. sin (m * x) * sin (n * x) = (if m = n \<and> n \<noteq> 0 then pi else 0)
[PROOF STEP]
by (auto simp: integral_sin_and_cos)


[STATEMENT]
lemma disj_family_sum:
  shows "finite I \<Longrightarrow> disjoint_family_on A I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> finite (A i))  \<Longrightarrow>
  (\<Sum> i \<in> (\<Union>n \<in> I. A n). f i) = (\<Sum> n\<in> I. (\<Sum> i \<in> A n. f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; disjoint_family_on A I; \<And>i. i \<in> I \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` I)) = (\<Sum>n\<in>I. sum f (A n))
[PROOF STEP]
proof (induct rule:finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>disjoint_family_on A {}; \<And>i. i \<in> {} \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` {})) = (\<Sum>n\<in>{}. sum f (A n))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
disjoint_family_on A {}
?i \<in> {} \<Longrightarrow> finite (A ?i)

goal (2 subgoals):
 1. \<lbrakk>disjoint_family_on A {}; \<And>i. i \<in> {} \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` {})) = (\<Sum>n\<in>{}. sum f (A n))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
disjoint_family_on A {}
?i \<in> {} \<Longrightarrow> finite (A ?i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
disjoint_family_on A {}
?i \<in> {} \<Longrightarrow> finite (A ?i)

goal (1 subgoal):
 1. sum f (\<Union> (A ` {})) = (\<Sum>n\<in>{}. sum f (A n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f (\<Union> (A ` {})) = (\<Sum>n\<in>{}. sum f (A n))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n))
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> finite (A ?i)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
hence "disjoint_family_on A F"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n))
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> finite (A ?i)

goal (1 subgoal):
 1. disjoint_family_on A F
[PROOF STEP]
by (meson disjoint_family_on_mono subset_insertI)
[PROOF STATE]
proof (state)
this:
disjoint_family_on A F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
have "(\<Union>n \<in> (insert x F). A n) = A x \<union> (\<Union>n \<in> F. A n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (A ` insert x F) = A x \<union> \<Union> (A ` F)
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n))
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> finite (A ?i)

goal (1 subgoal):
 1. \<Union> (A ` insert x F) = A x \<union> \<Union> (A ` F)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Union> (A ` insert x F) = A x \<union> \<Union> (A ` F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
hence "(\<Sum> i \<in> (\<Union>n \<in> (insert x F). A n). f i) = (\<Sum> i \<in> (A x \<union> (\<Union>n \<in> F. A n)). f i)"
[PROOF STATE]
proof (prove)
using this:
\<Union> (A ` insert x F) = A x \<union> \<Union> (A ` F)

goal (1 subgoal):
 1. sum f (\<Union> (A ` insert x F)) = sum f (A x \<union> \<Union> (A ` F))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f (\<Union> (A ` insert x F)) = sum f (A x \<union> \<Union> (A ` F))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f (\<Union> (A ` insert x F)) = sum f (A x \<union> \<Union> (A ` F))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
have "... = (\<Sum> i \<in>  A x. f i) + (\<Sum> i \<in> (\<Union>n \<in> F. A n). f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (A x \<union> \<Union> (A ` F)) = sum f (A x) + sum f (\<Union> (A ` F))
[PROOF STEP]
by (rule sum.union_disjoint, (simp add: insert disjoint_Un)+)
[PROOF STATE]
proof (state)
this:
sum f (A x \<union> \<Union> (A ` F)) = sum f (A x) + sum f (\<Union> (A ` F))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f (A x \<union> \<Union> (A ` F)) = sum f (A x) + sum f (\<Union> (A ` F))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
have "... = (\<Sum> i \<in>  A x. f i) + (\<Sum>n\<in>F. sum f (A n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (A x) + sum f (\<Union> (A ` F)) = sum f (A x) + (\<Sum>n\<in>F. sum f (A n))
[PROOF STEP]
using  \<open>disjoint_family_on A F\<close>
[PROOF STATE]
proof (prove)
using this:
disjoint_family_on A F

goal (1 subgoal):
 1. sum f (A x) + sum f (\<Union> (A ` F)) = sum f (A x) + (\<Sum>n\<in>F. sum f (A n))
[PROOF STEP]
by (simp add: insert)
[PROOF STATE]
proof (state)
this:
sum f (A x) + sum f (\<Union> (A ` F)) = sum f (A x) + (\<Sum>n\<in>F. sum f (A n))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f (A x) + sum f (\<Union> (A ` F)) = sum f (A x) + (\<Sum>n\<in>F. sum f (A n))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
have "... = (\<Sum>n\<in>(insert x F). sum f (A n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (A x) + (\<Sum>n\<in>F. sum f (A n)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n))
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> finite (A ?i)

goal (1 subgoal):
 1. sum f (A x) + (\<Sum>n\<in>F. sum f (A n)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f (A x) + (\<Sum>n\<in>F. sum f (A n)) = (\<Sum>n\<in>insert x F. sum f (A n))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` F)) = (\<Sum>n\<in>F. sum f (A n)); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> finite (A i)\<rbrakk> \<Longrightarrow> sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))

goal (1 subgoal):
 1. sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum f (\<Union> (A ` insert x F)) = (\<Sum>n\<in>insert x F. sum f (A n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma RSpan_append : "RSpan (ms @ ns) = RSpan ms + RSpan ns"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RSpan (ms @ ns) = RSpan ms + RSpan ns
[PROOF STEP]
proof (induct ms)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. RSpan ([] @ ns) = RSpan [] + RSpan ns
 2. \<And>a ms. RSpan (ms @ ns) = RSpan ms + RSpan ns \<Longrightarrow> RSpan ((a # ms) @ ns) = RSpan (a # ms) + RSpan ns
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. RSpan ([] @ ns) = RSpan [] + RSpan ns
 2. \<And>a ms. RSpan (ms @ ns) = RSpan ms + RSpan ns \<Longrightarrow> RSpan ((a # ms) @ ns) = RSpan (a # ms) + RSpan ns
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RSpan ([] @ ns) = RSpan [] + RSpan ns
[PROOF STEP]
using add_0_left[of "RSpan ns"]
[PROOF STATE]
proof (prove)
using this:
0 + RSpan ns = RSpan ns

goal (1 subgoal):
 1. RSpan ([] @ ns) = RSpan [] + RSpan ns
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
RSpan ([] @ ns) = RSpan [] + RSpan ns

goal (1 subgoal):
 1. \<And>a ms. RSpan (ms @ ns) = RSpan ms + RSpan ns \<Longrightarrow> RSpan ((a # ms) @ ns) = RSpan (a # ms) + RSpan ns
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ms. RSpan (ms @ ns) = RSpan ms + RSpan ns \<Longrightarrow> RSpan ((a # ms) @ ns) = RSpan (a # ms) + RSpan ns
[PROOF STEP]
case (Cons m ms)
[PROOF STATE]
proof (state)
this:
RSpan (ms @ ns) = RSpan ms + RSpan ns

goal (1 subgoal):
 1. \<And>a ms. RSpan (ms @ ns) = RSpan ms + RSpan ns \<Longrightarrow> RSpan ((a # ms) @ ns) = RSpan (a # ms) + RSpan ns
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
RSpan (ms @ ns) = RSpan ms + RSpan ns

goal (1 subgoal):
 1. RSpan ((m # ms) @ ns) = RSpan (m # ms) + RSpan ns
[PROOF STEP]
using RSpan_Cons[of m "ms@ns"] add.assoc
[PROOF STATE]
proof (prove)
using this:
RSpan (ms @ ns) = RSpan ms + RSpan ns
RSpan (m # ms @ ns) = RSpan [m] + RSpan (ms @ ns)
?a + ?b + ?c = ?a + (?b + ?c)

goal (1 subgoal):
 1. RSpan ((m # ms) @ ns) = RSpan (m # ms) + RSpan ns
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
RSpan ((m # ms) @ ns) = RSpan (m # ms) + RSpan ns

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma UN_Int_Compl_subset:
     "(\<Union>i \<in> lessThan n. A i) \<inter> (- A n) \<subseteq>
      (\<Union>i \<in> lessThan n. (A i) \<inter> (- A (Suc i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (A ` {..<n}) \<inter> - A n \<subseteq> (\<Union>i<n. A i \<inter> - A (Suc i))
[PROOF STEP]
by (induct n) (auto simp: lessThan_Suc)


[STATEMENT]
lemma mult_adjugate_det: "A ** adjugate A = mat (det A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ** adjugate A = mat (det A)
[PROOF STEP]
using mult_adjugate_det[of "from_vec A"]
[PROOF STATE]
proof (prove)
using this:
from_vec A * Square_Matrix.adjugate (from_vec A) = diag (Square_Matrix.det (from_vec A))

goal (1 subgoal):
 1. A ** adjugate A = mat (det A)
[PROOF STEP]
unfolding det_sq_matrix_eq adjugate_eq to_vec_eq_iff[symmetric] to_vec_matrix_matrix_mult to_vec_from_vec
[PROOF STATE]
proof (prove)
using this:
A ** to_vec (Square_Matrix.adjugate (from_vec A)) = to_vec (diag (det A))

goal (1 subgoal):
 1. A ** (to_vec \<circ> Square_Matrix.adjugate \<circ> from_vec) A = mat (det A)
[PROOF STEP]
by (simp add: to_vec_diag)


[STATEMENT]
lemma covar_indep_eq_zero:
  fixes f g :: "'a \<Rightarrow> real"
  assumes "integrable M f"
  assumes "integrable M g"
  assumes "indep_var borel f borel g"
  shows "covariance f g = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. covariance f g = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. covariance f g = 0
[PROOF STEP]
have a:"indep_var borel ((\<lambda>t. t - expectation f) \<circ> f) borel ((\<lambda>t. t - expectation g) \<circ> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_var borel ((\<lambda>t. t - expectation f) \<circ> f) borel ((\<lambda>t. t - expectation g) \<circ> g)
[PROOF STEP]
by (rule indep_var_compose[OF assms(3)], auto)
[PROOF STATE]
proof (state)
this:
indep_var borel ((\<lambda>t. t - expectation f) \<circ> f) borel ((\<lambda>t. t - expectation g) \<circ> g)

goal (1 subgoal):
 1. covariance f g = 0
[PROOF STEP]
have b:"expectation (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g)) = 0
[PROOF STEP]
using a assms
[PROOF STATE]
proof (prove)
using this:
indep_var borel ((\<lambda>t. t - expectation f) \<circ> f) borel ((\<lambda>t. t - expectation g) \<circ> g)
integrable M f
integrable M g
indep_var borel f borel g

goal (1 subgoal):
 1. expectation (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g)) = 0
[PROOF STEP]
by (subst indep_var_lebesgue_integral, auto simp add:comp_def prob_space)
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g)) = 0

goal (1 subgoal):
 1. covariance f g = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
expectation (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g)) = 0

goal (1 subgoal):
 1. covariance f g = 0
[PROOF STEP]
by (simp add:covariance_def)
[PROOF STATE]
proof (state)
this:
covariance f g = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Dirichlet_kernel_continuous: "continuous_on {-pi..pi} (Dirichlet_kernel n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {- pi..pi} (Dirichlet_kernel n)
[PROOF STEP]
apply (rule continuous_on_subset [OF Dirichlet_kernel_continuous_strong], clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>- pi \<le> x; x \<le> pi\<rbrakk> \<Longrightarrow> - (2 * pi) < x \<and> x < 2 * pi
[PROOF STEP]
using pi_gt_zero
[PROOF STATE]
proof (prove)
using this:
0 < pi

goal (1 subgoal):
 1. \<And>x. \<lbrakk>- pi \<le> x; x \<le> pi\<rbrakk> \<Longrightarrow> - (2 * pi) < x \<and> x < 2 * pi
[PROOF STEP]
by linarith


[STATEMENT]
lemma infnorm_2:
  fixes x :: "real^2"
  shows "infnorm x = max \<bar>x$1\<bar> \<bar>x$2\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infnorm x = max \<bar>x $ 1\<bar> \<bar>x $ 2\<bar>
[PROOF STEP]
unfolding infnorm_cart UNIV_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup {\<bar>x $ i\<bar> |i. i \<in> {1, 2}} = max \<bar>x $ 1\<bar> \<bar>x $ 2\<bar>
[PROOF STEP]
by (rule cSup_eq) auto


[STATEMENT]
lemma double_sum_split_square_diff:  "finite {0..<x} \<Longrightarrow>
  (\<Sum> i \<in> {0..<x} . (\<Sum> j \<in> ({0..< x} - {i}) . c i * c j)) =
  (\<Sum> i \<in> {0..<x} . c i)^2 - (\<Sum> i \<in> {0..<x} . c i * c i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0::'b..<x} \<Longrightarrow> (\<Sum>i = 0::'b..<x. \<Sum>j\<in>{0::'b..<x} - {i}. c i * c j) = (sum c {0::'b..<x})\<^sup>2 - (\<Sum>i = 0::'b..<x. c i * c i)
[PROOF STEP]
using double_sum_split_case_square[of "{0..<x}" "\<lambda> i. c i"]
[PROOF STATE]
proof (prove)
using this:
finite {0::'b..<x} \<Longrightarrow> (sum c {0::'b..<x})\<^sup>2 = (\<Sum>i = 0::'b..<x. c i * c i) + (\<Sum>i = 0::'b..<x. \<Sum>j\<in>{0::'b..<x} - {i}. c i * c j)

goal (1 subgoal):
 1. finite {0::'b..<x} \<Longrightarrow> (\<Sum>i = 0::'b..<x. \<Sum>j\<in>{0::'b..<x} - {i}. c i * c j) = (sum c {0::'b..<x})\<^sup>2 - (\<Sum>i = 0::'b..<x. c i * c i)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma Sigma_mset_Diff_distrib1: "Sigma_mset (I - J) C = Sigma_mset I C - Sigma_mset J C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_mset (I - J) C = Sigma_mset I C - Sigma_mset J C
[PROOF STEP]
by (auto simp: multiset_eq_iff count_sum_mset count_image_mset_Pair sum_mset_if_eq_constant
    Sigma_mset_def iterate_op_plus min_def not_in_iff diff_mult_distrib2)


[STATEMENT]
lemma Cn_Union: \<open>Cn(\<Union>{Cn(B)|B. P B}) = Cn(\<Union>{B. P B})\<close> (is \<open>?A = ?B\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cn (\<Union> {Cn B |B. P B}) = Cn (\<Union> {B. P B})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Cn (\<Union> {Cn B |B. P B}) \<subseteq> Cn (\<Union> {B. P B})
 2. Cn (\<Union> {B. P B}) \<subseteq> Cn (\<Union> {Cn B |B. P B})
[PROOF STEP]
have \<open>?A \<subseteq> Cn ?B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cn (\<Union> {Cn B |B. P B}) \<subseteq> Cn (Cn (\<Union> {B. P B}))
[PROOF STEP]
apply(rule monotonicity_L, rule Union_least, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x B. \<lbrakk>x \<in> Cn B; P B\<rbrakk> \<Longrightarrow> x \<in> Cn (\<Union> (Collect P))
[PROOF STEP]
by (metis Sup_upper in_mono mem_Collect_eq monotonicity_L)
[PROOF STATE]
proof (state)
this:
Cn (\<Union> {Cn B |B. P B}) \<subseteq> Cn (Cn (\<Union> {B. P B}))

goal (2 subgoals):
 1. Cn (\<Union> {Cn B |B. P B}) \<subseteq> Cn (\<Union> {B. P B})
 2. Cn (\<Union> {B. P B}) \<subseteq> Cn (\<Union> {Cn B |B. P B})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Cn (\<Union> {Cn B |B. P B}) \<subseteq> Cn (Cn (\<Union> {B. P B}))
[PROOF STEP]
show \<open>?A \<subseteq> ?B\<close>
[PROOF STATE]
proof (prove)
using this:
Cn (\<Union> {Cn B |B. P B}) \<subseteq> Cn (Cn (\<Union> {B. P B}))

goal (1 subgoal):
 1. Cn (\<Union> {Cn B |B. P B}) \<subseteq> Cn (\<Union> {B. P B})
[PROOF STEP]
by (simp add: idempotency_L)
[PROOF STATE]
proof (state)
this:
Cn (\<Union> {Cn B |B. P B}) \<subseteq> Cn (\<Union> {B. P B})

goal (1 subgoal):
 1. Cn (\<Union> {B. P B}) \<subseteq> Cn (\<Union> {Cn B |B. P B})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Cn (\<Union> {B. P B}) \<subseteq> Cn (\<Union> {Cn B |B. P B})
[PROOF STEP]
show \<open>?B \<subseteq> ?A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cn (\<Union> {B. P B}) \<subseteq> Cn (\<Union> {Cn B |B. P B})
[PROOF STEP]
by (metis (mono_tags, lifting) Union_subsetI inclusion_L mem_Collect_eq monotonicity_L)
[PROOF STATE]
proof (state)
this:
Cn (\<Union> {B. P B}) \<subseteq> Cn (\<Union> {Cn B |B. P B})

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>
The intersection of two closures is closed.
\<close>


[STATEMENT]
lemma sum_list_replicate: "sum_list (replicate n c) = n*c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate n c) = n * c
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sum_list (replicate 0 c) = 0 * c
 2. \<And>n. sum_list (replicate n c) = n * c \<Longrightarrow> sum_list (replicate (Suc n) c) = Suc n * c
[PROOF STEP]
apply(auto simp add: ring_class.ring_distribs(2))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dim_vec_lincomb [simp]:
  assumes "finite F" and "f: F \<rightarrow> UNIV" and "F \<subseteq> carrier_vec n"
  shows "dim_vec (module.lincomb (module_cpx_vec n) f F) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f F) = n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite F
f \<in> F \<rightarrow> UNIV
F \<subseteq> carrier_vec n

goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f F) = n
[PROOF STEP]
proof(induct F)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>f \<in> {} \<rightarrow> UNIV; {} \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f {}) = n
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n; f \<in> insert x F \<rightarrow> UNIV; insert x F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
f \<in> {} \<rightarrow> UNIV
{} \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<lbrakk>f \<in> {} \<rightarrow> UNIV; {} \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f {}) = n
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n; f \<in> insert x F \<rightarrow> UNIV; insert x F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
show "dim_vec (module.lincomb (module_cpx_vec n) f {}) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f {}) = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f {}) = n
[PROOF STEP]
have "module.lincomb (module_cpx_vec n) f {} = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f {} = 0\<^sub>v n
[PROOF STEP]
using module.lincomb_def abelian_monoid.finsum_empty module_cpx_vec_def vecspace_cpx_vec vectorspace_def
[PROOF STATE]
proof (prove)
using this:
Module.module ?R ?M \<Longrightarrow> module.lincomb ?M ?a ?A = (\<Oplus>\<^bsub>?M\<^esub>v\<in>?A. ?a v \<odot>\<^bsub>?M\<^esub> v)
abelian_monoid ?G \<Longrightarrow> finsum ?G ?f {} = \<zero>\<^bsub>?G\<^esub>
module_cpx_vec ?n \<equiv> module_vec TYPE(complex) ?n
vectorspace cpx_rng (module_cpx_vec ?n)
vectorspace ?K ?V \<equiv> Module.module ?K ?V \<and> field ?K

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f {} = 0\<^sub>v n
[PROOF STEP]
by (smt abelian_group_def Module.module_def module_vec_simps(2))
[PROOF STATE]
proof (state)
this:
module.lincomb (module_cpx_vec n) f {} = 0\<^sub>v n

goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f {}) = n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
module.lincomb (module_cpx_vec n) f {} = 0\<^sub>v n

goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f {}) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_vec (module.lincomb (module_cpx_vec n) f {}) = n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
dim_vec (module.lincomb (module_cpx_vec n) f {}) = n

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n; f \<in> insert x F \<rightarrow> UNIV; insert x F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n; f \<in> insert x F \<rightarrow> UNIV; insert x F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
\<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n
f \<in> insert x F \<rightarrow> UNIV
insert x F \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n; f \<in> insert x F \<rightarrow> UNIV; insert x F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
hence "module.lincomb (module_cpx_vec n) f (insert x F) =
    (f x \<cdot>\<^sub>v x) \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n
f \<in> insert x F \<rightarrow> UNIV
insert x F \<subseteq> carrier_vec n

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F
[PROOF STEP]
using module_cpx_vec_def module_vec_def module_cpx_vec module.lincomb_insert cpx_rng_def insert_subset
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n
f \<in> insert x F \<rightarrow> UNIV
insert x F \<subseteq> carrier_vec n
module_cpx_vec ?n \<equiv> module_vec TYPE(complex) ?n
module_vec ?ty ?n \<equiv> \<lparr>carrier = carrier_vec ?n, monoid.mult = undefined, one = undefined, zero = 0\<^sub>v ?n, add = (+), module.smult = (\<cdot>\<^sub>v)\<rparr>
Module.module cpx_rng (module_cpx_vec ?n)
\<lbrakk>Module.module ?R ?M; finite ?S; ?S \<subseteq> carrier ?M; ?a \<in> ?S \<union> {?v} \<rightarrow> carrier ?R; ?v \<notin> ?S; ?v \<in> carrier ?M\<rbrakk> \<Longrightarrow> module.lincomb ?M ?a (?S \<union> {?v}) = ?a ?v \<odot>\<^bsub>?M\<^esub> ?v \<oplus>\<^bsub>?M\<^esub> module.lincomb ?M ?a ?S
cpx_rng \<equiv> \<lparr>carrier = UNIV, monoid.mult = (*), one = 1, zero = 0, add = (+)\<rparr>
(insert ?x ?A \<subseteq> ?B) = (?x \<in> ?B \<and> ?A \<subseteq> ?B)

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F
[PROOF STEP]
by (smt Pi_I' UNIV_I Un_insert_right module_vec_simps(4) partial_object.select_convs(1) sup_bot.comm_neutral)
[PROOF STATE]
proof (state)
this:
module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n; f \<in> insert x F \<rightarrow> UNIV; insert x F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
hence "dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) =
    dim_vec (module.lincomb (module_cpx_vec n) f F)"
[PROOF STATE]
proof (prove)
using this:
module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F

goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = dim_vec (module.lincomb (module_cpx_vec n) f F)
[PROOF STEP]
using index_add_vec
[PROOF STATE]
proof (prove)
using this:
module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F
?i < dim_vec ?v\<^sub>2 \<Longrightarrow> (?v\<^sub>1 + ?v\<^sub>2) $ ?i = ?v\<^sub>1 $ ?i + ?v\<^sub>2 $ ?i
dim_vec (?v\<^sub>1 + ?v\<^sub>2) = dim_vec ?v\<^sub>2

goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = dim_vec (module.lincomb (module_cpx_vec n) f F)
[PROOF STEP]
by (simp add: module_cpx_vec_def module_vec_simps(1))
[PROOF STATE]
proof (state)
this:
dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = dim_vec (module.lincomb (module_cpx_vec n) f F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n; f \<in> insert x F \<rightarrow> UNIV; insert x F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
thus "dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n"
[PROOF STATE]
proof (prove)
using this:
dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = dim_vec (module.lincomb (module_cpx_vec n) f F)

goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
using insert.hyps(3) insert.prems(2)
[PROOF STATE]
proof (prove)
using this:
dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = dim_vec (module.lincomb (module_cpx_vec n) f F)
\<lbrakk>f \<in> F \<rightarrow> UNIV; F \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec n) f F) = n
insert x F \<subseteq> carrier_vec n

goal (1 subgoal):
 1. dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_vec (module.lincomb (module_cpx_vec n) f (insert x F)) = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma local_lipschitz_temp_dyn:
  assumes "0 < (a::real)"
  shows "local_lipschitz UNIV UNIV (\<lambda>t::real. f a L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_lipschitz UNIV UNIV (\<lambda>t. f a L)
[PROOF STEP]
apply(unfold local_lipschitz_def lipschitz_on_def dist_norm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>t\<in>UNIV. \<exists>u>0. \<exists>La. \<forall>t\<in>cball t u \<inter> UNIV. 0 \<le> La \<and> (\<forall>xa\<in>cball x u \<inter> UNIV. \<forall>y\<in>cball x u \<inter> UNIV. \<parallel>f a L xa - f a L y\<parallel> \<le> La \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
apply(clarsimp, rule_tac x=1 in exI, clarsimp, rule_tac x=a in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta. dist t ta \<le> 1 \<Longrightarrow> 0 \<le> a \<and> (\<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<parallel>f a L xa - f a L y\<parallel> \<le> a \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. \<And>x t ta. dist t ta \<le> 1 \<Longrightarrow> 0 \<le> a \<and> (\<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<parallel>f a L xa - f a L y\<parallel> \<le> a \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
apply(simp_all add: norm_diff_temp_dyn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta. \<lbrakk>dist t ta \<le> 1; 0 < a\<rbrakk> \<Longrightarrow> \<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<bar>xa $ 1 - y $ 1\<bar> \<le> \<parallel>xa - y\<parallel>
[PROOF STEP]
apply(simp add: norm_vec_def L2_set_def, unfold UNIV_4, clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta xa y. \<lbrakk>dist t ta \<le> 1; 0 < a; dist x xa \<le> 1; dist x y \<le> 1\<rbrakk> \<Longrightarrow> \<bar>xa $ 1 - y $ 1\<bar> \<le> sqrt ((xa $ 1 - y $ 1)\<^sup>2 + ((xa $ 2 - y $ 2)\<^sup>2 + ((xa $ 3 - y $ 3)\<^sup>2 + (xa $ 4 - y $ 4)\<^sup>2)))
[PROOF STEP]
unfolding real_sqrt_abs[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta xa y. \<lbrakk>dist t ta \<le> 1; 0 < a; dist x xa \<le> 1; dist x y \<le> 1\<rbrakk> \<Longrightarrow> sqrt ((xa $ 1 - y $ 1)\<^sup>2) \<le> sqrt ((xa $ 1 - y $ 1)\<^sup>2 + ((xa $ 2 - y $ 2)\<^sup>2 + ((xa $ 3 - y $ 3)\<^sup>2 + (xa $ 4 - y $ 4)\<^sup>2)))
[PROOF STEP]
by (rule real_le_lsqrt) auto


[STATEMENT]
lemma per_col_adjoint_row:
  assumes "A \<in> carrier_mat n n"
  and "i < n"
  and "f i < n"
shows "Matrix.row (Complex_Matrix.adjoint (per_col A f)) i =
  Matrix.row (Complex_Matrix.adjoint A) (f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
have "per_col A f \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. per_col A f \<in> carrier_mat n n
[PROOF STEP]
using assms per_col_carrier[of A]
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
f i < n
A \<in> carrier_mat ?n ?m \<Longrightarrow> per_col A ?f \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. per_col A f \<in> carrier_mat n n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
per_col A f \<in> carrier_mat n n

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
hence "Matrix.row (Complex_Matrix.adjoint (per_col A f)) i =
    conjugate (Matrix.col (per_col A f) i)"
[PROOF STATE]
proof (prove)
using this:
per_col A f \<in> carrier_mat n n

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = conjugate (Matrix.col (per_col A f) i)
[PROOF STEP]
using assms adjoint_row[of i "per_col A f"]
[PROOF STATE]
proof (prove)
using this:
per_col A f \<in> carrier_mat n n
A \<in> carrier_mat n n
i < n
f i < n
i < dim_col (per_col A f) \<Longrightarrow> Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = conjugate (Matrix.col (per_col A f) i)

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = conjugate (Matrix.col (per_col A f) i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = conjugate (Matrix.col (per_col A f) i)

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = conjugate (Matrix.col (per_col A f) i)

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
have "... = conjugate (Matrix.col A (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (Matrix.col (per_col A f) i) = conjugate (Matrix.col A (f i))
[PROOF STEP]
using assms per_col_col
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
f i < n
\<lbrakk>?A \<in> carrier_mat ?n ?m; ?j < ?m\<rbrakk> \<Longrightarrow> Matrix.col (per_col ?A ?f) ?j = Matrix.col ?A (?f ?j)

goal (1 subgoal):
 1. conjugate (Matrix.col (per_col A f) i) = conjugate (Matrix.col A (f i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
conjugate (Matrix.col (per_col A f) i) = conjugate (Matrix.col A (f i))

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conjugate (Matrix.col (per_col A f) i) = conjugate (Matrix.col A (f i))

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
have "... = Matrix.row (Complex_Matrix.adjoint A) (f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (Matrix.col A (f i)) = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
using assms
    adjoint_row[of "f i" A]
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
f i < n
f i < dim_col A \<Longrightarrow> Matrix.row (Complex_Matrix.adjoint A) (f i) = conjugate (Matrix.col A (f i))

goal (1 subgoal):
 1. conjugate (Matrix.col A (f i)) = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
conjugate (Matrix.col A (f i)) = Matrix.row (Complex_Matrix.adjoint A) (f i)

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Matrix.row (Complex_Matrix.adjoint (per_col A f)) i = Matrix.row (Complex_Matrix.adjoint A) (f i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma half_1_minus_sum:
 "1 - (\<Sum>i<k. ((1::real) / 2) ^ Suc i) = (1/2)^k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (\<Sum>i<k. (1 / 2) ^ Suc i) = (1 / 2) ^ k
[PROOF STEP]
by(induction k) auto


[STATEMENT]
lemma sum_pow2_upto: "sum ((^) (2 :: nat)) {0 ..< x} = 2 ^ x - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {0..<x} = 2 ^ x - 1
[PROOF STEP]
by (induct x) (auto simp: algebra_simps)


[STATEMENT]
lemma exhaust2_nat: "(\<forall>i<(2::nat). P i) \<longleftrightarrow> P 0 \<and> P 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<2. P i) = (P 0 \<and> P 1)
[PROOF STEP]
using less_2_cases
[PROOF STATE]
proof (prove)
using this:
?n < 2 \<Longrightarrow> ?n = 0 \<or> ?n = Suc 0

goal (1 subgoal):
 1. (\<forall>i<2. P i) = (P 0 \<and> P 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_mat_vec_smult_vec_assoc:
  fixes A :: "'a::comm_ring_1 mat"
  assumes A: "A \<in> carrier_mat n m" and w: "w \<in> carrier_vec m"
  shows "A *\<^sub>v (a \<cdot>\<^sub>v w) = a \<cdot>\<^sub>v (A *\<^sub>v w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v (a \<cdot>\<^sub>v w) = a \<cdot>\<^sub>v (A *\<^sub>v w)
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w)) \<Longrightarrow> (A *\<^sub>v (a \<cdot>\<^sub>v w)) $ i = (a \<cdot>\<^sub>v (A *\<^sub>v w)) $ i
 2. dim_vec (A *\<^sub>v (a \<cdot>\<^sub>v w)) = dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w))
[PROOF STEP]
apply (simp add: scalar_prod_def carrier_matD[OF A] carrier_vecD[OF w])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < n \<Longrightarrow> (\<Sum>ia = 0..<m. A $$ (i, ia) * (a * w $ ia)) = a * (\<Sum>ia = 0..<m. A $$ (i, ia) * w $ ia)
 2. dim_vec (A *\<^sub>v (a \<cdot>\<^sub>v w)) = dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w))
[PROOF STEP]
apply (subst sum_distrib_left)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < n \<Longrightarrow> (\<Sum>ia = 0..<m. A $$ (i, ia) * (a * w $ ia)) = (\<Sum>n = 0..<m. a * (A $$ (i, n) * w $ n))
 2. dim_vec (A *\<^sub>v (a \<cdot>\<^sub>v w)) = dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w))
[PROOF STEP]
apply (rule sum.cong, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i x. \<lbrakk>i < n; x \<in> {0..<m}\<rbrakk> \<Longrightarrow> A $$ (i, x) * (a * w $ x) = a * (A $$ (i, x) * w $ x)
 2. dim_vec (A *\<^sub>v (a \<cdot>\<^sub>v w)) = dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w))
[PROOF STEP]
by auto


[STATEMENT]
lemma hom_component_plus: "hom_component (p + q) n = hom_component p n + hom_component q n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_component (p + q) n = hom_component p n + hom_component q n
[PROOF STEP]
by (rule poly_mapping_eqI) (simp add: hom_component_def lookup_except lookup_add)


[STATEMENT]
lemma polyfun_Prod:
assumes "finite I"
assumes "\<And>i. i\<in>I \<Longrightarrow> polyfun N (f i)"
shows "polyfun N (\<lambda>x. \<Prod>i\<in>I. f i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polyfun N (\<lambda>x. \<Prod>i\<in>I. f i x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
?i \<in> I \<Longrightarrow> polyfun N (f ?i)

goal (1 subgoal):
 1. polyfun N (\<lambda>x. \<Prod>i\<in>I. f i x)
[PROOF STEP]
apply (induction I rule:finite_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> polyfun N (f i)) \<Longrightarrow> polyfun N (\<lambda>x. \<Prod>i\<in>{}. f i x)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> polyfun N (f i)) \<Longrightarrow> polyfun N (\<lambda>x. \<Prod>i\<in>F. f i x); \<And>i. i \<in> insert x F \<Longrightarrow> polyfun N (f i)\<rbrakk> \<Longrightarrow> polyfun N (\<lambda>xa. \<Prod>i\<in>insert x F. f i xa)
[PROOF STEP]
apply (simp add: polyfun_const)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> polyfun N (f i)) \<Longrightarrow> polyfun N (\<lambda>x. \<Prod>i\<in>F. f i x); \<And>i. i \<in> insert x F \<Longrightarrow> polyfun N (f i)\<rbrakk> \<Longrightarrow> polyfun N (\<lambda>xa. \<Prod>i\<in>insert x F. f i xa)
[PROOF STEP]
using comm_monoid_add_class.sum.insert polyfun_mult
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; ?x \<notin> ?A\<rbrakk> \<Longrightarrow> sum ?g (insert ?x ?A) = ?g ?x + sum ?g ?A
\<lbrakk>polyfun ?N ?f; polyfun ?N ?g\<rbrakk> \<Longrightarrow> polyfun ?N (\<lambda>x. ?f x * ?g x)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> polyfun N (f i)) \<Longrightarrow> polyfun N (\<lambda>x. \<Prod>i\<in>F. f i x); \<And>i. i \<in> insert x F \<Longrightarrow> polyfun N (f i)\<rbrakk> \<Longrightarrow> polyfun N (\<lambda>xa. \<Prod>i\<in>insert x F. f i xa)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma integrable_Beta':
  assumes "a > 0" "b > (0::real)"
  shows   "(\<lambda>t. t powr (a - 1) * (1 - t) powr (b - 1)) integrable_on {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. t powr (a - 1) * (1 - t) powr (b - 1)) integrable_on {0..1}
[PROOF STEP]
using integrable_Beta[OF assms]
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel {0..1} (\<lambda>t. t powr (a - 1) * (1 - t) powr (b - 1))

goal (1 subgoal):
 1. (\<lambda>t. t powr (a - 1) * (1 - t) powr (b - 1)) integrable_on {0..1}
[PROOF STEP]
by (rule set_borel_integral_eq_integral)


[STATEMENT]
theorem harry_sum_closed_form: "harry_sum n = n * (n + 1) * 2 ^ n div 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harry_sum n = n * (n + 1) * 2 ^ n div 4
[PROOF STEP]
using harry_sum_closed_form_aux[of n]
[PROOF STATE]
proof (prove)
using this:
4 * harry_sum n = n * (n + 1) * 2 ^ n

goal (1 subgoal):
 1. harry_sum n = n * (n + 1) * 2 ^ n div 4
[PROOF STEP]
by simp


[STATEMENT]
lemma cos_tan_half: "cos x \<noteq>0 \<Longrightarrow>  cos (2*x) = (1 - (tan x)^2) / (1+ (tan x)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<noteq> (0::'a) \<Longrightarrow> cos ((2::'a) * x) = ((1::'a) - (tan x)\<^sup>2) / ((1::'a) + (tan x)\<^sup>2)
[PROOF STEP]
unfolding cos_double tan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<noteq> (0::'a) \<Longrightarrow> (cos x)\<^sup>2 - (sin x)\<^sup>2 = ((1::'a) - (sin x / cos x)\<^sup>2) / ((1::'a) + (sin x / cos x)\<^sup>2)
[PROOF STEP]
by (auto simp add:field_simps )


[STATEMENT]
theorem exp_times_self_eq_iff:
  "w * exp w = x \<longleftrightarrow> x \<ge> -exp (-1) \<and> (w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w * exp w = x) = (- exp (- 1) \<le> x \<and> (w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x))
[PROOF STEP]
using exp_times_self_eqD[of w x]
[PROOF STATE]
proof (prove)
using this:
w * exp w = x \<Longrightarrow> - exp (- 1) \<le> x
w * exp w = x \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x

goal (1 subgoal):
 1. (w * exp w = x) = (- exp (- 1) \<le> x \<and> (w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x))
[PROOF STEP]
by (auto simp: Lambert_W_times_exp_self Lambert_W'_times_exp_self)


[STATEMENT]
lemma mat_kernel: assumes "A \<in> carrier_mat nr nc"
  shows "mat_kernel A = {v. v \<in> carrier_vec nc \<and> A *\<^sub>v v = 0\<^sub>v nr}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_kernel A = {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}
[PROOF STEP]
unfolding mat_kernel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {v \<in> carrier_vec (dim_col A). A *\<^sub>v v = 0\<^sub>v (dim_row A)} = {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. {v \<in> carrier_vec (dim_col A). A *\<^sub>v v = 0\<^sub>v (dim_row A)} = {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}
[PROOF STEP]
by auto


[STATEMENT]
lemma arsinh_minus_real [simp]: "arsinh (-x::real) = -arsinh x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
have "arsinh (-x) = ln (sqrt (x\<^sup>2 + 1) - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arsinh (- x) = ln (sqrt (x\<^sup>2 + 1) - x)
[PROOF STEP]
by (simp add: arsinh_real_def)
[PROOF STATE]
proof (state)
this:
arsinh (- x) = ln (sqrt (x\<^sup>2 + 1) - x)

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arsinh (- x) = ln (sqrt (x\<^sup>2 + 1) - x)

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
have "sqrt (x^2 + 1) - x = inverse (sqrt (x^2 + 1) + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x\<^sup>2 + 1) - x = inverse (sqrt (x\<^sup>2 + 1) + x)
[PROOF STEP]
using arsinh_real_aux[of x]
[PROOF STATE]
proof (prove)
using this:
0 < x + sqrt (x\<^sup>2 + 1)

goal (1 subgoal):
 1. sqrt (x\<^sup>2 + 1) - x = inverse (sqrt (x\<^sup>2 + 1) + x)
[PROOF STEP]
by (simp add: field_split_simps algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
sqrt (x\<^sup>2 + 1) - x = inverse (sqrt (x\<^sup>2 + 1) + x)

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (x\<^sup>2 + 1) - x = inverse (sqrt (x\<^sup>2 + 1) + x)

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
have "ln \<dots> = -arsinh x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (inverse (sqrt (x\<^sup>2 + 1) + x)) = - arsinh x
[PROOF STEP]
using arsinh_real_aux[of x]
[PROOF STATE]
proof (prove)
using this:
0 < x + sqrt (x\<^sup>2 + 1)

goal (1 subgoal):
 1. ln (inverse (sqrt (x\<^sup>2 + 1) + x)) = - arsinh x
[PROOF STEP]
by (simp add: arsinh_real_def ln_inverse)
[PROOF STATE]
proof (state)
this:
ln (inverse (sqrt (x\<^sup>2 + 1) + x)) = - arsinh x

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arsinh (- x) = - arsinh x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arsinh (- x) = - arsinh x

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
arsinh (- x) = - arsinh x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diag_mat_mul_diag_ele:
  fixes A B :: "complex mat"
  assumes dimA: "A \<in> carrier_mat n n" and dimB: "B \<in> carrier_mat n n"
    and dA: "diagonal_mat A" and dB: "diagonal_mat B"
  shows "\<forall>i<n. (A*B) $$ (i,i) = A$$(i, i) * B$$(i, i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
have AB: "A * B = mat n n (\<lambda>(i,j). if i = j then (A$$(i, i)) * (B$$(i, i)) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
using diag_mat_mult_diag_mat[of A n B] dimA dimB dA dB
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<in> carrier_mat n n; B \<in> carrier_mat n n; diagonal_mat A; diagonal_mat B\<rbrakk> \<Longrightarrow> A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat A
diagonal_mat B

goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)

goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)

goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
using AB
[PROOF STATE]
proof (prove)
using this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)

goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)

goal:
No subgoals!
[PROOF STEP]
qed