[STATEMENT]
lemma vector_derivative_cnj_within:
  assumes "at x within A \<noteq> bot" and "f differentiable at x within A"
  shows   "vector_derivative (\<lambda>z. cnj (f z)) (at x within A) =
             cnj (vector_derivative f (at x within A))" (is "_ = cnj ?D")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x within A) = cnj (vector_derivative f (at x within A))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x within A) = cnj (vector_derivative f (at x within A))
[PROOF STEP]
let ?D = "vector_derivative f (at x within A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x within A) = cnj (vector_derivative f (at x within A))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
at x within A \<noteq> bot
f differentiable at x within A
[PROOF STEP]
have "(f has_vector_derivative ?D) (at x within A)"
[PROOF STATE]
proof (prove)
using this:
at x within A \<noteq> bot
f differentiable at x within A

goal (1 subgoal):
 1. (f has_vector_derivative vector_derivative f (at x within A)) (at x within A)
[PROOF STEP]
by (subst (asm) vector_derivative_works)
[PROOF STATE]
proof (state)
this:
(f has_vector_derivative vector_derivative f (at x within A)) (at x within A)

goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x within A) = cnj (vector_derivative f (at x within A))
[PROOF STEP]
hence "((\<lambda>x. cnj (f x)) has_vector_derivative cnj ?D) (at x within A)"
[PROOF STATE]
proof (prove)
using this:
(f has_vector_derivative vector_derivative f (at x within A)) (at x within A)

goal (1 subgoal):
 1. ((\<lambda>x. cnj (f x)) has_vector_derivative cnj (vector_derivative f (at x within A))) (at x within A)
[PROOF STEP]
by (rule has_vector_derivative_cnj)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. cnj (f x)) has_vector_derivative cnj (vector_derivative f (at x within A))) (at x within A)

goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x within A) = cnj (vector_derivative f (at x within A))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. cnj (f x)) has_vector_derivative cnj (vector_derivative f (at x within A))) (at x within A)

goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x within A) = cnj (vector_derivative f (at x within A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. cnj (f x)) has_vector_derivative cnj (vector_derivative f (at x within A))) (at x within A)
at x within A \<noteq> bot
f differentiable at x within A

goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x within A) = cnj (vector_derivative f (at x within A))
[PROOF STEP]
by (auto dest: vector_derivative_within)
[PROOF STATE]
proof (state)
this:
vector_derivative (\<lambda>z. cnj (f z)) (at x within A) = cnj (vector_derivative f (at x within A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary11_special:
  assumes "unitary11 M" and "mat_det M = 1"
  shows "\<exists> a b. M = (a, b, cnj b, cnj a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a)
[PROOF STEP]
have "mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, -1) = (1, 0, 0, -1) *\<^sub>m\<^sub>m mat_inv M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
[PROOF STEP]
using assms mult_mm_inv_r
[PROOF STATE]
proof (prove)
using this:
unitary11 M
mat_det M = 1
\<lbrakk>mat_det ?B \<noteq> 0; ?A *\<^sub>m\<^sub>m ?B = ?C\<rbrakk> \<Longrightarrow> ?A = ?C *\<^sub>m\<^sub>m mat_inv ?B

goal (1 subgoal):
 1. mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
[PROOF STEP]
by (simp add: unitary11_def)
[PROOF STATE]
proof (state)
this:
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
mat_det M = 1

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a)
[PROOF STEP]
by (cases M) (simp add: mat_adj_def mat_cnj_def)
[PROOF STATE]
proof (state)
this:
\<exists>a b. M = (a, b, cnj b, cnj a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_integral_dominated_convergence:
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
  assumes "\<And>k. (f k has_integral y k) S" "h integrable_on S"
    "\<And>k. \<forall>x\<in>S. norm (f k x) \<le> h x" "\<forall>x\<in>S. (\<lambda>k. f k x) \<longlonglongrightarrow> g x"
    and x: "y \<longlonglongrightarrow> x"
  shows "(g has_integral x) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_integral x) S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (g has_integral x) S
[PROOF STEP]
have int_f: "\<And>k. (f k) integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. f k integrable_on S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f ?k has_integral y ?k) S
h integrable_on S
\<forall>x\<in>S. norm (f ?k x) \<le> h x
\<forall>x\<in>S. (\<lambda>k. f k x) \<longlonglongrightarrow> g x
y \<longlonglongrightarrow> x

goal (1 subgoal):
 1. \<And>k. f k integrable_on S
[PROOF STEP]
by (auto simp: integrable_on_def)
[PROOF STATE]
proof (state)
this:
f ?k integrable_on S

goal (1 subgoal):
 1. (g has_integral x) S
[PROOF STEP]
have "(g has_integral (integral S g)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_integral integral S g) S
[PROOF STEP]
by (metis assms(2-4) dominated_convergence(1) has_integral_integral int_f)
[PROOF STATE]
proof (state)
this:
(g has_integral integral S g) S

goal (1 subgoal):
 1. (g has_integral x) S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(g has_integral integral S g) S

goal (1 subgoal):
 1. (g has_integral x) S
[PROOF STEP]
have "integral S g = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral S g = x
[PROOF STEP]
proof (rule LIMSEQ_unique)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?X \<longlonglongrightarrow> integral S g
 2. ?X \<longlonglongrightarrow> x
[PROOF STEP]
show "(\<lambda>i. integral S (f i)) \<longlonglongrightarrow> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. integral S (f i)) \<longlonglongrightarrow> x
[PROOF STEP]
using integral_unique[OF assms(1)] x
[PROOF STATE]
proof (prove)
using this:
integral S (f ?k1) = y ?k1
y \<longlonglongrightarrow> x

goal (1 subgoal):
 1. (\<lambda>i. integral S (f i)) \<longlonglongrightarrow> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>i. integral S (f i)) \<longlonglongrightarrow> x

goal (1 subgoal):
 1. (\<lambda>i. integral S (f i)) \<longlonglongrightarrow> integral S g
[PROOF STEP]
show "(\<lambda>i. integral S (f i)) \<longlonglongrightarrow> integral S g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. integral S (f i)) \<longlonglongrightarrow> integral S g
[PROOF STEP]
by (metis assms(2) assms(3) assms(4) dominated_convergence(2) int_f)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. integral S (f i)) \<longlonglongrightarrow> integral S g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integral S g = x

goal (1 subgoal):
 1. (g has_integral x) S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(g has_integral integral S g) S
integral S g = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(g has_integral integral S g) S
integral S g = x

goal (1 subgoal):
 1. (g has_integral x) S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(g has_integral x) S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_integral_count_space_nn_integral:
  fixes f :: "'i \<Rightarrow> 'a \<Rightarrow> ennreal"
  assumes "countable I" and [measurable]: "\<And>i. i \<in> I \<Longrightarrow> f i \<in> borel_measurable M"
  shows "(\<integral>\<^sup>+x. \<integral>\<^sup>+i. f i x \<partial>count_space I \<partial>M) = (\<integral>\<^sup>+i. \<integral>\<^sup>+x. f i x \<partial>M \<partial>count_space I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
 2. \<not> ?P \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
assume "finite I"
[PROOF STATE]
proof (state)
this:
finite I

goal (2 subgoals):
 1. ?P \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
 2. \<not> ?P \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite I
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite I

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
by (simp add: nn_integral_count_space_finite nn_integral_sum)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I

goal (1 subgoal):
 1. infinite I \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite I \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
assume "infinite I"
[PROOF STATE]
proof (state)
this:
infinite I

goal (1 subgoal):
 1. infinite I \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite I
[PROOF STEP]
have [simp]: "I \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
infinite I

goal (1 subgoal):
 1. I \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
I \<noteq> {}

goal (1 subgoal):
 1. infinite I \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
note * = bij_betw_from_nat_into[OF \<open>countable I\<close> \<open>infinite I\<close>]
[PROOF STATE]
proof (state)
this:
bij_betw (from_nat_into I) UNIV I

goal (1 subgoal):
 1. infinite I \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
have **: "\<And>f. (\<And>i. 0 \<le> f i) \<Longrightarrow> (\<integral>\<^sup>+i. f i \<partial>count_space I) = (\<Sum>n. f (from_nat_into I n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. (\<And>i. 0 \<le> f i) \<Longrightarrow> integral\<^sup>N (count_space I) f = (\<Sum>n. f (from_nat_into I n))
[PROOF STEP]
by (simp add: nn_integral_bij_count_space[symmetric, OF *] nn_integral_count_space_nat)
[PROOF STATE]
proof (state)
this:
(\<And>i. 0 \<le> ?f i) \<Longrightarrow> integral\<^sup>N (count_space I) ?f = (\<Sum>n. ?f (from_nat_into I n))

goal (1 subgoal):
 1. infinite I \<Longrightarrow> \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I
[PROOF STEP]
by (simp add: ** nn_integral_suminf from_nat_into)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ i. f i x \<partial>count_space I \<partial>M = \<integral>\<^sup>+ i. integral\<^sup>N M (f i) \<partial>count_space I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filtermap_nhds_open_map:
  assumes cont: "isCont f a"
    and open_map: "\<And>S. open S \<Longrightarrow> open (f`S)"
  shows "filtermap f (nhds a) = nhds (f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap f (nhds a) = nhds (f a)
[PROOF STEP]
unfolding filter_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P. eventually P (filtermap f (nhds a)) = eventually P (nhds (f a))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
fix P
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
assume "eventually P (filtermap f (nhds a))"
[PROOF STATE]
proof (state)
this:
eventually P (filtermap f (nhds a))

goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eventually P (filtermap f (nhds a))
[PROOF STEP]
obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. P (f x)"
[PROOF STATE]
proof (prove)
using this:
eventually P (filtermap f (nhds a))

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>open S; a \<in> S; \<forall>x\<in>S. P (f x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_filtermap eventually_nhds)
[PROOF STATE]
proof (state)
this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)
[PROOF STEP]
show "eventually P (nhds (f a))"
[PROOF STATE]
proof (prove)
using this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (1 subgoal):
 1. eventually P (nhds (f a))
[PROOF STEP]
unfolding eventually_nhds
[PROOF STATE]
proof (prove)
using this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (1 subgoal):
 1. \<exists>S. open S \<and> f a \<in> S \<and> Ball S P
