[STATEMENT]
lemma topology_finer_continuous_id:
  assumes "topspace X = topspace Y"
  shows "(\<forall>S. openin X S \<longrightarrow> openin Y S) \<longleftrightarrow> continuous_map Y X id"  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>S. openin X S \<longrightarrow> openin Y S) = continuous_map Y X id
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>S. openin X S \<longrightarrow> openin Y S \<Longrightarrow> continuous_map Y X id
 2. continuous_map Y X id \<Longrightarrow> \<forall>S. openin X S \<longrightarrow> openin Y S
[PROOF STEP]
show "?lhs \<Longrightarrow> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>S. openin X S \<longrightarrow> openin Y S \<Longrightarrow> continuous_map Y X id
[PROOF STEP]
unfolding continuous_map_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>S. openin X S \<longrightarrow> openin Y S \<Longrightarrow> (\<forall>x\<in>topspace Y. id x \<in> topspace X) \<and> (\<forall>U. openin X U \<longrightarrow> openin Y {x \<in> topspace Y. id x \<in> U})
[PROOF STEP]
using assms openin_subopen openin_subset
[PROOF STATE]
proof (prove)
using this:
topspace X = topspace Y
openin ?U ?S = (\<forall>x\<in>?S. \<exists>T. openin ?U T \<and> x \<in> T \<and> T \<subseteq> ?S)
openin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. \<forall>S. openin X S \<longrightarrow> openin Y S \<Longrightarrow> (\<forall>x\<in>topspace Y. id x \<in> topspace X) \<and> (\<forall>U. openin X U \<longrightarrow> openin Y {x \<in> topspace Y. id x \<in> U})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>S. openin X S \<longrightarrow> openin Y S \<Longrightarrow> continuous_map Y X id

goal (1 subgoal):
 1. continuous_map Y X id \<Longrightarrow> \<forall>S. openin X S \<longrightarrow> openin Y S
[PROOF STEP]
show "?rhs \<Longrightarrow> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map Y X id \<Longrightarrow> \<forall>S. openin X S \<longrightarrow> openin Y S
[PROOF STEP]
unfolding continuous_map_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>topspace Y. id x \<in> topspace X) \<and> (\<forall>U. openin X U \<longrightarrow> openin Y {x \<in> topspace Y. id x \<in> U}) \<Longrightarrow> \<forall>S. openin X S \<longrightarrow> openin Y S
[PROOF STEP]
using assms openin_subopen topspace_def
[PROOF STATE]
proof (prove)
using this:
topspace X = topspace Y
openin ?U ?S = (\<forall>x\<in>?S. \<exists>T. openin ?U T \<and> x \<in> T \<and> T \<subseteq> ?S)
topspace ?T = \<Union> {S. openin ?T S}

goal (1 subgoal):
 1. (\<forall>x\<in>topspace Y. id x \<in> topspace X) \<and> (\<forall>U. openin X U \<longrightarrow> openin Y {x \<in> topspace Y. id x \<in> U}) \<Longrightarrow> \<forall>S. openin X S \<longrightarrow> openin Y S
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
continuous_map Y X id \<Longrightarrow> \<forall>S. openin X S \<longrightarrow> openin Y S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in sigma_algebra) countable_INT':
  fixes A :: "'i \<Rightarrow> 'a set"
  assumes X: "countable X" "X \<noteq> {}"
  assumes A: "A`X \<subseteq> M"
  shows  "(\<Inter>x\<in>X. A x) \<in> M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (A ` X) \<in> M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> (A ` X) \<in> M
[PROOF STEP]
have "(\<Inter>x\<in>X. A x) = (\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (A ` X) = (\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i))
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
countable X
X \<noteq> {}

goal (1 subgoal):
 1. \<Inter> (A ` X) = (\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Inter> (A ` X) = (\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i))

goal (1 subgoal):
 1. \<Inter> (A ` X) \<in> M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Inter> (A ` X) = (\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i))

goal (1 subgoal):
 1. \<Inter> (A ` X) \<in> M
[PROOF STEP]
have "\<dots> \<in> M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i)) \<in> M
[PROOF STEP]
using A X
[PROOF STATE]
proof (prove)
using this:
A ` X \<subseteq> M
countable X
X \<noteq> {}

goal (1 subgoal):
 1. (\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i)) \<in> M
[PROOF STEP]
by (intro countable_INT) auto
[PROOF STATE]
proof (state)
this:
(\<Inter>i\<in>to_nat_on X ` X. A (from_nat_into X i)) \<in> M

goal (1 subgoal):
 1. \<Inter> (A ` X) \<in> M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Inter> (A ` X) \<in> M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Inter> (A ` X) \<in> M

goal (1 subgoal):
 1. \<Inter> (A ` X) \<in> M
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Inter> (A ` X) \<in> M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lindelof_spaceD:
  "\<lbrakk>Lindelof_space X; \<And>U. U \<in> \<U> \<Longrightarrow> openin X U; \<Union>\<U> = topspace X\<rbrakk>
  \<Longrightarrow> \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union>\<V> = topspace X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Lindelof_space X; \<And>U. U \<in> \<U> \<Longrightarrow> openin X U; \<Union> \<U> = topspace X\<rbrakk> \<Longrightarrow> \<exists>\<V>. countable \<V> \<and> \<V> \<subseteq> \<U> \<and> \<Union> \<V> = topspace X
[PROOF STEP]
by (auto simp: Lindelof_space_def)


[STATEMENT]
lemma complex_vector_eq_affinity: "m \<noteq> 0 \<Longrightarrow> y = m *\<^sub>C x + c \<longleftrightarrow> inverse m *\<^sub>C y - (inverse m *\<^sub>C c) = x"
  for x :: "'a::complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> (y = m *\<^sub>C x + c) = (y /\<^sub>C m - c /\<^sub>C m = x)
[PROOF STEP]
using complex_vector_affinity_eq[where m=m and x=x and y=y and c=c]
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0 \<Longrightarrow> (m *\<^sub>C x + c = y) = (x = y /\<^sub>C m - c /\<^sub>C m)

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> (y = m *\<^sub>C x + c) = (y /\<^sub>C m - c /\<^sub>C m = x)
[PROOF STEP]
by metis


[STATEMENT]
lemma leadsTo_Union_Int:
 "(!!A. A \<in> S ==> F \<in> (A \<inter> C) leadsTo B) ==> F \<in> (\<Union>S \<inter> C) leadsTo B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A. A \<in> S \<Longrightarrow> F \<in> A \<inter> C \<longmapsto> B) \<Longrightarrow> F \<in> \<Union> S \<inter> C \<longmapsto> B
[PROOF STEP]
apply (unfold leadsTo_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A. A \<in> S \<Longrightarrow> F \<in> {F. (A \<inter> C, B) \<in> leads F}) \<Longrightarrow> F \<in> {F. (\<Union> S \<inter> C, B) \<in> leads F}
[PROOF STEP]
apply (simp only: Int_Union_Union)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A. A \<in> S \<Longrightarrow> F \<in> {F. (A \<inter> C, B) \<in> leads F}) \<Longrightarrow> F \<in> {F. (\<Union>Ca\<in>S. Ca \<inter> C, B) \<in> leads F}
[PROOF STEP]
apply (blast intro: leads.Union)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dist_fs_cvec_iff:
  assumes "z \<noteq> vec_zero" and "w \<noteq> vec_zero"
  shows "dist_fs_cvec z w = 2*sqrt(1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
obtain z1 z2 w1 w2 where *: "z = (z1, z2)" "w = (w1, w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z1 z2 w1 w2. \<lbrakk>z = (z1, z2); w = (w1, w2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "z", cases "w") auto
[PROOF STATE]
proof (state)
this:
z = (z1, z2)
w = (w1, w2)

goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
have 1: "2*sqrt(1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)) = 2*sqrt((\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2) / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)) = 2 * sqrt ((\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2) / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
using norm_cvec_gt_0[of z] norm_cvec_gt_0[of w] assms
[PROOF STATE]
proof (prove)
using this:
z \<noteq> vec_zero \<Longrightarrow> 0 < \<langle>z\<rangle>
w \<noteq> vec_zero \<Longrightarrow> 0 < \<langle>w\<rangle>
z \<noteq> vec_zero
w \<noteq> vec_zero

goal (1 subgoal):
 1. 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)) = 2 * sqrt ((\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2) / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)) = 2 * sqrt ((\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2) / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))

goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
have 2: "\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 = Re ((z1*cnj z1 + z2*cnj z2) * (w1*cnj w1 + w2*cnj w2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 = Re ((z1 * cnj z1 + z2 * cnj z2) * (w1 * cnj w1 + w2 * cnj w2))
[PROOF STEP]
using assms *
[PROOF STATE]
proof (prove)
using this:
z \<noteq> vec_zero
w \<noteq> vec_zero
z = (z1, z2)
w = (w1, w2)

goal (1 subgoal):
 1. \<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 = Re ((z1 * cnj z1 + z2 * cnj z2) * (w1 * cnj w1 + w2 * cnj w2))
[PROOF STEP]
by (simp add: vec_cnj_def)
[PROOF STATE]
proof (state)
this:
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 = Re ((z1 * cnj z1 + z2 * cnj z2) * (w1 * cnj w1 + w2 * cnj w2))

goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
have 3: "\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1*w2 - w1*z2) * (cnj z1*cnj w2 - cnj w1*cnj z2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))
[PROOF STEP]
apply (subst cmod_square, (subst norm_cvec_square)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re \<langle>z,z\<rangle> * Re \<langle>w,w\<rangle> - Re (\<langle>z,w\<rangle> * cnj \<langle>z,w\<rangle>) = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
z = (z1, z2)
w = (w1, w2)

goal (1 subgoal):
 1. Re \<langle>z,z\<rangle> * Re \<langle>w,w\<rangle> - Re (\<langle>z,w\<rangle> * cnj \<langle>z,w\<rangle>) = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))
[PROOF STEP]
by (simp add: vec_cnj_def field_simps)
[PROOF STATE]
proof (state)
this:
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))

goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))

goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
using 1 2 3
[PROOF STATE]
proof (prove)
using this:
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))
2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)) = 2 * sqrt ((\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2) / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 = Re ((z1 * cnj z1 + z2 * cnj z2) * (w1 * cnj w1 + w2 * cnj w2))
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))

goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))
2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)) = 2 * sqrt ((\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2) / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 = Re ((z1 * cnj z1 + z2 * cnj z2) * (w1 * cnj w1 + w2 * cnj w2))
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))
z = (z1, z2)
w = (w1, w2)

goal (1 subgoal):
 1. dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
unfolding dist_fs_cvec_def Let_def
[PROOF STATE]
proof (prove)
using this:
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))
2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2)) = 2 * sqrt ((\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2) / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 = Re ((z1 * cnj z1 + z2 * cnj z2) * (w1 * cnj w1 + w2 * cnj w2))
\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2 - (cmod \<langle>z,w\<rangle>)\<^sup>2 = Re ((z1 * w2 - w1 * z2) * (cnj z1 * cnj w2 - cnj w1 * cnj z2))
z = (z1, z2)
w = (w1, w2)

goal (1 subgoal):
 1. (case z of (z1x, z1y) \<Rightarrow> case w of (z2x, z2y) \<Rightarrow> 2 * sqrt (Re ((z1x * z2y - z2x * z1y) * (cnj z1x * cnj z2y - cnj z2x * cnj z1y)) / Re ((z1x * cnj z1x + z1y * cnj z1y) * (z2x * cnj z2x + z2y * cnj z2y)))) = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dist_fs_cvec z w = 2 * sqrt (1 - (cmod \<langle>z,w\<rangle>)\<^sup>2 / (\<langle>z\<rangle>\<^sup>2 * \<langle>w\<rangle>\<^sup>2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_mset_rempdups_union_mset:
  assumes "distinct_mset A" and "distinct_mset B"
  shows "A \<union># B = remdups_mset (A + B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union># B = remdups_mset (A + B)
[PROOF STEP]
using assms nat_le_linear
[PROOF STATE]
proof (prove)
using this:
distinct_mset A
distinct_mset B
?m \<le> ?n \<or> ?n \<le> ?m

goal (1 subgoal):
 1. A \<union># B = remdups_mset (A + B)
[PROOF STEP]
unfolding remdups_mset_def
[PROOF STATE]
proof (prove)
using this:
distinct_mset A
distinct_mset B
?m \<le> ?n \<or> ?n \<le> ?m

goal (1 subgoal):
 1. A \<union># B = mset_set (set_mset (A + B))
[PROOF STEP]
by (force simp add: multiset_eq_iff max_def count_mset_set_if distinct_mset_def not_in_iff)


[STATEMENT]
lemma greatest_ge_nonzero_row':
  fixes A::"'a::{bezout_ring}^'cols::{mod_type}^'rows::{mod_type}"
  assumes r: "echelon_form_upt_k A k"
  and i: "i \<le> (GREATEST m. \<not> is_zero_row_upt_k m k A)"
  and not_all_zero: "\<not> (\<forall>a. is_zero_row_upt_k a k A)"
  shows "\<not> is_zero_row_upt_k i k A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_zero_row_upt_k i k A
[PROOF STEP]
using greatest_less_zero_row[OF r] i not_all_zero
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_zero_row_upt_k ?i k A; \<not> (\<forall>a. is_zero_row_upt_k a k A)\<rbrakk> \<Longrightarrow> (GREATEST m. \<not> is_zero_row_upt_k m k A) < ?i
i \<le> (GREATEST m. \<not> is_zero_row_upt_k m k A)
\<not> (\<forall>a. is_zero_row_upt_k a k A)

goal (1 subgoal):
 1. \<not> is_zero_row_upt_k i k A
[PROOF STEP]
by fastforce


[STATEMENT]
lemma continuous_within_sequentiallyI:
  fixes f :: "'a::{first_countable_topology, t2_space} \<Rightarrow> 'b::topological_space"
  assumes "\<And>u::nat \<Rightarrow> 'a. u \<longlonglongrightarrow> a \<Longrightarrow> (\<forall>n. u n \<in> s) \<Longrightarrow> (\<lambda>n. f (u n)) \<longlonglongrightarrow> f a"
  shows "continuous (at a within s) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at a within s) f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<longlonglongrightarrow> a; \<forall>n. ?u n \<in> s\<rbrakk> \<Longrightarrow> (\<lambda>n. f (?u n)) \<longlonglongrightarrow> f a

goal (1 subgoal):
 1. continuous (at a within s) f
[PROOF STEP]
unfolding continuous_within tendsto_def[where l = "f a"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<longlonglongrightarrow> a; \<forall>n. ?u n \<in> s\<rbrakk> \<Longrightarrow> \<forall>S. open S \<longrightarrow> f a \<in> S \<longrightarrow> (\<forall>\<^sub>F x in sequentially. f (?u x) \<in> S)

goal (1 subgoal):
 1. \<forall>S. open S \<longrightarrow> f a \<in> S \<longrightarrow> (\<forall>\<^sub>F x in at a within s. f x \<in> S)
[PROOF STEP]
by (auto intro!: sequentially_imp_eventually_within)


[STATEMENT]
lemma M_1[simp]: "M 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M 1 = 1
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 mod m = 1
[PROOF STEP]
using m1
[PROOF STATE]
proof (prove)
using this:
1 < m

goal (1 subgoal):
 1. 1 mod m = 1
[PROOF STEP]
by auto


[STATEMENT]
lemma measure_frontier:
   "bounded S \<Longrightarrow> measure lebesgue (frontier S) = measure lebesgue (closure S) - measure lebesgue (interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded S \<Longrightarrow> Sigma_Algebra.measure lebesgue (frontier S) = Sigma_Algebra.measure lebesgue (closure S) - Sigma_Algebra.measure lebesgue (interior S)
[PROOF STEP]
using closure_subset interior_subset
[PROOF STATE]
proof (prove)
using this:
?S \<subseteq> closure ?S
interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. bounded S \<Longrightarrow> Sigma_Algebra.measure lebesgue (frontier S) = Sigma_Algebra.measure lebesgue (closure S) - Sigma_Algebra.measure lebesgue (interior S)
[PROOF STEP]
by (auto simp: frontier_def fmeasurable_compact intro!: measurable_measure_Diff)


[STATEMENT]
lemma  det_nz_iff_inj:
  fixes f :: "real^'n \<Rightarrow> real^'n"
  assumes "linear f"
  shows "det (matrix f) \<noteq> 0 \<longleftrightarrow> inj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (det (matrix f) \<noteq> 0) = inj f
[PROOF STEP]
using det_nz_iff_inj_gen[of f] assms
[PROOF STATE]
proof (prove)
using this:
Vector_Spaces.linear (*s) (*s) f \<Longrightarrow> (det (matrix f) \<noteq> 0) = inj f
linear f

goal (1 subgoal):
 1. (det (matrix f) \<noteq> 0) = inj f
[PROOF STEP]
unfolding linear_matrix_vector_mul_eq
[PROOF STATE]
proof (prove)
using this:
linear f \<Longrightarrow> (det (matrix f) \<noteq> 0) = inj f
linear f

goal (1 subgoal):
 1. (det (matrix f) \<noteq> 0) = inj f
[PROOF STEP]
.


[STATEMENT]
lemma is_aligned_add:
  "\<lbrakk>is_aligned p n; is_aligned q n\<rbrakk> \<Longrightarrow> is_aligned (p + q) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_aligned p n; is_aligned q n\<rbrakk> \<Longrightarrow> is_aligned (p + q) n
[PROOF STEP]
by (simp add: is_aligned_mask mask_add_aligned)


[STATEMENT]
theorem avl_insert_auto: "avl t \<Longrightarrow>
  avl(insert x t) \<and> height (insert x t) \<in> {height t, height t + 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. avl t \<Longrightarrow> avl (AVL_Set_Code.insert x t) \<and> height (AVL_Set_Code.insert x t) \<in> {height t, height t + 1}
[PROOF STEP]
apply (induction t rule: tree2_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. avl \<langle>\<rangle> \<Longrightarrow> avl (AVL_Set_Code.insert x \<langle>\<rangle>) \<and> height (AVL_Set_Code.insert x \<langle>\<rangle>) \<in> {height \<langle>\<rangle>, height \<langle>\<rangle> + 1}
 2. \<And>x1 a b x3. \<lbrakk>avl x1 \<Longrightarrow> avl (AVL_Set_Code.insert x x1) \<and> height (AVL_Set_Code.insert x x1) \<in> {height x1, height x1 + 1}; avl x3 \<Longrightarrow> avl (AVL_Set_Code.insert x x3) \<and> height (AVL_Set_Code.insert x x3) \<in> {height x3, height x3 + 1}; avl \<langle>x1, (a, b), x3\<rangle>\<rbrakk> \<Longrightarrow> avl (AVL_Set_Code.insert x \<langle>x1, (a, b), x3\<rangle>) \<and> height (AVL_Set_Code.insert x \<langle>x1, (a, b), x3\<rangle>) \<in> {height \<langle>x1, (a, b), x3\<rangle>, height \<langle>x1, (a, b), x3\<rangle> + 1}
[PROOF STEP]
apply (auto simp: balL_def balR_def node_def max_absorb2 split!: if_split tree.split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Fourier_sum_limit_Dirichlet_kernel:
  assumes f: "f absolutely_integrable_on {-pi..pi}" and periodic: "\<And>x. f(x + 2*pi) = f x"
  shows "((\<lambda>n. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t)) \<longlonglongrightarrow> l)
     \<longleftrightarrow> (\<lambda>n. LINT x|lebesgue_on {-pi..pi}. Dirichlet_kernel n x * f(x + t)) \<longlonglongrightarrow> pi * l"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
have "?lhs \<longleftrightarrow> (\<lambda>n. (LINT x|lebesgue_on {-pi..pi}. Dirichlet_kernel n x * f(x + t)) / pi) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) / pi) \<longlonglongrightarrow> l
[PROOF STEP]
by (simp add: Fourier_sum_limit_pair [OF f, symmetric] Fourier_sum_offset_Dirichlet_kernel assms)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) / pi) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) / pi) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<lambda>k. (LINT x|lebesgue_on {-pi..pi}. Dirichlet_kernel k x * f(x + t)) * inverse pi)
                    \<longlonglongrightarrow> pi * l * inverse pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) / pi) \<longlonglongrightarrow> l = (\<lambda>k. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel k x * f (x + t)) * inverse pi) \<longlonglongrightarrow> pi * l * inverse pi
