[STATEMENT]
lemma convex_rel_interior_closure:
  fixes S :: "'n::euclidean_space set"
  assumes "convex S"
  shows "rel_interior (closure S) = rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior (closure S) = rel_interior S
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
 2. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
 2. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

goal (1 subgoal):
 1. rel_interior (closure S) = rel_interior S
[PROOF STEP]
using assms rel_interior_eq_empty
[PROOF STATE]
proof (prove)
using this:
S = {}
convex S
convex ?S \<Longrightarrow> (rel_interior ?S = {}) = (?S = {})

goal (1 subgoal):
 1. rel_interior (closure S) = rel_interior S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (closure S) = rel_interior S

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
have "rel_interior (closure S) \<supseteq> rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior S \<subseteq> rel_interior (closure S)
[PROOF STEP]
using subset_rel_interior[of S "closure S"] closure_same_affine_hull closure_subset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>S \<subseteq> closure S; affine hull S = affine hull closure S\<rbrakk> \<Longrightarrow> rel_interior S \<subseteq> rel_interior (closure S)
affine hull closure ?S = affine hull ?S
?S \<subseteq> closure ?S

goal (1 subgoal):
 1. rel_interior S \<subseteq> rel_interior (closure S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior S \<subseteq> rel_interior (closure S)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rel_interior S \<subseteq> rel_interior (closure S)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
rel_interior S \<subseteq> rel_interior (closure S)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
assume z: "z \<in> rel_interior (closure S)"
[PROOF STATE]
proof (state)
this:
z \<in> rel_interior (closure S)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
obtain x where x: "x \<in> rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> rel_interior S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>S \<noteq> {}\<close> assms rel_interior_eq_empty
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
convex S
convex ?S \<Longrightarrow> (rel_interior ?S = {}) = (?S = {})

goal (1 subgoal):
 1. (\<And>x. x \<in> rel_interior S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> rel_interior S

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
have "z \<in> rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> rel_interior S
[PROOF STEP]
proof (cases "x = z")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = z \<Longrightarrow> z \<in> rel_interior S
 2. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = z

goal (2 subgoals):
 1. x = z \<Longrightarrow> z \<in> rel_interior S
 2. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = z

goal (1 subgoal):
 1. z \<in> rel_interior S
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x = z
x \<in> rel_interior S

goal (1 subgoal):
 1. z \<in> rel_interior S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> rel_interior S

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> z

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
obtain e where e: "e > 0" "cball z e \<inter> affine hull closure S \<le> closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; cball z e \<inter> affine hull closure S \<subseteq> closure S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using z rel_interior_cball[of "closure S"]
[PROOF STATE]
proof (prove)
using this:
z \<in> rel_interior (closure S)
rel_interior (closure S) = {x \<in> closure S. \<exists>e>0. cball x e \<inter> affine hull closure S \<subseteq> closure S}

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; cball z e \<inter> affine hull closure S \<subseteq> closure S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < e
cball z e \<inter> affine hull closure S \<subseteq> closure S

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
hence *: "0 < e/norm(z-x)"
[PROOF STATE]
proof (prove)
using this:
0 < e
cball z e \<inter> affine hull closure S \<subseteq> closure S

goal (1 subgoal):
 1. 0 < e / norm (z - x)
[PROOF STEP]
using e False
[PROOF STATE]
proof (prove)
using this:
0 < e
cball z e \<inter> affine hull closure S \<subseteq> closure S
0 < e
cball z e \<inter> affine hull closure S \<subseteq> closure S
x \<noteq> z

goal (1 subgoal):
 1. 0 < e / norm (z - x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < e / norm (z - x)

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
define y where "y = z + (e/norm(z-x)) *\<^sub>R (z-x)"
[PROOF STATE]
proof (state)
this:
y = z + (e / norm (z - x)) *\<^sub>R (z - x)

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
have yball: "y \<in> cball z e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> cball z e
[PROOF STEP]
using y_def dist_norm[of z y] e
[PROOF STATE]
proof (prove)
using this:
y = z + (e / norm (z - x)) *\<^sub>R (z - x)
dist z y = norm (z - y)
0 < e
cball z e \<inter> affine hull closure S \<subseteq> closure S

goal (1 subgoal):
 1. y \<in> cball z e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> cball z e

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
have "x \<in> affine hull closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> affine hull closure S
[PROOF STEP]
using x rel_interior_subset_closure hull_inc[of x "closure S"]
[PROOF STATE]
proof (prove)
using this:
x \<in> rel_interior S
rel_interior ?S \<subseteq> closure ?S
x \<in> closure S \<Longrightarrow> x \<in> ?P hull closure S

goal (1 subgoal):
 1. x \<in> affine hull closure S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> affine hull closure S

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> affine hull closure S

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
have "z \<in> affine hull closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> affine hull closure S
[PROOF STEP]
using z rel_interior_subset hull_subset[of "closure S"]
[PROOF STATE]
proof (prove)
using this:
z \<in> rel_interior (closure S)
rel_interior ?S \<subseteq> ?S
closure S \<subseteq> ?S hull closure S

goal (1 subgoal):
 1. z \<in> affine hull closure S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z \<in> affine hull closure S

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> affine hull closure S
z \<in> affine hull closure S
[PROOF STEP]
have "y \<in> affine hull closure S"
[PROOF STATE]
proof (prove)
using this:
x \<in> affine hull closure S
z \<in> affine hull closure S

goal (1 subgoal):
 1. y \<in> affine hull closure S
[PROOF STEP]
using y_def affine_affine_hull[of "closure S"]
          mem_affine_3_minus [of "affine hull closure S" z z x "e/norm(z-x)"]
[PROOF STATE]
proof (prove)
using this:
x \<in> affine hull closure S
z \<in> affine hull closure S
y = z + (e / norm (z - x)) *\<^sub>R (z - x)
affine (affine hull closure S)
\<lbrakk>affine (affine hull closure S); z \<in> affine hull closure S; z \<in> affine hull closure S; x \<in> affine hull closure S\<rbrakk> \<Longrightarrow> z + (e / norm (z - x)) *\<^sub>R (z - x) \<in> affine hull closure S

goal (1 subgoal):
 1. y \<in> affine hull closure S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> affine hull closure S

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> affine hull closure S
[PROOF STEP]
have "y \<in> closure S"
[PROOF STATE]
proof (prove)
using this:
y \<in> affine hull closure S

goal (1 subgoal):
 1. y \<in> closure S
[PROOF STEP]
using e yball
[PROOF STATE]
proof (prove)
using this:
y \<in> affine hull closure S
0 < e
cball z e \<inter> affine hull closure S \<subseteq> closure S
y \<in> cball z e

goal (1 subgoal):
 1. y \<in> closure S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> closure S

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
have "(1 + (e/norm(z-x))) *\<^sub>R z = (e/norm(z-x)) *\<^sub>R x + y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + e / norm (z - x)) *\<^sub>R z = (e / norm (z - x)) *\<^sub>R x + y
[PROOF STEP]
using y_def
[PROOF STATE]
proof (prove)
using this:
y = z + (e / norm (z - x)) *\<^sub>R (z - x)

goal (1 subgoal):
 1. (1 + e / norm (z - x)) *\<^sub>R z = (e / norm (z - x)) *\<^sub>R x + y
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(1 + e / norm (z - x)) *\<^sub>R z = (e / norm (z - x)) *\<^sub>R x + y

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 + e / norm (z - x)) *\<^sub>R z = (e / norm (z - x)) *\<^sub>R x + y
[PROOF STEP]
obtain e1 where "0 < e1" "e1 < 1" "z = y - e1 *\<^sub>R (y - x)"
[PROOF STATE]
proof (prove)
using this:
(1 + e / norm (z - x)) *\<^sub>R z = (e / norm (z - x)) *\<^sub>R x + y

goal (1 subgoal):
 1. (\<And>e1. \<lbrakk>0 < e1; e1 < 1; z = y - e1 *\<^sub>R (y - x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using * convex_rel_interior_closure_aux[of "e / norm (z - x)" 1 z x y]
[PROOF STATE]
proof (prove)
using this:
(1 + e / norm (z - x)) *\<^sub>R z = (e / norm (z - x)) *\<^sub>R x + y
0 < e / norm (z - x)
\<lbrakk>0 < e / norm (z - x); 0 < 1; (e / norm (z - x) + 1) *\<^sub>R z = (e / norm (z - x)) *\<^sub>R x + 1 *\<^sub>R y; \<And>e. \<lbrakk>0 < e; e < 1; z = y - e *\<^sub>R (y - x)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>e1. \<lbrakk>0 < e1; e1 < 1; z = y - e1 *\<^sub>R (y - x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
0 < e1
e1 < 1
z = y - e1 *\<^sub>R (y - x)

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> z \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e1
e1 < 1
z = y - e1 *\<^sub>R (y - x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < e1
e1 < 1
z = y - e1 *\<^sub>R (y - x)

goal (1 subgoal):
 1. z \<in> rel_interior S
[PROOF STEP]
using rel_interior_closure_convex_shrink assms x \<open>y \<in> closure S\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e1
e1 < 1
z = y - e1 *\<^sub>R (y - x)
\<lbrakk>convex ?S; ?c \<in> rel_interior ?S; ?x \<in> closure ?S; 0 < ?e; ?e \<le> 1\<rbrakk> \<Longrightarrow> ?x - ?e *\<^sub>R (?x - ?c) \<in> rel_interior ?S
convex S
x \<in> rel_interior S
y \<in> closure S

goal (1 subgoal):
 1. z \<in> rel_interior S
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
z \<in> rel_interior S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
z \<in> rel_interior S

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?z2 \<in> rel_interior (closure S) \<Longrightarrow> ?z2 \<in> rel_interior S

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> rel_interior (closure S) = rel_interior S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rel_interior S \<subseteq> rel_interior (closure S)
?z2 \<in> rel_interior (closure S) \<Longrightarrow> ?z2 \<in> rel_interior S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rel_interior S \<subseteq> rel_interior (closure S)
?z2 \<in> rel_interior (closure S) \<Longrightarrow> ?z2 \<in> rel_interior S

goal (1 subgoal):
 1. rel_interior (closure S) = rel_interior S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (closure S) = rel_interior S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rotate_rev:
  "rotate n (rev xs) = rev(rotate (length xs - (n mod length xs)) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rotate n (rev xs) = rev (rotate (length xs - n mod length xs) xs)
[PROOF STEP]
proof (cases "length xs = 0 \<or> n mod length xs = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length xs = 0 \<or> n mod length xs = 0 \<Longrightarrow> rotate n (rev xs) = rev (rotate (length xs - n mod length xs) xs)
 2. \<not> (length xs = 0 \<or> n mod length xs = 0) \<Longrightarrow> rotate n (rev xs) = rev (rotate (length xs - n mod length xs) xs)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (length xs = 0 \<or> n mod length xs = 0)

goal (2 subgoals):
 1. length xs = 0 \<or> n mod length xs = 0 \<Longrightarrow> rotate n (rev xs) = rev (rotate (length xs - n mod length xs) xs)
 2. \<not> (length xs = 0 \<or> n mod length xs = 0) \<Longrightarrow> rotate n (rev xs) = rev (rotate (length xs - n mod length xs) xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (length xs = 0 \<or> n mod length xs = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (length xs = 0 \<or> n mod length xs = 0)

goal (1 subgoal):
 1. rotate n (rev xs) = rev (rotate (length xs - n mod length xs) xs)
[PROOF STEP]
by(simp add:rotate_drop_take rev_drop rev_take)
[PROOF STATE]
proof (state)
this:
rotate n (rev xs) = rev (rotate (length xs - n mod length xs) xs)

goal (1 subgoal):
 1. length xs = 0 \<or> n mod length xs = 0 \<Longrightarrow> rotate n (rev xs) = rev (rotate (length xs - n mod length xs) xs)
[PROOF STEP]
qed force


[STATEMENT]
lemma col_sylvester_sub: (* TODO: from this directly derive col_sylvester *)
  assumes j: "j < m + n"
  shows "col (sylvester_mat_sub m n p q) j =
    vec_of_poly_rev_shifted p n m j @\<^sub>v vec_of_poly_rev_shifted q m n j" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (sylvester_mat_sub m n p q) j = Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) \<Longrightarrow> col (sylvester_mat_sub m n p q) j $ i = (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) $ i
 2. dim_vec (col (sylvester_mat_sub m n p q) j) = dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j)
[PROOF STEP]
show "dim_vec ?l = dim_vec ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (col (sylvester_mat_sub m n p q) j) = dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_vec (col (sylvester_mat_sub m n p q) j) = dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j)

goal (1 subgoal):
 1. \<And>i. i < dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) \<Longrightarrow> col (sylvester_mat_sub m n p q) j $ i = (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) $ i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) \<Longrightarrow> col (sylvester_mat_sub m n p q) j $ i = (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) $ i
[PROOF STEP]
assume "i < dim_vec ?r"
[PROOF STATE]
proof (state)
this:
i < dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j)

goal (1 subgoal):
 1. \<And>i. i < dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) \<Longrightarrow> col (sylvester_mat_sub m n p q) j $ i = (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) $ i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j)
[PROOF STEP]
have i: "i < m+n"
[PROOF STATE]
proof (prove)
using this:
i < dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j)

goal (1 subgoal):
 1. i < m + n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < m + n

goal (1 subgoal):
 1. \<And>i. i < dim_vec (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) \<Longrightarrow> col (sylvester_mat_sub m n p q) j $ i = (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) $ i
[PROOF STEP]
show "?l $ i = ?r $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (sylvester_mat_sub m n p q) j $ i = (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) $ i
[PROOF STEP]
unfolding vec_of_poly_rev_shifted_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (sylvester_mat_sub m n p q) j $ i = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply (subst index_col)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. i < dim_row (sylvester_mat_sub m n p q)
 2. j < dim_col (sylvester_mat_sub m n p q)
 3. sylvester_mat_sub m n p q $$ (i, j) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (3 subgoals):
 1. i < dim_row (sylvester_mat_sub m n p q)
 2. j < dim_col (sylvester_mat_sub m n p q)
 3. sylvester_mat_sub m n p q $$ (i, j) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. j < dim_col (sylvester_mat_sub m n p q)
 2. sylvester_mat_sub m n p q $$ (i, j) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < m + n

goal (2 subgoals):
 1. j < dim_col (sylvester_mat_sub m n p q)
 2. sylvester_mat_sub m n p q $$ (i, j) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sylvester_mat_sub m n p q $$ (i, j) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply (subst sylvester_mat_sub_index)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. i < m + n
 2. j < m + n
 3. (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (3 subgoals):
 1. i < m + n
 2. j < m + n
 3. (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. j < m + n
 2. (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < m + n

goal (2 subgoals):
 1. j < m + n
 2. (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply (cases "i < n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. i < n \<Longrightarrow> (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
 2. \<not> i < n \<Longrightarrow> (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (2 subgoals):
 1. i < n \<Longrightarrow> (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
 2. \<not> i < n \<Longrightarrow> (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> i < n \<Longrightarrow> (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < m + n

goal (1 subgoal):
 1. \<not> i < n \<Longrightarrow> (if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a)) = (vec n (\<lambda>i. if i \<le> j \<and> j \<le> m + i then coeff p (m + i - j) else (0::'a)) @\<^sub>v vec m (\<lambda>i. if i \<le> j \<and> j \<le> n + i then coeff q (n + i - j) else (0::'a))) $ i
[PROOF STEP]
apply (auto simp: not_less not_le intro!: coeff_eq_0)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
col (sylvester_mat_sub m n p q) j $ i = (Missing_Lemmas.vec_of_poly_rev_shifted p n m j @\<^sub>v Missing_Lemmas.vec_of_poly_rev_shifted q m n j) $ i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cart2_proj2: "cart2_pt (proj2_pt v) = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cart2_pt (proj2_pt v) = v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cart2_pt (proj2_pt v) = v
[PROOF STEP]
let ?v' = "vector2_append1 v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cart2_pt (proj2_pt v) = v
[PROOF STEP]
let ?p = "proj2_pt v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cart2_pt (proj2_pt v) = v
[PROOF STEP]
from proj2_pt_scalar
[PROOF STATE]
proof (chain)
picking this:
\<exists>c. c \<noteq> 0 \<and> proj2_rep (proj2_pt ?v) = c *\<^sub>R vector2_append1 ?v
[PROOF STEP]
obtain c where "c \<noteq> 0" and "proj2_rep ?p = c *\<^sub>R ?v'"
[PROOF STATE]
proof (prove)
using this:
\<exists>c. c \<noteq> 0 \<and> proj2_rep (proj2_pt ?v) = c *\<^sub>R vector2_append1 ?v

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<noteq> 0; proj2_rep (proj2_pt v) = c *\<^sub>R vector2_append1 v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
proj2_rep (proj2_pt v) = c *\<^sub>R vector2_append1 v

goal (1 subgoal):
 1. cart2_pt (proj2_pt v) = v
[PROOF STEP]
hence "(cart2_pt ?p)$1 = v$1" and "(cart2_pt ?p)$2 = v$2"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
proj2_rep (proj2_pt v) = c *\<^sub>R vector2_append1 v

goal (1 subgoal):
 1. cart2_pt (proj2_pt v) $ 1 = v $ 1 &&& cart2_pt (proj2_pt v) $ 2 = v $ 2
[PROOF STEP]
unfolding cart2_pt_def and vector2_append1_def and vector_def
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
proj2_rep (proj2_pt v) = c *\<^sub>R vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [v $ 1, v $ 2, 1] (\<lambda>n x. 0) 1)

goal (1 subgoal):
 1. vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [proj2_rep (proj2_pt v) $ 1 / proj2_rep (proj2_pt v) $ 3, proj2_rep (proj2_pt v) $ 2 / proj2_rep (proj2_pt v) $ 3] (\<lambda>n x. 0) 1) $ 1 = v $ 1 &&& vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [proj2_rep (proj2_pt v) $ 1 / proj2_rep (proj2_pt v) $ 3, proj2_rep (proj2_pt v) $ 2 / proj2_rep (proj2_pt v) $ 3] (\<lambda>n x. 0) 1) $ 2 = v $ 2
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
cart2_pt (proj2_pt v) $ 1 = v $ 1
cart2_pt (proj2_pt v) $ 2 = v $ 2

goal (1 subgoal):
 1. cart2_pt (proj2_pt v) = v
[PROOF STEP]
thus "cart2_pt ?p = v"
[PROOF STATE]
proof (prove)
using this:
cart2_pt (proj2_pt v) $ 1 = v $ 1
cart2_pt (proj2_pt v) $ 2 = v $ 2

goal (1 subgoal):
 1. cart2_pt (proj2_pt v) = v
[PROOF STEP]
by (simp add: vec_eq_iff forall_2)
[PROOF STATE]
proof (state)
this:
cart2_pt (proj2_pt v) = v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_spec[THEN SPEC_trans, refine_vcg]:
    assumes "l\<le>u"
    assumes "\<And>i. l\<le>i \<Longrightarrow> i<u \<Longrightarrow> \<Phi> i"
    shows "sum_prog \<Phi> l u f \<le> SPEC (\<lambda>r. r=(\<Sum>i=l..<u. f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_prog \<Phi> l u f \<le> SPEC (\<lambda>r. r = sum f {l..<u})
[PROOF STEP]
unfolding sum_prog_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli [l..<u] (\<lambda>_. True) (\<lambda>i s. ASSERT (\<Phi> i) \<bind> (\<lambda>_. RETURN (s + f i))) (0::'a) \<le> SPEC (\<lambda>r. r = sum f {l..<u})
[PROOF STEP]
supply nfoldli_upt_rule[where I="\<lambda>j s. s=(\<Sum>i=l..<j. f i)", refine_vcg]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli [l..<u] (\<lambda>_. True) (\<lambda>i s. ASSERT (\<Phi> i) \<bind> (\<lambda>_. RETURN (s + f i))) (0::'a) \<le> SPEC (\<lambda>r. r = sum f {l..<u})
[PROOF STEP]
apply refine_vcg
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. l \<le> u
 2. (0::'a) = sum f {l..<l}
 3. \<And>i \<sigma>. \<lbrakk>l \<le> i; i < u; \<sigma> = sum f {l..<i}; True\<rbrakk> \<Longrightarrow> \<Phi> i
 4. \<And>i \<sigma>. \<lbrakk>l \<le> i; i < u; \<sigma> = sum f {l..<i}; True; \<Phi> i\<rbrakk> \<Longrightarrow> \<sigma> + f i = sum f {l..<i + 1}
 5. \<And>i \<sigma>. \<lbrakk>l \<le> i; i \<le> u; \<sigma> = sum f {l..<i}; \<not> True\<rbrakk> \<Longrightarrow> \<sigma> = sum f {l..<u}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l \<le> u
\<lbrakk>l \<le> ?i; ?i < u\<rbrakk> \<Longrightarrow> \<Phi> ?i

goal (5 subgoals):
 1. l \<le> u
 2. (0::'a) = sum f {l..<l}
 3. \<And>i \<sigma>. \<lbrakk>l \<le> i; i < u; \<sigma> = sum f {l..<i}; True\<rbrakk> \<Longrightarrow> \<Phi> i
 4. \<And>i \<sigma>. \<lbrakk>l \<le> i; i < u; \<sigma> = sum f {l..<i}; True; \<Phi> i\<rbrakk> \<Longrightarrow> \<sigma> + f i = sum f {l..<i + 1}
 5. \<And>i \<sigma>. \<lbrakk>l \<le> i; i \<le> u; \<sigma> = sum f {l..<i}; \<not> True\<rbrakk> \<Longrightarrow> \<sigma> = sum f {l..<u}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma partition_set_of_intersecting_sets_by_card:
  assumes "finite A"
  shows "{B. A \<inter> B \<noteq> {}} = (\<Union>n \<in> {1..card A}. {B. card (A \<inter> B) = n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {B. A \<inter> B \<noteq> {}} = (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n})
[PROOF STEP]
proof (rule set_eqI, rule iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {B. A \<inter> B \<noteq> {}} \<Longrightarrow> x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n})
 2. \<And>x. x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n}) \<Longrightarrow> x \<in> {B. A \<inter> B \<noteq> {}}
[PROOF STEP]
fix B
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {B. A \<inter> B \<noteq> {}} \<Longrightarrow> x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n})
 2. \<And>x. x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n}) \<Longrightarrow> x \<in> {B. A \<inter> B \<noteq> {}}
[PROOF STEP]
assume "B \<in> {B. A \<inter> B \<noteq> {}}"
[PROOF STATE]
proof (state)
this:
B \<in> {B. A \<inter> B \<noteq> {}}

goal (2 subgoals):
 1. \<And>x. x \<in> {B. A \<inter> B \<noteq> {}} \<Longrightarrow> x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n})
 2. \<And>x. x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n}) \<Longrightarrow> x \<in> {B. A \<inter> B \<noteq> {}}
