[STATEMENT]
theorem riesz_frechet_representation_cblinfun_norm:
  includes notation_norm
  fixes f::\<open>'a::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L complex\<close>
  assumes \<open>\<And>x.  f *\<^sub>V x = (t \<bullet>\<^sub>C x)\<close>
  shows \<open>\<parallel>f\<parallel> = \<parallel>t\<parallel>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>f\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f *\<^sub>V ?x = t \<bullet>\<^sub>C ?x

goal (1 subgoal):
 1. \<parallel>f\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
proof transfer
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
fix f::\<open>'a \<Rightarrow> complex\<close> and t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
assume \<open>bounded_clinear f\<close> and \<open>\<And>x. f x = (t \<bullet>\<^sub>C x)\<close>
[PROOF STATE]
proof (state)
this:
bounded_clinear f
f ?x = t \<bullet>\<^sub>C ?x

goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
from  \<open>\<And>x. f x = (t \<bullet>\<^sub>C x)\<close>
[PROOF STATE]
proof (chain)
picking this:
f ?x = t \<bullet>\<^sub>C ?x
[PROOF STEP]
have \<open>(norm (f x)) / (norm x) \<le> norm t\<close>
    for x
[PROOF STATE]
proof (prove)
using this:
f ?x = t \<bullet>\<^sub>C ?x

goal (1 subgoal):
 1. cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