[PROOF STEP]
by (auto simp: divide_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) / pi) \<longlonglongrightarrow> l = (\<lambda>k. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel k x * f (x + t)) * inverse pi) \<longlonglongrightarrow> pi * l * inverse pi

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) / pi) \<longlonglongrightarrow> l = (\<lambda>k. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel k x * f (x + t)) * inverse pi) \<longlonglongrightarrow> pi * l * inverse pi

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
have "\<dots> \<longleftrightarrow> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel k x * f (x + t)) * inverse pi) \<longlonglongrightarrow> pi * l * inverse pi = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
using tendsto_mult_right_iff [of "inverse pi", symmetric]
[PROOF STATE]
proof (prove)
using this:
inverse pi \<noteq> 0 \<Longrightarrow> (?f \<longlongrightarrow> ?l) ?F = ((\<lambda>x. ?f x * inverse pi) \<longlongrightarrow> ?l * inverse pi) ?F

goal (1 subgoal):
 1. (\<lambda>k. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel k x * f (x + t)) * inverse pi) \<longlonglongrightarrow> pi * l * inverse pi = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>k. (LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel k x * f (x + t)) * inverse pi) \<longlonglongrightarrow> pi * l * inverse pi = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> l = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_Groebner_basis_singleton: "is_Groebner_basis {f}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Groebner_basis {f}
[PROOF STEP]
by (rule Buchberger_criterion_finite, simp, simp add: spoly_same)


[STATEMENT]
theorem exp_cf6_lower_bound_pos: "0\<le>x \<Longrightarrow> exp_cf6 x \<le> exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> exp_cf6 x \<le> exp x
[PROOF STEP]
by (metis exp_cf6_pos exp_le_cancel_iff exp_ln ln_exp_cf6_lower_bound_pos)


[STATEMENT]
lemma floor_less_one [simp]: "\<lfloor>x\<rfloor> < 1 \<longleftrightarrow> x < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> < 1) = (x < (1::'a))
[PROOF STEP]
by (simp add: floor_less_iff)