[PROOF STEP]
hence "0 < card (A \<inter> B)"
[PROOF STATE]
proof (prove)
using this:
B \<in> {B. A \<inter> B \<noteq> {}}

goal (1 subgoal):
 1. 0 < card (A \<inter> B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<in> {B. A \<inter> B \<noteq> {}}
finite A

goal (1 subgoal):
 1. 0 < card (A \<inter> B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < card (A \<inter> B)

goal (2 subgoals):
 1. \<And>x. x \<in> {B. A \<inter> B \<noteq> {}} \<Longrightarrow> x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n})
 2. \<And>x. x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n}) \<Longrightarrow> x \<in> {B. A \<inter> B \<noteq> {}}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < card (A \<inter> B)

goal (2 subgoals):
 1. \<And>x. x \<in> {B. A \<inter> B \<noteq> {}} \<Longrightarrow> x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n})
 2. \<And>x. x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n}) \<Longrightarrow> x \<in> {B. A \<inter> B \<noteq> {}}
[PROOF STEP]
have "card (A \<inter> B) \<le> card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<inter> B) \<le> card A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card (A \<inter> B) \<le> card A
[PROOF STEP]
by (simp add: card_mono)
[PROOF STATE]
proof (state)
this:
card (A \<inter> B) \<le> card A