[PROOF STEP]
by (intro exI[of _ "f`S"]) (auto intro!: open_map)
[PROOF STATE]
proof (state)
this:
eventually P (nhds (f a))

goal (1 subgoal):
 1. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
qed (metis filterlim_iff tendsto_at_iff_tendsto_nhds isCont_def eventually_filtermap cont)


[STATEMENT]
lemma vderiv_expI[poly_derivatives]:
  assumes "D (f::real \<Rightarrow> real) = f' on T" and "g = (\<lambda>t. (f' t) * exp (f t))"
  shows "D (\<lambda>t. exp (f t)) = g on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1.  D (\<lambda>t. exp (f t)) = g on T
[PROOF STEP]
apply(rule vderiv_on_composeI[OF _ assms(1), of "\<lambda>t. exp t"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1.  D exp = ?f' on f ` T
 2. g = (\<lambda>t. f' t *\<^sub>R ?f' (f t))
[PROOF STEP]
unfolding has_vderiv_on_def has_vector_derivative_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x\<in>f ` T. D exp \<mapsto> (\<lambda>xa. xa *\<^sub>R ?f' x) at x within f ` T
 2. g = (\<lambda>t. f' t *\<^sub>R ?f' (f t))
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: assms)

\<comment> \<open>Examples for checking derivatives\<close>


[STATEMENT]
lemma differentiable_cmult_left_iff [simp]:
  fixes c::"'a::real_normed_field"
  shows "(\<lambda>t. c * q t) differentiable at t \<longleftrightarrow> c = 0 \<or> (\<lambda>t. q t) differentiable at t" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. c * q t) differentiable at t) = (c = (0::'a) \<or> q differentiable at t)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>t. c * q t) differentiable at t \<Longrightarrow> c = (0::'a) \<or> q differentiable at t
 2. c = (0::'a) \<or> q differentiable at t \<Longrightarrow> (\<lambda>t. c * q t) differentiable at t
[PROOF STEP]
assume L: ?lhs
[PROOF STATE]
proof (state)
this:
(\<lambda>t. c * q t) differentiable at t

goal (2 subgoals):
 1. (\<lambda>t. c * q t) differentiable at t \<Longrightarrow> c = (0::'a) \<or> q differentiable at t
 2. c = (0::'a) \<or> q differentiable at t \<Longrightarrow> (\<lambda>t. c * q t) differentiable at t
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<lambda>t. c * q t) differentiable at t

goal (2 subgoals):
 1. (\<lambda>t. c * q t) differentiable at t \<Longrightarrow> c = (0::'a) \<or> q differentiable at t
 2. c = (0::'a) \<or> q differentiable at t \<Longrightarrow> (\<lambda>t. c * q t) differentiable at t
[PROOF STEP]
assume "c \<noteq> 0"
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a)

goal (2 subgoals):
 1. (\<lambda>t. c * q t) differentiable at t \<Longrightarrow> c = (0::'a) \<or> q differentiable at t
 2. c = (0::'a) \<or> q differentiable at t \<Longrightarrow> (\<lambda>t. c * q t) differentiable at t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
[PROOF STEP]
have "q differentiable at t"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. q differentiable at t
[PROOF STEP]
using differentiable_mult [OF differentiable_const L, of concl: "1/c"]
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)
(\<lambda>x. (1::'a) / c * (c * q x)) differentiable at t

goal (1 subgoal):
 1. q differentiable at t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q differentiable at t

goal (2 subgoals):
 1. (\<lambda>t. c * q t) differentiable at t \<Longrightarrow> c = (0::'a) \<or> q differentiable at t
 2. c = (0::'a) \<or> q differentiable at t \<Longrightarrow> (\<lambda>t. c * q t) differentiable at t
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a) \<Longrightarrow> q differentiable at t

goal (2 subgoals):
 1. (\<lambda>t. c * q t) differentiable at t \<Longrightarrow> c = (0::'a) \<or> q differentiable at t
 2. c = (0::'a) \<or> q differentiable at t \<Longrightarrow> (\<lambda>t. c * q t) differentiable at t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a) \<Longrightarrow> q differentiable at t
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a) \<Longrightarrow> q differentiable at t

goal (1 subgoal):
 1. c = (0::'a) \<or> q differentiable at t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c = (0::'a) \<or> q differentiable at t

goal (1 subgoal):
 1. c = (0::'a) \<or> q differentiable at t \<Longrightarrow> (\<lambda>t. c * q t) differentiable at t
[PROOF STEP]
qed auto


[STATEMENT]
lemma double_sum_split_case_square:
  assumes "finite A"
  shows "(\<Sum> i \<in> A . f i )^2 = (\<Sum> i \<in> A . (f i * f i)) + (\<Sum> i \<in> A . (\<Sum> j \<in> (A - {i}) . f i * f j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
have "(\<Sum> i \<in> A . f i )^2 = (\<Sum> i \<in> A . f i) * (\<Sum> i \<in> A . f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sum f A)\<^sup>2 = sum f A * sum f A
[PROOF STEP]
using power2_eq_square
[PROOF STATE]
proof (prove)
using this:
?a\<^sup>2 = ?a * ?a

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = sum f A * sum f A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(sum f A)\<^sup>2 = sum f A * sum f A

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(sum f A)\<^sup>2 = sum f A * sum f A
[PROOF STEP]
have "(\<Sum> i \<in> A . f i) * (\<Sum> i \<in> A . f i) = (\<Sum> i \<in> A . f i) * (\<Sum> j \<in> A . f j)"
[PROOF STATE]
proof (prove)
using this:
(sum f A)\<^sup>2 = sum f A * sum f A

goal (1 subgoal):
 1. sum f A * sum f A = sum f A * sum f A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f A * sum f A = sum f A * sum f A

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f A * sum f A = sum f A * sum f A

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
have 1: "... = (\<Sum> i \<in> A . f i * (\<Sum> j \<in> A . f j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A * sum f A = (\<Sum>i\<in>A. f i * sum f A)
[PROOF STEP]
using sum_distrib_right
[PROOF STATE]
proof (prove)
using this:
sum ?f ?A * ?r = (\<Sum>n\<in>?A. ?f n * ?r)

goal (1 subgoal):
 1. sum f A * sum f A = (\<Sum>i\<in>A. f i * sum f A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f A * sum f A = (\<Sum>i\<in>A. f i * sum f A)

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f A * sum f A = (\<Sum>i\<in>A. f i * sum f A)

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
have 2: "... = (\<Sum> i \<in> A .  (\<Sum> j \<in> A . f i * f j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>A. f i * sum f A) = (\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j)
[PROOF STEP]
using sum_distrib_left
[PROOF STATE]
proof (prove)
using this:
?r * sum ?f ?A = (\<Sum>n\<in>?A. ?r * ?f n)

goal (1 subgoal):
 1. (\<Sum>i\<in>A. f i * sum f A) = (\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>A. f i * sum f A) = (\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j)

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j) = (\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j)
[PROOF STEP]
have "(\<Sum> i \<in> A . f i) * (\<Sum> i \<in> A . f i) =
    (\<Sum> i \<in> A . (f i * f i)) + (\<Sum> i \<in> A . (\<Sum> j \<in> (A - {i}) . f i * f j))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j) = (\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j)

goal (1 subgoal):
 1. sum f A * sum f A = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
using assms double_sum_split_case[of "A" "\<lambda> i j . f i * f j"] 1 2
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j) = (\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j)
finite A
finite A \<Longrightarrow> (\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j) = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
sum f A * sum f A = (\<Sum>i\<in>A. f i * sum f A)
(\<Sum>i\<in>A. f i * sum f A) = (\<Sum>i\<in>A. \<Sum>j\<in>A. f i * f j)

goal (1 subgoal):
 1. sum f A * sum f A = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
sum f A * sum f A = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum f A * sum f A = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum f A * sum f A = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
using power2_eq_square
[PROOF STATE]
proof (prove)
using this:
sum f A * sum f A = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
?a\<^sup>2 = ?a * ?a

goal (1 subgoal):
 1. (sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(sum f A)\<^sup>2 = (\<Sum>i\<in>A. f i * f i) + (\<Sum>i\<in>A. \<Sum>j\<in>A - {i}. f i * f j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_z_over_z_series':
  fixes z :: "'a :: {real_normed_field,banach}"
  assumes "z \<noteq> 0"
  shows   "(\<lambda>n. sin_coeff (n+1) *\<^sub>R z^n) sums (sin z / z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sin_coeff (n + 1) *\<^sub>R z ^ n) sums (sin z / z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. sin_coeff (n + 1) *\<^sub>R z ^ n) sums (sin z / z)
[PROOF STEP]
from sums_split_initial_segment[OF sin_converges[of z], of 1]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. sin_coeff (i + 1) *\<^sub>R z ^ (i + 1)) sums (sin z - (\<Sum>i<1. sin_coeff i *\<^sub>R z ^ i))
[PROOF STEP]
have "(\<lambda>n. z * (sin_coeff (n+1) *\<^sub>R z ^ n)) sums sin z"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. sin_coeff (i + 1) *\<^sub>R z ^ (i + 1)) sums (sin z - (\<Sum>i<1. sin_coeff i *\<^sub>R z ^ i))

goal (1 subgoal):
 1. (\<lambda>n. z * sin_coeff (n + 1) *\<^sub>R z ^ n) sums sin z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. z * sin_coeff (n + 1) *\<^sub>R z ^ n) sums sin z

goal (1 subgoal):
 1. (\<lambda>n. sin_coeff (n + 1) *\<^sub>R z ^ n) sums (sin z / z)
[PROOF STEP]
from sums_mult[OF this, of "inverse z"] assms
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. inverse z * (z * sin_coeff (n + 1) *\<^sub>R z ^ n)) sums (inverse z * sin z)
z \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. inverse z * (z * sin_coeff (n + 1) *\<^sub>R z ^ n)) sums (inverse z * sin z)
z \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<lambda>n. sin_coeff (n + 1) *\<^sub>R z ^ n) sums (sin z / z)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sin_coeff (n + 1) *\<^sub>R z ^ n) sums (sin z / z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma independent_UnI:
  assumes "independent A" and "independent B" and "span A \<inter> span B = {0}"
  shows "independent (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.independent (A \<union> B)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
from span_superset
[PROOF STATE]
proof (chain)
picking this:
?S \<subseteq> local.span ?S
[PROOF STEP]
have "A \<inter> B \<subseteq> span A \<inter> span B"
[PROOF STATE]
proof (prove)
using this:
?S \<subseteq> local.span ?S

goal (1 subgoal):
 1. A \<inter> B \<subseteq> local.span A \<inter> local.span B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<inter> B \<subseteq> local.span A \<inter> local.span B

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
hence "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
using this:
A \<inter> B \<subseteq> local.span A \<inter> local.span B

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
unfolding assms(3)
[PROOF STATE]
proof (prove)
using this:
A \<inter> B \<subseteq> {0::'b}

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
using assms(1, 2) dependent_zero
[PROOF STATE]
proof (prove)
using this:
A \<inter> B \<subseteq> {0::'b}
local.independent A
local.independent B
(0::'b) \<in> ?A \<Longrightarrow> local.dependent ?A

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<inter> B = {}

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
assume "dependent (A \<union> B)"
[PROOF STATE]
proof (state)
this:
local.dependent (A \<union> B)

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
local.dependent (A \<union> B)
[PROOF STEP]
obtain T u v where "finite T" and "T \<subseteq> A \<union> B" and eq: "(\<Sum>v\<in>T. u v *s v) = 0"
    and "v \<in> T" and "u v \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
local.dependent (A \<union> B)

goal (1 subgoal):
 1. (\<And>T u v. \<lbrakk>finite T; T \<subseteq> A \<union> B; (\<Sum>v\<in>T. u v *s v) = (0::'b); v \<in> T; u v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dependent_explicit
[PROOF STATE]
proof (prove)
using this:
\<exists>t u. finite t \<and> t \<subseteq> A \<union> B \<and> (\<Sum>v\<in>t. u v *s v) = (0::'b) \<and> (\<exists>v\<in>t. u v \<noteq> (0::'a))

goal (1 subgoal):
 1. (\<And>T u v. \<lbrakk>finite T; T \<subseteq> A \<union> B; (\<Sum>v\<in>T. u v *s v) = (0::'b); v \<in> T; u v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite T
T \<subseteq> A \<union> B
(\<Sum>v\<in>T. u v *s v) = (0::'b)
v \<in> T
u v \<noteq> (0::'a)

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
define TA where "TA = T \<inter> A"
[PROOF STATE]
proof (state)
this:
TA = T \<inter> A

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
define TB where "TB = T \<inter> B"
[PROOF STATE]
proof (state)
this:
TB = T \<inter> B

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
from \<open>T \<subseteq> A \<union> B\<close>
[PROOF STATE]
proof (chain)
picking this:
T \<subseteq> A \<union> B
[PROOF STEP]
have T: "T = TA \<union> TB"
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> A \<union> B

goal (1 subgoal):
 1. T = TA \<union> TB
[PROOF STEP]
by (auto simp: TA_def TB_def)
[PROOF STATE]
proof (state)
this:
T = TA \<union> TB

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
from \<open>finite T\<close>
[PROOF STATE]
proof (chain)
picking this:
finite T
[PROOF STEP]
have "finite TA" and "TA \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
finite T

goal (1 subgoal):
 1. finite TA &&& TA \<subseteq> A
[PROOF STEP]
by (simp_all add: TA_def)
[PROOF STATE]
proof (state)
this:
finite TA
TA \<subseteq> A

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
from \<open>finite T\<close>
[PROOF STATE]
proof (chain)
picking this:
finite T
[PROOF STEP]
have "finite TB" and "TB \<subseteq> B"
[PROOF STATE]
proof (prove)
using this:
finite T

goal (1 subgoal):
 1. finite TB &&& TB \<subseteq> B
[PROOF STEP]
by (simp_all add: TB_def)
[PROOF STATE]
proof (state)
this:
finite TB
TB \<subseteq> B

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
from \<open>A \<inter> B = {}\<close> \<open>TA \<subseteq> A\<close> this(2)
[PROOF STATE]
proof (chain)
picking this:
A \<inter> B = {}
TA \<subseteq> A
TB \<subseteq> B
[PROOF STEP]
have "TA \<inter> TB = {}"
[PROOF STATE]
proof (prove)
using this:
A \<inter> B = {}
TA \<subseteq> A
TB \<subseteq> B

goal (1 subgoal):
 1. TA \<inter> TB = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
TA \<inter> TB = {}

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
have "0 = (\<Sum>v\<in>TA \<union> TB. u v *s v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'b) = (\<Sum>v\<in>TA \<union> TB. u v *s v)
[PROOF STEP]
by (simp only: eq flip: T)
[PROOF STATE]
proof (state)
this:
(0::'b) = (\<Sum>v\<in>TA \<union> TB. u v *s v)

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0::'b) = (\<Sum>v\<in>TA \<union> TB. u v *s v)

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>TA. u v *s v) + (\<Sum>v\<in>TB. u v *s v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>TA \<union> TB. u v *s v) = (\<Sum>v\<in>TA. u v *s v) + (\<Sum>v\<in>TB. u v *s v)
[PROOF STEP]
by (rule sum.union_disjoint) fact+
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>TA \<union> TB. u v *s v) = (\<Sum>v\<in>TA. u v *s v) + (\<Sum>v\<in>TB. u v *s v)

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0::'b) = (\<Sum>v\<in>TA. u v *s v) + (\<Sum>v\<in>TB. u v *s v)
[PROOF STEP]
have "(\<Sum>v\<in>TA. u v *s v) = (\<Sum>v\<in>TB. (- u) v *s v)" (is "?x = ?y")
[PROOF STATE]
proof (prove)
using this:
(0::'b) = (\<Sum>v\<in>TA. u v *s v) + (\<Sum>v\<in>TB. u v *s v)

goal (1 subgoal):
 1. (\<Sum>v\<in>TA. u v *s v) = (\<Sum>v\<in>TB. (- u) v *s v)
[PROOF STEP]
by (simp add: sum_negf eq_neg_iff_add_eq_0)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>TA. u v *s v) = (\<Sum>v\<in>TB. (- u) v *s v)

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
from \<open>finite TB\<close> \<open>TB \<subseteq> B\<close>
[PROOF STATE]
proof (chain)
picking this:
finite TB
TB \<subseteq> B
[PROOF STEP]
have "?y \<in> span B"
[PROOF STATE]
proof (prove)
using this:
finite TB
TB \<subseteq> B

goal (1 subgoal):
 1. (\<Sum>v\<in>TB. (- u) v *s v) \<in> local.span B
[PROOF STEP]
by (auto simp: span_explicit simp del: uminus_apply)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>TB. (- u) v *s v) \<in> local.span B

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>TB. (- u) v *s v) \<in> local.span B

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
from \<open>finite TA\<close> \<open>TA \<subseteq> A\<close>
[PROOF STATE]
proof (chain)
picking this:
finite TA
TA \<subseteq> A
[PROOF STEP]
have "?x \<in> span A"
[PROOF STATE]
proof (prove)
using this:
finite TA
TA \<subseteq> A

goal (1 subgoal):
 1. (\<Sum>v\<in>TA. u v *s v) \<in> local.span A
[PROOF STEP]
by (auto simp: span_explicit)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>TA. u v *s v) \<in> local.span A

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>v\<in>TB. (- u) v *s v) \<in> local.span B
(\<Sum>v\<in>TA. u v *s v) \<in> local.span A
[PROOF STEP]
have "?y \<in> span A \<inter> span B"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>TB. (- u) v *s v) \<in> local.span B
(\<Sum>v\<in>TA. u v *s v) \<in> local.span A

goal (1 subgoal):
 1. (\<Sum>v\<in>TB. (- u) v *s v) \<in> local.span A \<inter> local.span B
[PROOF STEP]
by (simp add: \<open>?x = ?y\<close>)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>TB. (- u) v *s v) \<in> local.span A \<inter> local.span B

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
hence "?x = 0" and "?y = 0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>TB. (- u) v *s v) \<in> local.span A \<inter> local.span B

goal (1 subgoal):
 1. (\<Sum>v\<in>TA. u v *s v) = (0::'b) &&& (\<Sum>v\<in>TB. (- u) v *s v) = (0::'b)
[PROOF STEP]
by (simp_all add: \<open>?x = ?y\<close> assms(3))
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>TA. u v *s v) = (0::'b)
(\<Sum>v\<in>TB. (- u) v *s v) = (0::'b)

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
from \<open>v \<in> T\<close>
[PROOF STATE]
proof (chain)
picking this:
v \<in> T
[PROOF STEP]
have "v \<in> TA \<union> TB"
[PROOF STATE]
proof (prove)
using this:
v \<in> T

goal (1 subgoal):
 1. v \<in> TA \<union> TB
[PROOF STEP]
by (simp only: T)
[PROOF STATE]
proof (state)
this:
v \<in> TA \<union> TB

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
hence "u v = 0"
[PROOF STATE]
proof (prove)
using this:
v \<in> TA \<union> TB

goal (1 subgoal):
 1. u v = (0::'a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. v \<in> TA \<Longrightarrow> u v = (0::'a)
 2. v \<in> TB \<Longrightarrow> u v = (0::'a)
[PROOF STEP]
assume "v \<in> TA"
[PROOF STATE]
proof (state)
this:
v \<in> TA

goal (2 subgoals):
 1. v \<in> TA \<Longrightarrow> u v = (0::'a)
 2. v \<in> TB \<Longrightarrow> u v = (0::'a)
[PROOF STEP]
with assms(1) \<open>finite TA\<close> \<open>TA \<subseteq> A\<close> \<open>?x = 0\<close>
[PROOF STATE]
proof (chain)
picking this:
local.independent A
finite TA
TA \<subseteq> A
(\<Sum>v\<in>TA. u v *s v) = (0::'b)
v \<in> TA
[PROOF STEP]
show "u v = 0"
[PROOF STATE]
proof (prove)
using this:
local.independent A
finite TA
TA \<subseteq> A
(\<Sum>v\<in>TA. u v *s v) = (0::'b)
v \<in> TA

goal (1 subgoal):
 1. u v = (0::'a)
[PROOF STEP]
by (rule independentD)
[PROOF STATE]
proof (state)
this:
u v = (0::'a)

goal (1 subgoal):
 1. v \<in> TB \<Longrightarrow> u v = (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<in> TB \<Longrightarrow> u v = (0::'a)
[PROOF STEP]
assume "v \<in> TB"
[PROOF STATE]
proof (state)
this:
v \<in> TB

goal (1 subgoal):
 1. v \<in> TB \<Longrightarrow> u v = (0::'a)
[PROOF STEP]
with assms(2) \<open>finite TB\<close> \<open>TB \<subseteq> B\<close> \<open>?y = 0\<close>
[PROOF STATE]
proof (chain)
picking this:
local.independent B
finite TB
TB \<subseteq> B
(\<Sum>v\<in>TB. (- u) v *s v) = (0::'b)
v \<in> TB
[PROOF STEP]
have "(- u) v = 0"
[PROOF STATE]
proof (prove)
using this:
local.independent B
finite TB
TB \<subseteq> B
(\<Sum>v\<in>TB. (- u) v *s v) = (0::'b)
v \<in> TB

goal (1 subgoal):
 1. (- u) v = (0::'a)
[PROOF STEP]
by (rule independentD)
[PROOF STATE]
proof (state)
this:
(- u) v = (0::'a)

goal (1 subgoal):
 1. v \<in> TB \<Longrightarrow> u v = (0::'a)
[PROOF STEP]
thus "u v = 0"
[PROOF STATE]
proof (prove)
using this:
(- u) v = (0::'a)

goal (1 subgoal):
 1. u v = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u v = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u v = (0::'a)

goal (1 subgoal):
 1. local.dependent (A \<union> B) \<Longrightarrow> False
[PROOF STEP]
with \<open>u v \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
u v \<noteq> (0::'a)
u v = (0::'a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
u v \<noteq> (0::'a)
u v = (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gauge_min:
     "[| gauge(E) g1; gauge(E) g2 |]
      ==> gauge(E) (%x. min (g1(x)) (g2(x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>gauge E g1; gauge E g2\<rbrakk> \<Longrightarrow> gauge E (\<lambda>x. min (g1 x) (g2 x))
[PROOF STEP]
by (simp add: gauge_def)


[STATEMENT]
lemma bij_unique_inv:
  assumes "bij_betw f A B"
    and "x \<in> B"
  shows "\<exists>!y \<in> A. (the_inv_into A f) x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!y. y \<in> A \<and> the_inv_into A f x = y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B
x \<in> B

goal (1 subgoal):
 1. \<exists>!y. y \<in> A \<and> the_inv_into A f x = y
[PROOF STEP]
unfolding bij_betw_def inj_on_def the_inv_into_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>x\<in>A. \<forall>y\<in>A. f x = f y \<longrightarrow> x = y) \<and> f ` A = B
x \<in> B

goal (1 subgoal):
 1. \<exists>!y. y \<in> A \<and> (THE y. y \<in> A \<and> f y = x) = y
[PROOF STEP]
by blast


[STATEMENT]
lemma monom_power: "monom c n ^ k = monom (c ^ k) (n * k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.monom c n ^ k = Polynomial.monom (c ^ k) (n * k)
[PROOF STEP]
by (induction k) (simp_all add: mult_monom)


[STATEMENT]
lemma bridgingInjection:
  assumes "card N > 0" "distinct G"
  shows "\<forall>l \<in> set (all_partitions_list G). set (injections_alg l N) =
         injections (set l) N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>l\<in>set (all_partitions_list G). set (injections_alg l N) = injections (set l) N
[PROOF STEP]
using lm102 injections_equiv assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?l \<in> set (all_partitions_list ?G); distinct ?G\<rbrakk> \<Longrightarrow> distinct ?l
\<lbrakk>finite ?Y; distinct ?X\<rbrakk> \<Longrightarrow> set (injections_alg ?X ?Y) = injections (set ?X) ?Y
0 < card N
distinct G

goal (1 subgoal):
 1. \<forall>l\<in>set (all_partitions_list G). set (injections_alg l N) = injections (set l) N
[PROOF STEP]
by (metis card_ge_0_finite)


[STATEMENT]
lemma complex_of_linear:
  shows "linear complex_of"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear complex_of
[PROOF STEP]
unfolding complex_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (\<lambda>x. complex_of_real (x $\<^sub>e 0) + \<i> * complex_of_real (x $\<^sub>e 1))
[PROOF STEP]
apply (auto intro!:linearI simp add: distrib_left plus_nth_eucl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r b. complex_of_real ((r *\<^sub>R b) $\<^sub>e 0) + \<i> * complex_of_real ((r *\<^sub>R b) $\<^sub>e Suc 0) = r *\<^sub>R (complex_of_real (b $\<^sub>e 0) + \<i> * complex_of_real (b $\<^sub>e Suc 0))
[PROOF STEP]
by (simp add: of_real_def scaleR_add_right scaleR_nth_eucl)


[STATEMENT]
lemma minus_1_div_exp_eq_int:
  \<open>- 1 div (2 :: int) ^ n = - 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 div 2 ^ n = - 1
[PROOF STEP]
by (induction n) (use div_exp_eq [symmetric, of \<open>- 1 :: int\<close> 1] in \<open>simp_all add: ac_simps\<close>)


[STATEMENT]
lemma atLeastPlusOneLessThan_greaterThanLessThan_integer:
    "{l+1..<u} = {l<..<u::integer}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l + 1..<u} = {l<..<u}
[PROOF STEP]
including integer.lifting
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l + 1..<u} = {l<..<u}
[PROOF STEP]
by (auto simp add: atLeastLessThan_def greaterThanLessThan_def, transfer, simp)


[STATEMENT]
lemma of_nat_inject_hmset[simp]: "(of_nat m :: hmultiset) = of_nat n \<longleftrightarrow> m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat m = of_nat n) = (m = n)
[PROOF STEP]
unfolding of_nat_hmset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (HMSet (replicate_mset m 0) = HMSet (replicate_mset n 0)) = (m = n)
[PROOF STEP]
by simp


[STATEMENT]
lemma constant_on_closureI:
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
  assumes cof: "f constant_on S" and contf: "continuous_on (closure S) f"
    shows "f constant_on (closure S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f constant_on closure S
[PROOF STEP]
using continuous_constant_on_closure [OF contf] cof
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> S \<Longrightarrow> f x = ?a; ?x \<in> closure S\<rbrakk> \<Longrightarrow> f ?x = ?a
f constant_on S

goal (1 subgoal):
 1. f constant_on closure S
[PROOF STEP]
unfolding constant_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> S \<Longrightarrow> f x = ?a; ?x \<in> closure S\<rbrakk> \<Longrightarrow> f ?x = ?a
\<exists>y. \<forall>x\<in>S. f x = y

goal (1 subgoal):
 1. \<exists>y. \<forall>x\<in>closure S. f x = y
[PROOF STEP]
by metis


[STATEMENT]
lemma sum_list_two_pow:
  "Suc (\<Sum>x\<leftarrow>[0..<n]. 2 ^ (n - Suc x)) = 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<n]. 2 ^ (n - Suc x)) = 2 ^ n
[PROOF STEP]
using sum_list_two_pow_aux sum_list_extract_last
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<leftarrow>[0..<?n]. 2 ^ (?n - x)) + 2 ^ (0 - 1) + 2 ^ 0 = 2 ^ Suc ?n
sum_list (map ?f [0..<Suc ?n]) = sum_list (map ?f [0..<?n]) + ?f ?n

goal (1 subgoal):
 1. Suc (\<Sum>x\<leftarrow>[0..<n]. 2 ^ (n - Suc x)) = 2 ^ n
[PROOF STEP]
by(cases n) auto


[STATEMENT]
lemma norm_id_minus_trunc_ell2:
  \<open>(norm (x - trunc_ell2 S x))^2 = (norm x)^2 - (norm (trunc_ell2 S x))^2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (x - trunc_ell2 S x))\<^sup>2 = (norm x)\<^sup>2 - (norm (trunc_ell2 S x))\<^sup>2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (norm (x - trunc_ell2 S x))\<^sup>2 = (norm x)\<^sup>2 - (norm (trunc_ell2 S x))\<^sup>2
[PROOF STEP]
have \<open>Rep_ell2 (trunc_ell2 S x) i = 0 \<or> Rep_ell2 (x - trunc_ell2 S x) i = 0\<close> for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_ell2 (trunc_ell2 S x) i = 0 \<or> Rep_ell2 (x - trunc_ell2 S x) i = 0
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S x i. has_ell2_norm x \<Longrightarrow> (if i \<in> S then x i else 0) = 0 \<or> x i - (if i \<in> S then x i else 0) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Rep_ell2 (trunc_ell2 S x) ?i = 0 \<or> Rep_ell2 (x - trunc_ell2 S x) ?i = 0

goal (1 subgoal):
 1. (norm (x - trunc_ell2 S x))\<^sup>2 = (norm x)\<^sup>2 - (norm (trunc_ell2 S x))\<^sup>2
[PROOF STEP]
hence \<open>((trunc_ell2 S x) \<bullet>\<^sub>C (x - trunc_ell2 S x)) = 0\<close>
[PROOF STATE]
proof (prove)
using this:
Rep_ell2 (trunc_ell2 S x) ?i = 0 \<or> Rep_ell2 (x - trunc_ell2 S x) ?i = 0

goal (1 subgoal):
 1. is_orthogonal (trunc_ell2 S x) (x - trunc_ell2 S x)
[PROOF STEP]
using ell2_pointwise_ortho
[PROOF STATE]
proof (prove)
using this:
Rep_ell2 (trunc_ell2 S x) ?i = 0 \<or> Rep_ell2 (x - trunc_ell2 S x) ?i = 0
(\<And>i. Rep_ell2 ?x i = 0 \<or> Rep_ell2 ?y i = 0) \<Longrightarrow> is_orthogonal ?x ?y

goal (1 subgoal):
 1. is_orthogonal (trunc_ell2 S x) (x - trunc_ell2 S x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_orthogonal (trunc_ell2 S x) (x - trunc_ell2 S x)

goal (1 subgoal):
 1. (norm (x - trunc_ell2 S x))\<^sup>2 = (norm x)\<^sup>2 - (norm (trunc_ell2 S x))\<^sup>2
[PROOF STEP]
hence \<open>(norm x)^2 = (norm (trunc_ell2 S x))^2 + (norm (x - trunc_ell2 S x))^2\<close>
[PROOF STATE]
proof (prove)
using this:
is_orthogonal (trunc_ell2 S x) (x - trunc_ell2 S x)

goal (1 subgoal):
 1. (norm x)\<^sup>2 = (norm (trunc_ell2 S x))\<^sup>2 + (norm (x - trunc_ell2 S x))\<^sup>2
[PROOF STEP]
using pythagorean_theorem
[PROOF STATE]
proof (prove)
using this:
is_orthogonal (trunc_ell2 S x) (x - trunc_ell2 S x)
is_orthogonal ?x ?y \<Longrightarrow> (norm (?x + ?y))\<^sup>2 = (norm ?x)\<^sup>2 + (norm ?y)\<^sup>2

goal (1 subgoal):
 1. (norm x)\<^sup>2 = (norm (trunc_ell2 S x))\<^sup>2 + (norm (x - trunc_ell2 S x))\<^sup>2
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(norm x)\<^sup>2 = (norm (trunc_ell2 S x))\<^sup>2 + (norm (x - trunc_ell2 S x))\<^sup>2

goal (1 subgoal):
 1. (norm (x - trunc_ell2 S x))\<^sup>2 = (norm x)\<^sup>2 - (norm (trunc_ell2 S x))\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(norm x)\<^sup>2 = (norm (trunc_ell2 S x))\<^sup>2 + (norm (x - trunc_ell2 S x))\<^sup>2

goal (1 subgoal):
 1. (norm (x - trunc_ell2 S x))\<^sup>2 = (norm x)\<^sup>2 - (norm (trunc_ell2 S x))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(norm (x - trunc_ell2 S x))\<^sup>2 = (norm x)\<^sup>2 - (norm (trunc_ell2 S x))\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arc_assoc:
     "\<lbrakk>pathfinish p = pathstart q; pathfinish q = pathstart r\<rbrakk>
      \<Longrightarrow> arc(p +++ (q +++ r)) \<longleftrightarrow> arc((p +++ q) +++ r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pathfinish p = pathstart q; pathfinish q = pathstart r\<rbrakk> \<Longrightarrow> arc (p +++ q +++ r) = arc ((p +++ q) +++ r)
[PROOF STEP]
by (simp add: arc_simple_path simple_path_assoc)


[STATEMENT]
lemma gker_hom_to_img:"\<lbrakk>Group F; Group G; f \<in> gHom F G \<rbrakk> \<Longrightarrow>
                               gker\<^bsub>F,(Img\<^bsub>F,G\<^esub> f)\<^esub> f = gker\<^bsub>F,G\<^esub> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> gker\<^bsub>F,Img\<^bsub>F,G\<^esub> f\<^esub> f = gker\<^bsub>F,G\<^esub> f
[PROOF STEP]
by (simp add:gkernel_def Gimage_def,
       frule sg_gimg[of "F" "G" "f"], assumption+,
       simp add:Group.one_Gp_one[of "G" "f ` (carrier F)"])


[STATEMENT]
lemma finite_UN_subsets:
  "\<lbrakk> \<forall> a \<in> A. B a \<subseteq> b; finite b \<rbrakk> \<Longrightarrow> finite (\<Union>a\<in>A. B a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>A. B a \<subseteq> b; finite b\<rbrakk> \<Longrightarrow> finite (\<Union> (B ` A))
[PROOF STEP]
by (metis UN_subset_iff finite_subset)


[STATEMENT]
lemma eq_solution:
  assumes "s \<in> S" and "is_interval (U s)" and "U s \<subseteq> T" and "t \<in> U s"
    and xivp: "X \<in> Sols (\<lambda>t. f) U S 0 s"
  shows "X t = \<phi> t s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X t = \<phi> t s
[PROOF STEP]
apply(rule ivp_unique_solution[OF assms], rule in_ivp_sols)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. s \<in> S
 2. 0 \<in> U s
 3. U s \<subseteq> T
[PROOF STEP]
by (simp_all add: ivp_solsD(4)[OF xivp] assms)


[STATEMENT]
lemma dist_commute: "dist x y = dist y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y = dist y x
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dist x y \<le> dist y x
 2. dist y x \<le> dist x y
[PROOF STEP]
show "dist x y \<le> dist y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y \<le> dist y x
[PROOF STEP]
using dist_triangle2 [of x y x]
[PROOF STATE]
proof (prove)
using this:
dist x y \<le> dist x x + dist y x

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

goal (1 subgoal):
 1. dist y x \<le> dist x y
[PROOF STEP]
show "dist y x \<le> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist y x \<le> dist x y
[PROOF STEP]
using dist_triangle2 [of y x y]
[PROOF STATE]
proof (prove)
using this:
dist y x \<le> dist y y + dist x y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_prod_int_rat_code[code]: "v \<bullet>i w = (\<Sum>i = 0..<dim_vec v. int_times_rat (v $ i) (w $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet>i w = (\<Sum>i = 0..<dim_vec v. int_times_rat (v $ i) (w $ i))
[PROOF STEP]
unfolding scalar_prod_int_rat_def Let_def scalar_prod_def int_times_rat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (of_int_hom.vec_hom v). w $ i * of_int_hom.vec_hom v $ i) = (\<Sum>i = 0..<dim_vec v. rat_of_int (v $ i) * w $ i)
[PROOF STEP]
by (rule sum.cong, auto)


[STATEMENT]
lemma small_lt:
  assumes u0:"0 \<le> u" and u1: "u < 1"
  shows "(real_of_int (n::int) < real_of_int (m::int) - u) = (n < m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_int n < real_of_int m - u) = (n < m)
[PROOF STEP]
using u0 u1
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
u < 1

goal (1 subgoal):
 1. (real_of_int n < real_of_int m - u) = (n < m)
[PROOF STEP]
by auto


[STATEMENT]
lemma NOT_i_append_same_eq: "
  \<not>(\<forall>xs ys f. (xs \<frown> (f::(nat \<Rightarrow> nat)) = ys \<frown> f) = (xs = ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>xs ys f. (xs \<frown> f = ys \<frown> f) = (xs = ys))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xs ys f. (xs \<frown> f = ys \<frown> f) = (xs \<noteq> ys)
[PROOF STEP]
apply (rule_tac x="[]" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ys f. ([] \<frown> f = ys \<frown> f) = ([] \<noteq> ys)
[PROOF STEP]
apply (rule_tac x="[0]" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. ([] \<frown> f = [0] \<frown> f) = ([] \<noteq> [0])
[PROOF STEP]
apply (rule_tac x="\<lambda>n. 0" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([] \<frown> (\<lambda>n. 0) = [0] \<frown> (\<lambda>n. 0)) = ([] \<noteq> [0])
[PROOF STEP]
apply (simp add: expand_ilist_eq i_append_nth)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma zero_le_iff_zero_nprt: "0 \<le> a \<longleftrightarrow> nprt a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) \<le> a) = (nprt a = (0::'a))
[PROOF STEP]
unfolding le_iff_inf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inf (0::'a) a = (0::'a)) = (nprt a = (0::'a))
[PROOF STEP]
by (simp add: nprt_def inf_commute)


[STATEMENT]
lemma measure_Diff:
  assumes finite: "emeasure M A \<noteq> \<infinity>"
  and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
  shows "measure M (A - B) = measure M A - measure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M B
[PROOF STEP]
have "emeasure M (A - B) \<le> emeasure M A" "emeasure M B \<le> emeasure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (A - B) \<le> emeasure M A &&& emeasure M B \<le> emeasure M A
[PROOF STEP]
using measurable
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
B \<in> sets M
B \<subseteq> A

goal (1 subgoal):
 1. emeasure M (A - B) \<le> emeasure M A &&& emeasure M B \<le> emeasure M A
[PROOF STEP]
by (auto intro!: emeasure_mono)
[PROOF STATE]
proof (state)
this:
emeasure M (A - B) \<le> emeasure M A
emeasure M B \<le> emeasure M A

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M B
[PROOF STEP]
hence "measure M ((A - B) \<union> B) = measure M (A - B) + measure M B"
[PROOF STATE]
proof (prove)
using this:
emeasure M (A - B) \<le> emeasure M A
emeasure M B \<le> emeasure M A

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B \<union> B) = Sigma_Algebra.measure M (A - B) + Sigma_Algebra.measure M B
[PROOF STEP]
using measurable finite
[PROOF STATE]
proof (prove)
using this:
emeasure M (A - B) \<le> emeasure M A
emeasure M B \<le> emeasure M A
A \<in> sets M
B \<in> sets M
B \<subseteq> A
emeasure M A \<noteq> \<infinity>

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B \<union> B) = Sigma_Algebra.measure M (A - B) + Sigma_Algebra.measure M B
[PROOF STEP]
by (rule_tac measure_Union) (auto simp: top_unique)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (A - B \<union> B) = Sigma_Algebra.measure M (A - B) + Sigma_Algebra.measure M B

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M B
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M (A - B \<union> B) = Sigma_Algebra.measure M (A - B) + Sigma_Algebra.measure M B

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M B
[PROOF STEP]
using \<open>B \<subseteq> A\<close>
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M (A - B \<union> B) = Sigma_Algebra.measure M (A - B) + Sigma_Algebra.measure M B
B \<subseteq> A

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M B
[PROOF STEP]
by (auto simp: Un_absorb2)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqrt_int_ceiling_pos: assumes x: "x \<ge> 0"
  shows "sqrt_int_ceiling_pos x = \<lceil> sqrt (of_int x) \<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt_int_ceiling_pos x = \<lceil>sqrt (real_of_int x)\<rceil>
[PROOF STEP]
using root_int_ceiling_pos[OF x, of 2]
[PROOF STATE]
proof (prove)
using this:
root_int_ceiling_pos 2 x = \<lceil>root 2 (real_of_int x)\<rceil>

goal (1 subgoal):
 1. sqrt_int_ceiling_pos x = \<lceil>sqrt (real_of_int x)\<rceil>
[PROOF STEP]
by (simp add: sqrt_def)


[STATEMENT]
lemma const_ghom:"\<lbrakk>Group F; Group G\<rbrakk> \<Longrightarrow> 1\<^bsub>F,G\<^esub> \<in> gHom F G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G\<rbrakk> \<Longrightarrow> 1\<^bsub>F,G\<^esub> \<in> gHom F G
[PROOF STEP]
apply (simp add:gHom_def constghom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>carrier F. \<one>\<^bsub>G\<^esub>) \<in> carrier F \<rightarrow> carrier G \<and> (\<forall>x\<in>carrier F. \<forall>y\<in>carrier F. (x \<cdot>\<^bsub>F\<^esub> y \<in> carrier F \<longrightarrow> \<one>\<^bsub>G\<^esub> = \<one>\<^bsub>G\<^esub> \<cdot>\<^bsub>G\<^esub> \<one>\<^bsub>G\<^esub>) \<and> (x \<cdot>\<^bsub>F\<^esub> y \<notin> carrier F \<longrightarrow> undefined = \<one>\<^bsub>G\<^esub> \<cdot>\<^bsub>G\<^esub> \<one>\<^bsub>G\<^esub>))
[PROOF STEP]
apply (simp add:Pi_def Group.unit_closed)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier F. \<forall>y\<in>carrier F. (x \<cdot>\<^bsub>F\<^esub> y \<in> carrier F \<longrightarrow> \<one>\<^bsub>G\<^esub> = \<one>\<^bsub>G\<^esub> \<cdot>\<^bsub>G\<^esub> \<one>\<^bsub>G\<^esub>) \<and> (x \<cdot>\<^bsub>F\<^esub> y \<notin> carrier F \<longrightarrow> undefined = \<one>\<^bsub>G\<^esub> \<cdot>\<^bsub>G\<^esub> \<one>\<^bsub>G\<^esub>)
[PROOF STEP]
apply ((rule ballI)+,
       cut_tac Group.unit_closed[of "G"],
       simp add:Group.mult_closed Group.l_unit)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>Group F; Group G; x \<in> carrier F; y \<in> carrier F\<rbrakk> \<Longrightarrow> Group G
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma abs_power_pos [simp]: "\<bar>a\<bar>^n > 0 \<longleftrightarrow> a \<noteq> 0 \<or> n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) < \<bar>a\<bar> ^ n) = (a \<noteq> (0::'a) \<or> n = 0)
[PROOF STEP]
using power_pos[of "\<bar>a\<bar>"]
[PROOF STATE]
proof (prove)
using this:
(0::'a) < \<bar>a\<bar> \<Longrightarrow> (0::'a) < \<bar>a\<bar> ^ ?n

goal (1 subgoal):
 1. ((0::'a) < \<bar>a\<bar> ^ n) = (a \<noteq> (0::'a) \<or> n = 0)
[PROOF STEP]
by (cases "n", auto)


[STATEMENT]
lemma ket_plus_dim:
  "ket_plus \<in> carrier_vec 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_plus \<in> carrier_vec 2
[PROOF STEP]
unfolding ket_plus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.vec 2 (\<lambda>k. 1 / csqrt 2) \<in> carrier_vec 2
[PROOF STEP]
by auto


[STATEMENT]
lemma degree_smult_eq [simp]: "degree (smult a p) = (if a = 0 then 0 else degree p)"
  for a :: "'a::{comm_semiring_0,semiring_no_zero_divisors}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (smult a p) = (if a = (0::'a) then 0 else degree p)
[PROOF STEP]
by (cases "a = 0") (simp_all add: degree_def)


[STATEMENT]
lemma in_Solutions_iff:
  "(x, y) \<in> Solutions \<longleftrightarrow> length x = m \<and> length y = n \<and> a \<bullet> x = b \<bullet> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in> Solutions) = (length x = m \<and> length y = n \<and> a \<bullet> x = b \<bullet> y)
[PROOF STEP]
by (auto simp: Solutions_def)

\<comment> \<open>The set of pointwise minimal solutions.\<close>


[STATEMENT]
lemma winding_number_ivt_pos:
    assumes \<gamma>: "valid_path \<gamma>" and z: "z \<notin> path_image \<gamma>" and "0 \<le> w" "w \<le> Re(winding_number \<gamma> z)"
    shows "\<exists>t \<in> {0..1}. Re(winding_number(subpath 0 t \<gamma>) z) = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
have "continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
[PROOF STEP]
using \<gamma> winding_number_subpath_continuous z
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
\<lbrakk>valid_path ?\<gamma>; ?z \<notin> path_image ?\<gamma>\<rbrakk> \<Longrightarrow> continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x ?\<gamma>) ?z)
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
have "Re (winding_number (subpath 0 0 \<gamma>) z) \<le> w" "w \<le> Re (winding_number (subpath 0 1 \<gamma>) z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number (subpath 0 0 \<gamma>) z) \<le> w &&& w \<le> Re (winding_number (subpath 0 1 \<gamma>) z)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
z \<notin> path_image \<gamma>
0 \<le> w
w \<le> Re (winding_number \<gamma> z)

goal (1 subgoal):
 1. Re (winding_number (subpath 0 0 \<gamma>) z) \<le> w &&& w \<le> Re (winding_number (subpath 0 1 \<gamma>) z)
[PROOF STEP]
by (auto simp: path_image_def image_def)
[PROOF STATE]
proof (state)
this:
Re (winding_number (subpath 0 0 \<gamma>) z) \<le> w
w \<le> Re (winding_number (subpath 0 1 \<gamma>) z)

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
Re (winding_number (subpath 0 0 \<gamma>) z) \<le> w
w \<le> Re (winding_number (subpath 0 1 \<gamma>) z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
Re (winding_number (subpath 0 0 \<gamma>) z) \<le> w
w \<le> Re (winding_number (subpath 0 1 \<gamma>) z)

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
using ivt_increasing_component_on_1[of 0 1, where ?k = "1"]
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
Re (winding_number (subpath 0 0 \<gamma>) z) \<le> w
w \<le> Re (winding_number (subpath 0 1 \<gamma>) z)
\<lbrakk>0 \<le> 1; continuous_on {0..1} ?f; ?f 0 \<bullet> (1::?'a1) \<le> ?y; ?y \<le> ?f 1 \<bullet> (1::?'a1)\<rbrakk> \<Longrightarrow> \<exists>x\<in>{0..1}. ?f x \<bullet> (1::?'a1) = ?y

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_of_Fpow_mono[simp]:
assumes "|A| \<le>o |B|"
shows "|Fpow A| \<le>o |Fpow B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Fpow A| \<le>o |Fpow B|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |Fpow A| \<le>o |Fpow B|
[PROOF STEP]
obtain f where "inj_on f A \<and> f ` A \<le> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. inj_on f A \<and> f ` A \<subseteq> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms card_of_ordLeq[of A B]
[PROOF STATE]
proof (prove)
using this:
|A| \<le>o |B|
(\<exists>f. inj_on f A \<and> f ` A \<subseteq> B) = (|A| \<le>o |B|)

goal (1 subgoal):
 1. (\<And>f. inj_on f A \<and> f ` A \<subseteq> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on f A \<and> f ` A \<subseteq> B

goal (1 subgoal):
 1. |Fpow A| \<le>o |Fpow B|
[PROOF STEP]
hence "inj_on (image f) (Fpow A) \<and> (image f) ` (Fpow A) \<le> (Fpow B)"
[PROOF STATE]
proof (prove)
using this:
inj_on f A \<and> f ` A \<subseteq> B

goal (1 subgoal):
 1. inj_on ((`) f) (Fpow A) \<and> (`) f ` Fpow A \<subseteq> Fpow B
[PROOF STEP]
by (auto simp add: inj_on_image_Fpow image_Fpow_mono)
[PROOF STATE]
proof (state)
this:
inj_on ((`) f) (Fpow A) \<and> (`) f ` Fpow A \<subseteq> Fpow B

goal (1 subgoal):
 1. |Fpow A| \<le>o |Fpow B|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on ((`) f) (Fpow A) \<and> (`) f ` Fpow A \<subseteq> Fpow B

goal (1 subgoal):
 1. |Fpow A| \<le>o |Fpow B|
[PROOF STEP]
using card_of_ordLeq[of "Fpow A"]
[PROOF STATE]
proof (prove)
using this:
inj_on ((`) f) (Fpow A) \<and> (`) f ` Fpow A \<subseteq> Fpow B
(\<exists>f. inj_on f (Fpow A) \<and> f ` Fpow A \<subseteq> ?B) = (|Fpow A| \<le>o |?B|)

goal (1 subgoal):
 1. |Fpow A| \<le>o |Fpow B|
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
|Fpow A| \<le>o |Fpow B|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finprod_0':
  "f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> (f 0) \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
assume A: "f \<in> {.. n} \<rightarrow> carrier G"
[PROOF STATE]
proof (state)
this:
f \<in> {..n} \<rightarrow> carrier G

goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
hence "(f 0) \<otimes> finprod G f {Suc 0..n} = finprod G f {..0} \<otimes> finprod G f {Suc 0..n}"
[PROOF STATE]
proof (prove)
using this:
f \<in> {..n} \<rightarrow> carrier G

goal (1 subgoal):
 1. f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..0} \<otimes> finprod G f {Suc 0..n}
[PROOF STEP]
using finprod_0[of f]
[PROOF STATE]
proof (prove)
using this:
f \<in> {..n} \<rightarrow> carrier G
f \<in> {0} \<rightarrow> carrier G \<Longrightarrow> finprod G f {..0} = f 0

goal (1 subgoal):
 1. f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..0} \<otimes> finprod G f {Suc 0..n}
[PROOF STEP]
by (simp add: funcset_mem)
[PROOF STATE]
proof (state)
this:
f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..0} \<otimes> finprod G f {Suc 0..n}

goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..0} \<otimes> finprod G f {Suc 0..n}

goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
have " ... = finprod G f ({..0} \<union> {Suc 0..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f {..0} \<otimes> finprod G f {Suc 0..n} = finprod G f ({..0} \<union> {Suc 0..n})
[PROOF STEP]
using finprod_Un_disjoint[of "{..0}" "{Suc 0..n}" f] A
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {..0}; finite {Suc 0..n}; {..0} \<inter> {Suc 0..n} = {}; f \<in> {..0} \<rightarrow> carrier G; f \<in> {Suc 0..n} \<rightarrow> carrier G\<rbrakk> \<Longrightarrow> finprod G f ({..0} \<union> {Suc 0..n}) = finprod G f {..0} \<otimes> finprod G f {Suc 0..n}
f \<in> {..n} \<rightarrow> carrier G

goal (1 subgoal):
 1. finprod G f {..0} \<otimes> finprod G f {Suc 0..n} = finprod G f ({..0} \<union> {Suc 0..n})
[PROOF STEP]
by (simp add: funcset_mem)
[PROOF STATE]
proof (state)
this:
finprod G f {..0} \<otimes> finprod G f {Suc 0..n} = finprod G f ({..0} \<union> {Suc 0..n})

goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finprod G f {..0} \<otimes> finprod G f {Suc 0..n} = finprod G f ({..0} \<union> {Suc 0..n})

goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
have " ... = finprod G f {..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f ({..0} \<union> {Suc 0..n}) = finprod G f {..n}
[PROOF STEP]
by (simp add: atLeastAtMost_insertL atMost_atLeast0)
[PROOF STATE]
proof (state)
this:
finprod G f ({..0} \<union> {Suc 0..n}) = finprod G f {..n}

goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> carrier G \<Longrightarrow> f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}

goal (1 subgoal):
 1. f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f 0 \<otimes> finprod G f {Suc 0..n} = finprod G f {..n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hlog_divide: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> hlog a (x / y) = hlog a x - hlog a y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1; 0 < x; 0 < y\<rbrakk> \<Longrightarrow> hlog a (x / y) = hlog a x - hlog a y
[PROOF STEP]
by (simp add: hlog_mult hlog_inverse divide_inverse)


[STATEMENT]
lemma orthogonal_mat_of_cols:
  assumes W: "set ws \<subseteq> carrier_vec n"
    and orth: "corthogonal ws"
    and len: "length ws = n"
  shows "corthogonal_mat (mat_of_cols n ws)" (is "corthogonal_mat ?W")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal_mat (mat_of_cols n ws)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col (mat_of_cols n ws); j < dim_col (mat_of_cols n ws)\<rbrakk> \<Longrightarrow> (col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col (mat_of_cols n ws); j < dim_col (mat_of_cols n ws)\<rbrakk> \<Longrightarrow> (col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
assume i: "i < dim_col ?W" and j: "j < dim_col ?W"
[PROOF STATE]
proof (state)
this:
i < dim_col (mat_of_cols n ws)
j < dim_col (mat_of_cols n ws)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col (mat_of_cols n ws); j < dim_col (mat_of_cols n ws)\<rbrakk> \<Longrightarrow> (col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
hence [simp]: "ws ! i : carrier_vec n" "ws ! j : carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
i < dim_col (mat_of_cols n ws)
j < dim_col (mat_of_cols n ws)

goal (1 subgoal):
 1. ws ! i \<in> carrier_vec n &&& ws ! j \<in> carrier_vec n
[PROOF STEP]
using W len
[PROOF STATE]
proof (prove)
using this:
i < dim_col (mat_of_cols n ws)
j < dim_col (mat_of_cols n ws)
set ws \<subseteq> carrier_vec n
length ws = n

goal (1 subgoal):
 1. ws ! i \<in> carrier_vec n &&& ws ! j \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ws ! i \<in> carrier_vec n
ws ! j \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col (mat_of_cols n ws); j < dim_col (mat_of_cols n ws)\<rbrakk> \<Longrightarrow> (col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
have "i < length ws" and "j < length ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length ws &&& j < length ws
[PROOF STEP]
using i j
[PROOF STATE]
proof (prove)
using this:
i < dim_col (mat_of_cols n ws)
j < dim_col (mat_of_cols n ws)

goal (1 subgoal):
 1. i < length ws &&& j < length ws
[PROOF STEP]
using len W
[PROOF STATE]
proof (prove)
using this:
i < dim_col (mat_of_cols n ws)
j < dim_col (mat_of_cols n ws)
length ws = n
set ws \<subseteq> carrier_vec n

goal (1 subgoal):
 1. i < length ws &&& j < length ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length ws
j < length ws

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col (mat_of_cols n ws); j < dim_col (mat_of_cols n ws)\<rbrakk> \<Longrightarrow> (col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
thus "col ?W i \<bullet>c col ?W j = 0 \<longleftrightarrow> i \<noteq> j"
[PROOF STATE]
proof (prove)
using this:
i < length ws
j < length ws

goal (1 subgoal):
 1. (col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
using orth
[PROOF STATE]
proof (prove)
using this:
i < length ws
j < length ws
corthogonal ws

goal (1 subgoal):
 1. (col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
unfolding corthogonal_def
[PROOF STATE]
proof (prove)
using this:
i < length ws
j < length ws
\<forall>i<length ws. \<forall>j<length ws. (ws ! i \<bullet>c ws ! j = (0::'a)) = (i \<noteq> j)

goal (1 subgoal):
 1. (col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(col (mat_of_cols n ws) i \<bullet>c col (mat_of_cols n ws) j = (0::'a)) = (i \<noteq> j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_least_Max[simp]:
    assumes "finite A" "A \<noteq> {}"
    shows "nth_least A (card A - 1) = Max A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least A (card A - 1) = Max A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. nth_least A (card A - 1) = Max A
[PROOF STEP]
proof (induct "card A - 1" arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
 2. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = card A - 1
finite A
A \<noteq> {}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
 2. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have 1: "card A = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = 1
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
0 = card A - 1
finite A
A \<noteq> {}

goal (1 subgoal):
 1. card A = 1
[PROOF STEP]
by (metis One_nat_def Suc_diff_1 card_gt_0_iff)
[PROOF STATE]
proof (state)
this:
card A = 1

goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
 2. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
obtain a where 2: "A = {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. A = {a} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
card A = 1

goal (1 subgoal):
 1. (\<And>a. A = {a} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by rule
[PROOF STATE]
proof (state)
this:
A = {a}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
 2. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least A (card A - 1) = Max A
[PROOF STEP]
unfolding 2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least {a} (card {a} - 1) = Max {a}
[PROOF STEP]
by (simp del: insert_iff)
[PROOF STATE]
proof (state)
this:
nth_least A (card A - 1) = Max A

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = card ?A - 1; finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least ?A (card ?A - 1) = Max ?A
Suc n = card A - 1
finite A
A \<noteq> {}

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have 1: "least A \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least A \<in> A
[PROOF STEP]
using Suc(4)
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. least A \<in> A
[PROOF STEP]
by rule
[PROOF STATE]
proof (state)
this:
least A \<in> A

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have 2: "card (A - {least A}) = Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A - {least A}) = Suc n
[PROOF STEP]
using Suc(2, 3) 1
[PROOF STATE]
proof (prove)
using this:
Suc n = card A - 1
finite A
least A \<in> A

goal (1 subgoal):
 1. card (A - {least A}) = Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (A - {least A}) = Suc n

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have 3: "A - {least A} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - {least A} \<noteq> {}
[PROOF STEP]
using 2 Suc(3)
[PROOF STATE]
proof (prove)
using this:
card (A - {least A}) = Suc n
finite A

goal (1 subgoal):
 1. A - {least A} \<noteq> {}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
A - {least A} \<noteq> {}

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have "nth_least A (card A - 1) = nth_least A (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least A (card A - 1) = nth_least A (Suc n)
[PROOF STEP]
unfolding Suc(2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least A (card A - 1) = nth_least A (card A - 1)
[PROOF STEP]
by rule
[PROOF STATE]
proof (state)
this:
nth_least A (card A - 1) = nth_least A (Suc n)

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nth_least A (card A - 1) = nth_least A (Suc n)

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have "\<dots> = nth_least (A - {least A}) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least A (Suc n) = nth_least (A - {least A}) n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nth_least A (Suc n) = nth_least (A - {least A}) n

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nth_least A (Suc n) = nth_least (A - {least A}) n

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have "\<dots> = nth_least (A - {least A}) (card (A - {least A}) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least (A - {least A}) n = nth_least (A - {least A}) (card (A - {least A}) - 1)
[PROOF STEP]
unfolding 2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least (A - {least A}) n = nth_least (A - {least A}) (Suc n - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nth_least (A - {least A}) n = nth_least (A - {least A}) (card (A - {least A}) - 1)

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nth_least (A - {least A}) n = nth_least (A - {least A}) (card (A - {least A}) - 1)

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have "\<dots> = Max (A - {least A})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least (A - {least A}) (card (A - {least A}) - 1) = Max (A - {least A})
[PROOF STEP]
proof (rule Suc(1))
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. n = card (A - {least A}) - 1
 2. finite (A - {least A})
 3. A - {least A} \<noteq> {}
[PROOF STEP]
show "n = card (A - {least A}) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = card (A - {least A}) - 1
[PROOF STEP]
unfolding 2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = Suc n - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = card (A - {least A}) - 1

goal (2 subgoals):
 1. finite (A - {least A})
 2. A - {least A} \<noteq> {}
[PROOF STEP]
show "finite (A - {least A})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (A - {least A})
[PROOF STEP]
using Suc(3)
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite (A - {least A})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (A - {least A})

goal (1 subgoal):
 1. A - {least A} \<noteq> {}
[PROOF STEP]
show "A - {least A} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - {least A} \<noteq> {}
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
A - {least A} \<noteq> {}

goal (1 subgoal):
 1. A - {least A} \<noteq> {}
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
A - {least A} \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nth_least (A - {least A}) (card (A - {least A}) - 1) = Max (A - {least A})

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nth_least (A - {least A}) (card (A - {least A}) - 1) = Max (A - {least A})

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
have "\<dots> = Max A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (A - {least A}) = Max A
[PROOF STEP]
using Suc(3) 3
[PROOF STATE]
proof (prove)
using this:
finite A
A - {least A} \<noteq> {}

goal (1 subgoal):
 1. Max (A - {least A}) = Max A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Max (A - {least A}) = Max A

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A; Suc x = card A - 1; finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> nth_least A (card A - 1) = Max A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
nth_least A (card A - 1) = Max A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
nth_least A (card A - 1) = Max A

goal (1 subgoal):
 1. nth_least A (card A - 1) = Max A
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
nth_least A (card A - 1) = Max A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem th2_2: "a b \<congruent> c d \<Longrightarrow> c d \<congruent> a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a b \<equiv> c d \<Longrightarrow> c d \<equiv> a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a b \<equiv> c d \<Longrightarrow> c d \<equiv> a b
[PROOF STEP]
assume "a b \<congruent> c d"
[PROOF STATE]
proof (state)
this:
a b \<equiv> c d

goal (1 subgoal):
 1. a b \<equiv> c d \<Longrightarrow> c d \<equiv> a b
[PROOF STEP]
with A2' [of a b c d a b] and th2_1 [of a b]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>a b \<equiv> c d; a b \<equiv> a b\<rbrakk> \<Longrightarrow> c d \<equiv> a b
a b \<equiv> a b
a b \<equiv> c d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a b \<equiv> c d; a b \<equiv> a b\<rbrakk> \<Longrightarrow> c d \<equiv> a b
a b \<equiv> a b
a b \<equiv> c d

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subadditive_of_superadditive:
  assumes "superadditive u"
  shows "subadditive (\<lambda>n. -u n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subadditive (\<lambda>n. - u n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
superadditive u

goal (1 subgoal):
 1. subadditive (\<lambda>n. - u n)
[PROOF STEP]
unfolding superadditive_def subadditive_def
[PROOF STATE]
proof (prove)
using this:
\<forall>m n. u m + u n \<le> u (m + n)

goal (1 subgoal):
 1. \<forall>m n. - u (m + n) \<le> - u m + - u n
[PROOF STEP]
by (auto simp add: algebra_simps)


[STATEMENT]
lemma stable_translation_length_le_translation_length [mono_intros]:
  "n * stable_translation_length f \<le> translation_length (f^^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * stable_translation_length f \<le> translation_length (f ^^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real n * stable_translation_length f \<le> translation_length (f ^^ n)
[PROOF STEP]
have *: "stable_translation_length f \<le> translation_length (f^^n)/n" if "n > 0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stable_translation_length f \<le> translation_length (f ^^ n) / real n
[PROOF STEP]
unfolding stable_translation_length_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf {translation_length (f ^^ n) / real n |n. 0 < n} \<le> translation_length (f ^^ n) / real n
[PROOF STEP]
apply (rule cInf_lower)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. translation_length (f ^^ n) / real n \<in> {translation_length (f ^^ n) / real n |n. 0 < n}
 2. bdd_below {translation_length (f ^^ n) / real n |n. 0 < n}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (2 subgoals):
 1. translation_length (f ^^ n) / real n \<in> {translation_length (f ^^ n) / real n |n. 0 < n}
 2. bdd_below {translation_length (f ^^ n) / real n |n. 0 < n}
[PROOF STEP]
by (auto intro: bdd_belowI[of _ 0])
[PROOF STATE]
proof (state)
this:
0 < ?n \<Longrightarrow> stable_translation_length f \<le> translation_length (f ^^ ?n) / real ?n

goal (1 subgoal):
 1. real n * stable_translation_length f \<le> translation_length (f ^^ n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * stable_translation_length f \<le> translation_length (f ^^ n)
[PROOF STEP]
apply (cases "n = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real n * stable_translation_length f \<le> translation_length (f ^^ n)
 2. n \<noteq> 0 \<Longrightarrow> real n * stable_translation_length f \<le> translation_length (f ^^ n)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
0 < ?n \<Longrightarrow> stable_translation_length f \<le> translation_length (f ^^ ?n) / real ?n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real n * stable_translation_length f \<le> translation_length (f ^^ n)
 2. n \<noteq> 0 \<Longrightarrow> real n * stable_translation_length f \<le> translation_length (f ^^ n)
[PROOF STEP]
by (auto simp add: divide_simps algebra_simps)
[PROOF STATE]
proof (state)
this:
real n * stable_translation_length f \<le> translation_length (f ^^ n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mini_maxi_nths:
 "length (nths xs (- {mini xs key, maxi xs key})) =
    (case length xs of 0 \<Rightarrow> 0 | Suc 0 \<Rightarrow> 0 | Suc (Suc n) \<Rightarrow> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (nths xs (- {mini xs key, maxi xs key})) = (case length xs of 0 \<Rightarrow> 0 | Suc 0 \<Rightarrow> 0 | Suc (Suc n) \<Rightarrow> n)
[PROOF STEP]
proof (simp add: length_nths split: nat.split, rule allI, rule conjI, rule_tac [2] allI,
 (rule_tac [!] impI)+, simp add: length_Suc_conv, erule exE, simp, blast)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x2 x2a. \<lbrakk>x2 = Suc x2a; length xs = Suc (Suc x2a)\<rbrakk> \<Longrightarrow> card {i. i < Suc (Suc x2a) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = x2a
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x2 x2a. \<lbrakk>x2 = Suc x2a; length xs = Suc (Suc x2a)\<rbrakk> \<Longrightarrow> card {i. i < Suc (Suc x2a) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = x2a
[PROOF STEP]
assume A: "length xs = Suc (Suc n)"
[PROOF STATE]
proof (state)
this:
length xs = Suc (Suc n)

goal (1 subgoal):
 1. \<And>x2 x2a. \<lbrakk>x2 = Suc x2a; length xs = Suc (Suc x2a)\<rbrakk> \<Longrightarrow> card {i. i < Suc (Suc x2a) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = x2a
[PROOF STEP]
hence B: "Suc 0 < length xs"
[PROOF STATE]
proof (prove)
using this:
length xs = Suc (Suc n)

goal (1 subgoal):
 1. Suc 0 < length xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc 0 < length xs

goal (1 subgoal):
 1. \<And>x2 x2a. \<lbrakk>x2 = Suc x2a; length xs = Suc (Suc x2a)\<rbrakk> \<Longrightarrow> card {i. i < Suc (Suc x2a) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = x2a
[PROOF STEP]
hence C: "0 < length xs"
[PROOF STATE]
proof (prove)
using this:
Suc 0 < length xs

goal (1 subgoal):
 1. 0 < length xs
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
0 < length xs

goal (1 subgoal):
 1. \<And>x2 x2a. \<lbrakk>x2 = Suc x2a; length xs = Suc (Suc x2a)\<rbrakk> \<Longrightarrow> card {i. i < Suc (Suc x2a) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = x2a
[PROOF STEP]
have "{i. i < Suc (Suc n) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} =
    {..<Suc (Suc n)} - {mini xs key} - {maxi xs key}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < Suc (Suc n) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = {..<Suc (Suc n)} - {mini xs key} - {maxi xs key}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{i. i < Suc (Suc n) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = {..<Suc (Suc n)} - {mini xs key} - {maxi xs key}

goal (1 subgoal):
 1. \<And>x2 x2a. \<lbrakk>x2 = Suc x2a; length xs = Suc (Suc x2a)\<rbrakk> \<Longrightarrow> card {i. i < Suc (Suc x2a) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = x2a
[PROOF STEP]
thus "card {i. i < Suc (Suc n) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = n"
[PROOF STATE]
proof (prove)
using this:
{i. i < Suc (Suc n) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = {..<Suc (Suc n)} - {mini xs key} - {maxi xs key}

goal (1 subgoal):
 1. card {i. i < Suc (Suc n) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = n
[PROOF STEP]
by (simp add: card_Diff_singleton_if, insert mini_maxi_neq [OF B, of key],
     simp add: mini_less [OF C] maxi_less [OF C] A [symmetric])
[PROOF STATE]
proof (state)
this:
card {i. i < Suc (Suc n) \<and> i \<noteq> mini xs key \<and> i \<noteq> maxi xs key} = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ack_add_bound2:
  assumes "i < ack k j" shows "i + j < ack (4 + k) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + j < ack (4 + k) j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i + j < ack (4 + k) j
[PROOF STEP]
have "i + j < ack k j + ack 0 j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + j < ack k j + ack 0 j
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < ack k j

goal (1 subgoal):
 1. i + j < ack k j + ack 0 j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i + j < ack k j + ack 0 j

goal (1 subgoal):
 1. i + j < ack (4 + k) j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
i + j < ack k j + ack 0 j

goal (1 subgoal):
 1. i + j < ack (4 + k) j
[PROOF STEP]
have "\<dots> < ack (4 + k) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack k j + ack 0 j < ack (4 + k) j
[PROOF STEP]
by (metis ack_add_bound add.right_neutral)
[PROOF STATE]
proof (state)
this:
ack k j + ack 0 j < ack (4 + k) j

goal (1 subgoal):
 1. i + j < ack (4 + k) j
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
i + j < ack (4 + k) j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i + j < ack (4 + k) j

goal (1 subgoal):
 1. i + j < ack (4 + k) j
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
i + j < ack (4 + k) j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_board: "card (board n m) = n * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (board n m) = n * m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (board n m) = n * m
[PROOF STEP]
have "card (board n m) = card (board_exec_aux n (row_exec m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (board n m) = card (board_exec_aux n (row_exec m))
[PROOF STEP]
using board_exec_correct
[PROOF STATE]
proof (prove)
using this:
board ?n ?m = board_exec ?n ?m

goal (1 subgoal):
 1. card (board n m) = card (board_exec_aux n (row_exec m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (board n m) = card (board_exec_aux n (row_exec m))

goal (1 subgoal):
 1. card (board n m) = n * m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (board n m) = card (board_exec_aux n (row_exec m))

goal (1 subgoal):
 1. card (board n m) = n * m
[PROOF STEP]
have "... = n * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (board_exec_aux n (row_exec m)) = n * m
[PROOF STEP]
using card_row_exec card_board_exec_aux finite_row_exec
[PROOF STATE]
proof (prove)
using this:
card (row_exec ?m) = ?m
finite ?M \<Longrightarrow> card (board_exec_aux ?k ?M) = ?k * card ?M
finite (row_exec ?m)

goal (1 subgoal):
 1. card (board_exec_aux n (row_exec m)) = n * m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (board_exec_aux n (row_exec m)) = n * m

goal (1 subgoal):
 1. card (board n m) = n * m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (board n m) = n * m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (board n m) = n * m

goal (1 subgoal):
 1. card (board n m) = n * m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (board n m) = n * m

goal:
No subgoals!
[PROOF STEP]
qed