[STATEMENT]
lemma arity_apps[simp]: "arity (apps s ts) = arity s - length ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arity (apps s ts) = arity s - enat (length ts)
[PROOF STEP]
proof (induct ts arbitrary: s)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s. arity (apps s []) = arity s - enat (length [])
 2. \<And>a ts s. (\<And>s. arity (apps s ts) = arity s - enat (length ts)) \<Longrightarrow> arity (apps s (a # ts)) = arity s - enat (length (a # ts))
[PROOF STEP]
case (Cons t ts)
[PROOF STATE]
proof (state)
this:
arity (apps ?s ts) = arity ?s - enat (length ts)

goal (2 subgoals):
 1. \<And>s. arity (apps s []) = arity s - enat (length [])
 2. \<And>a ts s. (\<And>s. arity (apps s ts) = arity s - enat (length ts)) \<Longrightarrow> arity (apps s (a # ts)) = arity s - enat (length (a # ts))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
arity (apps ?s ts) = arity ?s - enat (length ts)

goal (1 subgoal):
 1. arity (apps s (t # ts)) = arity s - enat (length (t # ts))
[PROOF STEP]
by (case_tac "arity s"; simp add: one_enat_def)
[PROOF STATE]
proof (state)
this:
arity (apps s (t # ts)) = arity s - enat (length (t # ts))

goal (1 subgoal):
 1. \<And>s. arity (apps s []) = arity s - enat (length [])
[PROOF STEP]
qed simp


[STATEMENT]
theorem card_farey_fractions_asymptotics':
  "(\<lambda>N. card (farey_fractions N)) =o (\<lambda>N. 3 / pi\<^sup>2 * N^2) +o O(\<lambda>N. N * ln N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (card (farey_fractions x))) \<in> (\<lambda>x. 3 / pi\<^sup>2 * (real x)\<^sup>2) +o O(\<lambda>x. real x * ln (real x))
[PROOF STEP]
using card_farey_fractions_asymptotics
[PROOF STATE]
proof (prove)
using this:
(\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))

goal (1 subgoal):
 1. (\<lambda>x. real (card (farey_fractions x))) \<in> (\<lambda>x. 3 / pi\<^sup>2 * (real x)\<^sup>2) +o O(\<lambda>x. real x * ln (real x))
[PROOF STEP]
by (subst set_minus_plus [symmetric]) (simp_all add: fun_diff_def)


[STATEMENT]
lemma sum_list_prod_map_smult_distrib :
  "m \<in> M \<Longrightarrow> set (map (case_prod f) xys) \<subseteq> R
        \<Longrightarrow> (\<Sum>(x,y)\<leftarrow>xys. f x y) \<cdot> m = (\<Sum>(x,y)\<leftarrow>xys. f x y \<cdot> m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<in> M; set (map (\<lambda>(x, y). f x y) xys) \<subseteq> R\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<leftarrow>xys. f x y) \<cdot> m = (\<Sum>(x, y)\<leftarrow>xys. f x y \<cdot> m)
[PROOF STEP]
using zero_smult R_scalars.sum_list_closed_prod[of f]
[PROOF STATE]
proof (prove)
using this:
?m \<in> M \<Longrightarrow> (0::'r) \<cdot> ?m = (0::'m)
set (map (\<lambda>(x, y). f x y) ?xys) \<subseteq> R \<Longrightarrow> (\<Sum>(x, y)\<leftarrow>?xys. f x y) \<in> R

goal (1 subgoal):
 1. \<lbrakk>m \<in> M; set (map (\<lambda>(x, y). f x y) xys) \<subseteq> R\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<leftarrow>xys. f x y) \<cdot> m = (\<Sum>(x, y)\<leftarrow>xys. f x y \<cdot> m)
[PROOF STEP]
by    (induct xys) auto


[STATEMENT]
lemma subdivide_interval_length:
  shows "length (subdivide_interval n I) = 2^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (subdivide_interval n I) = 2 ^ n
[PROOF STEP]
by(induction n arbitrary: I, simp_all add: Let_def)


[STATEMENT]
lemma nn_integral_has_integral_lebesgue':
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
  assumes nonneg: "\<And>x. x \<in> \<Omega> \<Longrightarrow> 0 \<le> f x" and I: "(f has_integral I) \<Omega>"
  shows "integral\<^sup>N lborel (\<lambda>x. ennreal (f x) * indicator \<Omega> x) = ennreal I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I
[PROOF STEP]
have "integral\<^sup>N lborel (\<lambda>x. ennreal (f x) * indicator \<Omega> x) =
        integral\<^sup>N lborel (\<lambda>x. ennreal (indicator \<Omega> x * f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real \<Omega> x * f x) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (auto simp: indicator_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real \<Omega> x * f x) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real \<Omega> x * f x) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I
[PROOF STEP]
have "\<dots> = ennreal I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (indicat_real \<Omega> x * f x) \<partial>lborel = ennreal I
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> \<Omega> \<Longrightarrow> 0 \<le> f ?x
(f has_integral I) \<Omega>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (indicat_real \<Omega> x * f x) \<partial>lborel = ennreal I
[PROOF STEP]
by (intro nn_integral_has_integral_lebesgue)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (indicat_real \<Omega> x * f x) \<partial>lborel = ennreal I

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>\<Omega>. ennreal (f x)\<partial>lborel = ennreal I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_identity:
  "det3 t p q * det3 t s r + det3 t q r * det3 t s p + det3 t r p * det3 t s q = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det3 t p q * det3 t s r + det3 t q r * det3 t s p + det3 t r p * det3 t s q = 0
[PROOF STEP]
by (auto simp: det3_def' algebra_simps)


[STATEMENT]
lemma mat_erase_carrier[simp]: "(mat_erase A i j) \<in> carrier_mat nr nc \<longleftrightarrow> A \<in> carrier_mat nr nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_erase A i j \<in> carrier_mat nr nc) = (A \<in> carrier_mat nr nc)
[PROOF STEP]
unfolding mat_erase_def carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat (dim_row A) (dim_col A) (\<lambda>(i', j'). if i' = i \<or> j' = j then 0::'a else A $$ (i', j')) \<in> {m. dim_row m = nr \<and> dim_col m = nc}) = (A \<in> {m. dim_row m = nr \<and> dim_col m = nc})
[PROOF STEP]
by simp


[STATEMENT]
lemma (in normal_set) range_ordering_lemma:
"\<forall>y. y \<in> A \<longrightarrow> y < ordering A x \<longrightarrow> y \<in> range (ordering A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A x \<longrightarrow> y \<in> range (OrdinalVeblen.ordering A)
[PROOF STEP]
apply (simp add: image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A x \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x)
[PROOF STEP]
apply (rule_tac a=x in oLimit_induct, safe)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>y. \<lbrakk>y \<in> A; y < OrdinalVeblen.ordering A 0\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
 2. \<And>x y. \<lbrakk>\<forall>y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A x \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oSuc x)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
 3. \<And>f y. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A (f n) \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oLimit f)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
[PROOF STEP]
apply (simp add: ordering_0)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>y. \<lbrakk>y \<in> A; y < (LEAST z. z \<in> A)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
 2. \<And>x y. \<lbrakk>\<forall>y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A x \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oSuc x)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
 3. \<And>f y. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A (f n) \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oLimit f)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
[PROOF STEP]
apply (drule not_less_Least, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>\<forall>y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A x \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oSuc x)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
 2. \<And>f y. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A (f n) \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oLimit f)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
[PROOF STEP]
apply (simp add: ordering_oSuc)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>\<forall>y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A x \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < (LEAST z. z \<in> A \<and> OrdinalVeblen.ordering A x < z)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
 2. \<And>f y. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A (f n) \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oLimit f)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
[PROOF STEP]
apply (drule not_less_Least, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>\<forall>y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A x \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; \<not> OrdinalVeblen.ordering A x < y\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
 2. \<And>f y. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A (f n) \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oLimit f)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
[PROOF STEP]
apply (force simp add: linorder_not_less order_le_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f y. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A (f n) \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < OrdinalVeblen.ordering A (oLimit f)\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
[PROOF STEP]
apply (simp add: ordering_oLimit)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f y. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n y. y \<in> A \<longrightarrow> y < OrdinalVeblen.ordering A (f n) \<longrightarrow> (\<exists>x. y = OrdinalVeblen.ordering A x); y \<in> A; y < oLimit (\<lambda>n. OrdinalVeblen.ordering A (f n))\<rbrakk> \<Longrightarrow> \<exists>x. y = OrdinalVeblen.ordering A x
[PROOF STEP]
apply (drule less_oLimitD, clarsimp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cauchy_schwarz_ineq_var:
  fixes X :: "'a \<Rightarrow> real"
  assumes "integrable M (\<lambda>x. (X x)^2)" and "X \<in> borel_measurable M"
  shows "expectation (\<lambda> x. (X x)^2) \<ge> (expectation (\<lambda> x . (X x)))^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
have "expectation (\<lambda> x. (X x)^2) - (expectation (\<lambda> x . (X x)))^2 = expectation (\<lambda>x. (X x - expectation X)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = expectation (\<lambda>x. (X x - expectation X)\<^sup>2)
[PROOF STEP]
using variance_expectation assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable M (\<lambda>x. (?X x)\<^sup>2); random_variable borel ?X\<rbrakk> \<Longrightarrow> integrable M (\<lambda>x. (?X x - expectation ?X)\<^sup>2)
\<lbrakk>integrable M (\<lambda>x. (?X x)\<^sup>2); random_variable borel ?X\<rbrakk> \<Longrightarrow> expectation (\<lambda>x. (?X x - expectation ?X)\<^sup>2) = expectation (\<lambda>x. (?X x)\<^sup>2) - (expectation ?X)\<^sup>2
integrable M (\<lambda>x. (X x)\<^sup>2)
random_variable borel X

goal (1 subgoal):
 1. expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = expectation (\<lambda>x. (X x - expectation X)\<^sup>2)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = expectation (\<lambda>x. (X x - expectation X)\<^sup>2)

goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = expectation (\<lambda>x. (X x - expectation X)\<^sup>2)
[PROOF STEP]
have "expectation (\<lambda> x. (X x)^2) - (expectation (\<lambda> x . (X x)))^2 \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = expectation (\<lambda>x. (X x - expectation X)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2

goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2

goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in domain) not_eq_diff_nonzero:
  assumes "a \<noteq> b"
  assumes "a \<in> carrier R"
  assumes "b \<in>carrier R"
  shows "a \<ominus> b \<in> nonzero R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<ominus> b \<in> nonzero R
[PROOF STEP]
by (simp add: nonzero_def assms(1) assms(2) assms(3))


[STATEMENT]
lemma product_nodes_card:
      assumes "list_all (finite \<circ> a.nodes) AA"
      shows "card (b.nodes (product AA)) \<le> prod_list (map (card \<circ> a.nodes) AA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)
[PROOF STEP]
have "card (b.nodes (product AA)) \<le> card (listset (map a.nodes AA))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (b.nodes' (product AA)) \<le> card (listset (map a.nodes' AA))
[PROOF STEP]
using list.pred_map product_nodes assms
[PROOF STATE]
proof (prove)
using this:
list_all ?Q (map ?f ?x) = list_all (?Q \<circ> ?f) ?x
b.nodes' (product ?AA) \<subseteq> listset (map a.nodes' ?AA)
list_all (finite \<circ> a.nodes') AA

goal (1 subgoal):
 1. card (b.nodes' (product AA)) \<le> card (listset (map a.nodes' AA))
[PROOF STEP]
by (blast intro: card_mono)
[PROOF STATE]
proof (state)
this:
card (b.nodes' (product AA)) \<le> card (listset (map a.nodes' AA))

goal (1 subgoal):
 1. card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (b.nodes' (product AA)) \<le> card (listset (map a.nodes' AA))