goal (2 subgoals):
 1. \<And>x. x \<in> {B. A \<inter> B \<noteq> {}} \<Longrightarrow> x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n})
 2. \<And>x. x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n}) \<Longrightarrow> x \<in> {B. A \<inter> B \<noteq> {}}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < card (A \<inter> B)
card (A \<inter> B) \<le> card A
[PROOF STEP]
have "card (A \<inter> B) \<in> {1..card A}"
[PROOF STATE]
proof (prove)
using this:
0 < card (A \<inter> B)
card (A \<inter> B) \<le> card A

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

goal (2 subgoals):
 1. \<And>x. x \<in> {B. A \<inter> B \<noteq> {}} \<Longrightarrow> x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n})
 2. \<And>x. x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n}) \<Longrightarrow> x \<in> {B. A \<inter> B \<noteq> {}}
[PROOF STEP]
thus "B \<in> (\<Union>n \<in> {1..card A}. {B. card (A \<inter> B) = n})"
[PROOF STATE]
proof (prove)
using this:
card (A \<inter> B) \<in> {1..card A}

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

goal (1 subgoal):
 1. \<And>x. x \<in> (\<Union>n\<in>{1..card A}. {B. card (A \<inter> B) = n}) \<Longrightarrow> x \<in> {B. A \<inter> B \<noteq> {}}
[PROOF STEP]
qed force


[STATEMENT]
lemma prime_gcd: fixes m::nat and n::nat assumes "prime m" and "prime n"
and "m \<noteq> n" shows "gcd m n =1 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd m n = 1
[PROOF STEP]
using prime_def
[PROOF STATE]
proof (prove)
using this:
prime ?p = (prime_elem ?p \<and> normalize ?p = ?p)

goal (1 subgoal):
 1. gcd m n = 1
[PROOF STEP]
by (simp add: assms primes_coprime)


[STATEMENT]
lemma IVT:
  fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology"
  shows "f a \<le> y \<Longrightarrow> y \<le> f b \<Longrightarrow> a \<le> b \<Longrightarrow> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x) \<Longrightarrow>
    \<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f a \<le> y; y \<le> f b; a \<le> b; \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> \<exists>x\<ge>a. x \<le> b \<and> f x = y
