[STATEMENT]
lemma finite_set_of_finite_funs2:
  fixes A :: "'a set"
    and B :: "'b set"
    and C :: "'c set"
    and d :: "'c"
  assumes "finite A"
    and "finite B"
    and "finite C"
  shows "finite {f. \<forall>x. \<forall>y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}"
        (is "finite ?S")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
let ?R = "{g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
let ?Q = "{f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> ?R) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
from finite_set_of_finite_funs[OF assms(2,3)]
[PROOF STATE]
proof (chain)
picking this:
finite {f. \<forall>x. (x \<in> B \<longrightarrow> f x \<in> C) \<and> (x \<notin> B \<longrightarrow> f x = ?d)}
[PROOF STEP]
have "finite ?R"
[PROOF STATE]
proof (prove)
using this:
finite {f. \<forall>x. (x \<in> B \<longrightarrow> f x \<in> C) \<and> (x \<notin> B \<longrightarrow> f x = ?d)}

goal (1 subgoal):
 1. finite {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}

goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
from finite_set_of_finite_funs[OF assms(1) this, of "\<lambda> y. d"]
[PROOF STATE]
proof (chain)
picking this:
finite {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}
[PROOF STEP]
have "finite ?Q"
[PROOF STATE]
proof (prove)
using this:
finite {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}

goal (1 subgoal):
 1. finite {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}

goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}

goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
have "?S = ?Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)} = {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}
[PROOF STEP]
by auto (case_tac "xa \<in> A", auto)
[PROOF STATE]
proof (state)
this:
{f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)} = {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}

goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}
{f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)} = {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}
{f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)} = {f. \<forall>x. (x \<in> A \<longrightarrow> f x \<in> {g. \<forall>x. (x \<in> B \<longrightarrow> g x \<in> C) \<and> (x \<notin> B \<longrightarrow> g x = d)}) \<and> (x \<notin> A \<longrightarrow> f x = (\<lambda>y. d))}