goal (1 subgoal):
 1. card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)
[PROOF STEP]
have "\<dots> = prod_list (map (card \<circ> a.nodes) AA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (listset (map a.nodes' AA)) = prod_list (map (card \<circ> a.nodes') AA)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (listset (map a.nodes' AA)) = prod_list (map (card \<circ> a.nodes') AA)

goal (1 subgoal):
 1. card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)

goal (1 subgoal):
 1. card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (b.nodes' (product AA)) \<le> prod_list (map (card \<circ> a.nodes') AA)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_enumerate_mono_iff [simp]:
  "\<lbrakk>finite S; m < card S; n < card S\<rbrakk> \<Longrightarrow> enumerate S m < enumerate S n \<longleftrightarrow> m < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; m < card S; n < card S\<rbrakk> \<Longrightarrow> (wellorder_class.enumerate S m < wellorder_class.enumerate S n) = (m < n)
[PROOF STEP]
by (metis finite_enumerate_mono less_asym less_linear)


[STATEMENT]
lemma complex_Im_of_int [simp]: "Im (of_int z) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (of_int z) = 0
[PROOF STEP]
by (cases z rule: int_diff_cases) simp


[STATEMENT]
lemma higher_deriv_ln_Gamma_real:
  assumes "(x::real) > 0"
  shows   "(deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