[PROOF STEP]
by (rule IVT') (auto intro: continuous_at_imp_continuous_on)


[STATEMENT]
lemma numeral_8_eq_8: "8 = Suc (Suc (Suc (Suc (Suc (Suc (Suc (Suc 0)))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 8 = Suc (Suc (Suc (Suc (Suc (Suc (Suc (Suc 0)))))))
[PROOF STEP]
by (simp add: eval_nat_numeral)


[STATEMENT]
lemma map2_append2_take_drop: "
  length ys1 \<le> length xs \<Longrightarrow>
  map2 f xs (ys1 @ ys2) =
  map2 f (xs \<down> length ys1) ys1 @
  map2 f (xs \<up> length ys1) ys2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys1 \<le> length xs \<Longrightarrow> List2.map2 f xs (ys1 @ ys2) = List2.map2 f (xs \<down> length ys1) ys1 @ List2.map2 f (xs \<up> length ys1) ys2
[PROOF STEP]
apply (rule_tac
  t = "map2 f xs (ys1 @ ys2)" and
  s = "map2 f (xs \<down> length ys1 @ xs \<up> length ys1) (ys1 @ ys2)"
  in subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length ys1 \<le> length xs \<Longrightarrow> List2.map2 f (xs \<down> length ys1 @ xs \<up> length ys1) (ys1 @ ys2) = List2.map2 f xs (ys1 @ ys2)
 2. length ys1 \<le> length xs \<Longrightarrow> List2.map2 f (xs \<down> length ys1 @ xs \<up> length ys1) (ys1 @ ys2) = List2.map2 f (xs \<down> length ys1) ys1 @ List2.map2 f (xs \<up> length ys1) ys2
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys1 \<le> length xs \<Longrightarrow> List2.map2 f (xs \<down> length ys1 @ xs \<up> length ys1) (ys1 @ ys2) = List2.map2 f (xs \<down> length ys1) ys1 @ List2.map2 f (xs \<up> length ys1) ys2
[PROOF STEP]
apply (simp add: map2_append_append del: append_take_drop_id)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_nat_less_two_power [simp]: "of_nat n < (2::'a::linordered_idom) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat n < (2::'a) ^ n
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. of_nat 0 < (2::'a) ^ 0
 2. \<And>n. of_nat n < (2::'a) ^ n \<Longrightarrow> of_nat (Suc n) < (2::'a) ^ Suc n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. of_nat n < (2::'a) ^ n \<Longrightarrow> of_nat (Suc n) < (2::'a) ^ Suc n
[PROOF STEP]
apply (metis add_le_less_mono mult_2 of_nat_Suc one_le_numeral one_le_power power_Suc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma integer_division:
  "PRE (\<lambda>s::nat store. s ''x'' \<ge> 0)
    (''q'' ::= (\<lambda>s. 0));
    (''r'' ::= (\<lambda>s. s ''x''));
    (WHILE (\<lambda>s. s ''y'' \<le> s ''r'') INV (\<lambda>s. s ''x'' = s ''q'' * s ''y'' + s ''r'' \<and> s ''r'' \<ge> 0)
     DO
      (''q'' ::= (\<lambda>s. s ''q'' + 1));
      (''r'' ::= (\<lambda>s. s ''r'' - s ''y''))
      OD)
   POST (\<lambda>s. s ''x'' = s ''q'' * s ''y'' + s ''r'' \<and> s ''r'' \<ge> 0 \<and> s ''r'' < s ''y'')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. PRE (\<lambda>s. 0 \<le> s ''x'') (''q'' ::= (\<lambda>s. 0)) ; (''r'' ::= (\<lambda>s. s ''x'')) ; (WHILE (\<lambda>s. s ''y'' \<le> s ''r'') INV (\<lambda>s. s ''x'' = s ''q'' \<cdot> s ''y'' + s ''r'' \<and> 0 \<le> s ''r'') DO (''q'' ::= (\<lambda>s. s ''q'' + 1)) ; (''r'' ::= (\<lambda>s. s ''r'' - s ''y'')) OD) POST (\<lambda>s. s ''x'' = s ''q'' \<cdot> s ''y'' + s ''r'' \<and> 0 \<le> s ''r'' \<and> s ''r'' < s ''y'')
[PROOF STEP]
by hoare auto


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


[STATEMENT]
lemma absolutely_integrable_on_linear_image:
  fixes f :: "real^'m::{finite,wellorder} \<Rightarrow> real^'n" and g :: "real^'m::_ \<Rightarrow> real^'m::_"
  assumes "linear g"
  shows "f absolutely_integrable_on (g ` S)
     \<longleftrightarrow> (f \<circ> g) absolutely_integrable_on S \<or> det(matrix g) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f absolutely_integrable_on g ` S) = (f \<circ> g absolutely_integrable_on S \<or> det (matrix g) = 0)
[PROOF STEP]
unfolding assms absolutely_integrable_change_of_variables_linear [OF assms, symmetric] absolutely_integrable_on_scaleR_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>det (matrix g)\<bar> = 0 \<or> (\<lambda>x. f (g x)) absolutely_integrable_on S) = (f \<circ> g absolutely_integrable_on S \<or> det (matrix g) = 0)
[PROOF STEP]
by (auto simp: set_integrable_def)


[STATEMENT]
lemma matrix_to_iarray_morph:
  fixes A::"'a^'n::{mod_type}^'m::{mod_type}"
shows "(A = B) = (matrix_to_iarray A = matrix_to_iarray B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = B) = (matrix_to_iarray A = matrix_to_iarray B)
[PROOF STEP]
unfolding matrix_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = B) = (IArray (map (vec_to_iarray \<circ> ($) A \<circ> mod_type_class.from_nat) [0..<CARD('m)]) = IArray (map (vec_to_iarray \<circ> ($) B \<circ> mod_type_class.from_nat) [0..<CARD('m)]))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = B) = (\<forall>x\<in>{0..<CARD('m)}. vec_to_iarray (A $ mod_type_class.from_nat x) = vec_to_iarray (B $ mod_type_class.from_nat x))
[PROOF STEP]
unfolding forall_from_nat_rw[of "\<lambda>x. vec_to_iarray (A $ x) = vec_to_iarray (B $ x)"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = B) = (\<forall>x. vec_to_iarray (A $ mod_type_class.from_nat x) = vec_to_iarray (B $ mod_type_class.from_nat x))
[PROOF STEP]
by (metis from_nat_to_nat_id vec_eq_iff vec_to_iarray_morph)


[STATEMENT]
lemma dr_mono_bind:
  assumes MA: "mono A" and MB: "\<And>s. mono (B s)"
  shows "mono (\<lambda>F s. dbind (A F s) (\<lambda>s'. B s F s'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono (\<lambda>F s. A F s \<bind> B s F)
[PROOF STEP]
apply (rule monoI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> (\<lambda>s. A x s \<bind> B s x) \<le> (\<lambda>s. A y s \<bind> B s y)
[PROOF STEP]
apply (rule le_funI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa. x \<le> y \<Longrightarrow> A x xa \<bind> B xa x \<le> A y xa \<bind> B xa y
[PROOF STEP]
apply (rule dbind_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y xa. x \<le> y \<Longrightarrow> A x xa \<le> A y xa
 2. \<And>x y xa xb. \<lbrakk>x \<le> y; dRETURN xb \<le> A x xa\<rbrakk> \<Longrightarrow> B xa x xb \<le> B xa y xb
[PROOF STEP]
apply (auto dest: monoD[OF MA, THEN le_funD]) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y xa xb. \<lbrakk>x \<le> y; dRETURN xb \<le> A x xa\<rbrakk> \<Longrightarrow> B xa x xb \<le> B xa y xb
[PROOF STEP]
apply (auto dest: monoD[OF MB, THEN le_funD]) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mult_col_div_index_row[simp]:
  "i < dim_row A \<Longrightarrow> i < dim_col A \<Longrightarrow> j < dim_row A \<Longrightarrow> j < dim_col A \<Longrightarrow> a \<noteq> 0
    \<Longrightarrow> mult_col_div_row a k A $$ (i,j) = (if
      i = k \<and> j \<noteq> i then inverse a * A $$ (i, j) else if
      j = k \<and> j \<noteq> i then a * A $$ (i, j) else A $$ (i,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row A; i < dim_col A; j < dim_row A; j < dim_col A; a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> mult_col_div_row a k A $$ (i, j) = (if i = k \<and> j \<noteq> i then inverse a * A $$ (i, j) else if j = k \<and> j \<noteq> i then a * A $$ (i, j) else A $$ (i, j))
[PROOF STEP]
unfolding mult_col_div_row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row A; i < dim_col A; j < dim_row A; j < dim_col A; a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> multrow k (inverse a) (multcol k a A) $$ (i, j) = (if i = k \<and> j \<noteq> i then inverse a * A $$ (i, j) else if j = k \<and> j \<noteq> i then a * A $$ (i, j) else A $$ (i, j))
[PROOF STEP]
by auto


[STATEMENT]
lemma neg_numeral_less_floor [simp]: "- numeral v < \<lfloor>x\<rfloor> \<longleftrightarrow> - numeral v + 1 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- numeral v < \<lfloor>x\<rfloor>) = (- numeral v + (1::'a) \<le> x)
[PROOF STEP]
by (simp add: less_floor_iff)


[STATEMENT]
lemma Max_eq_image_if:
  assumes
    "finite S" "finite T" "\<forall>x \<in> S. \<exists>y \<in> T. f x \<le> g y" "\<forall>x \<in> T. \<exists>y \<in> S. g x \<le> f y"
  shows "Max (f ` S) = Max (g ` T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (f ` S) = Max (g ` T)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
finite T
\<forall>x\<in>S. \<exists>y\<in>T. f x \<le> g y
\<forall>x\<in>T. \<exists>y\<in>S. g x \<le> f y

goal (1 subgoal):
 1. Max (f ` S) = Max (g ` T)
[PROOF STEP]
by (auto intro: Max_eq_if)


[STATEMENT]
theorem Residue_theorem:
  fixes s pts::"complex set" and f::"complex \<Rightarrow> complex"
    and g::"real \<Rightarrow> complex"
  assumes "open s" "connected s" "finite pts" and
          holo:"f holomorphic_on s-pts" and
          "valid_path g" and
          loop:"pathfinish g = pathstart g" and
          "path_image g \<subseteq> s-pts" and
          homo:"\<forall>z. (z \<notin> s) \<longrightarrow> winding_number g z  = 0"
  shows "contour_integral g f = 2 * pi * \<i> *(\<Sum>p\<in>pts. winding_number g p * residue f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
define c where "c \<equiv>  2 * pi * \<i>"
[PROOF STATE]
proof (state)
this:
c \<equiv> complex_of_real (2 * pi) * \<i>

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
obtain h where avoid:"\<forall>p\<in>s. h p>0 \<and> (\<forall>w\<in>cball p (h p). w\<in>s \<and> (w\<noteq>p \<longrightarrow> w \<notin> pts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. \<forall>p\<in>s. 0 < h p \<and> (\<forall>w\<in>cball p (h p). w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_cball_avoid[OF \<open>open s\<close> \<open>finite pts\<close>]
[PROOF STATE]
proof (prove)
using this:
?p \<in> s \<Longrightarrow> \<exists>e>0. \<forall>w\<in>cball ?p e. w \<in> s \<and> (w \<noteq> ?p \<longrightarrow> w \<notin> pts)

goal (1 subgoal):
 1. (\<And>h. \<forall>p\<in>s. 0 < h p \<and> (\<forall>w\<in>cball p (h p). w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>s. 0 < h p \<and> (\<forall>w\<in>cball p (h p). w \<in> s \<and> (w \<noteq> p \<longrightarrow> w \<notin> pts))

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
have "contour_integral g f
      = (\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral g f = (\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f)
[PROOF STEP]
using Cauchy_theorem_singularities[OF assms avoid]
[PROOF STATE]
proof (prove)
using this:
contour_integral g f = (\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f)

goal (1 subgoal):
 1. contour_integral g f = (\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
contour_integral g f = (\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f)

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
contour_integral g f = (\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f)

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
have "... = (\<Sum>p\<in>pts.  c * winding_number g p * residue f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f) = (\<Sum>p\<in>pts. c * winding_number g p * residue f p)
[PROOF STEP]
proof (intro sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pts = pts
 2. \<And>x. x \<in> pts \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
show "pts = pts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pts = pts
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pts = pts

goal (1 subgoal):
 1. \<And>x. x \<in> pts \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> pts \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> pts \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
assume "x \<in> pts"
[PROOF STATE]
proof (state)
this:
x \<in> pts

goal (1 subgoal):
 1. \<And>x. x \<in> pts \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
show "winding_number g x * contour_integral (circlepath x (h x)) f
          = c * winding_number g x * residue f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
proof (cases "x\<in>s")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
 2. x \<notin> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> s

goal (2 subgoals):
 1. x \<in> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
 2. x \<notin> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> s
[PROOF STEP]
have "winding_number g x=0"
[PROOF STATE]
proof (prove)
using this:
x \<notin> s

goal (1 subgoal):
 1. winding_number g x = 0
[PROOF STEP]
using homo
[PROOF STATE]
proof (prove)
using this:
x \<notin> s
\<forall>z. z \<notin> s \<longrightarrow> winding_number g z = 0

goal (1 subgoal):
 1. winding_number g x = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
winding_number g x = 0

goal (2 subgoals):
 1. x \<in> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
 2. x \<notin> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
winding_number g x = 0

goal (1 subgoal):
 1. winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x

goal (1 subgoal):
 1. x \<in> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> s

goal (1 subgoal):
 1. x \<in> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
have "contour_integral (circlepath x (h x)) f = c* residue f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (circlepath x (h x)) f = c * residue f x
[PROOF STEP]
using \<open>x\<in>pts\<close> \<open>finite pts\<close> avoid[rule_format,OF True]
[PROOF STATE]
proof (prove)
using this:
x \<in> pts
finite pts
0 < h x \<and> (\<forall>w\<in>cball x (h x). w \<in> s \<and> (w \<noteq> x \<longrightarrow> w \<notin> pts))

goal (1 subgoal):
 1. contour_integral (circlepath x (h x)) f = c * residue f x
[PROOF STEP]
apply (intro base_residue[of "s-(pts-{x})",THEN contour_integral_unique,folded c_def])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<lbrakk>x \<in> pts; finite pts; 0 < h x \<and> (\<forall>w\<in>cball x (h x). w \<in> s \<and> (w \<noteq> x \<longrightarrow> w \<notin> pts))\<rbrakk> \<Longrightarrow> open (s - (pts - {x}))
 2. \<lbrakk>x \<in> pts; finite pts; 0 < h x \<and> (\<forall>w\<in>cball x (h x). w \<in> s \<and> (w \<noteq> x \<longrightarrow> w \<notin> pts))\<rbrakk> \<Longrightarrow> x \<in> s - (pts - {x})
 3. \<lbrakk>x \<in> pts; finite pts; 0 < h x \<and> (\<forall>w\<in>cball x (h x). w \<in> s \<and> (w \<noteq> x \<longrightarrow> w \<notin> pts))\<rbrakk> \<Longrightarrow> 0 < h x
 4. \<lbrakk>x \<in> pts; finite pts; 0 < h x \<and> (\<forall>w\<in>cball x (h x). w \<in> s \<and> (w \<noteq> x \<longrightarrow> w \<notin> pts))\<rbrakk> \<Longrightarrow> f holomorphic_on s - (pts - {x}) - {x}
 5. \<lbrakk>x \<in> pts; finite pts; 0 < h x \<and> (\<forall>w\<in>cball x (h x). w \<in> s \<and> (w \<noteq> x \<longrightarrow> w \<notin> pts))\<rbrakk> \<Longrightarrow> cball x (h x) \<subseteq> s - (pts - {x})
[PROOF STEP]
by (auto intro:holomorphic_on_subset[OF holo] open_Diff[OF \<open>open s\<close> finite_imp_closed])
[PROOF STATE]
proof (state)
this:
contour_integral (circlepath x (h x)) f = c * residue f x

goal (1 subgoal):
 1. x \<in> s \<Longrightarrow> winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
contour_integral (circlepath x (h x)) f = c * residue f x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
contour_integral (circlepath x (h x)) f = c * residue f x

goal (1 subgoal):
 1. winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
winding_number g x * contour_integral (circlepath x (h x)) f = c * winding_number g x * residue f x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f) = (\<Sum>p\<in>pts. c * winding_number g p * residue f p)

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>pts. winding_number g p * contour_integral (circlepath p (h p)) f) = (\<Sum>p\<in>pts. c * winding_number g p * residue f p)

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
have "... = c * (\<Sum>p\<in>pts. winding_number g p * residue f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>pts. c * winding_number g p * residue f p) = c * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
by (simp add: sum_distrib_left algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>pts. c * winding_number g p * residue f p) = c * (\<Sum>p\<in>pts. winding_number g p * residue f p)

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
contour_integral g f = c * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
contour_integral g f = c * (\<Sum>p\<in>pts. winding_number g p * residue f p)

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
using this:
contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)

goal (1 subgoal):
 1. contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
contour_integral g f = complex_of_real (2 * pi) * \<i> * (\<Sum>p\<in>pts. winding_number g p * residue f p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subspace_orthogonal_complement: "subspace (orthogonal_complement W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace (orthogonal_complement W)
[PROOF STEP]
unfolding subspace_def orthogonal_complement_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<in> {x. Ball W (orthogonal x)} \<and> (\<forall>x\<in>{x. Ball W (orthogonal x)}. \<forall>y\<in>{x. Ball W (orthogonal x)}. x + y \<in> {x. Ball W (orthogonal x)}) \<and> (\<forall>c. \<forall>x\<in>{x. Ball W (orthogonal x)}. c *\<^sub>R x \<in> {x. Ball W (orthogonal x)})
[PROOF STEP]
by (simp add: orthogonal_def inner_left_distrib)


[STATEMENT]
lemma "2 ^ 15 = (32768::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ 15 = 32768
[PROOF STEP]
by simp


[STATEMENT]
theorem delete_bound_size_univ: "invar_vebt t n \<Longrightarrow> u =  2^n \<Longrightarrow>   T\<^sub>d\<^sub>e\<^sub>l\<^sub>e\<^sub>t\<^sub>e  t x \<le> 140 + 70 * lb (lb u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>d\<^sub>e\<^sub>l\<^sub>e\<^sub>t\<^sub>e t x) \<le> 140 + 70 * log 2 (log 2 u)
[PROOF STEP]
using delete_bound_height[of t n x] height_double_log_univ_size[of u n t]
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n \<Longrightarrow> T\<^sub>d\<^sub>e\<^sub>l\<^sub>e\<^sub>t\<^sub>e t x \<le> (1 + height t) * 70
\<lbrakk>u = 2 ^ n; invar_vebt t n\<rbrakk> \<Longrightarrow> real (height t) \<le> 1 + log 2 (log 2 u)

goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>d\<^sub>e\<^sub>l\<^sub>e\<^sub>t\<^sub>e t x) \<le> 140 + 70 * log 2 (log 2 u)
[PROOF STEP]
by simp


[STATEMENT]
lemma lfinite_lSup_chain:
  assumes chain: "Complete_Partial_Order.chain (\<sqsubseteq>) A"
  shows "lfinite (lSup A) \<longleftrightarrow> finite A \<and> (\<forall>xs \<in> A. lfinite xs)" (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfinite (lSup A) = (finite A \<and> (\<forall>xs\<in>A. lfinite xs))
[PROOF STEP]
proof(intro iffI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> finite A
 2. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 3. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
lfinite (lSup A)

goal (3 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> finite A
 2. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 3. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
lfinite (lSup A)
[PROOF STEP]
obtain n where n: "llength (lSup A) = enat n"
[PROOF STATE]
proof (prove)
using this:
lfinite (lSup A)

goal (1 subgoal):
 1. (\<And>n. llength (lSup A) = enat n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lfinite_conv_llength_enat
[PROOF STATE]
proof (prove)
using this:
\<exists>n. llength (lSup A) = enat n

goal (1 subgoal):
 1. (\<And>n. llength (lSup A) = enat n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
llength (lSup A) = enat n

goal (3 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> finite A
 2. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 3. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
have "llength ` A \<subseteq> {..<enat (Suc n)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength ` A \<subseteq> {..<enat (Suc n)}
[PROOF STEP]
by(auto dest!: chain_lprefix_lSup[OF chain] lprefix_llength_le simp add: n intro: le_less_trans)
[PROOF STATE]
proof (state)
this:
llength ` A \<subseteq> {..<enat (Suc n)}

goal (3 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> finite A
 2. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 3. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
hence "finite (llength ` A)"
[PROOF STATE]
proof (prove)
using this:
llength ` A \<subseteq> {..<enat (Suc n)}

goal (1 subgoal):
 1. finite (llength ` A)
[PROOF STEP]
by(rule finite_subset)(simp add: finite_lessThan_enat_iff)
[PROOF STATE]
proof (state)
this:
finite (llength ` A)

goal (3 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> finite A
 2. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 3. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (llength ` A)

goal (3 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> finite A
 2. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 3. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
have "inj_on llength A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on llength A
[PROOF STEP]
by(rule inj_onI)(auto 4 3 dest: chainD[OF chain] lprefix_llength_eq_imp_eq)
[PROOF STATE]
proof (state)
this:
inj_on llength A

goal (3 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> finite A
 2. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 3. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (llength ` A)
inj_on llength A
[PROOF STEP]
show "finite A"
[PROOF STATE]
proof (prove)
using this:
finite (llength ` A)
inj_on llength A

goal (1 subgoal):
 1. finite A
[PROOF STEP]
by(rule finite_imageD)
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 2. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 2. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
finite A \<and> (\<forall>xs\<in>A. lfinite xs)

goal (2 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 2. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
hence "finite A" "\<forall>xs\<in>A. lfinite xs"
[PROOF STATE]
proof (prove)
using this:
finite A \<and> (\<forall>xs\<in>A. lfinite xs)

goal (1 subgoal):
 1. finite A &&& \<forall>xs\<in>A. lfinite xs
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
finite A
\<forall>xs\<in>A. lfinite xs

goal (2 subgoals):
 1. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
 2. finite A \<and> (\<forall>xs\<in>A. lfinite xs) \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfinite (lSup A)
[PROOF STEP]
proof(cases "A = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = {} \<Longrightarrow> lfinite (lSup A)
 2. A \<noteq> {} \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> lfinite (lSup A)
 2. A \<noteq> {} \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
with chain \<open>finite A\<close>
[PROOF STATE]
proof (chain)
picking this:
Complete_Partial_Order.chain (\<sqsubseteq>) A
finite A
A \<noteq> {}
[PROOF STEP]
have "lSup A \<in> A"
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (\<sqsubseteq>) A
finite A
A \<noteq> {}

goal (1 subgoal):
 1. lSup A \<in> A
[PROOF STEP]
by(rule ccpo.in_chain_finite[OF llist_ccpo])
[PROOF STATE]
proof (state)
this:
lSup A \<in> A

goal (2 subgoals):
 1. A = {} \<Longrightarrow> lfinite (lSup A)
 2. A \<noteq> {} \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
with \<open>\<forall>xs\<in>A. lfinite xs\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>xs\<in>A. lfinite xs
lSup A \<in> A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>xs\<in>A. lfinite xs
lSup A \<in> A

goal (1 subgoal):
 1. lfinite (lSup A)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
lfinite (lSup A)

goal (1 subgoal):
 1. A = {} \<Longrightarrow> lfinite (lSup A)
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
lfinite (lSup A)

goal (1 subgoal):
 1. lfinite (lSup A) \<Longrightarrow> \<forall>xs\<in>A. lfinite xs
[PROOF STEP]
qed(rule lfinite_lSupD)


[STATEMENT]
lemma inext_insert_ge_Max: "
  \<lbrakk> finite I; I \<noteq> {}; Max I \<le> a \<rbrakk> \<Longrightarrow> inext (Max I) (insert a I) = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; Max I \<le> a\<rbrakk> \<Longrightarrow> inext (Max I) (insert a I) = a
[PROOF STEP]
apply (case_tac "a = Max I")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; I \<noteq> {}; Max I \<le> a; a = Max I\<rbrakk> \<Longrightarrow> inext (Max I) (insert a I) = a
 2. \<lbrakk>finite I; I \<noteq> {}; Max I \<le> a; a \<noteq> Max I\<rbrakk> \<Longrightarrow> inext (Max I) (insert a I) = a
[PROOF STEP]
apply (simp add: insert_absorb inext_Max)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; Max I \<le> a; a \<noteq> Max I\<rbrakk> \<Longrightarrow> inext (Max I) (insert a I) = a
[PROOF STEP]
apply (drule le_neq_trans, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; a \<noteq> Max I; Max I < a\<rbrakk> \<Longrightarrow> inext (Max I) (insert a I) = a
[PROOF STEP]
apply (rule min_step_inext2)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>finite I; I \<noteq> {}; a \<noteq> Max I; Max I < a\<rbrakk> \<Longrightarrow> Max I < a
 2. \<lbrakk>finite I; I \<noteq> {}; a \<noteq> Max I; Max I < a\<rbrakk> \<Longrightarrow> Max I \<in> insert a I
 3. \<lbrakk>finite I; I \<noteq> {}; a \<noteq> Max I; Max I < a\<rbrakk> \<Longrightarrow> a \<in> insert a I
 4. \<lbrakk>finite I; I \<noteq> {}; a \<noteq> Max I; Max I < a\<rbrakk> \<Longrightarrow> \<not> (\<exists>k\<in>insert a I. Max I < k \<and> k < a)
[PROOF STEP]
apply (simp, simp, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; a \<noteq> Max I; Max I < a\<rbrakk> \<Longrightarrow> \<not> (\<exists>k\<in>insert a I. Max I < k \<and> k < a)
[PROOF STEP]
apply (simp_all, blast?)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
(* blast is optional for the case, that the last goal could be solved by the simplifier in a future version, making the blast command superfluous. *)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vector_finitely_spanned:
  assumes \<open>z \<in> cspan T\<close>
  shows \<open>\<exists> S. finite S \<and> S \<subseteq> T \<and> z \<in> cspan S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S. finite S \<and> S \<subseteq> T \<and> z \<in> cspan S
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>S. finite S \<and> S \<subseteq> T \<and> z \<in> cspan S
[PROOF STEP]
have \<open>\<exists> S r. finite S \<and> S \<subseteq> T \<and> z = (\<Sum>a\<in>S. r a *\<^sub>C a)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S r. finite S \<and> S \<subseteq> T \<and> z = (\<Sum>a\<in>S. r a *\<^sub>C a)
[PROOF STEP]
using complex_vector.span_explicit[where b = "T"]
      assms
[PROOF STATE]
proof (prove)
using this:
cspan T = {\<Sum>a\<in>t. r a *\<^sub>C a |t r. finite t \<and> t \<subseteq> T}
z \<in> cspan T

goal (1 subgoal):
 1. \<exists>S r. finite S \<and> S \<subseteq> T \<and> z = (\<Sum>a\<in>S. r a *\<^sub>C a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>S r. finite S \<and> S \<subseteq> T \<and> z = (\<Sum>a\<in>S. r a *\<^sub>C a)

goal (1 subgoal):
 1. \<exists>S. finite S \<and> S \<subseteq> T \<and> z \<in> cspan S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>S r. finite S \<and> S \<subseteq> T \<and> z = (\<Sum>a\<in>S. r a *\<^sub>C a)
[PROOF STEP]
obtain S r where \<open>finite S\<close> and \<open>S \<subseteq> T\<close> and \<open>z = (\<Sum>a\<in>S. r a *\<^sub>C a)\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>S r. finite S \<and> S \<subseteq> T \<and> z = (\<Sum>a\<in>S. r a *\<^sub>C a)

goal (1 subgoal):
 1. (\<And>S r. \<lbrakk>finite S; S \<subseteq> T; z = (\<Sum>a\<in>S. r a *\<^sub>C a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite S
S \<subseteq> T
z = (\<Sum>a\<in>S. r a *\<^sub>C a)

goal (1 subgoal):
 1. \<exists>S. finite S \<and> S \<subseteq> T \<and> z \<in> cspan S
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finite S
S \<subseteq> T
z = (\<Sum>a\<in>S. r a *\<^sub>C a)

goal (1 subgoal):
 1. \<exists>S. finite S \<and> S \<subseteq> T \<and> z \<in> cspan S
[PROOF STEP]
by (meson complex_vector.span_scale complex_vector.span_sum complex_vector.span_superset subset_iff)
[PROOF STATE]
proof (state)
this:
\<exists>S. finite S \<and> S \<subseteq> T \<and> z \<in> cspan S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lnth_iterates [simp]: "lnth (iterates f x) n = (f ^^ n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lnth (iterates f x) n = (f ^^ n) x
[PROOF STEP]
proof(induct n arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. lnth (iterates f x) 0 = (f ^^ 0) x
 2. \<And>n x. (\<And>x. lnth (iterates f x) n = (f ^^ n) x) \<Longrightarrow> lnth (iterates f x) (Suc n) = (f ^^ Suc n) x
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x. lnth (iterates f x) 0 = (f ^^ 0) x
 2. \<And>n x. (\<And>x. lnth (iterates f x) n = (f ^^ n) x) \<Longrightarrow> lnth (iterates f x) (Suc n) = (f ^^ Suc n) x
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lnth (iterates f x) 0 = (f ^^ 0) x
[PROOF STEP]
by(subst iterates) simp
[PROOF STATE]
proof (state)
this:
lnth (iterates f x) 0 = (f ^^ 0) x

goal (1 subgoal):
 1. \<And>n x. (\<And>x. lnth (iterates f x) n = (f ^^ n) x) \<Longrightarrow> lnth (iterates f x) (Suc n) = (f ^^ Suc n) x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n x. (\<And>x. lnth (iterates f x) n = (f ^^ n) x) \<Longrightarrow> lnth (iterates f x) (Suc n) = (f ^^ Suc n) x
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
lnth (iterates f ?x) n = (f ^^ n) ?x

goal (1 subgoal):
 1. \<And>n x. (\<And>x. lnth (iterates f x) n = (f ^^ n) x) \<Longrightarrow> lnth (iterates f x) (Suc n) = (f ^^ Suc n) x
[PROOF STEP]
hence "lnth (iterates f (f x)) n = (f ^^ n) (f x)"
[PROOF STATE]
proof (prove)
using this:
lnth (iterates f ?x) n = (f ^^ n) ?x

goal (1 subgoal):
 1. lnth (iterates f (f x)) n = (f ^^ n) (f x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lnth (iterates f (f x)) n = (f ^^ n) (f x)

goal (1 subgoal):
 1. \<And>n x. (\<And>x. lnth (iterates f x) n = (f ^^ n) x) \<Longrightarrow> lnth (iterates f x) (Suc n) = (f ^^ Suc n) x
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
lnth (iterates f (f x)) n = (f ^^ n) (f x)

goal (1 subgoal):
 1. lnth (iterates f x) (Suc n) = (f ^^ Suc n) x
[PROOF STEP]
by(subst iterates)(simp add: funpow_swap1)
[PROOF STATE]
proof (state)
this:
lnth (iterates f x) (Suc n) = (f ^^ Suc n) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma markov_inequality:
  assumes "\<And>a. 0 \<le> X a" and "integrable M X" "0 < t"
  shows "prob {a \<in> space M. t \<le> X a} \<le> expectation X / t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {a \<in> space M. t \<le> X a} \<le> expectation X / t
[PROOF STEP]
proof -
  \<comment> \<open>proof adapted from @{thm [source] edge_space.Markov_inequality}, but generalized to arbitrary
       @{term prob_space}s\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob {a \<in> space M. t \<le> X a} \<le> expectation X / t
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (X x) \<partial>M) = (\<integral>x. X x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (X x) \<partial>M = ennreal (expectation X)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> X ?a12
integrable M X
0 < t

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (X x) \<partial>M = ennreal (expectation X)
[PROOF STEP]
by (intro nn_integral_eq_integral) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (X x) \<partial>M = ennreal (expectation X)

goal (1 subgoal):
 1. prob {a \<in> space M. t \<le> X a} \<le> expectation X / t
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (X x) \<partial>M = ennreal (expectation X)

goal (1 subgoal):
 1. prob {a \<in> space M. t \<le> X a} \<le> expectation X / t
[PROOF STEP]
using assms nn_integral_Markov_inequality[of X "space M" M "1 / t"]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (X x) \<partial>M = ennreal (expectation X)
0 \<le> X ?a12
integrable M X
0 < t
\<lbrakk>random_variable borel (\<lambda>x. ennreal (X x) * indicator (space M) x); space M \<in> events\<rbrakk> \<Longrightarrow> emeasure M {x \<in> space M. 1 \<le> ennreal (1 / t) * ennreal (X x)} \<le> ennreal (1 / t) * (\<integral>\<^sup>+x\<in>space M. ennreal (X x)\<partial>M)

goal (1 subgoal):
 1. prob {a \<in> space M. t \<le> X a} \<le> expectation X / t
[PROOF STEP]
by (auto cong: nn_integral_cong simp: emeasure_eq_measure ennreal_mult[symmetric])
[PROOF STATE]
proof (state)
this:
prob {a \<in> space M. t \<le> X a} \<le> expectation X / t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Join_subset_mono: "A \<subseteq> B \<Longrightarrow> \<Squnion>A \<sqsubseteq> \<Squnion>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> \<Squnion>A \<sqsubseteq> \<Squnion>B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> \<Squnion>A \<sqsubseteq> \<Squnion>B
[PROOF STEP]
assume "A \<subseteq> B"
[PROOF STATE]
proof (state)
this:
A \<subseteq> B

goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> \<Squnion>A \<sqsubseteq> \<Squnion>B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> B
[PROOF STEP]
have "dual ` A \<subseteq> dual ` B"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

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

goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> \<Squnion>A \<sqsubseteq> \<Squnion>B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dual ` A \<subseteq> dual ` B
[PROOF STEP]
have "\<Sqinter>(dual ` B) \<sqsubseteq> \<Sqinter>(dual ` A)"
[PROOF STATE]
proof (prove)
using this:
dual ` A \<subseteq> dual ` B

goal (1 subgoal):
 1. \<Sqinter>dual ` B \<sqsubseteq> \<Sqinter>dual ` A
[PROOF STEP]
by (rule Meet_subset_antimono)
[PROOF STATE]
proof (state)
this:
\<Sqinter>dual ` B \<sqsubseteq> \<Sqinter>dual ` A

goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> \<Squnion>A \<sqsubseteq> \<Squnion>B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Sqinter>dual ` B \<sqsubseteq> \<Sqinter>dual ` A
[PROOF STEP]
have "dual (\<Squnion>B) \<sqsubseteq> dual (\<Squnion>A)"
[PROOF STATE]
proof (prove)
using this:
\<Sqinter>dual ` B \<sqsubseteq> \<Sqinter>dual ` A

goal (1 subgoal):
 1. dual (\<Squnion>B) \<sqsubseteq> dual (\<Squnion>A)
[PROOF STEP]
by (simp only: dual_Join)
[PROOF STATE]
proof (state)
this:
dual (\<Squnion>B) \<sqsubseteq> dual (\<Squnion>A)

goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> \<Squnion>A \<sqsubseteq> \<Squnion>B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dual (\<Squnion>B) \<sqsubseteq> dual (\<Squnion>A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dual (\<Squnion>B) \<sqsubseteq> dual (\<Squnion>A)

goal (1 subgoal):
 1. \<Squnion>A \<sqsubseteq> \<Squnion>B
[PROOF STEP]
by (simp only: dual_leq)
[PROOF STATE]
proof (state)
this:
\<Squnion>A \<sqsubseteq> \<Squnion>B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem terminal_objs_isomorphic:
    assumes "terminal a" and "terminal b"
    shows "isomorphic a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isomorphic a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isomorphic a b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
terminal a
terminal b
[PROOF STEP]
obtain f where f: "\<guillemotleft>f : a \<rightarrow> b\<guillemotright>"
[PROOF STATE]
proof (prove)
using this:
terminal a
terminal b

goal (1 subgoal):
 1. (\<And>f. \<guillemotleft>f : a \<rightarrow> b\<guillemotright> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using terminal_def
[PROOF STATE]
proof (prove)
using this:
terminal a
terminal b
terminal ?b \<equiv> ide ?b \<and> (\<forall>a. ide a \<longrightarrow> (\<exists>!f. \<guillemotleft>f : a \<rightarrow> ?b\<guillemotright>))

goal (1 subgoal):
 1. (\<And>f. \<guillemotleft>f : a \<rightarrow> b\<guillemotright> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
\<guillemotleft>f : a \<rightarrow> b\<guillemotright>

goal (1 subgoal):
 1. isomorphic a b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
terminal a
terminal b
[PROOF STEP]
obtain g where g: "\<guillemotleft>g : b \<rightarrow> a\<guillemotright>"
[PROOF STATE]
proof (prove)
using this:
terminal a
terminal b

goal (1 subgoal):
 1. (\<And>g. \<guillemotleft>g : b \<rightarrow> a\<guillemotright> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using terminal_def
[PROOF STATE]
proof (prove)
using this:
terminal a
terminal b
terminal ?b \<equiv> ide ?b \<and> (\<forall>a. ide a \<longrightarrow> (\<exists>!f. \<guillemotleft>f : a \<rightarrow> ?b\<guillemotright>))

goal (1 subgoal):
 1. (\<And>g. \<guillemotleft>g : b \<rightarrow> a\<guillemotright> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
\<guillemotleft>g : b \<rightarrow> a\<guillemotright>

goal (1 subgoal):
 1. isomorphic a b
[PROOF STEP]
have "iso f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.iso f
[PROOF STEP]
using assms f g
[PROOF STATE]
proof (prove)
using this:
terminal a
terminal b
\<guillemotleft>f : a \<rightarrow> b\<guillemotright>
\<guillemotleft>g : b \<rightarrow> a\<guillemotright>

goal (1 subgoal):
 1. local.iso f
[PROOF STEP]
by (metis arr_iff_in_hom cod_comp retractionI sectionI seqI' terminal_def
            dom_comp in_homE iso_iff_section_and_retraction ide_in_hom)
[PROOF STATE]
proof (state)
this:
local.iso f

goal (1 subgoal):
 1. isomorphic a b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
local.iso f

goal (1 subgoal):
 1. isomorphic a b
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
local.iso f
\<guillemotleft>f : a \<rightarrow> b\<guillemotright>

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deformation_retract_imp_homotopy_eqv:
  fixes S :: "'a::euclidean_space set"
  assumes "homotopic_with_canon (\<lambda>x. True) S S id r" and r: "retraction S T r"
  shows "S homotopy_eqv T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
have "homotopic_with_canon (\<lambda>x. True) S S (id \<circ> r) id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>x. True) S S (id \<circ> r) id
[PROOF STEP]
by (simp add: assms(1) homotopic_with_symD)
[PROOF STATE]
proof (state)
this:
homotopic_with_canon (\<lambda>x. True) S S (id \<circ> r) id

goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
homotopic_with_canon (\<lambda>x. True) S S (id \<circ> r) id

goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
have "homotopic_with_canon (\<lambda>x. True) T T (r \<circ> id) id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>x. True) T T (r \<circ> id) id
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
retraction S T r

goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>x. True) T T (r \<circ> id) id
[PROOF STEP]
unfolding retraction_def
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> S \<and> continuous_on S r \<and> r ` S \<subseteq> T \<and> (\<forall>x\<in>T. r x = x)

goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>x. True) T T (r \<circ> id) id
[PROOF STEP]
by (metis eq_id_iff homotopic_with_id2 topspace_euclidean_subtopology)
[PROOF STATE]
proof (state)
this:
homotopic_with_canon (\<lambda>x. True) T T (r \<circ> id) id

goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
homotopic_with_canon (\<lambda>x. True) S S (id \<circ> r) id
homotopic_with_canon (\<lambda>x. True) T T (r \<circ> id) id
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
homotopic_with_canon (\<lambda>x. True) S S (id \<circ> r) id
homotopic_with_canon (\<lambda>x. True) T T (r \<circ> id) id

goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
unfolding homotopy_equivalent_space_def
[PROOF STATE]
proof (prove)
using this:
homotopic_with_canon (\<lambda>x. True) S S (id \<circ> r) id
homotopic_with_canon (\<lambda>x. True) T T (r \<circ> id) id

goal (1 subgoal):
 1. \<exists>f g. continuous_map (top_of_set S) (top_of_set T) f \<and> continuous_map (top_of_set T) (top_of_set S) g \<and> homotopic_with_canon (\<lambda>x. True) S S (g \<circ> f) id \<and> homotopic_with_canon (\<lambda>x. True) T T (f \<circ> g) id
[PROOF STEP]
by (metis (no_types, lifting) continuous_map_subtopology_eu continuous_on_id' id_def image_id r retraction_def)
[PROOF STATE]
proof (state)
this:
S homotopy_eqv T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma log2_at_0: "log2 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
let ?v = "log2 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
have S1: "0 \<le> ?v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> log2 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> log2 0

goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
have S2: "?v = Least(%(z::nat). (0::nat)<2^(z+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log2 0 = (LEAST z. 0 < 2 ^ (z + 1))
[PROOF STEP]
by (simp add: log2_def)
[PROOF STATE]
proof (state)
this:
log2 0 = (LEAST z. 0 < 2 ^ (z + 1))

goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
have S3: "(0::nat)<2^(0+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 2 ^ (0 + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < 2 ^ (0 + 1)

goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
from S3
[PROOF STATE]
proof (chain)
picking this:
0 < 2 ^ (0 + 1)
[PROOF STEP]
have S4: "Least(%(z::nat). (0::nat)<2^(z+1)) \<le> 0"
[PROOF STATE]
proof (prove)
using this:
0 < 2 ^ (0 + 1)

goal (1 subgoal):
 1. (LEAST z. 0 < 2 ^ (z + 1)) \<le> 0
[PROOF STEP]
by (rule Least_le)
[PROOF STATE]
proof (state)
this:
(LEAST z. 0 < 2 ^ (z + 1)) \<le> 0

goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
from S2 S4
[PROOF STATE]
proof (chain)
picking this:
log2 0 = (LEAST z. 0 < 2 ^ (z + 1))
(LEAST z. 0 < 2 ^ (z + 1)) \<le> 0
[PROOF STEP]
have S5: "?v \<le> 0"
[PROOF STATE]
proof (prove)
using this:
log2 0 = (LEAST z. 0 < 2 ^ (z + 1))
(LEAST z. 0 < 2 ^ (z + 1)) \<le> 0

goal (1 subgoal):
 1. log2 0 \<le> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
log2 0 \<le> 0

goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
from S1 S5
[PROOF STATE]
proof (chain)
picking this:
0 \<le> log2 0
log2 0 \<le> 0
[PROOF STEP]
have S6: "?v = 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> log2 0
log2 0 \<le> 0

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

goal (1 subgoal):
 1. log2 0 = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
log2 0 = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_span_insert_eq:
  assumes "(x - y) \<in> span S"
    shows "span(insert x S) = span(insert y S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (insert x S) = span (insert y S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. span (insert x S) = span (insert y S)
[PROOF STEP]
have *: "span(insert x S) \<subseteq> span(insert y S)" if "(x - y) \<in> span S" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (insert x S) \<subseteq> span (insert y S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. span (insert x S) \<subseteq> span (insert y S)
[PROOF STEP]
have 1: "(r *s x - r *s y) \<in> span S" for r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r *s x - r *s y \<in> span S
[PROOF STEP]
by (metis scale_right_diff_distrib span_scale that)
[PROOF STATE]
proof (state)
this:
?r *s x - ?r *s y \<in> span S

goal (1 subgoal):
 1. span (insert x S) \<subseteq> span (insert y S)
[PROOF STEP]
have 2: "(z - k *s y) - k *s (x - y) = z - k *s x" for  z k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z - k *s y - k *s (x - y) = z - k *s x
[PROOF STEP]
by (simp add: scale_right_diff_distrib)
[PROOF STATE]
proof (state)
this:
?z - ?k *s y - ?k *s (x - y) = ?z - ?k *s x

goal (1 subgoal):
 1. span (insert x S) \<subseteq> span (insert y S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (insert x S) \<subseteq> span (insert y S)
[PROOF STEP]
apply (clarsimp simp add: span_breakdown_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x k. x - k *s x \<in> span S \<Longrightarrow> \<exists>k. x - k *s y \<in> span S
[PROOF STEP]
by (metis 1 2 diff_add_cancel scale_right_diff_distrib span_add_eq)
[PROOF STATE]
proof (state)
this:
span (insert x S) \<subseteq> span (insert y S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x - ?y \<in> span S \<Longrightarrow> span (insert ?x S) \<subseteq> span (insert ?y S)

goal (1 subgoal):
 1. span (insert x S) = span (insert y S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (insert x S) = span (insert y S)
[PROOF STEP]
apply (intro subset_antisym * assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y - x \<in> span S
[PROOF STEP]
using assms subspace_neg subspace_span minus_diff_eq
[PROOF STATE]
proof (prove)
using this:
x - y \<in> span S
\<lbrakk>subspace ?S; ?x \<in> ?S\<rbrakk> \<Longrightarrow> - ?x \<in> ?S
subspace (span ?S)
- (?a - ?b) = ?b - ?a

goal (1 subgoal):
 1. y - x \<in> span S
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
span (insert x S) = span (insert y S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma euler_mascheroni_bounds':
  fixes n :: nat assumes "n \<ge> 1" "ln (real_of_nat (Suc n)) \<in> {l<..<u}"
  shows "euler_mascheroni \<in>
           {harm n - u + inverse (of_nat (2*(n+1)))<..<harm n - l + inverse (of_nat (2*n))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euler_mascheroni \<in> {harm n - u + inverse (real (2 * (n + 1)))<..<harm n - l + inverse (real (2 * n))}
[PROOF STEP]
using euler_mascheroni_bounds[OF assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
euler_mascheroni \<in> {harm n - ln (real (Suc n)) + inverse (real (2 * (n + 1)))..harm n - ln (real (Suc n)) + inverse (real (2 * n))}
ln (real (Suc n)) \<in> {l<..<u}

goal (1 subgoal):
 1. euler_mascheroni \<in> {harm n - u + inverse (real (2 * (n + 1)))<..<harm n - l + inverse (real (2 * n))}
[PROOF STEP]
by auto


[STATEMENT]
lemma directed_alt: "directed X = (X \<noteq> {} \<and> (\<forall>x \<in> X. \<forall>y \<in> X. \<exists>z \<in> X. x \<le> z \<and> y \<le> z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. directed X = (X \<noteq> {} \<and> (\<forall>x\<in>X. \<forall>y\<in>X. \<exists>z\<in>X. x \<le> z \<and> y \<le> z))
[PROOF STEP]
by (metis directed_prop directed_nonempty directed_ub)


[STATEMENT]
lemma bigo_abs3: "O(f) = O(\<lambda>x. \<bar>f x\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O(f) = O(\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. O(f) = O(\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
have F1: "\<forall>v u. u \<in> O(v) \<longrightarrow> O(u) \<subseteq> O(v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v u. u \<in> O(v) \<longrightarrow> O(u) \<subseteq> O(v)
[PROOF STEP]
by (metis bigo_elt_subset)
[PROOF STATE]
proof (state)
this:
\<forall>v u. u \<in> O(v) \<longrightarrow> O(u) \<subseteq> O(v)

goal (1 subgoal):
 1. O(f) = O(\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
have F2: "\<forall>u. (\<lambda>R. \<bar>u R\<bar>) \<in> O(u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u. (\<lambda>R. \<bar>u R\<bar>) \<in> O(u)
[PROOF STEP]
by (metis bigo_abs)
[PROOF STATE]
proof (state)
this:
\<forall>u. (\<lambda>R. \<bar>u R\<bar>) \<in> O(u)

goal (1 subgoal):
 1. O(f) = O(\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
have "\<forall>u. u \<in> O(\<lambda>R. \<bar>u R\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u. u \<in> O(\<lambda>R. \<bar>u R\<bar>)
[PROOF STEP]
by (metis bigo_abs2)
[PROOF STATE]
proof (state)
this:
\<forall>u. u \<in> O(\<lambda>R. \<bar>u R\<bar>)

goal (1 subgoal):
 1. O(f) = O(\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
thus "O(f) = O(\<lambda>x. \<bar>f x\<bar>)"
[PROOF STATE]
proof (prove)
using this:
\<forall>u. u \<in> O(\<lambda>R. \<bar>u R\<bar>)

goal (1 subgoal):
 1. O(f) = O(\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
using F1 F2
[PROOF STATE]
proof (prove)
using this:
\<forall>u. u \<in> O(\<lambda>R. \<bar>u R\<bar>)
\<forall>v u. u \<in> O(v) \<longrightarrow> O(u) \<subseteq> O(v)
\<forall>u. (\<lambda>R. \<bar>u R\<bar>) \<in> O(u)

goal (1 subgoal):
 1. O(f) = O(\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
O(f) = O(\<lambda>x. \<bar>f x\<bar>)

goal:
No subgoals!
[PROOF STEP]
qed