goal (1 subgoal):
 1. finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {f. \<forall>x y. (x \<in> A \<and> y \<in> B \<longrightarrow> f x y \<in> C) \<and> (x \<notin> A \<longrightarrow> f x y = d) \<and> (y \<notin> B \<longrightarrow> f x y = d)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma strict_mono_Suc_iff: "strict_mono f \<longleftrightarrow> (\<forall>n. f n < f (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono f = (\<forall>n. f n < f (Suc n))
[PROOF STEP]
proof (intro iffI strict_monoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
 2. \<And>x y. \<lbrakk>\<forall>n. f n < f (Suc n); x < y\<rbrakk> \<Longrightarrow> f x < f y
[PROOF STEP]
assume *: "\<forall>n. f n < f (Suc n)"
[PROOF STATE]
proof (state)
this:
\<forall>n. f n < f (Suc n)

goal (2 subgoals):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
 2. \<And>x y. \<lbrakk>\<forall>n. f n < f (Suc n); x < y\<rbrakk> \<Longrightarrow> f x < f y
[PROOF STEP]
fix m n :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
 2. \<And>x y. \<lbrakk>\<forall>n. f n < f (Suc n); x < y\<rbrakk> \<Longrightarrow> f x < f y
[PROOF STEP]
assume "m < n"
[PROOF STATE]
proof (state)
this:
m < n

goal (2 subgoals):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
 2. \<And>x y. \<lbrakk>\<forall>n. f n < f (Suc n); x < y\<rbrakk> \<Longrightarrow> f x < f y
[PROOF STEP]
thus "f m < f n"
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. f m < f n
[PROOF STEP]
by (induction rule: less_Suc_induct) (use * in auto)
[PROOF STATE]
proof (state)
this:
f m < f n

goal (1 subgoal):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
[PROOF STEP]
qed (auto simp: strict_mono_def)


[STATEMENT]
lemma one_cinner_one[simp]: \<open>(1::('a::one_dim)) \<bullet>\<^sub>C 1 = 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
include notation_norm
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
have \<open>(canonical_basis::'a list) = [1::('a::one_dim)]\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canonical_basis = [1::'a]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
canonical_basis = [1::'a]

goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
hence \<open>\<parallel>1::'a::one_dim\<parallel> = 1\<close>
[PROOF STATE]
proof (prove)
using this:
canonical_basis = [1::'a]

goal (1 subgoal):
 1. \<parallel>1::'a\<parallel> = 1
[PROOF STEP]
by (metis is_normal list.set_intros(1))
[PROOF STATE]
proof (state)
this:
\<parallel>1::'a\<parallel> = 1

goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
hence \<open>\<parallel>1::'a::one_dim\<parallel>^2 = 1\<close>
[PROOF STATE]
proof (prove)
using this:
\<parallel>1::'a\<parallel> = 1

goal (1 subgoal):
 1. \<parallel>1::'a\<parallel>\<^sup>2 = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<parallel>1::'a\<parallel>\<^sup>2 = 1

goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<parallel>1::'a\<parallel>\<^sup>2 = 1

goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
have  \<open>\<parallel>(1::('a::one_dim))\<parallel>^2 = (1::('a::one_dim)) \<bullet>\<^sub>C 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<parallel>1::'a\<parallel>\<^sup>2) = (1::'a) \<bullet>\<^sub>C (1::'a)
[PROOF STEP]
by (metis cnorm_eq_square)
[PROOF STATE]
proof (state)
this:
complex_of_real (\<parallel>1::'a\<parallel>\<^sup>2) = (1::'a) \<bullet>\<^sub>C (1::'a)

goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<parallel>1::'a\<parallel>\<^sup>2 = 1
complex_of_real (\<parallel>1::'a\<parallel>\<^sup>2) = (1::'a) \<bullet>\<^sub>C (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<parallel>1::'a\<parallel>\<^sup>2 = 1
complex_of_real (\<parallel>1::'a\<parallel>\<^sup>2) = (1::'a) \<bullet>\<^sub>C (1::'a)

goal (1 subgoal):
 1. (1::'a) \<bullet>\<^sub>C (1::'a) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1::'a) \<bullet>\<^sub>C (1::'a) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma decreasing_sum_le_integral':
  fixes f :: "real \<Rightarrow> real"
  assumes "\<And>x. x \<ge> 0 \<Longrightarrow> f x \<ge> 0"
  assumes "\<And>x y. 0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> f y \<le> f x"
  assumes "(f has_integral I) {0..}"
  shows   "summable (\<lambda>i. f (real i))" and "suminf (\<lambda>i. f (real i)) \<le> f 0 + I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>i. f (real i)) &&& (\<Sum>i. f (real i)) \<le> f 0 + I
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable (\<lambda>i. f (real i))
 2. (\<Sum>i. f (real i)) \<le> f 0 + I
[PROOF STEP]
have "summable ((\<lambda>i. f (real (Suc i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>i. f (real (Suc i)))
[PROOF STEP]
using decreasing_sum_le_integral[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. 0 \<le> x \<Longrightarrow> 0 \<le> x; \<And>x y. \<lbrakk>0 \<le> x; x \<le> y\<rbrakk> \<Longrightarrow> 0 \<le> x; \<And>x y. \<lbrakk>0 \<le> x; x \<le> y\<rbrakk> \<Longrightarrow> x \<le> y\<rbrakk> \<Longrightarrow> summable (\<lambda>i. f (real (Suc i)))
\<lbrakk>\<And>x. 0 \<le> x \<Longrightarrow> 0 \<le> x; \<And>x y. \<lbrakk>0 \<le> x; x \<le> y\<rbrakk> \<Longrightarrow> 0 \<le> x; \<And>x y. \<lbrakk>0 \<le> x; x \<le> y\<rbrakk> \<Longrightarrow> x \<le> y\<rbrakk> \<Longrightarrow> (\<Sum>i. f (real (Suc i))) \<le> I

goal (1 subgoal):
 1. summable (\<lambda>i. f (real (Suc i)))
[PROOF STEP]
by (simp add: o_def)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>i. f (real (Suc i)))

goal (2 subgoals):
 1. summable (\<lambda>i. f (real i))
 2. (\<Sum>i. f (real i)) \<le> f 0 + I
[PROOF STEP]
thus *: "summable (\<lambda>i. f (real i))"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>i. f (real (Suc i)))

goal (1 subgoal):
 1. summable (\<lambda>i. f (real i))
[PROOF STEP]
by (subst (asm) summable_Suc_iff)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>i. f (real i))

goal (1 subgoal):
 1. (\<Sum>i. f (real i)) \<le> f 0 + I
[PROOF STEP]
have "(\<Sum>n. f (real (Suc n))) \<le> I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. f (real (Suc n))) \<le> I
[PROOF STEP]
by (intro decreasing_sum_le_integral assms)
[PROOF STATE]
proof (state)
this:
(\<Sum>n. f (real (Suc n))) \<le> I

goal (1 subgoal):
 1. (\<Sum>i. f (real i)) \<le> f 0 + I
[PROOF STEP]
thus "suminf (\<lambda>i. f (real i)) \<le> f 0 + I"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. f (real (Suc n))) \<le> I

goal (1 subgoal):
 1. (\<Sum>i. f (real i)) \<le> f 0 + I
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. f (real (Suc n))) \<le> I
summable (\<lambda>i. f (real i))

goal (1 subgoal):
 1. (\<Sum>i. f (real i)) \<le> f 0 + I
[PROOF STEP]
by (subst (asm) suminf_split_head) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i. f (real i)) \<le> f 0 + I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eigenspace_scaleC[simp]:
  assumes a1: "a \<noteq> 0"
  shows "eigenspace b (a *\<^sub>C A) = eigenspace (b/a) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eigenspace b (a *\<^sub>C A) = eigenspace (b / a) A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eigenspace b (a *\<^sub>C A) = eigenspace (b / a) A
[PROOF STEP]
have "b *\<^sub>C (id_cblinfun::('a, _) cblinfun) = a *\<^sub>C (b / a) *\<^sub>C id_cblinfun"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b *\<^sub>C id_cblinfun = a *\<^sub>C (b / a) *\<^sub>C id_cblinfun
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. b *\<^sub>C id_cblinfun = a *\<^sub>C (b / a) *\<^sub>C id_cblinfun
[PROOF STEP]
by (metis ceq_vector_fraction_iff)
[PROOF STATE]
proof (state)
this:
b *\<^sub>C id_cblinfun = a *\<^sub>C (b / a) *\<^sub>C id_cblinfun

goal (1 subgoal):
 1. eigenspace b (a *\<^sub>C A) = eigenspace (b / a) A
[PROOF STEP]
hence "kernel (a *\<^sub>C A - b *\<^sub>C id_cblinfun) = kernel (A - (b / a) *\<^sub>C id_cblinfun)"
[PROOF STATE]
proof (prove)
using this:
b *\<^sub>C id_cblinfun = a *\<^sub>C (b / a) *\<^sub>C id_cblinfun

goal (1 subgoal):
 1. kernel (a *\<^sub>C A - b *\<^sub>C id_cblinfun) = kernel (A - (b / a) *\<^sub>C id_cblinfun)
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
b *\<^sub>C id_cblinfun = a *\<^sub>C (b / a) *\<^sub>C id_cblinfun
a \<noteq> 0

goal (1 subgoal):
 1. kernel (a *\<^sub>C A - b *\<^sub>C id_cblinfun) = kernel (A - (b / a) *\<^sub>C id_cblinfun)
[PROOF STEP]
by (metis (no_types) complex_vector.scale_right_diff_distrib kernel_scaleC)
[PROOF STATE]
proof (state)
this:
kernel (a *\<^sub>C A - b *\<^sub>C id_cblinfun) = kernel (A - (b / a) *\<^sub>C id_cblinfun)

goal (1 subgoal):
 1. eigenspace b (a *\<^sub>C A) = eigenspace (b / a) A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
kernel (a *\<^sub>C A - b *\<^sub>C id_cblinfun) = kernel (A - (b / a) *\<^sub>C id_cblinfun)

goal (1 subgoal):
 1. eigenspace b (a *\<^sub>C A) = eigenspace (b / a) A
[PROOF STEP]
unfolding eigenspace_def
[PROOF STATE]
proof (prove)
using this:
kernel (a *\<^sub>C A - b *\<^sub>C id_cblinfun) = kernel (A - (b / a) *\<^sub>C id_cblinfun)

goal (1 subgoal):
 1. kernel (a *\<^sub>C A - b *\<^sub>C id_cblinfun) = kernel (A - (b / a) *\<^sub>C id_cblinfun)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
eigenspace b (a *\<^sub>C A) = eigenspace (b / a) A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frontier_ci:
  assumes "a < (b::real)"
  shows "frontier {a<..<b}  = {a,b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier {a<..<b} = {a, b}
[PROOF STEP]
apply(simp add: frontier_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure {a<..<b} - {a<..<b} = {a, b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. closure {a<..<b} - {a<..<b} = {a, b}
[PROOF STEP]
by auto


[STATEMENT]
lemma sums_cos_x_plus_y:
  fixes x :: "'a::{real_normed_field,banach}"
  shows
    "(\<lambda>p. \<Sum>n\<le>p.
        if even p
        then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n)
        else 0)
      sums cos (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)
[PROOF STEP]
have
    "(\<Sum>n\<le>p.
      if even p then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n)
      else 0) = cos_coeff p *\<^sub>R ((x + y) ^ p)"
    for p :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
have
      "(\<Sum>n\<le>p. if even p then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) =
       (if even p then \<Sum>n\<le>p. ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (if even p then \<Sum>n\<le>p. (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (if even p then \<Sum>n\<le>p. (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (if even p then \<Sum>n\<le>p. (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
have "\<dots> =
       (if even p
        then of_real ((-1) ^ (p div 2) / (fact p)) * (\<Sum>n\<le>p. (p choose n) *\<^sub>R (x^n) * y^(p-n))
        else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if even p then \<Sum>n\<le>p. (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (if even p then of_real ((- 1) ^ (p div 2) / fact p) * (\<Sum>n\<le>p. real (p choose n) *\<^sub>R x ^ n * y ^ (p - n)) else (0::'a))
[PROOF STEP]
by (auto simp: sum_distrib_left field_simps scaleR_conv_of_real nonzero_of_real_divide)
[PROOF STATE]
proof (state)
this:
(if even p then \<Sum>n\<le>p. (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (if even p then of_real ((- 1) ^ (p div 2) / fact p) * (\<Sum>n\<le>p. real (p choose n) *\<^sub>R x ^ n * y ^ (p - n)) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if even p then \<Sum>n\<le>p. (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (if even p then of_real ((- 1) ^ (p div 2) / fact p) * (\<Sum>n\<le>p. real (p choose n) *\<^sub>R x ^ n * y ^ (p - n)) else (0::'a))

goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
have "\<dots> = cos_coeff p *\<^sub>R ((x + y) ^ p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if even p then of_real ((- 1) ^ (p div 2) / fact p) * (\<Sum>n\<le>p. real (p choose n) *\<^sub>R x ^ n * y ^ (p - n)) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
by (simp add: cos_coeff_def binomial_ring [of x y]  scaleR_conv_of_real atLeast0AtMost)
[PROOF STATE]
proof (state)
this:
(if even p then of_real ((- 1) ^ (p div 2) / fact p) * (\<Sum>n\<le>p. real (p choose n) *\<^sub>R x ^ n * y ^ (p - n)) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p

goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p

goal (1 subgoal):
 1. (\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = cos_coeff p *\<^sub>R (x + y) ^ p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<le>?p. if even ?p then (real_of_int ((- 1) ^ (?p div 2) * int (?p choose n)) / fact ?p) *\<^sub>R x ^ n * y ^ (?p - n) else (0::'a)) = cos_coeff ?p *\<^sub>R (x + y) ^ ?p

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n\<le>?p. if even ?p then (real_of_int ((- 1) ^ (?p div 2) * int (?p choose n)) / fact ?p) *\<^sub>R x ^ n * y ^ (?p - n) else (0::'a)) = cos_coeff ?p *\<^sub>R (x + y) ^ ?p
[PROOF STEP]
have
    "(\<lambda>p. \<Sum>n\<le>p.
        if even p
        then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n)
        else 0) = (\<lambda>p. cos_coeff p *\<^sub>R ((x+y)^p))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n\<le>?p. if even ?p then (real_of_int ((- 1) ^ (?p div 2) * int (?p choose n)) / fact ?p) *\<^sub>R x ^ n * y ^ (?p - n) else (0::'a)) = cos_coeff ?p *\<^sub>R (x + y) ^ ?p

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (\<lambda>p. cos_coeff p *\<^sub>R (x + y) ^ p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (\<lambda>p. cos_coeff p *\<^sub>R (x + y) ^ p)

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) = (\<lambda>p. cos_coeff p *\<^sub>R (x + y) ^ p)

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)
[PROOF STEP]
have "\<dots> sums cos (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. cos_coeff p *\<^sub>R (x + y) ^ p) sums cos (x + y)
[PROOF STEP]
by (rule cos_converges)
[PROOF STATE]
proof (state)
this:
(\<lambda>p. cos_coeff p *\<^sub>R (x + y) ^ p) sums cos (x + y)

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>p. \<Sum>n\<le>p. if even p then (real_of_int ((- 1) ^ (p div 2) * int (p choose n)) / fact p) *\<^sub>R x ^ n * y ^ (p - n) else (0::'a)) sums cos (x + y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interval_induct: "
  \<lbrakk> \<And>x. \<forall>y. (x\<in>(I::nat set) \<and> y \<in> I \<and> y < x \<longrightarrow> P y) \<Longrightarrow> P x \<rbrakk>
  \<Longrightarrow> P a"
  (is "\<lbrakk> \<And>x. \<forall>y. ?IA x y \<Longrightarrow> P x \<rbrakk> \<Longrightarrow> P a")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<forall>y. x \<in> I \<and> y \<in> I \<and> y < x \<longrightarrow> P y \<Longrightarrow> P x) \<Longrightarrow> P a
[PROOF STEP]
apply (rule_tac r="{ (x,y). x \<in> I \<and> y \<in> I \<and> x < y }" in wf_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>x. \<forall>y. x \<in> I \<and> y \<in> I \<and> y < x \<longrightarrow> P y \<Longrightarrow> P x) \<Longrightarrow> wf {(x, y). x \<in> I \<and> y \<in> I \<and> x < y}
 2. \<And>x. \<lbrakk>\<And>x. \<forall>y. x \<in> I \<and> y \<in> I \<and> y < x \<longrightarrow> P y \<Longrightarrow> P x; \<forall>y. (y, x) \<in> {(x, y). x \<in> I \<and> y \<in> I \<and> x < y} \<longrightarrow> P y\<rbrakk> \<Longrightarrow> P x
[PROOF STEP]
apply (rule wf_less_interval)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>x. \<forall>y. x \<in> I \<and> y \<in> I \<and> y < x \<longrightarrow> P y \<Longrightarrow> P x; \<forall>y. (y, x) \<in> {(x, y). x \<in> I \<and> y \<in> I \<and> x < y} \<longrightarrow> P y\<rbrakk> \<Longrightarrow> P x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sorted_quicksort: "sorted (quicksort xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (quicksort xs)
[PROOF STEP]
apply (induction xs rule: quicksort.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sorted (quicksort [])
 2. \<And>x xs. \<lbrakk>sorted (quicksort (filter (\<lambda>y. y < x) xs)); sorted (quicksort (filter ((\<le>) x) xs))\<rbrakk> \<Longrightarrow> sorted (quicksort (x # xs))
[PROOF STEP]
apply (auto simp add: sorted_append set_quicksort)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dropWhile_filter':
  fixes nt :: nat
  shows "sorted (map fst xs) \<Longrightarrow> \<forall>t \<in> fst ` set xs. t \<le> nt \<Longrightarrow>
  dropWhile (\<lambda>(t, X). nt - t \<ge> c) xs = filter (\<lambda>(t, X). nt - t < c) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted (map fst xs); \<forall>t\<in>fst ` set xs. t \<le> nt\<rbrakk> \<Longrightarrow> dropWhile (\<lambda>(t, X). c \<le> nt - t) xs = filter (\<lambda>(t, X). nt - t < c) xs
[PROOF STEP]
by (induction xs) (auto 0 3 intro!: filter_id_conv[THEN iffD2, symmetric] elim: order.trans[rotated])


[STATEMENT]
lemma base_case_matrix_eq:
  fixes q p:: "real poly"
  assumes nonzero: "p \<noteq> 0"
  shows "(mult_mat_vec (mat_of_rows_list 3 [[1,1,1], [0,1,0], [1,0,-1]]) (construct_lhs_vector_R p [q] [[1],[0],[-1]]) =
    (construct_rhs_vector_R p [q] [([], []),([0], []),([], [0])]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]] *\<^sub>v w_vec_R p [q] [[1], [0], [- 1]] = v_vec_R p [q] [([], []), ([0], []), ([], [0])]
[PROOF STEP]
using mat_base_case_R base_case_satisfy_equation_R
[PROOF STATE]
proof (prove)
using this:
M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])] = mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]
?p \<noteq> 0 \<Longrightarrow> satisfy_equation_R ?p [?q] [([], []), ([0], []), ([], [0])] [[1], [0], [- 1]]

goal (1 subgoal):
 1. mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]] *\<^sub>v w_vec_R p [q] [[1], [0], [- 1]] = v_vec_R p [q] [([], []), ([0], []), ([], [0])]
[PROOF STEP]
unfolding satisfy_equation_R_def
[PROOF STATE]
proof (prove)
using this:
M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])] = mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]
?p \<noteq> 0 \<Longrightarrow> M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])] *\<^sub>v w_vec_R ?p [?q] [[1], [0], [- 1]] = v_vec_R ?p [?q] [([], []), ([0], []), ([], [0])]

goal (1 subgoal):
 1. mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]] *\<^sub>v w_vec_R p [q] [[1], [0], [- 1]] = v_vec_R p [q] [([], []), ([0], []), ([], [0])]
[PROOF STEP]
by (simp add: nonzero)


[STATEMENT]
lemma convex_hulls_are_convex: assumes "A \<subseteq> carrier_vec n"
  shows "convex (convex_hull A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (convex_hull A)
[PROOF STEP]
by (intro convexI convex_hull_convex_sum convex_hull_carrier assms)


[STATEMENT]
lemma take_bit_Suc_bit0:
  \<open>take_bit (Suc n) (numeral (Num.Bit0 k)) = take_bit n (numeral k) * 2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) (numeral (num.Bit0 k)) = take_bit n (numeral k) * (2::'a)
[PROOF STEP]
by (simp add: take_bit_Suc numeral_Bit0_div_2)


[STATEMENT]
lemma gen_boolean_algebra_diff:
  assumes "A \<in> gen_boolean_algebra S B"
  assumes "C \<in> gen_boolean_algebra S B"
  shows "A -  C \<in> gen_boolean_algebra S B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - C \<in> gen_boolean_algebra S B
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A - C \<in> gen_boolean_algebra S B
[PROOF STEP]
have "A - C = A \<inter> (S - C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - C = A \<inter> (S - C)
[PROOF STEP]
by (metis Int_Diff assms(1) gen_boolean_algebra_subset inf_absorb1)
[PROOF STATE]
proof (state)
this:
A - C = A \<inter> (S - C)

goal (1 subgoal):
 1. A - C \<in> gen_boolean_algebra S B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A - C = A \<inter> (S - C)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A - C = A \<inter> (S - C)

goal (1 subgoal):
 1. A - C \<in> gen_boolean_algebra S B
[PROOF STEP]
by (metis assms(1) assms(2) gen_boolean_algebra.complement gen_boolean_algebra_intersect)
[PROOF STATE]
proof (state)
this:
A - C \<in> gen_boolean_algebra S B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Log_eq_one [simp]: "\<lbrakk> 0 < a; a \<noteq> 1 \<rbrakk> \<Longrightarrow> Log a a = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1\<rbrakk> \<Longrightarrow> Log a a = 1
[PROOF STEP]
using powreal_inject
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?a; ?a \<noteq> 1\<rbrakk> \<Longrightarrow> (?a pow\<^sub>\<real> ?r = ?a pow\<^sub>\<real> ?s) = (?s = ?r)

goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1\<rbrakk> \<Longrightarrow> Log a a = 1
[PROOF STEP]
by fastforce


[STATEMENT]
lemma lm161:
  fixes a::real
  fixes b c
  shows "a*b - a*c=a*(b-c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * b - a * c = a * (b - c)
[PROOF STEP]
by (metis real_scaleR_def real_vector.scale_right_diff_distrib)


[STATEMENT]
lemma (in domain) poly_mult_degree_le:
  assumes "x \<in> carrier (poly_ring R)"
  assumes "y \<in> carrier (poly_ring R)"
  assumes "degree x \<le> n"
  assumes "degree y \<le> m"
  shows "degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> n + m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> n + m
[PROOF STEP]
using poly_mult_degree_le_1 assms add_mono
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier (poly_ring R); ?y \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> degree (?x \<otimes>\<^bsub>poly_ring R\<^esub> ?y) \<le> degree ?x + degree ?y
x \<in> carrier (poly_ring R)
y \<in> carrier (poly_ring R)
degree x \<le> n
degree y \<le> m
\<lbrakk>?a \<le> ?b; ?c \<le> ?d\<rbrakk> \<Longrightarrow> ?a + ?c \<le> ?b + ?d

goal (1 subgoal):
 1. degree (x \<otimes>\<^bsub>poly_ring R\<^esub> y) \<le> n + m
[PROOF STEP]
by force


[STATEMENT]
lemma primes_lower_bound:
  fixes n :: nat
  assumes "n > 0"
  defines "\<pi> \<equiv> \<lambda>n. card {p. prime p \<and> p \<le> n}"
  shows   "real (\<pi> n) \<ge> ln (real n) / ln 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
have "real n = real (card {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n = real (card {1..n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n = real (card {1..n})

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n = real (card {1..n})

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
have "{1..n} = (\<lambda>(A, b). \<Prod>A * b^2) ` (\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..n} = (\<lambda>(A, b). \<Prod>A * b\<^sup>2) ` (\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}
[PROOF STEP]
unfolding image_comp o_def squarefree_decompose case_prod_unfold fst_conv snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..n} = (\<lambda>x. x) ` {1..n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{1..n} = (\<lambda>(A, b). \<Prod>A * b\<^sup>2) ` (\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{1..n} = (\<lambda>(A, b). \<Prod>A * b\<^sup>2) ` (\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
have "card \<dots> \<le> card ((\<lambda>n. (squarefree_part n, square_part n)) ` {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>(A, b). \<Prod>A * b\<^sup>2) ` (\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}) \<le> card ((\<lambda>n. (squarefree_part n, square_part n)) ` {1..n})
[PROOF STEP]
by (rule card_image_le) simp_all
[PROOF STATE]
proof (state)
this:
card ((\<lambda>(A, b). \<Prod>A * b\<^sup>2) ` (\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}) \<le> card ((\<lambda>n. (squarefree_part n, square_part n)) ` {1..n})

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((\<lambda>(A, b). \<Prod>A * b\<^sup>2) ` (\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}) \<le> card ((\<lambda>n. (squarefree_part n, square_part n)) ` {1..n})

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
have "\<dots> \<le> card (squarefree_part ` {1..n} \<times> square_part ` {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}) \<le> card (squarefree_part ` {1..n} \<times> square_part ` {1..n})
[PROOF STEP]
by (rule card_mono) auto
[PROOF STATE]
proof (state)
this:
card ((\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}) \<le> card (squarefree_part ` {1..n} \<times> square_part ` {1..n})

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((\<lambda>n. (squarefree_part n, square_part n)) ` {1..n}) \<le> card (squarefree_part ` {1..n} \<times> square_part ` {1..n})

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
have "real \<dots> = real (card (squarefree_part ` {1..n})) * real (card (square_part ` {1..n}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (squarefree_part ` {1..n} \<times> square_part ` {1..n})) = real (card (squarefree_part ` {1..n})) * real (card (square_part ` {1..n}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (card (squarefree_part ` {1..n} \<times> square_part ` {1..n})) = real (card (squarefree_part ` {1..n})) * real (card (square_part ` {1..n}))

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card (squarefree_part ` {1..n} \<times> square_part ` {1..n})) = real (card (squarefree_part ` {1..n})) * real (card (square_part ` {1..n}))

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
have "\<dots> \<le> 2 ^ \<pi> n * sqrt (real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (squarefree_part ` {1..n})) * real (card (square_part ` {1..n})) \<le> 2 ^ \<pi> n * sqrt (real n)
[PROOF STEP]
proof (rule mult_mono)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n
 2. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 3. 0 \<le> 2 ^ \<pi> n
 4. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
have "card (squarefree_part ` {1..n}) \<le> card (Pow {p. prime p \<and> p \<le> n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (squarefree_part ` {1..n}) \<le> card (Pow {p. prime p \<and> p \<le> n})
[PROOF STEP]
using squarefree_part_subset squarefree_part_le
[PROOF STATE]
proof (prove)
using this:
squarefree_part ?n \<subseteq> prime_factors ?n
?p \<in> squarefree_part ?n \<Longrightarrow> ?p \<le> ?n

goal (1 subgoal):
 1. card (squarefree_part ` {1..n}) \<le> card (Pow {p. prime p \<and> p \<le> n})
[PROOF STEP]
by (intro card_mono) force+
[PROOF STATE]
proof (state)
this:
card (squarefree_part ` {1..n}) \<le> card (Pow {p. prime p \<and> p \<le> n})

goal (4 subgoals):
 1. real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n
 2. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 3. 0 \<le> 2 ^ \<pi> n
 4. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (squarefree_part ` {1..n}) \<le> card (Pow {p. prime p \<and> p \<le> n})

goal (4 subgoals):
 1. real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n
 2. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 3. 0 \<le> 2 ^ \<pi> n
 4. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
have "real \<dots> = 2 ^ \<pi> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (Pow {p. prime p \<and> p \<le> n})) = 2 ^ \<pi> n
[PROOF STEP]
by (simp add: \<pi>_def card_Pow)
[PROOF STATE]
proof (state)
this:
real (card (Pow {p. prime p \<and> p \<le> n})) = 2 ^ \<pi> n

goal (4 subgoals):
 1. real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n
 2. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 3. 0 \<le> 2 ^ \<pi> n
 4. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n
[PROOF STEP]
show "real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n

goal (1 subgoal):
 1. real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n
[PROOF STEP]
by - simp_all
[PROOF STATE]
proof (state)
this:
real (card (squarefree_part ` {1..n})) \<le> 2 ^ \<pi> n

goal (3 subgoals):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 2. 0 \<le> 2 ^ \<pi> n
 3. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 2. 0 \<le> 2 ^ \<pi> n
 3. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
have "square_part k \<le> nat \<lfloor>sqrt n\<rfloor>" if "k \<le> n" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_part k \<le> nat \<lfloor>sqrt (real n)\<rfloor>
[PROOF STEP]
by (rule order.trans[OF square_part_le_sqrt])
         (insert that, auto intro!: nat_mono floor_mono)
[PROOF STATE]
proof (state)
this:
?k \<le> n \<Longrightarrow> square_part ?k \<le> nat \<lfloor>sqrt (real n)\<rfloor>

goal (3 subgoals):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 2. 0 \<le> 2 ^ \<pi> n
 3. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
hence "card (square_part ` {1..n}) \<le> card {1..nat \<lfloor>sqrt n\<rfloor>}"
[PROOF STATE]
proof (prove)
using this:
?k \<le> n \<Longrightarrow> square_part ?k \<le> nat \<lfloor>sqrt (real n)\<rfloor>

goal (1 subgoal):
 1. card (square_part ` {1..n}) \<le> card {1..nat \<lfloor>sqrt (real n)\<rfloor>}
[PROOF STEP]
by (intro card_mono) (auto intro: order.trans[OF square_part_le_sqrt])
[PROOF STATE]
proof (state)
this:
card (square_part ` {1..n}) \<le> card {1..nat \<lfloor>sqrt (real n)\<rfloor>}

goal (3 subgoals):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 2. 0 \<le> 2 ^ \<pi> n
 3. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (square_part ` {1..n}) \<le> card {1..nat \<lfloor>sqrt (real n)\<rfloor>}

goal (3 subgoals):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 2. 0 \<le> 2 ^ \<pi> n
 3. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
have "\<dots> = nat \<lfloor>sqrt n\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {1..nat \<lfloor>sqrt (real n)\<rfloor>} = nat \<lfloor>sqrt (real n)\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {1..nat \<lfloor>sqrt (real n)\<rfloor>} = nat \<lfloor>sqrt (real n)\<rfloor>

goal (3 subgoals):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 2. 0 \<le> 2 ^ \<pi> n
 3. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {1..nat \<lfloor>sqrt (real n)\<rfloor>} = nat \<lfloor>sqrt (real n)\<rfloor>

goal (3 subgoals):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 2. 0 \<le> 2 ^ \<pi> n
 3. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
have "real \<dots> \<le> sqrt n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (nat \<lfloor>sqrt (real n)\<rfloor>) \<le> sqrt (real n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (nat \<lfloor>sqrt (real n)\<rfloor>) \<le> sqrt (real n)

goal (3 subgoals):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
 2. 0 \<le> 2 ^ \<pi> n
 3. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card (square_part ` {1..n})) \<le> sqrt (real n)
[PROOF STEP]
show "real (card (square_part ` {1..n})) \<le> sqrt (real n)"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card (square_part ` {1..n})) \<le> sqrt (real n)

goal (1 subgoal):
 1. real (card (square_part ` {1..n})) \<le> sqrt (real n)
[PROOF STEP]
by - simp_all
[PROOF STATE]
proof (state)
this:
real (card (square_part ` {1..n})) \<le> sqrt (real n)

goal (2 subgoals):
 1. 0 \<le> 2 ^ \<pi> n
 2. 0 \<le> real (card (square_part ` {1..n}))
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
real (card (squarefree_part ` {1..n})) * real (card (square_part ` {1..n})) \<le> 2 ^ \<pi> n * sqrt (real n)

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y; \<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y\<rbrakk> \<Longrightarrow> real n \<le> 2 ^ \<pi> n * sqrt (real n)
[PROOF STEP]
have "real n \<le> 2 ^ \<pi> n * sqrt (real n)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y; \<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y\<rbrakk> \<Longrightarrow> real n \<le> 2 ^ \<pi> n * sqrt (real n)

goal (1 subgoal):
 1. real n \<le> 2 ^ \<pi> n * sqrt (real n)
[PROOF STEP]
by - simp_all
[PROOF STATE]
proof (state)
this:
real n \<le> 2 ^ \<pi> n * sqrt (real n)

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
with \<open>n > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < n
real n \<le> 2 ^ \<pi> n * sqrt (real n)
[PROOF STEP]
have "ln (real n) \<le> ln (2 ^ \<pi> n * sqrt (real n))"
[PROOF STATE]
proof (prove)
using this:
0 < n
real n \<le> 2 ^ \<pi> n * sqrt (real n)

goal (1 subgoal):
 1. ln (real n) \<le> ln (2 ^ \<pi> n * sqrt (real n))
[PROOF STEP]
by (subst ln_le_cancel_iff) simp_all
[PROOF STATE]
proof (state)
this:
ln (real n) \<le> ln (2 ^ \<pi> n * sqrt (real n))

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ln (real n) \<le> ln (2 ^ \<pi> n * sqrt (real n))

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
have "ln (4 :: real) = real 2 * ln 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln 4 = real 2 * ln 2
[PROOF STEP]
by (subst ln_realpow [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
ln 4 = real 2 * ln 2

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ln (real n) \<le> ln (2 ^ \<pi> n * sqrt (real n))
ln 4 = real 2 * ln 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (real n) \<le> ln (2 ^ \<pi> n * sqrt (real n))
ln 4 = real 2 * ln 2

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
ln (real n) \<le> ln (2 ^ \<pi> n * sqrt (real n))
ln 4 = real 2 * ln 2
0 < n

goal (1 subgoal):
 1. ln (real n) / ln 4 \<le> real (\<pi> n)
[PROOF STEP]
by (simp add: ln_mult ln_realpow[of _ "\<pi> n"] ln_sqrt field_simps)
[PROOF STATE]
proof (state)
this:
ln (real n) / ln 4 \<le> real (\<pi> n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_equal_swap:
  assumes x: "x \<in> carrier R" and y: "y \<in> carrier R"
  shows "(\<ominus> x = y) = (x = \<ominus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<ominus> x = y) = (x = \<ominus> y)
[PROOF STEP]
using assms neg_equal_iff_equal [of x "\<ominus> y"]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
\<lbrakk>x \<in> carrier R; \<ominus> y \<in> carrier R\<rbrakk> \<Longrightarrow> (\<ominus> x = \<ominus> (\<ominus> y)) = (x = \<ominus> y)

goal (1 subgoal):
 1. (\<ominus> x = y) = (x = \<ominus> y)
[PROOF STEP]
by simp


[STATEMENT]
lemma iff_sem [simp]: "(\<nu> \<in> fml_sem I (A \<leftrightarrow> B))
  \<longleftrightarrow> ((\<nu> \<in> fml_sem I A) \<longleftrightarrow> (\<nu> \<in> fml_sem I B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nu> \<in> fml_sem I (A \<leftrightarrow> B)) = ((\<nu> \<in> fml_sem I A) = (\<nu> \<in> fml_sem I B))
[PROOF STEP]
by (auto simp add: Equiv_def)


[STATEMENT]
lemma has_derivative_sqnorm_at [derivative_intros, simp]:
  "((\<lambda>x. (norm x)\<^sup>2) has_derivative (\<lambda>x. 2 *\<^sub>R (a \<bullet> x))) (at a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (norm x)\<^sup>2) has_derivative (\<lambda>x. 2 *\<^sub>R (a \<bullet> x))) (at a)
[PROOF STEP]
using bounded_bilinear.FDERIV  [of "(\<bullet>)" id id a _ id id]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bounded_bilinear (\<bullet>); (id has_derivative id) (at a within ?s); (id has_derivative id) (at a within ?s)\<rbrakk> \<Longrightarrow> ((\<lambda>x. id x \<bullet> id x) has_derivative (\<lambda>h. id a \<bullet> id h + id h \<bullet> id a)) (at a within ?s)

goal (1 subgoal):
 1. ((\<lambda>x. (norm x)\<^sup>2) has_derivative (\<lambda>x. 2 *\<^sub>R (a \<bullet> x))) (at a)
[PROOF STEP]
by (auto simp: inner_commute dot_square_norm bounded_bilinear_inner)


[STATEMENT]
lemma span_eq_iff[simp]: "span s = s \<longleftrightarrow> subspace s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (span s = s) = subspace s
[PROOF STEP]
unfolding span_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subspace hull s = s) = subspace s
[PROOF STEP]
by (rule hull_eq) (rule subspace_Inter)


[STATEMENT]
lemma vec_elements: "vec_elements v = { v $ i | i. i < dim_vec v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_elements v = {v $v i |i. i < dim_vec v}
[PROOF STEP]
unfolding vec_elements_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (($v) v) [0..<dim_vec v]) = {v $v i |i. i < dim_vec v}
[PROOF STEP]
by auto


[STATEMENT]
lemma mssnth_arctan_series_stream:
  "mssnth arctan_series_stream n = (-1) ^ n / (2 * n + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mssnth arctan_series_stream n = (- 1) ^ n / (2 * real n + 1)
[PROOF STEP]
by (simp add: arctan_series_stream_def mssnth_arctan_series_stream_aux)


[STATEMENT]
lemma Dirichlet_L_0_principal [simp]: "Dirichlet_L n \<chi>\<^sub>0 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = 0
[PROOF STEP]
have "Dirichlet_L n \<chi>\<^sub>0 0 = -1/2 * (\<Prod>p | prime p \<and> p dvd n. 1 - 1 / p powr 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = - 1 / 2 * (\<Prod>x\<in>{p. prime p \<and> p dvd n}. 1 - 1 / of_nat x powr 0)
[PROOF STEP]
by (simp add: Dirichlet_L_principal prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
Dirichlet_L n \<chi>\<^sub>0 0 = - 1 / 2 * (\<Prod>x\<in>{p. prime p \<and> p dvd n}. 1 - 1 / of_nat x powr 0)

goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Dirichlet_L n \<chi>\<^sub>0 0 = - 1 / 2 * (\<Prod>x\<in>{p. prime p \<and> p dvd n}. 1 - 1 / of_nat x powr 0)

goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = 0
[PROOF STEP]
have "(\<Prod>p | prime p \<and> p dvd n. 1 - 1 / p powr 0) = (\<Prod>p | prime p \<and> p dvd n. 0 :: complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>{p. prime p \<and> p dvd n}. 1 - 1 / of_nat x powr 0) = (\<Prod>p\<in>{p. prime p \<and> p dvd n}. 0)
[PROOF STEP]
by (intro prod.cong) (auto simp: prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>{p. prime p \<and> p dvd n}. 1 - 1 / of_nat x powr 0) = (\<Prod>p\<in>{p. prime p \<and> p dvd n}. 0)

goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>{p. prime p \<and> p dvd n}. 1 - 1 / of_nat x powr 0) = (\<Prod>p\<in>{p. prime p \<and> p dvd n}. 0)

goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = 0
[PROOF STEP]
have "(\<Prod>p | prime p \<and> p dvd n. 0 :: complex) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>{p. prime p \<and> p dvd n}. 0) = 0
[PROOF STEP]
using prime_divisor_exists[of n] n
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n \<noteq> 0; \<not> is_unit n\<rbrakk> \<Longrightarrow> \<exists>b. b dvd n \<and> prime b
1 < n

goal (1 subgoal):
 1. (\<Prod>p\<in>{p. prime p \<and> p dvd n}. 0) = 0
[PROOF STEP]
by (auto simp: card_gt_0_iff)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. prime p \<and> p dvd n}. 0) = 0

goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Dirichlet_L n \<chi>\<^sub>0 0 = - 1 / 2 * 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Dirichlet_L n \<chi>\<^sub>0 0 = - 1 / 2 * 0

goal (1 subgoal):
 1. Dirichlet_L n \<chi>\<^sub>0 0 = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Dirichlet_L n \<chi>\<^sub>0 0 = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l2norm_lmult:
   "f square_integrable S \<Longrightarrow> l2norm S (\<lambda>x. c * f x) = \<bar>c\<bar> * l2norm S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f square_integrable S \<Longrightarrow> l2norm S (\<lambda>x. c * f x) = \<bar>c\<bar> * l2norm S f
[PROOF STEP]
by (simp add: l2norm_def l2product_rmult l2product_sym real_sqrt_mult)


[STATEMENT]
lemma powrat_add_neg_pos:
    assumes pos_x: "0 < x" and
            neg_r: "r < 0" and
            pos_s: "0 < s"
    shows "x pow\<^sub>\<rat> (r + s) = (x pow\<^sub>\<rat> r) * (x pow\<^sub>\<rat> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
proof (cases "r + s > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
assume exp_pos: "r + s > 0"
[PROOF STATE]
proof (state)
this:
0 < r + s

goal (2 subgoals):
 1. 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
have "-r > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < - r
[PROOF STEP]
using neg_r
[PROOF STATE]
proof (prove)
using this:
r < 0

goal (1 subgoal):
 1. 0 < - r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < - r

goal (2 subgoals):
 1. 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < - r
[PROOF STEP]
have "x pow\<^sub>\<rat> (r + s) * (x pow\<^sub>\<rat> -r) =  (x pow\<^sub>\<rat> s)"
[PROOF STATE]
proof (prove)
using this:
0 < - r

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - r = x pow\<^sub>\<rat> s
[PROOF STEP]
using exp_pos pos_x powrat_add_pos
[PROOF STATE]
proof (prove)
using this:
0 < - r
0 < r + s
0 < x
\<lbrakk>0 < ?x; 0 < ?r; 0 < ?s\<rbrakk> \<Longrightarrow> ?x pow\<^sub>\<rat> (?r + ?s) = ?x pow\<^sub>\<rat> ?r * ?x pow\<^sub>\<rat> ?s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - r = x pow\<^sub>\<rat> s
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - r = x pow\<^sub>\<rat> s

goal (2 subgoals):
 1. 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - r = x pow\<^sub>\<rat> s
[PROOF STEP]
have "x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> r) =  (x pow\<^sub>\<rat> s)"
[PROOF STATE]
proof (prove)
using this:
x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - r = x pow\<^sub>\<rat> s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> r) = x pow\<^sub>\<rat> s
[PROOF STEP]
by (simp add: powrat_minus)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> r) = x pow\<^sub>\<rat> s

goal (2 subgoals):
 1. 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> r) = x pow\<^sub>\<rat> s
[PROOF STEP]
show "x pow\<^sub>\<rat> (r + s) = (x pow\<^sub>\<rat> r) * (x pow\<^sub>\<rat> s)"
[PROOF STATE]
proof (prove)
using this:
x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> r) = x pow\<^sub>\<rat> s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
by (metis Groups.mult_ac(3) assms(1) mult.right_neutral
          order_less_irrefl powrat_gt_zero right_inverse)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s

goal (1 subgoal):
 1. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
assume exp_pos: "\<not> r + s > 0"
[PROOF STATE]
proof (state)
this:
\<not> 0 < r + s

goal (1 subgoal):
 1. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> 0 < r + s
[PROOF STEP]
have "r + s = 0 \<or> r + s < 0"
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < r + s

goal (1 subgoal):
 1. r + s = 0 \<or> r + s < 0
[PROOF STEP]
using neq_iff
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < r + s
(?x \<noteq> ?y) = (?x < ?y \<or> ?y < ?x)

goal (1 subgoal):
 1. r + s = 0 \<or> r + s < 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r + s = 0 \<or> r + s < 0

goal (1 subgoal):
 1. \<not> 0 < r + s \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r + s = 0 \<or> r + s < 0
[PROOF STEP]
show "x pow\<^sub>\<rat> (r + s) = (x pow\<^sub>\<rat> r) * (x pow\<^sub>\<rat> s)"
[PROOF STATE]
proof (prove)
using this:
r + s = 0 \<or> r + s < 0

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r + s = 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
assume exp_zero: "r + s = 0"
[PROOF STATE]
proof (state)
this:
r + s = 0

goal (2 subgoals):
 1. r + s = 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r + s = 0
[PROOF STEP]
have "x pow\<^sub>\<rat> (r + s) = 1"
[PROOF STATE]
proof (prove)
using this:
r + s = 0

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) = 1

goal (2 subgoals):
 1. r + s = 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) = 1

goal (2 subgoals):
 1. r + s = 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
have "... = (x pow\<^sub>\<rat> r) * inverse (x pow\<^sub>\<rat> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 = x pow\<^sub>\<rat> r * inverse (x pow\<^sub>\<rat> r)
[PROOF STEP]
using pos_x powrat_not_zero
[PROOF STATE]
proof (prove)
using this:
0 < x
?x \<noteq> 0 \<Longrightarrow> ?x pow\<^sub>\<rat> ?r \<noteq> 0

goal (1 subgoal):
 1. 1 = x pow\<^sub>\<rat> r * inverse (x pow\<^sub>\<rat> r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 = x pow\<^sub>\<rat> r * inverse (x pow\<^sub>\<rat> r)

goal (2 subgoals):
 1. r + s = 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 = x pow\<^sub>\<rat> r * inverse (x pow\<^sub>\<rat> r)

goal (2 subgoals):
 1. r + s = 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
have "... = (x pow\<^sub>\<rat> r) * (x pow\<^sub>\<rat> - r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> r * inverse (x pow\<^sub>\<rat> r) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> - r
[PROOF STEP]
by (simp add: powrat_minus)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> r * inverse (x pow\<^sub>\<rat> r) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> - r

goal (2 subgoals):
 1. r + s = 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> - r
[PROOF STEP]
show "x pow\<^sub>\<rat> (r + s) = (x pow\<^sub>\<rat> r) * (x pow\<^sub>\<rat> s)"
[PROOF STATE]
proof (prove)
using this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> - r

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
using exp_zero minus_unique
[PROOF STATE]
proof (prove)
using this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> - r
r + s = 0
?a + ?b = (0::?'a) \<Longrightarrow> - ?a = ?b

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s

goal (1 subgoal):
 1. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
assume "r + s < 0"
[PROOF STATE]
proof (state)
this:
r + s < 0

goal (1 subgoal):
 1. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
have "-s < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - s < 0
[PROOF STEP]
using pos_s
[PROOF STATE]
proof (prove)
using this:
0 < s

goal (1 subgoal):
 1. - s < 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- s < 0

goal (1 subgoal):
 1. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- s < 0
[PROOF STEP]
have "x pow\<^sub>\<rat> (r + s) * (x pow\<^sub>\<rat> -s) =  (x pow\<^sub>\<rat> r)"
[PROOF STATE]
proof (prove)
using this:
- s < 0

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - s = x pow\<^sub>\<rat> r
[PROOF STEP]
using \<open>r + s < 0\<close> pos_x powrat_add_neg
[PROOF STATE]
proof (prove)
using this:
- s < 0
r + s < 0
0 < x
\<lbrakk>0 < ?x; ?r < 0; ?s < 0\<rbrakk> \<Longrightarrow> ?x pow\<^sub>\<rat> (?r + ?s) = ?x pow\<^sub>\<rat> ?r * ?x pow\<^sub>\<rat> ?s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - s = x pow\<^sub>\<rat> r
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - s = x pow\<^sub>\<rat> r

goal (1 subgoal):
 1. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - s = x pow\<^sub>\<rat> r
[PROOF STEP]
have "x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> s) =  (x pow\<^sub>\<rat> r)"
[PROOF STATE]
proof (prove)
using this:
x pow\<^sub>\<rat> (r + s) * x pow\<^sub>\<rat> - s = x pow\<^sub>\<rat> r

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> s) = x pow\<^sub>\<rat> r
[PROOF STEP]
by (simp add: powrat_minus)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> s) = x pow\<^sub>\<rat> r

goal (1 subgoal):
 1. r + s < 0 \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> s) = x pow\<^sub>\<rat> r
[PROOF STEP]
show "x pow\<^sub>\<rat> (r + s) = (x pow\<^sub>\<rat> r) * (x pow\<^sub>\<rat> s)"
[PROOF STATE]
proof (prove)
using this:
x pow\<^sub>\<rat> (r + s) * inverse (x pow\<^sub>\<rat> s) = x pow\<^sub>\<rat> r

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
by (metis divide_eq_eq divide_real_def
            less_irrefl pos_x powrat_not_zero)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ereal_Inf_uminus_image_eq: "Inf (uminus ` S::ereal set) = - Sup S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (uminus ` S) = - Sup S
[PROOF STEP]
using ereal_Sup_uminus_image_eq[of "uminus ` S"]
[PROOF STATE]
proof (prove)
using this:
Sup (uminus ` uminus ` S) = - Inf (uminus ` S)

goal (1 subgoal):
 1. Inf (uminus ` S) = - Sup S
[PROOF STEP]
by simp


[STATEMENT]
lemma sgn_power:
  fixes x::"'a::linordered_idom"
  shows "sgn (x^n) = (if n=0 then 1 else if even n then \<bar>sgn x\<bar> else sgn x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (x ^ n) = (if n = 0 then 1::'a else if even n then \<bar>sgn x\<bar> else sgn x)
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sgn (x ^ 0) = (if 0 = 0 then 1::'a else if even 0 then \<bar>sgn x\<bar> else sgn x)
 2. \<And>n. sgn (x ^ n) = (if n = 0 then 1::'a else if even n then \<bar>sgn x\<bar> else sgn x) \<Longrightarrow> sgn (x ^ Suc n) = (if Suc n = 0 then 1::'a else if even (Suc n) then \<bar>sgn x\<bar> else sgn x)
[PROOF STEP]
by (auto simp add:sgn_mult)


[STATEMENT]
lemma solution_fixed_point_left:
  fixes x:: "real \<Rightarrow> 'a::banach"
  assumes x: "(x solves_ode f) T X" and t: "t \<in> T"
  shows "x t1 - ivl_integral t t1 (\<lambda>t. f t (x t)) = x t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x t1 - ivl_integral t t1 (\<lambda>t. f t (x t)) = x t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x t1 - ivl_integral t t1 (\<lambda>t. f t (x t)) = x t
[PROOF STEP]
from solves_odeD(1)[OF x, unfolded T_def]
[PROOF STATE]
proof (chain)
picking this:
(x has_vderiv_on (\<lambda>t. f t (x t))) {t0--t1}
[PROOF STEP]
have "(x has_vderiv_on (\<lambda>t. f t (x t))) (closed_segment t t1)"
[PROOF STATE]
proof (prove)
using this:
(x has_vderiv_on (\<lambda>t. f t (x t))) {t0--t1}

goal (1 subgoal):
 1. (x has_vderiv_on (\<lambda>t. f t (x t))) {t--t1}
[PROOF STEP]
by (rule has_vderiv_on_subset) (insert \<open>t \<in> T\<close>, auto simp: closed_segment_eq_real_ivl T_def)
[PROOF STATE]
proof (state)
this:
(x has_vderiv_on (\<lambda>t. f t (x t))) {t--t1}

goal (1 subgoal):
 1. x t1 - ivl_integral t t1 (\<lambda>t. f t (x t)) = x t
[PROOF STEP]
from fundamental_theorem_of_calculus_ivl_integral[OF this]
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>t. f t (x t)) has_ivl_integral x t1 - x t) t t1
[PROOF STEP]
have "((\<lambda>t. f t (x t)) has_ivl_integral x t1 - x t) t t1"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. f t (x t)) has_ivl_integral x t1 - x t) t t1

goal (1 subgoal):
 1. ((\<lambda>t. f t (x t)) has_ivl_integral x t1 - x t) t t1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>t. f t (x t)) has_ivl_integral x t1 - x t) t t1

goal (1 subgoal):
 1. x t1 - ivl_integral t t1 (\<lambda>t. f t (x t)) = x t
[PROOF STEP]
from this[THEN ivl_integral_unique]
[PROOF STATE]
proof (chain)
picking this:
ivl_integral t t1 (\<lambda>t. f t (x t)) = x t1 - x t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ivl_integral t t1 (\<lambda>t. f t (x t)) = x t1 - x t

goal (1 subgoal):
 1. x t1 - ivl_integral t t1 (\<lambda>t. f t (x t)) = x t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x t1 - ivl_integral t t1 (\<lambda>t. f t (x t)) = x t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma square2_Suc: "square2 (Suc n) i j =
  square2 n i j \<union> square2 n (2^n + i) j \<union> square2 n i (2^n + j) \<union>
  square2 n (2^n + i) (2^n + j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square2 (Suc n) i j = square2 n i j \<union> square2 n (2 ^ n + i) j \<union> square2 n i (2 ^ n + j) \<union> square2 n (2 ^ n + i) (2 ^ n + j)
[PROOF STEP]
by(auto simp:square2_def)


[STATEMENT]
lemma Imam_calc_aux: "$(I^{m}a)^{m}_n = (\<Sum>k<n*m. $v.^((k+1)/m) * (k+1) / m^2)"
  if "m \<noteq> 0" for m::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real (k + 1) / real (m\<^sup>2))
[PROOF STEP]
unfolding ann_incr_def power_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real_of_int \<lceil>real (m * (k + 1)) / real m\<rceil> / (real m * real m)) = (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real (k + 1) / real (rec_nat (\<lambda>a. 1) (\<lambda>n na a. a * na a) 2 m))
[PROOF STEP]
apply (rule sum.cong, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<n * m} \<Longrightarrow> $v .^ (real (x + 1) / real m) * real_of_int \<lceil>real (m * (x + 1)) / real m\<rceil> / (real m * real m) = $v .^ (real (x + 1) / real m) * real (x + 1) / real (rec_nat (\<lambda>a. 1) (\<lambda>n na a. a * na a) 2 m)
[PROOF STEP]
apply (subst of_nat_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<n * m} \<Longrightarrow> $v .^ (real (x + 1) / real m) * real_of_int \<lceil>real m * real (x + 1) / real m\<rceil> / (real m * real m) = $v .^ (real (x + 1) / real m) * real (x + 1) / real (rec_nat (\<lambda>a. 1) (\<lambda>n na a. a * na a) 2 m)
[PROOF STEP]
using v_pos that
[PROOF STATE]
proof (prove)
using this:
0 < $v
m \<noteq> 0

goal (1 subgoal):
 1. \<And>x. x \<in> {..<n * m} \<Longrightarrow> $v .^ (real (x + 1) / real m) * real_of_int \<lceil>real m * real (x + 1) / real m\<rceil> / (real m * real m) = $v .^ (real (x + 1) / real m) * real (x + 1) / real (rec_nat (\<lambda>a. 1) (\<lambda>n na a. a * na a) 2 m)
[PROOF STEP]
apply (subst nonzero_mult_div_cancel_left, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {..<n * m}; 0 < $v; m \<noteq> 0\<rbrakk> \<Longrightarrow> $v .^ (real (x + 1) / real m) * real_of_int \<lceil>real (x + 1)\<rceil> / (real m * real m) = $v .^ (real (x + 1) / real m) * real (x + 1) / real (rec_nat (\<lambda>a. 1) (\<lambda>n na a. a * na a) 2 m)
[PROOF STEP]
by (subst ceiling_of_nat; simp)


[STATEMENT]
lemma adjoint_dim_row [simp]:
  "dim_row (adjoint A) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (adjoint A) = dim_col A
[PROOF STEP]
by (simp add: mat_adjoint_def)


[STATEMENT]
lemma eqpoll_iff_card:
  assumes "finite A" "finite B"
  shows  "A \<approx> B \<longleftrightarrow> card A = card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<approx> B) = (card A = card B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. (A \<approx> B) = (card A = card B)
[PROOF STEP]
by (auto simp: bij_betw_iff_card eqpoll_def)


[STATEMENT]
lemma abs_triangle_half_r:
  fixes y :: "'a::linordered_field"
  shows "abs (y - x1) < e / 2 \<Longrightarrow> abs (y - x2) < e / 2 \<Longrightarrow> abs (x1 - x2) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<bar>y - x1\<bar> < e / (2::'a); \<bar>y - x2\<bar> < e / (2::'a)\<rbrakk> \<Longrightarrow> \<bar>x1 - x2\<bar> < e
[PROOF STEP]
by linarith


[STATEMENT]
lemma ln_fact_conv_sum_mangoldt:
  "sum_upto (\<lambda>n. mangoldt n * \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
have "sum_upto (\<lambda>n. mangoldt n * of_int \<lfloor>x / real n\<rfloor>) x =
          sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d :: real) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x
[PROOF STEP]
using sum_upto_divisor_sum1[of mangoldt x]
[PROOF STATE]
proof (prove)
using this:
sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x = sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
have "\<dots> = sum_upto (\<lambda>n. of_real (ln (real n))) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x = sum_upto (\<lambda>n. of_real (ln (real n))) x
[PROOF STEP]
by (intro sum_upto_cong mangoldt_sum refl) auto
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x = sum_upto (\<lambda>n. of_real (ln (real n))) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x = sum_upto (\<lambda>n. of_real (ln (real n))) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
have "\<dots> = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. ln n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. of_real (ln (real n))) x = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. ln (real n))
[PROOF STEP]
by (simp add: sum_upto_altdef)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. of_real (ln (real n))) x = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. ln (real n))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. of_real (ln (real n))) x = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. ln (real n))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
have "\<dots> = ln (\<Prod>{0<..nat \<lfloor>x\<rfloor>})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. ln (real n)) = ln (real (\<Prod>{0<..nat \<lfloor>x\<rfloor>}))
[PROOF STEP]
unfolding of_nat_prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. ln (real n)) = ln (prod real {0<..nat \<lfloor>x\<rfloor>})
[PROOF STEP]
by (subst ln_prod) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. ln (real n)) = ln (real (\<Prod>{0<..nat \<lfloor>x\<rfloor>}))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. ln (real n)) = ln (real (\<Prod>{0<..nat \<lfloor>x\<rfloor>}))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
have "{0<..nat \<lfloor>x\<rfloor>} = {1..nat \<lfloor>x\<rfloor>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0<..nat \<lfloor>x\<rfloor>} = {1..nat \<lfloor>x\<rfloor>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0<..nat \<lfloor>x\<rfloor>} = {1..nat \<lfloor>x\<rfloor>}

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{0<..nat \<lfloor>x\<rfloor>} = {1..nat \<lfloor>x\<rfloor>}

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
have "\<Prod>\<dots> = fact (nat \<lfloor>x\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>{1..nat \<lfloor>x\<rfloor>} = fact (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
by (simp add: fact_prod)
[PROOF STATE]
proof (state)
this:
\<Prod>{1..nat \<lfloor>x\<rfloor>} = fact (nat \<lfloor>x\<rfloor>)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (real (fact (nat \<lfloor>x\<rfloor>)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (real (fact (nat \<lfloor>x\<rfloor>)))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. mangoldt n * real_of_int \<lfloor>x / real n\<rfloor>) x = ln (fact (nat \<lfloor>x\<rfloor>))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infinite_contains_3_elems:
  assumes "infinite A"
  shows "\<exists> x y z. x \<noteq> y \<and> x \<noteq> z \<and> y \<noteq> z \<and> x \<in> A \<and> y \<in> A \<and> z \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y z. x \<noteq> y \<and> x \<noteq> z \<and> y \<noteq> z \<and> x \<in> A \<and> y \<in> A \<and> z \<in> A
[PROOF STEP]
by (metis Diff_iff assms infinite_contains_2_elems infinite_remove insertI1)


[STATEMENT]
lemma perms_comp [simp]:
  assumes f: "f \<in> perms" and g: "g \<in> perms"
  shows "(f \<circ> g) \<in> perms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> g \<in> perms
[PROOF STEP]
apply (intro permsI bij_comp)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. bij g
 2. bij f
 3. \<forall>\<^sub>\<infinity>x. (f \<circ> g) x = x
[PROOF STEP]
apply (rule perms_imp_bij [OF g])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. bij f
 2. \<forall>\<^sub>\<infinity>x. (f \<circ> g) x = x
[PROOF STEP]
apply (rule perms_imp_bij [OF f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>\<infinity>x. (f \<circ> g) x = x
[PROOF STEP]
apply (rule MOST_rev_mp [OF perms_imp_MOST_eq [OF g]])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>\<infinity>x. g x = x \<longrightarrow> (f \<circ> g) x = x
[PROOF STEP]
apply (rule MOST_rev_mp [OF perms_imp_MOST_eq [OF f]])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>\<infinity>x. f x = x \<longrightarrow> g x = x \<longrightarrow> (f \<circ> g) x = x
[PROOF STEP]
by simp


[STATEMENT]
lemma length_prefix_ex2:
  assumes "i < length xs" "j < length xs" "i < j"
  shows "\<exists>ys zs vs. xs = ys@xs ! i#zs@xs ! j#vs \<and> length ys = i \<and> length zs = j - i - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ys zs vs. xs = ys @ xs ! i # zs @ xs ! j # vs \<and> length ys = i \<and> length zs = j - i - 1
[PROOF STEP]
by (smt assms length_prefix_ex' nth_append append.assoc append.simps(2) add_diff_cancel_left'
        diff_Suc_1 length_Cons length_append)


[STATEMENT]
lemma acyclic_5b_implies_4:
  assumes "irreflexive x"
      and "acyclic_5b x"
    shows "acyclic_4 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. acyclic_4 x
[PROOF STEP]
proof (unfold acyclic_4_def, rule allI, rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<le> x \<Longrightarrow> x \<sqinter> y\<^sup>\<star> \<le> - - y
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<le> x \<Longrightarrow> x \<sqinter> y\<^sup>\<star> \<le> - - y
[PROOF STEP]
assume "y \<le> x"
[PROOF STATE]
proof (state)
this:
y \<le> x

goal (1 subgoal):
 1. \<And>y. y \<le> x \<Longrightarrow> x \<sqinter> y\<^sup>\<star> \<le> - - y
[PROOF STEP]
hence "y\<^sup>\<star> \<sqinter> (x \<sqinter> -y)\<^sup>+ \<le> 1"
[PROOF STATE]
proof (prove)
using this:
y \<le> x

goal (1 subgoal):
 1. coreflexive (y\<^sup>\<star> \<sqinter> (x \<sqinter> - y)\<^sup>+)
[PROOF STEP]
using acyclic_5b_def assms(2)
[PROOF STATE]
proof (prove)
using this:
y \<le> x
acyclic_5b ?x \<equiv> \<forall>y\<le>?x. coreflexive (y\<^sup>\<star> \<sqinter> (?x \<sqinter> - y)\<^sup>+)
acyclic_5b x

goal (1 subgoal):
 1. coreflexive (y\<^sup>\<star> \<sqinter> (x \<sqinter> - y)\<^sup>+)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
coreflexive (y\<^sup>\<star> \<sqinter> (x \<sqinter> - y)\<^sup>+)

goal (1 subgoal):
 1. \<And>y. y \<le> x \<Longrightarrow> x \<sqinter> y\<^sup>\<star> \<le> - - y
[PROOF STEP]
hence "y\<^sup>\<star> \<sqinter> x \<sqinter> -y \<le> 1"
[PROOF STATE]
proof (prove)
using this:
coreflexive (y\<^sup>\<star> \<sqinter> (x \<sqinter> - y)\<^sup>+)

goal (1 subgoal):
 1. coreflexive (y\<^sup>\<star> \<sqinter> x \<sqinter> - y)
[PROOF STEP]
by (smt inf.sup_left_divisibility inf.sup_monoid.add_assoc star.circ_mult_increasing)
[PROOF STATE]
proof (state)
this:
coreflexive (y\<^sup>\<star> \<sqinter> x \<sqinter> - y)

goal (1 subgoal):
 1. \<And>y. y \<le> x \<Longrightarrow> x \<sqinter> y\<^sup>\<star> \<le> - - y
[PROOF STEP]
hence "y\<^sup>\<star> \<sqinter> x \<sqinter> -y = bot"
[PROOF STATE]
proof (prove)
using this:
coreflexive (y\<^sup>\<star> \<sqinter> x \<sqinter> - y)

goal (1 subgoal):
 1. y\<^sup>\<star> \<sqinter> x \<sqinter> - y = bot
[PROOF STEP]
by (smt assms(1) comp_inf.semiring.mult_zero_left inf.orderE inf.sup_monoid.add_assoc inf.sup_monoid.add_commute pseudo_complement)
[PROOF STATE]
proof (state)
this:
y\<^sup>\<star> \<sqinter> x \<sqinter> - y = bot

goal (1 subgoal):
 1. \<And>y. y \<le> x \<Longrightarrow> x \<sqinter> y\<^sup>\<star> \<le> - - y
[PROOF STEP]
thus "x \<sqinter> y\<^sup>\<star> \<le> --y"
[PROOF STATE]
proof (prove)
using this:
y\<^sup>\<star> \<sqinter> x \<sqinter> - y = bot

goal (1 subgoal):
 1. x \<sqinter> y\<^sup>\<star> \<le> - - y
[PROOF STEP]
using inf.sup_monoid.add_commute pseudo_complement
[PROOF STATE]
proof (prove)
using this:
y\<^sup>\<star> \<sqinter> x \<sqinter> - y = bot
?a \<sqinter> ?b = ?b \<sqinter> ?a
(?x \<sqinter> ?y = bot) = (?x \<le> - ?y)

goal (1 subgoal):
 1. x \<sqinter> y\<^sup>\<star> \<le> - - y
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<sqinter> y\<^sup>\<star> \<le> - - y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conv_radius_ratio_limit_ereal_nonzero:
  fixes f :: "nat \<Rightarrow> 'a :: {banach,real_normed_div_algebra}"
  assumes nz:  "c \<noteq> 0"
  assumes lim: "(\<lambda>n. ereal (norm (f n) / norm (f (Suc n)))) \<longlonglongrightarrow> c"
  shows   "conv_radius f = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius f = c
[PROOF STEP]
proof (rule conv_radius_ratio_limit_ereal[OF _ lim], rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
assume "\<not>eventually (\<lambda>n. f n \<noteq> 0) sequentially"
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a))

goal (1 subgoal):
 1. \<not> (\<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
hence "frequently (\<lambda>n. f n = 0) sequentially"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a))

goal (1 subgoal):
 1. \<exists>\<^sub>F n in sequentially. f n = (0::'a)
[PROOF STEP]
by (simp add: frequently_def)
[PROOF STATE]
proof (state)
this:
\<exists>\<^sub>F n in sequentially. f n = (0::'a)

goal (1 subgoal):
 1. \<not> (\<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
hence "frequently (\<lambda>n. ereal (norm (f n) / norm (f (Suc n))) = 0) sequentially"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<^sub>F n in sequentially. f n = (0::'a)

goal (1 subgoal):
 1. \<exists>\<^sub>F n in sequentially. ereal (norm (f n) / norm (f (Suc n))) = 0
[PROOF STEP]
by (force elim!: frequently_elim1)
[PROOF STATE]
proof (state)
this:
\<exists>\<^sub>F n in sequentially. ereal (norm (f n) / norm (f (Suc n))) = 0

goal (1 subgoal):
 1. \<not> (\<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
hence "c = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<^sub>F n in sequentially. ereal (norm (f n) / norm (f (Suc n))) = 0

goal (1 subgoal):
 1. c = 0
[PROOF STEP]
by (intro limit_frequently_eq[OF _ _ lim]) auto
[PROOF STATE]
proof (state)
this:
c = 0

goal (1 subgoal):
 1. \<not> (\<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
with nz
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> 0
c = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
c = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_powr_eq: "0 < b \<Longrightarrow> b \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> x * b powr y = b powr (y + log b x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b; b \<noteq> 1; 0 < x\<rbrakk> \<Longrightarrow> x * b powr y = b powr (y + log b x)
[PROOF STEP]
by (simp_all add: powr_add)


[STATEMENT]
lemma index_tensor_mat':
  assumes "0 < dim_col A"
  and "0 < dim_col B"
  and "i < dim_row A * dim_row B"
  and "j < dim_col A * dim_col B"
  shows "(A \<Otimes> B) $$ (i, j) =
    A $$ (i div (dim_row B), j div (dim_col B)) * B $$ (i mod (dim_row B), j mod (dim_col B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<Otimes> B) $$ (i, j) = A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B)
[PROOF STEP]
by (rule index_tensor_mat, (simp add: assms)+)


[STATEMENT]
lemma powreal_ge_one2:
   "\<lbrakk> 0 < a; a < 1; x \<le> 0 \<rbrakk> \<Longrightarrow> a pow\<^sub>\<real> x \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a < 1; x \<le> 0\<rbrakk> \<Longrightarrow> 1 \<le> a pow\<^sub>\<real> x
[PROOF STEP]
by (simp add: powa_ge_one powreal_def real_inverse_ge_one_lemma)


[STATEMENT]
lemma winding_number_zero_point:
    "\<lbrakk>path \<gamma>; convex S; pathfinish \<gamma> = pathstart \<gamma>; open S; path_image \<gamma> \<subseteq> S\<rbrakk>
     \<Longrightarrow> \<exists>z. z \<in> S \<and> winding_number \<gamma> z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path \<gamma>; convex S; pathfinish \<gamma> = pathstart \<gamma>; open S; path_image \<gamma> \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> S \<and> winding_number \<gamma> z = 0
[PROOF STEP]
using outside_compact_in_open [of "path_image \<gamma>" S] path_image_nonempty winding_number_zero_in_outside
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>compact (path_image \<gamma>); open S; path_image \<gamma> \<subseteq> S; S \<noteq> {}\<rbrakk> \<Longrightarrow> outside (path_image \<gamma>) \<inter> S \<noteq> {}
path_image ?g \<noteq> {}
\<lbrakk>path ?\<gamma>; pathfinish ?\<gamma> = pathstart ?\<gamma>; ?z \<in> outside (path_image ?\<gamma>)\<rbrakk> \<Longrightarrow> winding_number ?\<gamma> ?z = 0

goal (1 subgoal):
 1. \<lbrakk>path \<gamma>; convex S; pathfinish \<gamma> = pathstart \<gamma>; open S; path_image \<gamma> \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> S \<and> winding_number \<gamma> z = 0
[PROOF STEP]
by (fastforce simp add: compact_path_image)


[STATEMENT]
lemma nasty_split_lt:
  \<open>x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1\<close>
    if \<open>x < 2 ^ (m - n)\<close> \<open>n \<le> m\<close> \<open>m < LENGTH('a::len)\<close>
    for x :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1
[PROOF STEP]
define q where \<open>q = m - n\<close>
[PROOF STATE]
proof (state)
this:
q = m - n

goal (1 subgoal):
 1. x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1
[PROOF STEP]
with \<open>n \<le> m\<close>
[PROOF STATE]
proof (chain)
picking this:
n \<le> m
q = m - n
[PROOF STEP]
have \<open>m = q + n\<close>
[PROOF STATE]
proof (prove)
using this:
n \<le> m
q = m - n

goal (1 subgoal):
 1. m = q + n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m = q + n

goal (1 subgoal):
 1. x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1
[PROOF STEP]
with \<open>x < 2 ^ (m - n)\<close>
[PROOF STATE]
proof (chain)
picking this:
x < 2 ^ (m - n)
m = q + n
[PROOF STEP]
have *: \<open>i < q\<close> if \<open>bit x i\<close> for i
[PROOF STATE]
proof (prove)
using this:
x < 2 ^ (m - n)
m = q + n

goal (1 subgoal):
 1. i < q
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x < 2 ^ (m - n)
m = q + n
bit x i

goal (1 subgoal):
 1. i < q
[PROOF STEP]
by simp (metis bit_take_bit_iff take_bit_word_eq_self_iff)
[PROOF STATE]
proof (state)
this:
bit x ?i \<Longrightarrow> ?i < q

goal (1 subgoal):
 1. x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1
[PROOF STEP]
from \<open>m = q + n\<close>
[PROOF STATE]
proof (chain)
picking this:
m = q + n
[PROOF STEP]
have \<open>push_bit n x OR mask n \<le> mask m\<close>
[PROOF STATE]
proof (prove)
using this:
m = q + n

goal (1 subgoal):
 1. push_bit n x OR mask n \<le> mask m
[PROOF STEP]
by (auto simp add: le_mask_high_bits word_size bit_simps dest!: *)
[PROOF STATE]
proof (state)
this:
push_bit n x OR mask n \<le> mask m

goal (1 subgoal):
 1. x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
push_bit n x OR mask n \<le> mask m
[PROOF STEP]
have \<open>push_bit n x + mask n \<le> mask m\<close>
[PROOF STATE]
proof (prove)
using this:
push_bit n x OR mask n \<le> mask m

goal (1 subgoal):
 1. push_bit n x + mask n \<le> mask m
[PROOF STEP]
by (simp add: disjunctive_add bit_simps)
[PROOF STATE]
proof (state)
this:
push_bit n x + mask n \<le> mask m

goal (1 subgoal):
 1. x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
push_bit n x + mask n \<le> mask m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
push_bit n x + mask n \<le> mask m

goal (1 subgoal):
 1. x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1
[PROOF STEP]
by (simp add: mask_eq_exp_minus_1 push_bit_eq_mult)
[PROOF STATE]
proof (state)
this:
x * 2 ^ n + (2 ^ n - 1) \<le> 2 ^ m - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem quotient_composition_closed [intro, simp]:
  "\<lbrakk> A \<in> M / E; B \<in> M / E \<rbrakk> \<Longrightarrow> A [\<cdot>] B \<in> M / E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> Partition; B \<in> Partition\<rbrakk> \<Longrightarrow> A [\<cdot>] B \<in> Partition
[PROOF STEP]
by (erule quotient_ClassE)+ (simp add: Class_commutes_with_composition)


[STATEMENT]
lemma integral_combine_tagged_division_bottomup:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes p: "p tagged_division_of (cbox a b)"
    and f: "\<And>x k. (x,k)\<in>p \<Longrightarrow> f integrable_on k"
  shows "integral (cbox a b) f = sum (\<lambda>(x,k). integral k f) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cbox a b) f = (\<Sum>(x, k)\<in>p. integral k f)
[PROOF STEP]
by (simp add: has_integral_combine_tagged_division[OF p] integral_unique f integrable_integral)


[STATEMENT]
lemma NR\<^sub>N_recurrence':
  assumes "0 < n" "p \<in> {0<..<1}"
  shows "NR\<^sub>N n u l = (p * l + p * NR\<^sub>N (n - 1) u l +
                     q * u + q * (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * (pmf (binomial_pmf (n - 1) q) k)))
                     / (1 - (q ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal (p * real l) + ennreal p * NR\<^sub>N (n - 1) u l + ennreal (q * real u) + ennreal q * (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k))) / ennreal (1 - q ^ n)
[PROOF STEP]
unfolding NR\<^sub>N_recurrence[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n) = (ennreal (p * real l) + ennreal p * NR\<^sub>N (n - 1) u l + ennreal (q * real u) + ennreal q * (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k))) / ennreal (1 - q ^ n)
[PROOF STEP]
by (auto simp add: field_simps ennreal_of_nat_eq_real_of_nat ennreal_mult' ennreal_mult'')


[STATEMENT]
lemma has_derivative_divide[simp, derivative_intros]:
  fixes f :: "_ \<Rightarrow> 'a::real_normed_div_algebra"
  assumes f: "(f has_derivative f') (at x within S)"
    and g: "(g has_derivative g') (at x within S)"
  assumes x: "g x \<noteq> 0"
  shows "((\<lambda>x. f x / g x) has_derivative
                (\<lambda>h. - f x * (inverse (g x) * g' h * inverse (g x)) + f' h / g x)) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) has_derivative (\<lambda>h. - f x * (inverse (g x) * g' h * inverse (g x)) + f' h / g x)) (at x within S)
[PROOF STEP]
using has_derivative_mult[OF f has_derivative_inverse[OF x g]]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f x * inverse (g x)) has_derivative (\<lambda>h. f x * - (inverse (g x) * g' h * inverse (g x)) + f' h * inverse (g x))) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) has_derivative (\<lambda>h. - f x * (inverse (g x) * g' h * inverse (g x)) + f' h / g x)) (at x within S)
[PROOF STEP]
by (simp add: field_simps)