proof (cases j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j = 0 \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
 2. \<And>nat. j = Suc nat \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
case (Suc j')
[PROOF STATE]
proof (state)
this:
j = Suc j'

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
 2. \<And>nat. j = Suc nat \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
have "(deriv ^^ j') (deriv ln_Gamma) x = (deriv ^^ j') Digamma x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ j') (deriv ln_Gamma) x = (deriv ^^ j') Digamma x
[PROOF STEP]
using eventually_nhds_in_open[of "{0<..}" x] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>open {0<..}; x \<in> {0<..}\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F y in nhds x. y \<in> {0<..}
0 < x

goal (1 subgoal):
 1. (deriv ^^ j') (deriv ln_Gamma) x = (deriv ^^ j') Digamma x
[PROOF STEP]
by (intro higher_deriv_cong_ev refl)
       (auto elim!: eventually_mono simp: open_Diff deriv_ln_Gamma_real)
[PROOF STATE]
proof (state)
this:
(deriv ^^ j') (deriv ln_Gamma) x = (deriv ^^ j') Digamma x

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
 2. \<And>nat. j = Suc nat \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(deriv ^^ j') (deriv ln_Gamma) x = (deriv ^^ j') Digamma x

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
 2. \<And>nat. j = Suc nat \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
have "\<dots> = Polygamma j' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ j') Digamma x = Polygamma j' x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. (deriv ^^ j') Digamma x = Polygamma j' x
[PROOF STEP]
by (subst higher_deriv_Polygamma)
       (auto elim!: nonpos_Ints_cases simp: complex_nonpos_Reals_iff)
[PROOF STATE]
proof (state)
this:
(deriv ^^ j') Digamma x = Polygamma j' x

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
 2. \<And>nat. j = Suc nat \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(deriv ^^ j') (deriv ln_Gamma) x = Polygamma j' x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(deriv ^^ j') (deriv ln_Gamma) x = Polygamma j' x

goal (1 subgoal):
 1. (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
(deriv ^^ j') (deriv ln_Gamma) x = Polygamma j' x
j = Suc j'

goal (1 subgoal):
 1. (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
by (simp del: funpow.simps add: funpow_Suc_right)
[PROOF STATE]
proof (state)
this:
(deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)

goal (1 subgoal):
 1. j = 0 \<Longrightarrow> (deriv ^^ j) ln_Gamma x = (if j = 0 then ln_Gamma x else Polygamma (j - 1) x)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma setprod_lessThan_Suc[simp]:
  "(\<Prod>i < Suc n. f i) = (\<Prod>i < n. f i) * f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<Suc n} = prod f {..<n} * f n
[PROOF STEP]
by (simp add:lessThan_Suc mult_ac)


[STATEMENT]
lemma rel_interior_aff_dim:
  fixes S :: "'n::euclidean_space set"
  assumes "convex S"
  shows "aff_dim (rel_interior S) = aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (rel_interior S) = aff_dim S
[PROOF STEP]
by (metis aff_dim_affine_hull2 assms rel_interior_same_affine_hull)


[STATEMENT]
lemma zmset_subset_eq_add_zmset_cancel: \<open>add_zmset a A \<subseteq>#\<^sub>z add_zmset a B \<longleftrightarrow> A \<subseteq>#\<^sub>z B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (add_zmset a A \<subseteq>#\<^sub>z add_zmset a B) = (A \<subseteq>#\<^sub>z B)
[PROOF STEP]
unfolding add_zmset_add_single[of _ A] add_zmset_add_single[of _ B]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + {#a#}\<^sub>z \<subseteq>#\<^sub>z B + {#a#}\<^sub>z) = (A \<subseteq>#\<^sub>z B)
[PROOF STEP]
by (rule subset_zmset.add_le_cancel_right)


[STATEMENT]
lemma convex_rel_open_sum:
  fixes S T :: "'n::euclidean_space set"
  assumes "convex S"
    and "rel_open S"
    and "convex T"
    and "rel_open T"
  shows "convex (S + T) \<and> rel_open (S + T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (S + T) \<and> rel_open (S + T)
[PROOF STEP]
by (metis assms convex_set_plus rel_interior_sum rel_open_def)


[STATEMENT]
lemma diameter_cbox:
  fixes a b::"'a::euclidean_space"
  shows "(\<forall>i \<in> Basis. a \<bullet> i \<le> b \<bullet> i) \<Longrightarrow> diameter (cbox a b) = dist a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i \<Longrightarrow> diameter (cbox a b) = dist a b
[PROOF STEP]
by (force simp: diameter_def intro!: cSup_eq_maximum L2_set_mono
     simp: euclidean_dist_l2[where 'a='a] cbox_def dist_norm)


[STATEMENT]
lemma poly_pos_between_less_leq:
  "(\<forall>x::real. a < x \<and> x \<le> b \<longrightarrow> poly p x > 0) \<longleftrightarrow>
    (a \<ge> b \<or> poly p b > 0) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x) = ((b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0))
[PROOF STEP]
proof (intro iffI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> b \<le> a \<or> 0 < poly p b
 2. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
 3. (b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
assume A: "\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (state)
this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x

goal (3 subgoals):
 1. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> b \<le> a \<or> 0 < poly p b
 2. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
 3. (b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
have "\<And>x. poly p (x::real) > 0 \<Longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < poly p x \<Longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0

goal (3 subgoals):
 1. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> b \<le> a \<or> 0 < poly p b
 2. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
 3. (b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0
[PROOF STEP]
show "\<forall>x::real. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0

goal (1 subgoal):
 1. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0

goal (2 subgoals):
 1. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> b \<le> a \<or> 0 < poly p b
 2. (b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
show "a \<ge> b \<or> poly p b > 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x

goal (1 subgoal):
 1. b \<le> a \<or> 0 < poly p b
[PROOF STEP]
by (cases "a < b", auto)
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> 0 < poly p b

goal (1 subgoal):
 1. (b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
assume "(b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a<x \<and> x\<le>b \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
(b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0)

goal (1 subgoal):
 1. (b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
hence A: "b \<le> a \<or> 0 < poly p b" and B: "\<forall>x. a<x \<and> x\<le>b \<longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
(b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0)

goal (1 subgoal):
 1. b \<le> a \<or> 0 < poly p b &&& \<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> 0 < poly p b
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. (b \<le> a \<or> 0 < poly p b) \<and> (\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
show "\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
proof (cases "a \<ge> b", simp, clarify, rule_tac ccontr,
         simp only: not_le not_less)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x \<le> b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x \<le> b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "a < b" "a < x" "x \<le> b" "poly p x \<le> 0"
[PROOF STATE]
proof (state)
this:
a < b
a < x
x \<le> b
poly p x \<le> 0

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x \<le> b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with B
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
a < b
a < x
x \<le> b
poly p x \<le> 0
[PROOF STEP]
have "poly p x < 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
a < b
a < x
x \<le> b
poly p x \<le> 0

goal (1 subgoal):
 1. poly p x < 0
[PROOF STEP]
by (simp add: less_eq_real_def)
[PROOF STATE]
proof (state)
this:
poly p x < 0

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x \<le> b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly p x < 0

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x \<le> b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from A and \<open>a < b\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<le> a \<or> 0 < poly p b
a < b
[PROOF STEP]
have "poly p b > 0"
[PROOF STATE]
proof (prove)
using this:
b \<le> a \<or> 0 < poly p b
a < b

goal (1 subgoal):
 1. 0 < poly p b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < poly p b

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x \<le> b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
poly p x < 0
0 < poly p b
[PROOF STEP]
have "x < b"
[PROOF STATE]
proof (prove)
using this:
poly p x < 0
0 < poly p b

goal (1 subgoal):
 1. x < b
[PROOF STEP]
using \<open>x \<le> b\<close>
[PROOF STATE]
proof (prove)
using this:
poly p x < 0
0 < poly p b
x \<le> b

goal (1 subgoal):
 1. x < b
[PROOF STEP]
by (auto simp: less_eq_real_def)
[PROOF STATE]
proof (state)
this:
x < b

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x \<le> b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from \<open>poly p x < 0\<close> and \<open>poly p b > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
poly p x < 0
0 < poly p b
[PROOF STEP]
have "sgn (poly p x) \<noteq> sgn (poly p b)"
[PROOF STATE]
proof (prove)
using this:
poly p x < 0
0 < poly p b

goal (1 subgoal):
 1. sgn (poly p x) \<noteq> sgn (poly p b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sgn (poly p x) \<noteq> sgn (poly p b)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a < x; x \<le> b; poly p x \<le> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from poly_different_sign_imp_root[OF \<open>x < b\<close> this] and B and \<open>x > a\<close>
[PROOF STATE]
proof (chain)
picking this:
\<exists>xa\<ge>x. xa \<le> b \<and> poly p xa = 0
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
a < x
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<exists>xa\<ge>x. xa \<le> b \<and> poly p xa = 0
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
a < x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> 0 < poly p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma order_gt_0: "order G > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < order G
[PROOF STEP]
using order_gt_0_iff_finite
[PROOF STATE]
proof (prove)
using this:
(0 < order G) = finite (carrier G)

goal (1 subgoal):
 1. 0 < order G
[PROOF STEP]
by(simp add: finite_carrier)


[STATEMENT]
lemma "!!x. ((x::nat) <= y) = (x - y = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (x \<le> y) = (x - y = 0)
[PROOF STEP]
by linarith


[STATEMENT]
lemma "(x < x + y) = ((0::real) < y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x < x + y) = (0 < y)
[PROOF STEP]
by arith


[STATEMENT]
lemma floor_div_neg_int:
  fixes r :: "'a :: floor_ceiling"
  assumes n: "n < 0"
  shows "\<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
n < 0
[PROOF STEP]
have n': "- n > 0"
[PROOF STATE]
proof (prove)
using this:
n < 0

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

goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
have "\<lfloor>r / of_int n\<rfloor> = \<lfloor> - r / of_int (- n)\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lfloor>- r / of_int (- n)\<rfloor>
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
n < 0

goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lfloor>- r / of_int (- n)\<rfloor>
[PROOF STEP]
by (metis floor_of_int floor_zero less_int_code(1) minus_divide_left minus_minus nonzero_minus_divide_right of_int_minus)
[PROOF STATE]
proof (state)
this:
\<lfloor>r / of_int n\<rfloor> = \<lfloor>- r / of_int (- n)\<rfloor>

goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>r / of_int n\<rfloor> = \<lfloor>- r / of_int (- n)\<rfloor>

goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
have "\<dots> = \<lfloor> - r \<rfloor> div (- n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- r / of_int (- n)\<rfloor> = \<lfloor>- r\<rfloor> div - n
[PROOF STEP]
by (rule floor_div_pos_int[OF n'])
[PROOF STATE]
proof (state)
this:
\<lfloor>- r / of_int (- n)\<rfloor> = \<lfloor>- r\<rfloor> div - n

goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>- r / of_int (- n)\<rfloor> = \<lfloor>- r\<rfloor> div - n

goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
have "\<dots> = \<lceil> r \<rceil> div n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- r\<rfloor> div - n = \<lceil>r\<rceil> div n
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
n < 0

goal (1 subgoal):
 1. \<lfloor>- r\<rfloor> div - n = \<lceil>r\<rceil> div n
[PROOF STEP]
by (metis ceiling_def div_minus_right)
[PROOF STATE]
proof (state)
this:
\<lfloor>- r\<rfloor> div - n = \<lceil>r\<rceil> div n

goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n

goal (1 subgoal):
 1. \<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<lfloor>r / of_int n\<rfloor> = \<lceil>r\<rceil> div n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma csqrt_exp_Ln:
  assumes "z \<noteq> 0"
    shows "csqrt z = exp(Ln(z) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
have "(exp (Ln z / 2))\<^sup>2 = (exp (Ln z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp (Ln z / 2))\<^sup>2 = exp (Ln z)
[PROOF STEP]
by (metis exp_double nonzero_mult_div_cancel_left times_divide_eq_right zero_neq_numeral)
[PROOF STATE]
proof (state)
this:
(exp (Ln z / 2))\<^sup>2 = exp (Ln z)

goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(exp (Ln z / 2))\<^sup>2 = exp (Ln z)

goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
have "\<dots> = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (Ln z) = z
[PROOF STEP]
using assms exp_Ln
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
?z \<noteq> 0 \<Longrightarrow> exp (Ln ?z) = ?z

goal (1 subgoal):
 1. exp (Ln z) = z
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
exp (Ln z) = z

goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(exp (Ln z / 2))\<^sup>2 = z
[PROOF STEP]
have "csqrt z = csqrt ((exp (Ln z / 2))\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
(exp (Ln z / 2))\<^sup>2 = z

goal (1 subgoal):
 1. csqrt z = csqrt ((exp (Ln z / 2))\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
csqrt z = csqrt ((exp (Ln z / 2))\<^sup>2)

goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
csqrt z = csqrt ((exp (Ln z / 2))\<^sup>2)

goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
have "\<dots> = exp (Ln z / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csqrt ((exp (Ln z / 2))\<^sup>2) = exp (Ln z / 2)
[PROOF STEP]
apply (rule csqrt_square)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re (exp (Ln z / 2)) \<or> Re (exp (Ln z / 2)) = 0 \<and> 0 \<le> Im (exp (Ln z / 2))
[PROOF STEP]
using cos_gt_zero_pi [of "(Im (Ln z) / 2)"] Im_Ln_le_pi mpi_less_Im_Ln assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- (pi / 2) < Im (Ln z) / 2; Im (Ln z) / 2 < pi / 2\<rbrakk> \<Longrightarrow> 0 < cos (Im (Ln z) / 2)
?z \<noteq> 0 \<Longrightarrow> Im (Ln ?z) \<le> pi
?z \<noteq> 0 \<Longrightarrow> - pi < Im (Ln ?z)
z \<noteq> 0

goal (1 subgoal):
 1. 0 < Re (exp (Ln z / 2)) \<or> Re (exp (Ln z / 2)) = 0 \<and> 0 \<le> Im (exp (Ln z / 2))
[PROOF STEP]
by (fastforce simp: Re_exp Im_exp )
[PROOF STATE]
proof (state)
this:
csqrt ((exp (Ln z / 2))\<^sup>2) = exp (Ln z / 2)

goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
csqrt z = exp (Ln z / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
csqrt z = exp (Ln z / 2)

goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
using assms csqrt_square
[PROOF STATE]
proof (prove)
using this:
csqrt z = exp (Ln z / 2)
z \<noteq> 0
0 < Re ?b \<or> Re ?b = 0 \<and> 0 \<le> Im ?b \<Longrightarrow> csqrt (?b\<^sup>2) = ?b

goal (1 subgoal):
 1. csqrt z = exp (Ln z / 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
csqrt z = exp (Ln z / 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_split_min:
  "\<lbrakk> split_min t = (a,t'); t \<noteq> Leaf \<rbrakk> \<Longrightarrow> size t' = size t - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Root_Balanced_Tree.split_min t = (a, t'); t \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> size t' = size t - 1
[PROOF STEP]
by(induction t arbitrary: t')
  (auto simp add: zero_less_iff_neq_zero split: if_splits prod.splits)


[STATEMENT]
theorem jordan_block_constant_bound: assumes a: "norm a < 1"
  shows "\<exists> p. \<forall> i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i,j)) \<le> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
proof (cases "a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
 2. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = (0::'a)

goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
 2. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
proof (rule exI[of _ 1], intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
fix i j k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
assume *: "i < n" "j < n"
[PROOF STATE]
proof (state)
this:
i < n
j < n

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
i < n
j < n

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
assume ij: "i \<le> j"
[PROOF STATE]
proof (state)
this:
i \<le> j

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
have "norm ((of_nat (k choose (j - i)) :: 'a) * 0 ^ (k + i - j)) \<le> 1" (is "norm ?lhs \<le> 1")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
proof (cases "k + i > j")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
 2. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
j < k + i

goal (2 subgoals):
 1. j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
 2. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
hence "?lhs = 0"
[PROOF STATE]
proof (prove)
using this:
j < k + i

goal (1 subgoal):
 1. of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j) = (0::'a)

goal (2 subgoals):
 1. j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
 2. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j) = (0::'a)

goal (2 subgoals):
 1. j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
 2. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
have "norm (\<dots>) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (0::'a) \<le> 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (0::'a) \<le> 1

goal (2 subgoals):
 1. j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
 2. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal (1 subgoal):
 1. norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal (1 subgoal):
 1. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> j < k + i

goal (1 subgoal):
 1. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
hence id: "?lhs = (of_nat (k choose (j - i)) :: 'a)" and j: "j - i \<ge> k"
[PROOF STATE]
proof (prove)
using this:
\<not> j < k + i

goal (1 subgoal):
 1. of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j) = of_nat (k choose (j - i)) &&& k \<le> j - i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j) = of_nat (k choose (j - i))
k \<le> j - i

goal (1 subgoal):
 1. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
k \<le> j - i
[PROOF STEP]
have "k choose (j - i) = 0 \<or> k choose (j - i) = 1"
[PROOF STATE]
proof (prove)
using this:
k \<le> j - i

goal (1 subgoal):
 1. k choose (j - i) = 0 \<or> k choose (j - i) = 1
[PROOF STEP]
by (simp add: nat_less_le)
[PROOF STATE]
proof (state)
this:
k choose (j - i) = 0 \<or> k choose (j - i) = 1

goal (1 subgoal):
 1. \<not> j < k + i \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
thus "norm ?lhs \<le> 1"
[PROOF STATE]
proof (prove)
using this:
k choose (j - i) = 0 \<or> k choose (j - i) = 1

goal (1 subgoal):
 1. norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k choose (j - i) = 0 \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
 2. k choose (j - i) = 1 \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
assume k: "k choose (j - i) = 0"
[PROOF STATE]
proof (state)
this:
k choose (j - i) = 0

goal (2 subgoals):
 1. k choose (j - i) = 0 \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
 2. k choose (j - i) = 1 \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
unfolding id k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_nat 0 * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal (1 subgoal):
 1. k choose (j - i) = 1 \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k choose (j - i) = 1 \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
assume k: "k choose (j - i) = 1"
[PROOF STATE]
proof (state)
this:
k choose (j - i) = 1

goal (1 subgoal):
 1. k choose (j - i) = 1 \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_nat (k choose (j - i))) \<le> 1
[PROOF STEP]
unfolding k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_nat 1) \<le> 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
i \<le> j \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
thus "norm ((jordan_block n a ^\<^sub>m k) $$ (i,j)) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
i \<le> j \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
unfolding True
[PROOF STATE]
proof (prove)
using this:
i \<le> j \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal (1 subgoal):
 1. norm ((jordan_block n (0::'a) ^\<^sub>m k) $$ (i, j)) \<le> 1
[PROOF STEP]
unfolding jordan_block_pow
[PROOF STATE]
proof (prove)
using this:
i \<le> j \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1

goal (1 subgoal):
 1. norm (mat n n (\<lambda>(i, j). if i \<le> j then of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j) else (0::'a)) $$ (i, j)) \<le> 1
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
i \<le> j \<Longrightarrow> norm (of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j)) \<le> 1
i < n
j < n

goal (1 subgoal):
 1. norm (mat n n (\<lambda>(i, j). if i \<le> j then of_nat (k choose (j - i)) * (0::'a) ^ (k + i - j) else (0::'a)) $$ (i, j)) \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
hence na: "norm a > 0"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)

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

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
define c where "c = inverse (norm a ^ n)"
[PROOF STATE]
proof (state)
this:
c = inverse (norm a ^ n)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
define deg where "deg = n - 1"
[PROOF STATE]
proof (state)
this:
deg = n - 1

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
have c: "c > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < c
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < inverse (norm a ^ n)
[PROOF STEP]
using na
[PROOF STATE]
proof (prove)
using this:
0 < norm a

goal (1 subgoal):
 1. 0 < inverse (norm a ^ n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < c

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
define b where "b = norm a"
[PROOF STATE]
proof (state)
this:
b = norm a

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
from a na
[PROOF STATE]
proof (chain)
picking this:
norm a < 1
0 < norm a
[PROOF STEP]
have "0 < b" "b < 1"
[PROOF STATE]
proof (prove)
using this:
norm a < 1
0 < norm a

goal (1 subgoal):
 1. 0 < b &&& b < 1
[PROOF STEP]
unfolding b_def
[PROOF STATE]
proof (prove)
using this:
norm a < 1
0 < norm a

goal (1 subgoal):
 1. 0 < norm a &&& norm a < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < b
b < 1

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
from poly_exp_max_constant_bound[OF this, of c deg]
[PROOF STATE]
proof (chain)
picking this:
\<exists>p. \<forall>x. c * b ^ x * max 1 (real x ^ deg) \<le> p
[PROOF STEP]
obtain p where "\<And> k. c * b ^ k * max 1 (of_nat k ^ deg) \<le> p"
[PROOF STATE]
proof (prove)
using this:
\<exists>p. \<forall>x. c * b ^ x * max 1 (real x ^ deg) \<le> p

goal (1 subgoal):
 1. (\<And>p. (\<And>k. c * b ^ k * max 1 (real k ^ deg) \<le> p) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c * b ^ ?k * max 1 (real ?k ^ deg) \<le> p

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
proof (intro exI[of _ p], intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
fix i j k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
assume ij: "i < n" "j < n"
[PROOF STATE]
proof (state)
this:
i < n
j < n

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
from jordan_block_bound[OF this]
[PROOF STATE]
proof (chain)
picking this:
norm ((jordan_block n a ^\<^sub>m ?k) $$ (i, j)) \<le> norm a ^ (?k + i - j) * max 1 (real ?k ^ (n - 1))
[PROOF STEP]
have "norm ((jordan_block n a ^\<^sub>m k) $$ (i, j))
      \<le> norm a ^ (k + i - j) * max 1 (real_of_nat k ^ (n - 1))"
[PROOF STATE]
proof (prove)
using this:
norm ((jordan_block n a ^\<^sub>m ?k) $$ (i, j)) \<le> norm a ^ (?k + i - j) * max 1 (real ?k ^ (n - 1))

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
have "\<dots> \<le> c * norm a ^ k * max 1 (real_of_nat k ^ (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a ^ (k + i - j) * max 1 (real k ^ (n - 1)) \<le> c * norm a ^ k * max 1 (real k ^ (n - 1))
[PROOF STEP]
proof (rule mult_right_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. norm a ^ (k + i - j) \<le> c * norm a ^ k
 2. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
from ij
[PROOF STATE]
proof (chain)
picking this:
i < n
j < n
[PROOF STEP]
have "i - j \<le> n"
[PROOF STATE]
proof (prove)
using this:
i < n
j < n

goal (1 subgoal):
 1. i - j \<le> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i - j \<le> n

goal (2 subgoals):
 1. norm a ^ (k + i - j) \<le> c * norm a ^ k
 2. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
show "norm a ^ (k + i - j) \<le> c * norm a ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a ^ (k + i - j) \<le> c * norm a ^ k
[PROOF STEP]
proof (rule mult_left_le_imp_le)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?c * norm a ^ (k + i - j) \<le> ?c * (c * norm a ^ k)
 2. 0 < ?c
[PROOF STEP]
show "0 < norm a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < norm a ^ n
[PROOF STEP]
using na
[PROOF STATE]
proof (prove)
using this:
0 < norm a

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

goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
let ?lhs = "norm a ^ n * norm a ^ (k + i - j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
let ?rhs = "norm a ^ n * (c * norm a ^ k)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
from ij
[PROOF STATE]
proof (chain)
picking this:
i < n
j < n
[PROOF STEP]
have ge: "n + (k + i - j) \<ge> k"
[PROOF STATE]
proof (prove)
using this:
i < n
j < n

goal (1 subgoal):
 1. k \<le> n + (k + i - j)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
k \<le> n + (k + i - j)

goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
have "?lhs = norm a ^ (n + (k + i - j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) = norm a ^ (n + (k + i - j))
[PROOF STEP]
by (simp add: power_add)
[PROOF STATE]
proof (state)
this:
norm a ^ n * norm a ^ (k + i - j) = norm a ^ (n + (k + i - j))

goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm a ^ n * norm a ^ (k + i - j) = norm a ^ (n + (k + i - j))

goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
have "\<dots> \<le> norm a ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a ^ (n + (k + i - j)) \<le> norm a ^ k
[PROOF STEP]
using ge a na
[PROOF STATE]
proof (prove)
using this:
k \<le> n + (k + i - j)
norm a < 1
0 < norm a

goal (1 subgoal):
 1. norm a ^ (n + (k + i - j)) \<le> norm a ^ k
[PROOF STEP]
using less_imp_le power_decreasing
[PROOF STATE]
proof (prove)
using this:
k \<le> n + (k + i - j)
norm a < 1
0 < norm a
?x < ?y \<Longrightarrow> ?x \<le> ?y
\<lbrakk>?n \<le> ?N; (0::?'a) \<le> ?a; ?a \<le> (1::?'a)\<rbrakk> \<Longrightarrow> ?a ^ ?N \<le> ?a ^ ?n

goal (1 subgoal):
 1. norm a ^ (n + (k + i - j)) \<le> norm a ^ k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
norm a ^ (n + (k + i - j)) \<le> norm a ^ k

goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm a ^ (n + (k + i - j)) \<le> norm a ^ k

goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a ^ k = norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a ^ k = norm a ^ n * (inverse (norm a ^ n) * norm a ^ k)
[PROOF STEP]
using na
[PROOF STATE]
proof (prove)
using this:
0 < norm a

goal (1 subgoal):
 1. norm a ^ k = norm a ^ n * (inverse (norm a ^ n) * norm a ^ k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm a ^ k = norm a ^ n * (c * norm a ^ k)

goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
show "?lhs \<le> ?rhs"
[PROOF STATE]
proof (prove)
using this:
norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)

goal (1 subgoal):
 1. norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm a ^ n * norm a ^ (k + i - j) \<le> norm a ^ n * (c * norm a ^ k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm a ^ (k + i - j) \<le> c * norm a ^ k

goal (1 subgoal):
 1. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
norm a ^ (k + i - j) * max 1 (real k ^ (n - 1)) \<le> c * norm a ^ k * max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm a ^ (k + i - j) * max 1 (real k ^ (n - 1)) \<le> c * norm a ^ k * max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
have "\<dots> = c * b ^ k * max 1 (real_of_nat k ^ deg)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * norm a ^ k * max 1 (real k ^ (n - 1)) = c * b ^ k * max 1 (real k ^ deg)
[PROOF STEP]
unfolding b_def deg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * norm a ^ k * max 1 (real k ^ (n - 1)) = c * norm a ^ k * max 1 (real k ^ (n - 1))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
c * norm a ^ k * max 1 (real k ^ (n - 1)) = c * b ^ k * max 1 (real k ^ deg)

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c * norm a ^ k * max 1 (real k ^ (n - 1)) = c * b ^ k * max 1 (real k ^ deg)

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
have "\<dots> \<le> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * b ^ k * max 1 (real k ^ deg) \<le> p
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
c * b ^ k * max 1 (real k ^ deg) \<le> p

goal (1 subgoal):
 1. \<And>i j k. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
show "norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p"
[PROOF STATE]
proof (prove)
using this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>p. \<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isCont_powrat_exponent:
  assumes "0 < a" shows "isCont (\<lambda>x. a pow\<^sub>\<rat> x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont ((pow\<^sub>\<rat>) a) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isCont ((pow\<^sub>\<rat>) a) x
[PROOF STEP]
have isCont_of_rat: "isCont real_of_rat x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont real_of_rat x
[PROOF STEP]
using isCont_def LIM_def dist_real_def
[PROOF STATE]
proof (prove)
using this:
isCont ?f ?a = ?f \<midarrow>?a\<rightarrow> ?f ?a
?f \<midarrow>?a\<rightarrow> ?L = (\<forall>r>0. \<exists>s>0. \<forall>x. x \<noteq> ?a \<and> dist x ?a < s \<longrightarrow> dist (?f x) ?L < r)
dist ?x ?y = \<bar>?x - ?y\<bar>

goal (1 subgoal):
 1. isCont real_of_rat x
[PROOF STEP]
by (metis dist_commute of_rat_diff rat_dist_def real_of_rat_abs)
[PROOF STATE]
proof (state)
this:
isCont real_of_rat x

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<rat>) a) x
[PROOF STEP]
have "isCont ((pow\<^sub>\<real>) a) (real_of_rat x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) (real_of_rat x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) (real_of_rat x)
[PROOF STEP]
by (simp add: isCont_powreal_exponent)
[PROOF STATE]
proof (state)
this:
isCont ((pow\<^sub>\<real>) a) (real_of_rat x)

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<rat>) a) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isCont ((pow\<^sub>\<real>) a) (real_of_rat x)
[PROOF STEP]
have "isCont (\<lambda>x. a pow\<^sub>\<real> real_of_rat x) x"
[PROOF STATE]
proof (prove)
using this:
isCont ((pow\<^sub>\<real>) a) (real_of_rat x)

goal (1 subgoal):
 1. isCont (\<lambda>x. a pow\<^sub>\<real> real_of_rat x) x
[PROOF STEP]
using isCont_of_rat
[PROOF STATE]
proof (prove)
using this:
isCont ((pow\<^sub>\<real>) a) (real_of_rat x)
isCont real_of_rat x

goal (1 subgoal):
 1. isCont (\<lambda>x. a pow\<^sub>\<real> real_of_rat x) x
[PROOF STEP]
using isCont_o2
[PROOF STATE]
proof (prove)
using this:
isCont ((pow\<^sub>\<real>) a) (real_of_rat x)
isCont real_of_rat x
\<lbrakk>isCont ?f ?a; isCont ?g (?f ?a)\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. ?g (?f x)) ?a

goal (1 subgoal):
 1. isCont (\<lambda>x. a pow\<^sub>\<real> real_of_rat x) x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>x. a pow\<^sub>\<real> real_of_rat x) x

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<rat>) a) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isCont (\<lambda>x. a pow\<^sub>\<real> real_of_rat x) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
isCont (\<lambda>x. a pow\<^sub>\<real> real_of_rat x) x

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<rat>) a) x
[PROOF STEP]
using realpow_powrat_eq assms
[PROOF STATE]
proof (prove)
using this:
isCont (\<lambda>x. a pow\<^sub>\<real> real_of_rat x) x
0 < ?a \<Longrightarrow> ?a pow\<^sub>\<real> real_of_rat ?q = ?a pow\<^sub>\<rat> ?q
0 < a

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

goal:
No subgoals!
[PROOF STEP]
qed