proof(cases \<open>norm x = 0\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> = 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
 2. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<parallel>x\<parallel> = 0

goal (2 subgoals):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> = 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
 2. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<parallel>x\<parallel> = 0

goal (1 subgoal):
 1. cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>

goal (1 subgoal):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<parallel>x\<parallel> \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
have \<open>norm (f x) = norm ((t \<bullet>\<^sub>C x))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (f x) = cmod (t \<bullet>\<^sub>C x)
[PROOF STEP]
using \<open>\<And>x. f x = (t \<bullet>\<^sub>C x)\<close>
[PROOF STATE]
proof (prove)
using this:
f ?x = t \<bullet>\<^sub>C ?x

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

goal (1 subgoal):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (f x) = cmod (t \<bullet>\<^sub>C x)

goal (1 subgoal):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
have \<open>norm (t \<bullet>\<^sub>C x) \<le> norm t * norm x\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (t \<bullet>\<^sub>C x) \<le> \<parallel>t\<parallel> * \<parallel>x\<parallel>
[PROOF STEP]
by (simp add: complex_inner_class.Cauchy_Schwarz_ineq2)
[PROOF STATE]
proof (state)
this:
cmod (t \<bullet>\<^sub>C x) \<le> \<parallel>t\<parallel> * \<parallel>x\<parallel>

goal (1 subgoal):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (f x) \<le> \<parallel>t\<parallel> * \<parallel>x\<parallel>
[PROOF STEP]
have \<open>norm (f x) \<le> norm t * norm x\<close>
[PROOF STATE]
proof (prove)
using this:
cmod (f x) \<le> \<parallel>t\<parallel> * \<parallel>x\<parallel>

goal (1 subgoal):
 1. cmod (f x) \<le> \<parallel>t\<parallel> * \<parallel>x\<parallel>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cmod (f x) \<le> \<parallel>t\<parallel> * \<parallel>x\<parallel>

goal (1 subgoal):
 1. \<lbrakk>\<And>x. f x = t \<bullet>\<^sub>C x; \<parallel>x\<parallel> \<noteq> 0\<rbrakk> \<Longrightarrow> cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (f x) \<le> \<parallel>t\<parallel> * \<parallel>x\<parallel>

goal (1 subgoal):
 1. cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>
[PROOF STEP]
by (metis False linordered_field_class.divide_right_mono nonzero_mult_div_cancel_right norm_ge_zero)
[PROOF STATE]
proof (state)
this:
cmod (f x) / \<parallel>x\<parallel> \<le> \<parallel>t\<parallel>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cmod (f ?x) / \<parallel>?x\<parallel> \<le> \<parallel>t\<parallel>

goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cmod (f ?x) / \<parallel>?x\<parallel> \<le> \<parallel>t\<parallel>

goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
have \<open>(norm (f t)) / (norm t) = norm t\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
proof(cases \<open>norm t = 0\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<parallel>t\<parallel> = 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
 2. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<parallel>t\<parallel> = 0

goal (2 subgoals):
 1. \<parallel>t\<parallel> = 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
 2. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<parallel>t\<parallel> = 0

goal (1 subgoal):
 1. cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>

goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<parallel>t\<parallel> \<noteq> 0

goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
have \<open>f t = (t \<bullet>\<^sub>C t)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f t = t \<bullet>\<^sub>C t
[PROOF STEP]
using \<open>\<And>x. f x = (t \<bullet>\<^sub>C x)\<close>
[PROOF STATE]
proof (prove)
using this:
f ?x = t \<bullet>\<^sub>C ?x

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

goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f t = t \<bullet>\<^sub>C t

goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
have \<open>\<dots> = (norm t)^2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<bullet>\<^sub>C t = complex_of_real (\<parallel>t\<parallel>\<^sup>2)
[PROOF STEP]
by (meson cnorm_eq_square)
[PROOF STATE]
proof (state)
this:
t \<bullet>\<^sub>C t = complex_of_real (\<parallel>t\<parallel>\<^sup>2)

goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
t \<bullet>\<^sub>C t = complex_of_real (\<parallel>t\<parallel>\<^sup>2)

goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
have \<open>\<dots> = (norm t)*(norm t)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<parallel>t\<parallel>\<^sup>2) = complex_of_real (\<parallel>t\<parallel> * \<parallel>t\<parallel>)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
complex_of_real (\<parallel>t\<parallel>\<^sup>2) = complex_of_real (\<parallel>t\<parallel> * \<parallel>t\<parallel>)

goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f t = complex_of_real (\<parallel>t\<parallel> * \<parallel>t\<parallel>)
[PROOF STEP]
have \<open>f t = (norm t)*(norm t)\<close>
[PROOF STATE]
proof (prove)
using this:
f t = complex_of_real (\<parallel>t\<parallel> * \<parallel>t\<parallel>)

goal (1 subgoal):
 1. f t = complex_of_real (\<parallel>t\<parallel> * \<parallel>t\<parallel>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f t = complex_of_real (\<parallel>t\<parallel> * \<parallel>t\<parallel>)

goal (1 subgoal):
 1. \<parallel>t\<parallel> \<noteq> 0 \<Longrightarrow> cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f t = complex_of_real (\<parallel>t\<parallel> * \<parallel>t\<parallel>)

goal (1 subgoal):
 1. cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
by (metis False Re_complex_of_real \<open>\<And>x. f x = cinner t x\<close> cinner_ge_zero complex_of_real_cmod nonzero_divide_eq_eq)
[PROOF STATE]
proof (state)
this:
cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>

goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cmod (f ?x) / \<parallel>?x\<parallel> \<le> \<parallel>t\<parallel>
cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>
[PROOF STEP]
have \<open>Sup {(norm (f x)) / (norm x)| x. True} = norm t\<close>
[PROOF STATE]
proof (prove)
using this:
cmod (f ?x) / \<parallel>?x\<parallel> \<le> \<parallel>t\<parallel>
cmod (f t) / \<parallel>t\<parallel> = \<parallel>t\<parallel>

goal (1 subgoal):
 1. \<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = \<parallel>t\<parallel>
[PROOF STEP]
by (smt cSup_eq_maximum mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
\<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = \<parallel>t\<parallel>

goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = \<parallel>t\<parallel>

goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
have \<open>Sup {(norm (f x)) / (norm x)| x. True} = (SUP x. (norm (f x)) / (norm x))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = (\<Squnion>x. cmod (f x) / \<parallel>x\<parallel>)
[PROOF STEP]
by (simp add: full_SetCompr_eq)
[PROOF STATE]
proof (state)
this:
\<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = (\<Squnion>x. cmod (f x) / \<parallel>x\<parallel>)

goal (1 subgoal):
 1. \<And>f t. \<lbrakk>bounded_clinear f; \<And>x. f x = t \<bullet>\<^sub>C x\<rbrakk> \<Longrightarrow> onorm f = \<parallel>t\<parallel>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = \<parallel>t\<parallel>
\<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = (\<Squnion>x. cmod (f x) / \<parallel>x\<parallel>)
[PROOF STEP]
show \<open>onorm f = norm t\<close>
[PROOF STATE]
proof (prove)
using this:
\<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = \<parallel>t\<parallel>
\<Squnion> {cmod (f x) / \<parallel>x\<parallel> |x. True} = (\<Squnion>x. cmod (f x) / \<parallel>x\<parallel>)

goal (1 subgoal):
 1. onorm f = \<parallel>t\<parallel>
[PROOF STEP]
by (simp add: onorm_def)
[PROOF STATE]
proof (state)
this:
onorm f = \<parallel>t\<parallel>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma disjoint_family_on_iff_disjoint_image:
  assumes "\<And>i. i \<in> I \<Longrightarrow> A i \<noteq> {}"
  shows "disjoint_family_on A I \<longleftrightarrow> disjoint (A ` I) \<and> inj_on A I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_family_on A I = (disjoint (A ` I) \<and> inj_on A I)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. disjoint_family_on A I \<Longrightarrow> disjoint (A ` I) \<and> inj_on A I
 2. disjoint (A ` I) \<and> inj_on A I \<Longrightarrow> disjoint_family_on A I
[PROOF STEP]
assume "disjoint_family_on A I"
[PROOF STATE]
proof (state)
this:
disjoint_family_on A I

goal (2 subgoals):
 1. disjoint_family_on A I \<Longrightarrow> disjoint (A ` I) \<and> inj_on A I
 2. disjoint (A ` I) \<and> inj_on A I \<Longrightarrow> disjoint_family_on A I
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
disjoint_family_on A I
[PROOF STEP]
show "disjoint (A ` I) \<and> inj_on A I"
[PROOF STATE]
proof (prove)
using this:
disjoint_family_on A I

goal (1 subgoal):
 1. disjoint (A ` I) \<and> inj_on A I
[PROOF STEP]
by (metis (mono_tags, lifting) assms disjoint_family_onD disjoint_family_on_disjoint_image inf.idem inj_onI)
[PROOF STATE]
proof (state)
this:
disjoint (A ` I) \<and> inj_on A I

goal (1 subgoal):
 1. disjoint (A ` I) \<and> inj_on A I \<Longrightarrow> disjoint_family_on A I
[PROOF STEP]
qed (use disjoint_image_disjoint_family_on in metis)


[STATEMENT]
lemma mem_rel_interior_ball:
  "x \<in> rel_interior S \<longleftrightarrow> x \<in> S \<and> (\<exists>e. e > 0 \<and> ball x e \<inter> affine hull S \<subseteq> S)"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> rel_interior S) = (x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> rel_interior S \<Longrightarrow> x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S)
 2. x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S) \<Longrightarrow> x \<in> rel_interior S
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S)

goal (2 subgoals):
 1. x \<in> rel_interior S \<Longrightarrow> x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S)
 2. x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S) \<Longrightarrow> x \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S)
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S)

goal (1 subgoal):
 1. x \<in> rel_interior S
[PROOF STEP]
by (simp add: rel_interior) (meson Elementary_Metric_Spaces.open_ball centre_in_ball)
[PROOF STATE]
proof (state)
this:
x \<in> rel_interior S

goal (1 subgoal):
 1. x \<in> rel_interior S \<Longrightarrow> x \<in> S \<and> (\<exists>e>0. ball x e \<inter> affine hull S \<subseteq> S)
[PROOF STEP]
qed (force simp: rel_interior open_contains_ball)


[STATEMENT]
lemma lfp_chain_induct:
  assumes mono: "mono f"
  and step: "\<And>x. P x \<Longrightarrow> P (f x)"
  and chain: "\<And>C. set_chain C \<Longrightarrow> \<forall> x \<in> C. P x \<Longrightarrow> P (Sup C)"
  shows "P (lfp f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (lfp f)
[PROOF STEP]
unfolding lfp_eq_fixp[OF mono]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (ccpo_class.fixp f)
[PROOF STEP]
proof (rule fixp_induct)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. ccpo.admissible Sup (\<le>) P
 2. mono f
 3. P (Sup {})
 4. \<And>x. P x \<Longrightarrow> P (f x)
[PROOF STEP]
show "monotone (\<le>) (\<le>) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f
[PROOF STEP]
using mono
[PROOF STATE]
proof (prove)
using this:
mono f

goal (1 subgoal):
 1. mono f
[PROOF STEP]
unfolding order_class.mono_def monotone_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y

goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mono f

goal (3 subgoals):
 1. ccpo.admissible Sup (\<le>) P
 2. P (Sup {})
 3. \<And>x. P x \<Longrightarrow> P (f x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ccpo.admissible Sup (\<le>) P
 2. P (Sup {})
 3. \<And>x. P x \<Longrightarrow> P (f x)
[PROOF STEP]
show "P (Sup {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (Sup {})
[PROOF STEP]
using chain[of "{}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set_chain {}; \<forall>x\<in>{}. P x\<rbrakk> \<Longrightarrow> P (Sup {})

goal (1 subgoal):
 1. P (Sup {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P (Sup {})

goal (2 subgoals):
 1. ccpo.admissible Sup (\<le>) P
 2. \<And>x. P x \<Longrightarrow> P (f x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ccpo.admissible Sup (\<le>) P
 2. \<And>x. P x \<Longrightarrow> P (f x)
[PROOF STEP]
show "ccpo.admissible Sup (\<le>) P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccpo.admissible Sup (\<le>) P
[PROOF STEP]
by (auto simp add: chain ccpo.admissible_def Complete_Partial_Order.chain_def)
[PROOF STATE]
proof (state)
this:
ccpo.admissible Sup (\<le>) P

goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> P (f x)
[PROOF STEP]
qed fact


[STATEMENT]
lemma lookup_filter:
  "lookup (filter P t) k =
     (case lookup t k of None \<Rightarrow> None | Some v \<Rightarrow> if P k v then Some v else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (RBT.filter P t) k = (case lookup t k of None \<Rightarrow> None | Some v \<Rightarrow> if P k v then Some v else None)
[PROOF STEP]
unfolding filter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (RBT.fold (\<lambda>k v t. if P k v then RBT.insert k v t else t) t RBT.empty) k = (case lookup t k of None \<Rightarrow> None | Some v \<Rightarrow> if P k v then Some v else None)
[PROOF STEP]
using lookup_filter_aux[of "entries t" P empty k]
[PROOF STATE]
proof (prove)
using this:
distinct (list.map fst (entries t)) \<Longrightarrow> lookup (List.fold (\<lambda>(k, v) t. if P k v then RBT.insert k v t else t) (entries t) RBT.empty) k = (case map_of (entries t) k of None \<Rightarrow> lookup RBT.empty k | Some v \<Rightarrow> if P k v then Some v else lookup RBT.empty k)

goal (1 subgoal):
 1. lookup (RBT.fold (\<lambda>k v t. if P k v then RBT.insert k v t else t) t RBT.empty) k = (case lookup t k of None \<Rightarrow> None | Some v \<Rightarrow> if P k v then Some v else None)
[PROOF STEP]
by (simp add: fold_fold distinct_entries split: option.splits)


[STATEMENT]
lemma finite_ordering_intro:
  assumes "finite X"
    and "\<forall>n < card X. f n \<in> X"
    and "\<forall>x \<in> X. \<exists>n < card X. f n = x"
    and "\<forall>n n' n''. n < n' \<and> n' < n'' \<and> n'' < card X \<longrightarrow> ord (f n) (f n') (f n'')"
  shows "ordering f ord X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TernaryOrdering.ordering f ord X
[PROOF STEP]
unfolding ordering_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n. (finite X \<longrightarrow> n < card X) \<longrightarrow> f n \<in> X) \<and> (\<forall>x\<in>X. \<exists>n. (finite X \<longrightarrow> n < card X) \<and> f n = x) \<and> (\<forall>n n' n''. (finite X \<longrightarrow> n'' < card X) \<and> n < n' \<and> n' < n'' \<longrightarrow> ord (f n) (f n') (f n''))
[PROOF STEP]
by (simp add: assms)


[STATEMENT]
lemma degree_add:
  "degree (f + g) \<le> max (degree f) (Poly_Mapping.degree g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (f + g) \<le> max (degree f) (degree g)
[PROOF STEP]
unfolding degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (insert 0 (Suc ` keys (f + g))) \<le> max (Max (insert 0 (Suc ` keys f))) (Max (insert 0 (Suc ` keys g)))
[PROOF STEP]
proof transfer
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
fix f g :: "nat \<Rightarrow> 'a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
assume f: "finite {x. f x \<noteq> 0}"
[PROOF STATE]
proof (state)
this:
finite {x. f x \<noteq> (0::'a)}

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
assume g: "finite {x. g x \<noteq> 0}"
[PROOF STATE]
proof (state)
this:
finite {x. g x \<noteq> (0::'a)}

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
let ?f = "Max (insert 0 (Suc ` {k. f k \<noteq> 0}))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
let ?g = "Max (insert 0 (Suc ` {k. g k \<noteq> 0}))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
have "Max (insert 0 (Suc ` {k. f k + g k \<noteq> 0})) \<le> Max (insert 0 (Suc ` ({k. f k \<noteq> 0} \<union> {k. g k \<noteq> 0})))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> Max (insert 0 (Suc ` ({k. f k \<noteq> (0::'a)} \<union> {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
by (rule Max.subset_imp) (insert f g, auto)
[PROOF STATE]
proof (state)
this:
Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> Max (insert 0 (Suc ` ({k. f k \<noteq> (0::'a)} \<union> {k. g k \<noteq> (0::'a)})))

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> Max (insert 0 (Suc ` ({k. f k \<noteq> (0::'a)} \<union> {k. g k \<noteq> (0::'a)})))

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
have "\<dots> = max ?f ?g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (insert 0 (Suc ` ({k. f k \<noteq> (0::'a)} \<union> {k. g k \<noteq> (0::'a)}))) = max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
using f g
[PROOF STATE]
proof (prove)
using this:
finite {x. f x \<noteq> (0::'a)}
finite {x. g x \<noteq> (0::'a)}

goal (1 subgoal):
 1. Max (insert 0 (Suc ` ({k. f k \<noteq> (0::'a)} \<union> {k. g k \<noteq> (0::'a)}))) = max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
by (simp_all add: image_Un Max_Un [symmetric])
[PROOF STATE]
proof (state)
this:
Max (insert 0 (Suc ` ({k. f k \<noteq> (0::'a)} \<union> {k. g k \<noteq> (0::'a)}))) = max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>finite {x. f x \<noteq> (0::'a)}; finite {x. g x \<noteq> (0::'a)}\<rbrakk> \<Longrightarrow> Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
show "Max (insert 0 (Suc ` {k. f k + g k \<noteq> 0}))
    \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> 0}))) (Max (insert 0 (Suc ` {k. g k \<noteq> 0})))"
[PROOF STATE]
proof (prove)
using this:
Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))

goal (1 subgoal):
 1. Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Max (insert 0 (Suc ` {k. f k + g k \<noteq> (0::'a)})) \<le> max (Max (insert 0 (Suc ` {k. f k \<noteq> (0::'a)}))) (Max (insert 0 (Suc ` {k. g k \<noteq> (0::'a)})))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma swaprows_mat_inv: assumes k: "k < n" and l: "l < n"
  shows "swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
have "swaprows_mat n k l * swaprows_mat n k l =
    swaprows_mat n k l * (swaprows_mat n k l * 1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = swaprows_mat n k l * (swaprows_mat n k l * 1\<^sub>m n)
[PROOF STEP]
by (simp add: right_mult_one_mat[of _ n])
[PROOF STATE]
proof (state)
this:
swaprows_mat n k l * swaprows_mat n k l = swaprows_mat n k l * (swaprows_mat n k l * 1\<^sub>m n)

goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
swaprows_mat n k l * swaprows_mat n k l = swaprows_mat n k l * (swaprows_mat n k l * 1\<^sub>m n)

goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
have "swaprows_mat n k l * 1\<^sub>m n = swaprows k l (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swaprows_mat n k l * 1\<^sub>m n = swaprows k l (1\<^sub>m n)
[PROOF STEP]
by (rule swaprows_mat[symmetric, OF _ k l, of _ n], simp)
[PROOF STATE]
proof (state)
this:
swaprows_mat n k l * 1\<^sub>m n = swaprows k l (1\<^sub>m n)

goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
swaprows_mat n k l * 1\<^sub>m n = swaprows k l (1\<^sub>m n)

goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
have "swaprows_mat n k l * \<dots> = swaprows k l \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swaprows_mat n k l * swaprows k l (1\<^sub>m n) = swaprows k l (swaprows k l (1\<^sub>m n))
[PROOF STEP]
by (rule swaprows_mat[symmetric, of _ _ n], insert k l, auto)
[PROOF STATE]
proof (state)
this:
swaprows_mat n k l * swaprows k l (1\<^sub>m n) = swaprows k l (swaprows k l (1\<^sub>m n))

goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
swaprows_mat n k l * swaprows k l (1\<^sub>m n) = swaprows k l (swaprows k l (1\<^sub>m n))

goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
have "\<dots> = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swaprows k l (swaprows k l (1\<^sub>m n)) = 1\<^sub>m n
[PROOF STEP]
by (rule eq_matI, insert k l, auto)
[PROOF STATE]
proof (state)
this:
swaprows k l (swaprows k l (1\<^sub>m n)) = 1\<^sub>m n

goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n

goal (1 subgoal):
 1. swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
swaprows_mat n k l * swaprows_mat n k l = 1\<^sub>m n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_insort:
  "sorted cmp (insort cmp x xs)" if "sorted cmp xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x xs)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Sorting_Algorithms.sorted cmp xs

goal (1 subgoal):
 1. Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x xs)
[PROOF STEP]
proof (induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x [])
 2. \<And>xa xs. \<lbrakk>Sorting_Algorithms.sorted cmp xs; Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x xs); \<And>y. y \<in> set xs \<Longrightarrow> compare cmp xa y \<noteq> Greater\<rbrakk> \<Longrightarrow> Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x (xa # xs))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x [])
 2. \<And>xa xs. \<lbrakk>Sorting_Algorithms.sorted cmp xs; Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x xs); \<And>y. y \<in> set xs \<Longrightarrow> compare cmp xa y \<noteq> Greater\<rbrakk> \<Longrightarrow> Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x (xa # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x [])

goal (1 subgoal):
 1. \<And>xa xs. \<lbrakk>Sorting_Algorithms.sorted cmp xs; Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x xs); \<And>y. y \<in> set xs \<Longrightarrow> compare cmp xa y \<noteq> Greater\<rbrakk> \<Longrightarrow> Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x (xa # xs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa xs. \<lbrakk>Sorting_Algorithms.sorted cmp xs; Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x xs); \<And>y. y \<in> set xs \<Longrightarrow> compare cmp xa y \<noteq> Greater\<rbrakk> \<Longrightarrow> Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x (xa # xs))
[PROOF STEP]
case (Cons y ys)
[PROOF STATE]
proof (state)
this:
Sorting_Algorithms.sorted cmp ys
?y \<in> set ys \<Longrightarrow> compare cmp y ?y \<noteq> Greater
Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x ys)

goal (1 subgoal):
 1. \<And>xa xs. \<lbrakk>Sorting_Algorithms.sorted cmp xs; Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x xs); \<And>y. y \<in> set xs \<Longrightarrow> compare cmp xa y \<noteq> Greater\<rbrakk> \<Longrightarrow> Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x (xa # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sorting_Algorithms.sorted cmp ys
?y \<in> set ys \<Longrightarrow> compare cmp y ?y \<noteq> Greater
Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Sorting_Algorithms.sorted cmp ys
?y \<in> set ys \<Longrightarrow> compare cmp y ?y \<noteq> Greater
Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x ys)

goal (1 subgoal):
 1. Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x (y # ys))
[PROOF STEP]
by (cases ys)
    (auto, simp_all add: compare.greater_iff_sym_less)
[PROOF STATE]
proof (state)
this:
Sorting_Algorithms.sorted cmp (Sorting_Algorithms.insort cmp x (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prodinf_eq_one_iff [simp]:
  fixes f :: "nat \<Rightarrow> real"
  assumes f: "convergent_prod f" and ge1: "\<And>n. 1 \<le> f n"
  shows "prodinf f = 1 \<longleftrightarrow> (\<forall>n. f n = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prodinf f = 1) = (\<forall>n. f n = 1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prodinf f = 1 \<Longrightarrow> \<forall>n. f n = 1
 2. \<forall>n. f n = 1 \<Longrightarrow> prodinf f = 1
[PROOF STEP]
assume "prodinf f = 1"
[PROOF STATE]
proof (state)
this:
prodinf f = 1

goal (2 subgoals):
 1. prodinf f = 1 \<Longrightarrow> \<forall>n. f n = 1
 2. \<forall>n. f n = 1 \<Longrightarrow> prodinf f = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prodinf f = 1
[PROOF STEP]
have "(\<lambda>n. \<Prod>i<n. f i) \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
using this:
prodinf f = 1

goal (1 subgoal):
 1. (\<lambda>n. prod f {..<n}) \<longlonglongrightarrow> 1
[PROOF STEP]
using convergent_prod_LIMSEQ[of f] assms
[PROOF STATE]
proof (prove)
using this:
prodinf f = 1
convergent_prod f \<Longrightarrow> (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> prodinf f
convergent_prod f
1 \<le> f ?n

goal (1 subgoal):
 1. (\<lambda>n. prod f {..<n}) \<longlonglongrightarrow> 1
[PROOF STEP]
by (simp add: LIMSEQ_lessThan_iff_atMost)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. prod f {..<n}) \<longlonglongrightarrow> 1

goal (2 subgoals):
 1. prodinf f = 1 \<Longrightarrow> \<forall>n. f n = 1
 2. \<forall>n. f n = 1 \<Longrightarrow> prodinf f = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. prod f {..<n}) \<longlonglongrightarrow> 1
[PROOF STEP]
have "\<And>i. (\<Prod>n\<in>{i}. f n) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. prod f {..<n}) \<longlonglongrightarrow> 1

goal (1 subgoal):
 1. \<And>i. prod f {i} \<le> 1
[PROOF STEP]
proof (rule LIMSEQ_le_const)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<exists>N. \<forall>n\<ge>N. prod f {i} \<le> prod f {..<n}
[PROOF STEP]
have "1 \<le> prod f n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> prod f n
[PROOF STEP]
by (simp add: ge1 prod_ge_1)
[PROOF STATE]
proof (state)
this:
1 \<le> prod f ?n

goal (1 subgoal):
 1. \<And>i. \<exists>N. \<forall>n\<ge>N. prod f {i} \<le> prod f {..<n}
[PROOF STEP]
have "prod f {..<n} = 1" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<n} = 1
[PROOF STEP]
by (metis \<open>\<And>n. 1 \<le> prod f n\<close> \<open>prodinf f = 1\<close> antisym f convergent_prod_has_prod ge1 order_trans prod_le_prodinf zero_le_one)
[PROOF STATE]
proof (state)
this:
prod f {..<?n} = 1

goal (1 subgoal):
 1. \<And>i. \<exists>N. \<forall>n\<ge>N. prod f {i} \<le> prod f {..<n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prod f {..<?n} = 1
[PROOF STEP]
have "(\<Prod>n\<in>{i}. f n) \<le> prod f {..<n}" if "n \<ge> Suc i" for i n
[PROOF STATE]
proof (prove)
using this:
prod f {..<?n} = 1

goal (1 subgoal):
 1. prod f {i} \<le> prod f {..<n}
[PROOF STEP]
by (metis mult.left_neutral order_refl prod.cong prod.neutral_const prod.lessThan_Suc)
[PROOF STATE]
proof (state)
this:
Suc ?i \<le> ?n \<Longrightarrow> prod f {?i} \<le> prod f {..<?n}

goal (1 subgoal):
 1. \<And>i. \<exists>N. \<forall>n\<ge>N. prod f {i} \<le> prod f {..<n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc ?i \<le> ?n \<Longrightarrow> prod f {?i} \<le> prod f {..<?n}
[PROOF STEP]
show "\<exists>N. \<forall>n\<ge>N. (\<Prod>n\<in>{i}. f n) \<le> prod f {..<n}" for i
[PROOF STATE]
proof (prove)
using this:
Suc ?i \<le> ?n \<Longrightarrow> prod f {?i} \<le> prod f {..<?n}

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. prod f {i} \<le> prod f {..<n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>n\<ge>N. prod f {?i} \<le> prod f {..<n}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prod f {?i} \<le> 1

goal (2 subgoals):
 1. prodinf f = 1 \<Longrightarrow> \<forall>n. f n = 1
 2. \<forall>n. f n = 1 \<Longrightarrow> prodinf f = 1
[PROOF STEP]
with ge1
[PROOF STATE]
proof (chain)
picking this:
1 \<le> f ?n
prod f {?i} \<le> 1
[PROOF STEP]
show "\<forall>n. f n = 1"
[PROOF STATE]
proof (prove)
using this:
1 \<le> f ?n
prod f {?i} \<le> 1

goal (1 subgoal):
 1. \<forall>n. f n = 1
[PROOF STEP]
by (auto intro!: antisym)
[PROOF STATE]
proof (state)
this:
\<forall>n. f n = 1

goal (1 subgoal):
 1. \<forall>n. f n = 1 \<Longrightarrow> prodinf f = 1
[PROOF STEP]
qed (metis prodinf_zero fun_eq_iff)


[STATEMENT]
lemma degree_mult_eq: "p \<noteq> 0 \<Longrightarrow> q \<noteq> 0 \<Longrightarrow> degree (p * q) = degree p + degree q"
  for p q :: "'a::{comm_semiring_0,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> degree (p * q) = degree p + degree q
[PROOF STEP]
by (rule order_antisym [OF degree_mult_le le_degree]) (simp add: coeff_mult_degree_sum)


[STATEMENT]
lemma sum_pow2_insert0:
  "\<lbrakk>finite X; 0 \<notin> X\<rbrakk> \<Longrightarrow> sum ((^) (2 :: nat)) (insert 0 X) = Suc (sum ((^) 2) X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite X; 0 \<notin> X\<rbrakk> \<Longrightarrow> sum ((^) 2) (insert 0 X) = Suc (sum ((^) 2) X)
[PROOF STEP]
by (induct X rule: finite_induct) (auto intro: trans[OF sum.insert])


[STATEMENT]
lemma lincomb_concat :
  "list_all2 (\<lambda>rs ms. length rs = length ms) rss mss
        \<Longrightarrow> (concat rss) \<bullet>\<cdot> (concat mss) = (\<Sum>(rs,ms)\<leftarrow>zip rss mss. rs \<bullet>\<cdot> ms)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (\<lambda>rs ms. length rs = length ms) rss mss \<Longrightarrow> concat rss \<bullet>\<cdot> concat mss = sum_list (map2 (\<bullet>\<cdot>) rss mss)
[PROOF STEP]
using lincomb_Nil lincomb_append
[PROOF STATE]
proof (prove)
using this:
?rs = [] \<or> ?ms = [] \<Longrightarrow> ?rs \<bullet>\<cdot> ?ms = (0::'m)
length ?rs = length ?ms \<Longrightarrow> (?rs @ ?ss) \<bullet>\<cdot> (?ms @ ?ns) = ?rs \<bullet>\<cdot> ?ms + ?ss \<bullet>\<cdot> ?ns

goal (1 subgoal):
 1. list_all2 (\<lambda>rs ms. length rs = length ms) rss mss \<Longrightarrow> concat rss \<bullet>\<cdot> concat mss = sum_list (map2 (\<bullet>\<cdot>) rss mss)
[PROOF STEP]
by (induct rss mss rule: list_induct2') auto


[STATEMENT]
lemma bounded_plus:
  fixes S ::"'a::real_normed_vector set"
  assumes "bounded S" "bounded T"
  shows "bounded ((\<lambda>(x,y). x + y) ` (S \<times> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded ((\<lambda>(x, y). x + y) ` (S \<times> T))
[PROOF STEP]
using bounded_plus_comp [of fst "S \<times> T" snd] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bounded (fst ` (S \<times> T)); bounded (snd ` (S \<times> T))\<rbrakk> \<Longrightarrow> bounded ((\<lambda>x. fst x + snd x) ` (S \<times> T))
bounded S
bounded T

goal (1 subgoal):
 1. bounded ((\<lambda>(x, y). x + y) ` (S \<times> T))
[PROOF STEP]
by (auto simp: split_def split: if_split_asm)


[STATEMENT]
lemma NSLIMSEQ_add_const: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. f n + b) \<longlonglongrightarrow>\<^sub>N\<^sub>S a + b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. f n + b) \<longlonglongrightarrow>\<^sub>N\<^sub>S a + b
[PROOF STEP]
by (simp only: NSLIMSEQ_add NSLIMSEQ_const)


[STATEMENT]
lemma poly_pos_between_leq_leq:
  "(\<forall>x::real. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x > 0) \<longleftrightarrow>
    (a > b \<or> poly p a > 0) \<and> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x) = ((b < a \<or> 0 < poly p a) \<and> (\<forall>x. a \<le> 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 \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> b < a \<or> 0 < poly p a
 2. \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
 3. (b < a \<or> 0 < poly p a) \<and> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
assume A: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (state)
this:
\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x

goal (3 subgoals):
 1. \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> b < a \<or> 0 < poly p a
 2. \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
 3. (b < a \<or> 0 < poly p a) \<and> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a \<le> 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 \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> b < a \<or> 0 < poly p a
 2. \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x \<Longrightarrow> \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
 3. (b < a \<or> 0 < poly p a) \<and> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0) \<Longrightarrow> \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a \<le> 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 \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a \<le> 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 \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> poly p x \<noteq> 0

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

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

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

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

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

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

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

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

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a \<le> b; a \<le> 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 a
[PROOF STEP]
have "x > a"
[PROOF STATE]
proof (prove)
using this:
poly p x < 0
0 < poly p a

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

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

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a \<le> b; a \<le> 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 a > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
poly p x < 0
0 < poly p a
[PROOF STEP]
have "sgn (poly p a) \<noteq> sgn (poly p x)"
[PROOF STATE]
proof (prove)
using this:
poly p x < 0
0 < poly p a

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

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

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 \<le> x \<and> x \<le> b \<longrightarrow> 0 < poly p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dlex_pp_alt: "dlex_pp s t \<longleftrightarrow> (deg_pp s < deg_pp t \<or> (deg_pp s = deg_pp t \<and> lex_pp s t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dlex_pp s t = (deg_pp s < deg_pp t \<or> deg_pp s = deg_pp t \<and> lex_pp s t)
[PROOF STEP]
by transfer (simp only: dlex_pm_def dord_pm_alt)


[STATEMENT]
lemma cartesian_product_car_complement_left:
  assumes "A \<subseteq> carrier (R\<^bsup>n\<^esup>)"
  shows "carrier (R\<^bsup>n + m\<^esup>) - cartesian_product  A (carrier (R\<^bsup>m\<^esup>)) =
          cartesian_product ((carrier (R\<^bsup>n\<^esup>)) - A) (carrier (R\<^bsup>m\<^esup>)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) = cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) \<subseteq> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))
 2. cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)) \<subseteq> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
show "carrier (R\<^bsup>n + m\<^esup>) - cartesian_product  A (carrier (R\<^bsup>m\<^esup>)) \<subseteq>
          cartesian_product ((carrier (R\<^bsup>n\<^esup>)) - A) (carrier (R\<^bsup>m\<^esup>)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) \<subseteq> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
assume A: " x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product  A (carrier (R\<^bsup>m\<^esup>))"
[PROOF STATE]
proof (state)
this:
x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
show "x \<in> cartesian_product ((carrier (R\<^bsup>n\<^esup>)) - A) (carrier (R\<^bsup>m\<^esup>)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
proof(rule cartesian_product_memI[of _ R n _ m])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. carrier (R\<^bsup>n\<^esup>) - A \<subseteq> carrier (R\<^bsup>n\<^esup>)
 2. carrier (R\<^bsup>m\<^esup>) \<subseteq> carrier (R\<^bsup>m\<^esup>)
 3. take n x \<in> carrier (R\<^bsup>n\<^esup>) - A
 4. drop n x \<in> carrier (R\<^bsup>m\<^esup>)
[PROOF STEP]
show "carrier (R\<^bsup>n\<^esup>) - A \<subseteq> carrier (R\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (R\<^bsup>n\<^esup>) - A \<subseteq> carrier (R\<^bsup>n\<^esup>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
carrier (R\<^bsup>n\<^esup>) - A \<subseteq> carrier (R\<^bsup>n\<^esup>)

goal (3 subgoals):
 1. carrier (R\<^bsup>m\<^esup>) \<subseteq> carrier (R\<^bsup>m\<^esup>)
 2. take n x \<in> carrier (R\<^bsup>n\<^esup>) - A
 3. drop n x \<in> carrier (R\<^bsup>m\<^esup>)
[PROOF STEP]
show "carrier (R\<^bsup>m\<^esup>) \<subseteq> carrier (R\<^bsup>m\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (R\<^bsup>m\<^esup>) \<subseteq> carrier (R\<^bsup>m\<^esup>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
carrier (R\<^bsup>m\<^esup>) \<subseteq> carrier (R\<^bsup>m\<^esup>)

goal (2 subgoals):
 1. take n x \<in> carrier (R\<^bsup>n\<^esup>) - A
 2. drop n x \<in> carrier (R\<^bsup>m\<^esup>)
[PROOF STEP]
show "take n x \<in> carrier (R\<^bsup>n\<^esup>) - A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n x \<in> carrier (R\<^bsup>n\<^esup>) - A
[PROOF STEP]
by (metis (no_types, lifting) A DiffD1 DiffD2 DiffI assms
            cartesian_product_carrier cartesian_product_memE(2) cartesian_product_memI
            le_add1 order_refl take_closed)
[PROOF STATE]
proof (state)
this:
take n x \<in> carrier (R\<^bsup>n\<^esup>) - A

goal (1 subgoal):
 1. drop n x \<in> carrier (R\<^bsup>m\<^esup>)
[PROOF STEP]
show "drop n x \<in> carrier (R\<^bsup>m\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop n x \<in> carrier (R\<^bsup>m\<^esup>)
[PROOF STEP]
by (metis A DiffD1 cartesian_product_carrier cartesian_product_memE(2) order_refl)
[PROOF STATE]
proof (state)
this:
drop n x \<in> carrier (R\<^bsup>m\<^esup>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) \<subseteq> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))

goal (1 subgoal):
 1. cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)) \<subseteq> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
show "cartesian_product ((carrier (R\<^bsup>n\<^esup>)) - A) (carrier (R\<^bsup>m\<^esup>)) \<subseteq>
        carrier (R\<^bsup>n + m\<^esup>) - cartesian_product  A (carrier (R\<^bsup>m\<^esup>)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)) \<subseteq> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)) \<Longrightarrow> x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)) \<Longrightarrow> x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
assume A: " x \<in> cartesian_product ((carrier (R\<^bsup>n\<^esup>)) - A) (carrier (R\<^bsup>m\<^esup>))"
[PROOF STATE]
proof (state)
this:
x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))

goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)) \<Longrightarrow> x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
show "x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product  A (carrier (R\<^bsup>m\<^esup>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))
[PROOF STEP]
apply(rule ccontr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) \<Longrightarrow> False
[PROOF STEP]
using A cartesian_product_memE[of x "((carrier (R\<^bsup>n\<^esup>)) - A)" "(carrier (R\<^bsup>m\<^esup>))"]
              cartesian_product_memE[of x A "(carrier (R\<^bsup>m\<^esup>))"]
[PROOF STATE]
proof (prove)
using this:
x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>))
\<lbrakk>x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)); carrier (R\<^bsup>n\<^esup>) - A \<subseteq> carrier (?R\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> take ?n x \<in> carrier (R\<^bsup>n\<^esup>) - A
\<lbrakk>x \<in> cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)); carrier (R\<^bsup>n\<^esup>) - A \<subseteq> carrier (?R\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> drop ?n x \<in> carrier (R\<^bsup>m\<^esup>)
\<lbrakk>x \<in> cartesian_product A (carrier (R\<^bsup>m\<^esup>)); A \<subseteq> carrier (?R\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> take ?n x \<in> A
\<lbrakk>x \<in> cartesian_product A (carrier (R\<^bsup>m\<^esup>)); A \<subseteq> carrier (?R\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> drop ?n x \<in> carrier (R\<^bsup>m\<^esup>)

goal (1 subgoal):
 1. x \<notin> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>)) \<Longrightarrow> False
[PROOF STEP]
by (smt DiffD1 DiffD2 DiffI Diff_subset append_take_drop_id assms cartesian_product_closed')
[PROOF STATE]
proof (state)
this:
x \<in> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cartesian_product (carrier (R\<^bsup>n\<^esup>) - A) (carrier (R\<^bsup>m\<^esup>)) \<subseteq> carrier (R\<^bsup>n + m\<^esup>) - cartesian_product A (carrier (R\<^bsup>m\<^esup>))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_minus: "\<lfloor>- x\<rfloor> = - \<lceil>x\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- x\<rfloor> = - \<lceil>x\<rceil>
[PROOF STEP]
unfolding ceiling_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- x\<rfloor> = - (- \<lfloor>- x\<rfloor>)
[PROOF STEP]
by simp


[STATEMENT]
lemma sum_divisors_code:
  assumes "n > (0::nat)"
  shows   "(\<Sum>d | d dvd n. f d) =
             fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
have "(\<lambda>d acc. if d dvd n then f d + acc else acc) = (\<lambda>d acc. (if d dvd n then f d else 0) + acc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>d acc. if d dvd n then f d + acc else acc) = (\<lambda>d. (+) (if d dvd n then f d else (0::'a)))
[PROOF STEP]
by (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>d acc. if d dvd n then f d + acc else acc) = (\<lambda>d. (+) (if d dvd n then f d else (0::'a)))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
hence "fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n 0 =
           fold_atLeastAtMost_nat (\<lambda>d acc. (if d dvd n then f d else 0) + acc) 1 n 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>d acc. if d dvd n then f d + acc else acc) = (\<lambda>d. (+) (if d dvd n then f d else (0::'a)))

goal (1 subgoal):
 1. fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a) = fold_atLeastAtMost_nat (\<lambda>d. (+) (if d dvd n then f d else (0::'a))) 1 n (0::'a)
[PROOF STEP]
by (simp only: )
[PROOF STATE]
proof (state)
this:
fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a) = fold_atLeastAtMost_nat (\<lambda>d. (+) (if d dvd n then f d else (0::'a))) 1 n (0::'a)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a) = fold_atLeastAtMost_nat (\<lambda>d. (+) (if d dvd n then f d else (0::'a))) 1 n (0::'a)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
have "\<dots> = (\<Sum>d = 1..n. if d dvd n then f d else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_atLeastAtMost_nat (\<lambda>d. (+) (if d dvd n then f d else (0::'a))) 1 n (0::'a) = (\<Sum>d = 1..n. if d dvd n then f d else (0::'a))
[PROOF STEP]
by (rule sum_atLeastAtMost_code [symmetric])
[PROOF STATE]
proof (state)
this:
fold_atLeastAtMost_nat (\<lambda>d. (+) (if d dvd n then f d else (0::'a))) 1 n (0::'a) = (\<Sum>d = 1..n. if d dvd n then f d else (0::'a))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fold_atLeastAtMost_nat (\<lambda>d. (+) (if d dvd n then f d else (0::'a))) 1 n (0::'a) = (\<Sum>d = 1..n. if d dvd n then f d else (0::'a))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "\<dots> = (\<Sum>d | d dvd n. f d)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (\<Sum>d = 1..n. if d dvd n then f d else (0::'a)) = (\<Sum>d | d dvd n. f d)
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) (auto elim: dvdE dest: dvd_imp_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. if d dvd n then f d else (0::'a)) = (\<Sum>d | d dvd n. f d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a) = (\<Sum>d | d dvd n. f d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a) = (\<Sum>d | d dvd n. f d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. f d) = fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then f d + acc else acc) 1 n (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_vector_derivative_divide[derivative_intros]:
  fixes a :: "'a::real_normed_field"
  shows "(f has_vector_derivative x) F \<Longrightarrow> ((\<lambda>x. f x / a) has_vector_derivative (x / a)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_vector_derivative x) F \<Longrightarrow> ((\<lambda>x. f x / a) has_vector_derivative x / a) F
[PROOF STEP]
using has_vector_derivative_mult_left [of f x F "inverse a"]
[PROOF STATE]
proof (prove)
using this:
(f has_vector_derivative x) F \<Longrightarrow> ((\<lambda>x. f x * inverse a) has_vector_derivative x * inverse a) F

goal (1 subgoal):
 1. (f has_vector_derivative x) F \<Longrightarrow> ((\<lambda>x. f x / a) has_vector_derivative x / a) F
[PROOF STEP]
by (simp add: field_class.field_divide_inverse)


[STATEMENT]
lemma poincare_line_0_imag_is_y_axis:
  assumes "y \<in> circline_set y_axis" "y \<noteq> 0\<^sub>h" "y \<noteq> \<infinity>\<^sub>h"
  shows "poincare_line 0\<^sub>h y = y_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_line 0\<^sub>h y = y_axis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y \<in> circline_set y_axis
y \<noteq> 0\<^sub>h
y \<noteq> \<infinity>\<^sub>h

goal (1 subgoal):
 1. poincare_line 0\<^sub>h y = y_axis
[PROOF STEP]
using is_poincare_line_0_imag_is_y_axis[of "poincare_line 0\<^sub>h y" y]
[PROOF STATE]
proof (prove)
using this:
y \<in> circline_set y_axis
y \<noteq> 0\<^sub>h
y \<noteq> \<infinity>\<^sub>h
\<lbrakk>is_poincare_line (poincare_line 0\<^sub>h y); 0\<^sub>h \<in> circline_set (poincare_line 0\<^sub>h y); y \<in> circline_set (poincare_line 0\<^sub>h y) \<inter> circline_set y_axis; y \<noteq> 0\<^sub>h; y \<noteq> \<infinity>\<^sub>h\<rbrakk> \<Longrightarrow> poincare_line 0\<^sub>h y = y_axis

goal (1 subgoal):
 1. poincare_line 0\<^sub>h y = y_axis
[PROOF STEP]
by auto


[STATEMENT]
lemma continuous_on_divide[continuous_intros]:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_field"
  assumes "continuous_on s f" "continuous_on s g"
    and "\<forall>x\<in>s. g x \<noteq> 0"
  shows "continuous_on s (\<lambda>x. (f x) / (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x / g x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on s f
continuous_on s g
\<forall>x\<in>s. g x \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x / g x)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s)
\<forall>x\<in>s. (g \<longlongrightarrow> g x) (at x within s)
\<forall>x\<in>s. g x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<forall>x\<in>s. ((\<lambda>x. f x / g x) \<longlongrightarrow> f x / g x) (at x within s)
[PROOF STEP]
by (blast intro: tendsto_divide)


[STATEMENT]
lemma disjoint_union: "disjoint C \<Longrightarrow> disjoint B \<Longrightarrow> \<Union>C \<inter> \<Union>B = {} \<Longrightarrow> disjoint (C \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>disjoint C; disjoint B; \<Union> C \<inter> \<Union> B = {}\<rbrakk> \<Longrightarrow> disjoint (C \<union> B)
[PROOF STEP]
using disjoint_UN[of "{C, B}" "\<lambda>x. x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i \<in> {C, B} \<Longrightarrow> disjoint i; disjoint_family_on \<Union> {C, B}\<rbrakk> \<Longrightarrow> disjoint (\<Union>i\<in>{C, B}. i)

goal (1 subgoal):
 1. \<lbrakk>disjoint C; disjoint B; \<Union> C \<inter> \<Union> B = {}\<rbrakk> \<Longrightarrow> disjoint (C \<union> B)
[PROOF STEP]
by (auto simp add: disjoint_family_on_def)


[STATEMENT]
lemma even_Bit0_int: "even (numeral (Num.Bit0 x) :: int) = True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (numeral (num.Bit0 x)) = True
[PROOF STEP]
by (simp only: even_numeral)


[STATEMENT]
lemma lemma_interval: "a < x \<Longrightarrow> x < b \<Longrightarrow> \<exists>d. 0 < d \<and> (\<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a \<le> y \<and> y \<le> b)"
  for a b x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> a \<le> y \<and> y \<le> b
[PROOF STEP]
by (force dest: lemma_interval_lt)


[STATEMENT]
lemma ordinal_of_hmset_suc[simp]: "ordinal_of_hmset (k + 1) = ordinal_of_hmset k + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_of_hmset (k + 1) = ordinal_of_hmset k + 1
[PROOF STEP]
unfolding plus_hmultiset_def one_hmultiset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_of_hmset (HMSet (hmsetmset k + hmsetmset (\<omega>\<^sub>h^ 0))) = ordinal_of_hmset k + 1
[PROOF STEP]
by (cases k) simp


[STATEMENT]
lemma (in prob_space) simp_exp_composed:
  assumes X: "simple_distributed M X Px"
shows "expectation (\<lambda>a. f (X a)) = (\<Sum>x \<in> X`space M. f x * Px x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>a. f (X a)) = (\<Sum>x\<in>X ` space M. f x * Px x)
[PROOF STEP]
using distributed_integral[OF simple_distributed[OF X], of f]
    simple_distributed_nonneg[OF X]
    lebesgue_integral_count_space_finite[OF simple_distributed_finite[OF X], of "\<lambda>x. f x * Px x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f \<in> borel_measurable (count_space (X ` space M)); \<And>x. x \<in> space (count_space (X ` space M)) \<Longrightarrow> 0 \<le> Px x\<rbrakk> \<Longrightarrow> LINT x|count_space (X ` space M). Px x * f x = expectation (\<lambda>x. f (X x))
0 \<le> Px ?x
LINT x|count_space (X ` space M). f x * Px x = (\<Sum>a\<in>X ` space M. f a * Px a)

goal (1 subgoal):
 1. expectation (\<lambda>a. f (X a)) = (\<Sum>x\<in>X ` space M. f x * Px x)
[PROOF STEP]
by (simp add:  ac_simps)


[STATEMENT]
lemma Re_express_cnj:
  shows "Re z = (z + cnj z) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cor (Re z) = (z + cnj z) / 2
[PROOF STEP]
by (simp add: complex_add_cnj)


[STATEMENT]
lemma length_merge_adjacent[simp]: "length (merge_adj xs) = (length xs + 1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (merge_adj xs) = (length xs + 1) div 2
[PROOF STEP]
by (induction xs rule: merge_adj.induct) auto


[STATEMENT]
lemma open_segment_as_ball:
    "open_segment a b =
     affine hull {a,b} \<inter> ball(inverse 2 *\<^sub>R (a + b))(norm(b - a) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
proof (cases "b = a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = a \<Longrightarrow> open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
 2. b \<noteq> a \<Longrightarrow> open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = a

goal (2 subgoals):
 1. b = a \<Longrightarrow> open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
 2. b \<noteq> a \<Longrightarrow> open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b = a

goal (1 subgoal):
 1. open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
by (auto simp: hull_inc)
[PROOF STATE]
proof (state)
this:
open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> a

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> a
[PROOF STEP]
have *: "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) =
                 (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)" for x
[PROOF STATE]
proof (prove)
using this:
b \<noteq> a

goal (1 subgoal):
 1. ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
have "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) =
          ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and>
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a))
[PROOF STEP]
unfolding eq_diff_eq [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u = 1 - v) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
                          norm ((a+b) - (2 *\<^sub>R x)) < norm (b - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R x) < norm (b - a))
[PROOF STEP]
by (simp add: dist_half_times2) (simp add: dist_norm)
[PROOF STATE]
proof (state)
this:
((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R x) < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R x) < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
            norm ((a+b) - (2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b))) < norm (b - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R x) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b)) < norm (b - a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R x) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b)) < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R x) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b)) < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
                norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b)) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a))
[PROOF STEP]
by (simp add: algebra_simps scaleR_2)
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b)) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm (a + b - 2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b)) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
                          \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a))

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> < 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> < 1)
[PROOF STEP]
by (simp add: mult_le_cancel_right2 False)
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> < 1)

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> < 1)

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> < 1) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> < 1) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)

goal (1 subgoal):
 1. ((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<exists>u v. ?x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and> dist ((1 / 2) *\<^sub>R (a + b)) ?x * 2 < norm (b - a)) = (\<exists>u. ?x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)

goal (1 subgoal):
 1. b \<noteq> a \<Longrightarrow> open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
b \<noteq> a

goal (1 subgoal):
 1. open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)
[PROOF STEP]
by (force simp: affine_hull_2 Set.set_eq_iff open_segment_image_interval *)
[PROOF STATE]
proof (state)
this:
open_segment a b = affine hull {a, b} \<inter> ball ((a + b) /\<^sub>R 2) (norm (b - a) / 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gbinomial_sum_lower_neg: "(\<Sum>k\<le>m. (a gchoose k) * (- 1) ^ k) = (- 1) ^ m * (a - 1 gchoose m)"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
have "?lhs = (\<Sum>k\<le>m. -(a + 1) + of_nat k gchoose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (\<Sum>k\<le>m. - (a + (1::'a)) + of_nat k gchoose k)
[PROOF STEP]
by (intro sum.cong[OF refl]) (subst gbinomial_negated_upper, simp add: power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (\<Sum>k\<le>m. - (a + (1::'a)) + of_nat k gchoose k)

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (\<Sum>k\<le>m. - (a + (1::'a)) + of_nat k gchoose k)

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
have "\<dots>  = - a + of_nat m gchoose m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. - (a + (1::'a)) + of_nat k gchoose k) = - a + of_nat m gchoose m
[PROOF STEP]
by (subst gbinomial_parallel_sum) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. - (a + (1::'a)) + of_nat k gchoose k) = - a + of_nat m gchoose m

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. - (a + (1::'a)) + of_nat k gchoose k) = - a + of_nat m gchoose m

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a + of_nat m gchoose m = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
by (subst gbinomial_negated_upper) (simp add: power_mult_distrib)
[PROOF STATE]
proof (state)
this:
- a + of_nat m gchoose m = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)

goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. (a gchoose k) * (- (1::'a)) ^ k) = (- (1::'a)) ^ m * (a - (1::'a) gchoose m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inter_num_max_bound:
  assumes "finite b1" "finite b2"
  shows "b1 |\<inter>| b2 \<le> card b1" "b1 |\<inter>| b2 \<le> card b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b1 |\<inter>| b2 \<le> card b1 &&& b1 |\<inter>| b2 \<le> card b2
[PROOF STEP]
by(simp_all add: assms intersection_number_def card_mono)


[STATEMENT]
lemma zeta_partial_sum_pos_bigtheta:
  assumes "s > 0" "s \<noteq> 1"
  shows   "sum_upto (\<lambda>n. n powr -s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
proof (cases "s > 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 < s \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
 2. \<not> 1 < s \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 1 < s

goal (2 subgoals):
 1. 1 < s \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
 2. \<not> 1 < s \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> 1 < s

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
using asymp_equiv_imp_bigtheta[OF zeta_partial_sum_01_asymp_equiv[of s]] assms
[PROOF STATE]
proof (prove)
using this:
\<not> 1 < s
s \<in> {0<..<1} \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr (1 - s) / (1 - s))
0 < s
s \<noteq> 1

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
by (simp add: max_def)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))

goal (1 subgoal):
 1. 1 < s \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < s \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
1 < s

goal (1 subgoal):
 1. 1 < s \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
have [simp]: "Re (zeta s) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (zeta (complex_of_real s)) \<noteq> 0
[PROOF STEP]
using True zeta_Re_gt_1_nonzero[of s] zeta_real[of s]
[PROOF STATE]
proof (prove)
using this:
1 < s
1 < Re (complex_of_real s) \<Longrightarrow> zeta (complex_of_real s) \<noteq> 0
zeta (complex_of_real s) \<in> \<real>

goal (1 subgoal):
 1. Re (zeta (complex_of_real s)) \<noteq> 0
[PROOF STEP]
by (auto elim!: Reals_cases)
[PROOF STATE]
proof (state)
this:
Re (zeta (complex_of_real s)) \<noteq> 0

goal (1 subgoal):
 1. 1 < s \<Longrightarrow> sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
using True asymp_equiv_imp_bigtheta[OF zeta_partial_sum_gt_1_asymp_equiv[of s]]
[PROOF STATE]
proof (prove)
using this:
1 < s
1 < s \<Longrightarrow> sum_upto (\<lambda>x. real x powr - s) \<in> \<Theta>(\<lambda>x. Re (zeta (complex_of_real s)))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
by (simp add: max_def)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real n powr - s) \<in> \<Theta>(\<lambda>x. x powr max 0 (1 - s))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isomorphic_to_left_adjoint_implies_isomorphic_right_adjoint:
    assumes "is_left_adjoint f" and "f \<cong> h"
    shows "f\<^sup>* \<cong> h\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f\<^sup>* \<cong> h\<^sup>*
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f\<^sup>* \<cong> h\<^sup>*
[PROOF STEP]
have 1: "adjoint_pair f f\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint_pair f f\<^sup>*
[PROOF STEP]
using assms left_adjoint_extends_to_adjoint_pair
[PROOF STATE]
proof (prove)
using this:
is_left_adjoint f
f \<cong> h
is_left_adjoint ?f \<Longrightarrow> adjoint_pair ?f ?f\<^sup>*

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

goal (1 subgoal):
 1. f\<^sup>* \<cong> h\<^sup>*
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
adjoint_pair f f\<^sup>*

goal (1 subgoal):
 1. f\<^sup>* \<cong> h\<^sup>*
[PROOF STEP]
have "adjoint_pair h f\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint_pair h f\<^sup>*
[PROOF STEP]
using assms 1 adjoint_pair_preserved_by_iso isomorphic_symmetric isomorphic_reflexive
[PROOF STATE]
proof (prove)
using this:
is_left_adjoint f
f \<cong> h
adjoint_pair f f\<^sup>*
\<lbrakk>adjoint_pair ?f ?g; \<guillemotleft>?\<phi> : ?f \<Rightarrow> ?f'\<guillemotright>; local.iso ?\<phi>; \<guillemotleft>?\<psi> : ?g \<Rightarrow> ?g'\<guillemotright>; local.iso ?\<psi>\<rbrakk> \<Longrightarrow> adjoint_pair ?f' ?g'
?f \<cong> ?g \<Longrightarrow> ?g \<cong> ?f
ide ?f \<Longrightarrow> ?f \<cong> ?f

goal (1 subgoal):
 1. adjoint_pair h f\<^sup>*
[PROOF STEP]
by (meson isomorphic_def right_adjoint_simps(1))
[PROOF STATE]
proof (state)
this:
adjoint_pair h f\<^sup>*

goal (1 subgoal):
 1. f\<^sup>* \<cong> h\<^sup>*
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
adjoint_pair h f\<^sup>*

goal (1 subgoal):
 1. f\<^sup>* \<cong> h\<^sup>*
[PROOF STEP]
using left_adjoint_determines_right_up_to_iso left_adjoint_extends_to_adjoint_pair
[PROOF STATE]
proof (prove)
using this:
adjoint_pair h f\<^sup>*
\<lbrakk>adjoint_pair ?f ?g; adjoint_pair ?f ?g'\<rbrakk> \<Longrightarrow> ?g \<cong> ?g'
is_left_adjoint ?f \<Longrightarrow> adjoint_pair ?f ?f\<^sup>*

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_sorted_list_of_set [simp]:
  "finite A \<Longrightarrow> length (sorted_list_of_set A) = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> length (sorted_list_of_set A) = card A
[PROOF STEP]
by (metis length_remdups_card_conv length_sort set_sorted_list_of_set
            sorted_list_of_set_sort_remdups)