[STATEMENT]
lemma mean_square_density_bounded:
  assumes "finite_graph_partition (uverts G) P k" "finite (uverts G)"
  shows "mean_square_density G P \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mean_square_density G P \<le> 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mean_square_density G P \<le> 1
[PROOF STEP]
have "(\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S) * (edge_density R S G)\<^sup>2)
     \<le> (\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S) * (edge_density R S G)\<^sup>2) \<le> (\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S))
[PROOF STEP]
by (intro sum_mono mult_right_le_one_le) (auto simp: abs_square_le_1 edge_density_ge0 edge_density_le1)
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S) * (edge_density R S G)\<^sup>2) \<le> (\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S))

goal (1 subgoal):
 1. mean_square_density G P \<le> 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S) * (edge_density R S G)\<^sup>2) \<le> (\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S))

goal (1 subgoal):
 1. mean_square_density G P \<le> 1
[PROOF STEP]
have "\<dots> \<le> (real(card (uverts G)))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S)) \<le> (real (card (uverts G)))\<^sup>2
[PROOF STEP]
using sum_partition_le assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite_graph_partition ?V ?P ?k; finite ?V\<rbrakk> \<Longrightarrow> (\<Sum>R\<in>?P. \<Sum>S\<in>?P. real (card R * card S)) \<le> (real (card ?V))\<^sup>2
finite_graph_partition (uverts G) P k
finite (uverts G)

goal (1 subgoal):
 1. (\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S)) \<le> (real (card (uverts G)))\<^sup>2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S)) \<le> (real (card (uverts G)))\<^sup>2

goal (1 subgoal):
 1. mean_square_density G P \<le> 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S) * (edge_density R S G)\<^sup>2) \<le> (real (card (uverts G)))\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>R\<in>P. \<Sum>S\<in>P. real (card R * card S) * (edge_density R S G)\<^sup>2) \<le> (real (card (uverts G)))\<^sup>2

goal (1 subgoal):
 1. mean_square_density G P \<le> 1
[PROOF STEP]
by (simp add: mean_square_density divide_simps)
[PROOF STATE]
proof (state)
this:
mean_square_density G P \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cinner_ket_same[simp]:
  \<open>(ket i \<bullet>\<^sub>C ket i) = 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = 1
[PROOF STEP]
have \<open>norm (ket i) = 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (ket i) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (ket i) = 1

goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = 1
[PROOF STEP]
hence \<open>sqrt (cmod (ket i \<bullet>\<^sub>C ket i)) = 1\<close>
[PROOF STATE]
proof (prove)
using this:
norm (ket i) = 1

goal (1 subgoal):
 1. sqrt (cmod (ket i \<bullet>\<^sub>C ket i)) = 1
[PROOF STEP]
by (metis norm_eq_sqrt_cinner)
[PROOF STATE]
proof (state)
this:
sqrt (cmod (ket i \<bullet>\<^sub>C ket i)) = 1

goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = 1
[PROOF STEP]
hence \<open>cmod (ket i \<bullet>\<^sub>C ket i) = 1\<close>
[PROOF STATE]
proof (prove)
using this:
sqrt (cmod (ket i \<bullet>\<^sub>C ket i)) = 1

goal (1 subgoal):
 1. cmod (ket i \<bullet>\<^sub>C ket i) = 1
[PROOF STEP]
using real_sqrt_eq_1_iff
[PROOF STATE]
proof (prove)
using this:
sqrt (cmod (ket i \<bullet>\<^sub>C ket i)) = 1
(sqrt ?x = 1) = (?x = 1)

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

goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cmod (ket i \<bullet>\<^sub>C ket i) = 1

goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = 1
[PROOF STEP]
have \<open>(ket i \<bullet>\<^sub>C ket i) = cmod (ket i \<bullet>\<^sub>C ket i)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = complex_of_real (cmod (ket i \<bullet>\<^sub>C ket i))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = complex_of_real (cmod (ket i \<bullet>\<^sub>C ket i))
[PROOF STEP]
have \<open>(ket i \<bullet>\<^sub>C ket i) \<in> \<real>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i \<in> \<real>
[PROOF STEP]
by (simp add: cinner_real)
[PROOF STATE]
proof (state)
this:
ket i \<bullet>\<^sub>C ket i \<in> \<real>

goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = complex_of_real (cmod (ket i \<bullet>\<^sub>C ket i))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ket i \<bullet>\<^sub>C ket i \<in> \<real>

goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = complex_of_real (cmod (ket i \<bullet>\<^sub>C ket i))
[PROOF STEP]
by (metis cinner_ge_zero complex_of_real_cmod)
[PROOF STATE]
proof (state)
this:
ket i \<bullet>\<^sub>C ket i = complex_of_real (cmod (ket i \<bullet>\<^sub>C ket i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ket i \<bullet>\<^sub>C ket i = complex_of_real (cmod (ket i \<bullet>\<^sub>C ket i))

goal (1 subgoal):
 1. ket i \<bullet>\<^sub>C ket i = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cmod (ket i \<bullet>\<^sub>C ket i) = 1
ket i \<bullet>\<^sub>C ket i = complex_of_real (cmod (ket i \<bullet>\<^sub>C ket i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (ket i \<bullet>\<^sub>C ket i) = 1
ket i \<bullet>\<^sub>C ket i = complex_of_real (cmod (ket i \<bullet>\<^sub>C ket i))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interpolation_poly: assumes dist: "distinct (map fst xs_ys)"
  and p: "p = interpolation_poly alg xs_ys"
  and xy: "(x,y) \<in> set xs_ys"
  shows "poly p x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
proof (cases alg)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. alg = Newton \<Longrightarrow> poly p x = y
 2. alg = Lagrange \<Longrightarrow> poly p x = y
 3. alg = Neville_Aitken \<Longrightarrow> poly p x = y
[PROOF STEP]
case Newton
[PROOF STATE]
proof (state)
this:
alg = Newton

goal (3 subgoals):
 1. alg = Newton \<Longrightarrow> poly p x = y
 2. alg = Lagrange \<Longrightarrow> poly p x = y
 3. alg = Neville_Aitken \<Longrightarrow> poly p x = y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
alg = Newton

goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
using newton_interpolation_poly[OF dist _ xy] p
[PROOF STATE]
proof (prove)
using this:
alg = Newton
?p = newton_interpolation_poly xs_ys \<Longrightarrow> poly ?p x = y
p = interpolation_poly alg xs_ys

goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly p x = y

goal (2 subgoals):
 1. alg = Lagrange \<Longrightarrow> poly p x = y
 2. alg = Neville_Aitken \<Longrightarrow> poly p x = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. alg = Lagrange \<Longrightarrow> poly p x = y
 2. alg = Neville_Aitken \<Longrightarrow> poly p x = y
[PROOF STEP]
case Lagrange
[PROOF STATE]
proof (state)
this:
alg = Lagrange

goal (2 subgoals):
 1. alg = Lagrange \<Longrightarrow> poly p x = y
 2. alg = Neville_Aitken \<Longrightarrow> poly p x = y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
alg = Lagrange

goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
using lagrange_interpolation_poly[OF dist _ xy] p
[PROOF STATE]
proof (prove)
using this:
alg = Lagrange
?p = lagrange_interpolation_poly xs_ys \<Longrightarrow> poly ?p x = y
p = interpolation_poly alg xs_ys

goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly p x = y

goal (1 subgoal):
 1. alg = Neville_Aitken \<Longrightarrow> poly p x = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. alg = Neville_Aitken \<Longrightarrow> poly p x = y
[PROOF STEP]
case Neville_Aitken
[PROOF STATE]
proof (state)
this:
alg = Neville_Aitken

goal (1 subgoal):
 1. alg = Neville_Aitken \<Longrightarrow> poly p x = y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
alg = Neville_Aitken

goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
using neville_aitken_interpolation_poly[OF dist _ xy] p
[PROOF STATE]
proof (prove)
using this:
alg = Neville_Aitken
?p = neville_aitken_interpolation_poly xs_ys \<Longrightarrow> poly ?p x = y
p = interpolation_poly alg xs_ys

goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly p x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_contains_Inf:
  fixes S :: "real set"
  assumes "S \<noteq> {}" "bdd_below S"
  shows "Inf S \<in> closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
have *: "\<forall>x\<in>S. Inf S \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>S. Inf S \<le> x
[PROOF STEP]
using cInf_lower[of _ S] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; bdd_below S\<rbrakk> \<Longrightarrow> Inf S \<le> ?x
S \<noteq> {}
bdd_below S

goal (1 subgoal):
 1. \<forall>x\<in>S. Inf S \<le> x
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. Inf S \<le> x

goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. Inf S \<le> x

goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
fix e :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
have "Inf S < Inf S + e"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. Inf S < Inf S + e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Inf S < Inf S + e

goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
bdd_below S
Inf S < Inf S + e
[PROOF STEP]
obtain x where "x \<in> S" "x < Inf S + e"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
bdd_below S
Inf S < Inf S + e

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> S; x < Inf S + e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (subst (asm) cInf_less_iff) auto
[PROOF STATE]
proof (state)
this:
x \<in> S
x < Inf S + e

goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>S. Inf S \<le> x
x \<in> S
x < Inf S + e
[PROOF STEP]
have "\<exists>x\<in>S. dist x (Inf S) < e"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. Inf S \<le> x
x \<in> S
x < Inf S + e

goal (1 subgoal):
 1. \<exists>x\<in>S. dist x (Inf S) < e
[PROOF STEP]
by (intro bexI[of _ x]) (auto simp: dist_real_def)
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>S. dist x (Inf S) < e

goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < ?e2 \<Longrightarrow> \<exists>x\<in>S. dist x (Inf S) < ?e2

goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < ?e2 \<Longrightarrow> \<exists>x\<in>S. dist x (Inf S) < ?e2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < ?e2 \<Longrightarrow> \<exists>x\<in>S. dist x (Inf S) < ?e2

goal (1 subgoal):
 1. Inf S \<in> closure S
[PROOF STEP]
unfolding closure_approachable
[PROOF STATE]
proof (prove)
using this:
0 < ?e2 \<Longrightarrow> \<exists>x\<in>S. dist x (Inf S) < ?e2

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma last_take[simp]:
    assumes "n < length xs"
    shows "last (take (Suc n) xs) = xs ! n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (take (Suc n) xs) = xs ! n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < length xs

goal (1 subgoal):
 1. last (take (Suc n) xs) = xs ! n
[PROOF STEP]
proof (induct xs arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. n < length [] \<Longrightarrow> last (take (Suc n) []) = [] ! n
 2. \<And>a xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> last (take (Suc n) xs) = xs ! n; n < length (a # xs)\<rbrakk> \<Longrightarrow> last (take (Suc n) (a # xs)) = (a # xs) ! n
[PROOF STEP]
case (Nil)
[PROOF STATE]
proof (state)
this:
n < length []

goal (2 subgoals):
 1. \<And>n. n < length [] \<Longrightarrow> last (take (Suc n) []) = [] ! n
 2. \<And>a xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> last (take (Suc n) xs) = xs ! n; n < length (a # xs)\<rbrakk> \<Longrightarrow> last (take (Suc n) (a # xs)) = (a # xs) ! n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (take (Suc n) []) = [] ! n
[PROOF STEP]
using Nil
[PROOF STATE]
proof (prove)
using this:
n < length []

goal (1 subgoal):
 1. last (take (Suc n) []) = [] ! n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
last (take (Suc n) []) = [] ! n

goal (1 subgoal):
 1. \<And>a xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> last (take (Suc n) xs) = xs ! n; n < length (a # xs)\<rbrakk> \<Longrightarrow> last (take (Suc n) (a # xs)) = (a # xs) ! n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> last (take (Suc n) xs) = xs ! n; n < length (a # xs)\<rbrakk> \<Longrightarrow> last (take (Suc n) (a # xs)) = (a # xs) ! n
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
?n < length xs \<Longrightarrow> last (take (Suc ?n) xs) = xs ! ?n
n < length (x # xs)

goal (1 subgoal):
 1. \<And>a xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> last (take (Suc n) xs) = xs ! n; n < length (a # xs)\<rbrakk> \<Longrightarrow> last (take (Suc n) (a # xs)) = (a # xs) ! n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (take (Suc n) (x # xs)) = (x # xs) ! n
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
?n < length xs \<Longrightarrow> last (take (Suc ?n) xs) = xs ! ?n
n < length (x # xs)

goal (1 subgoal):
 1. last (take (Suc n) (x # xs)) = (x # xs) ! n
[PROOF STEP]
by (auto) (metis Suc_less_eq Suc_pred)
[PROOF STATE]
proof (state)
this:
last (take (Suc n) (x # xs)) = (x # xs) ! n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nonzero_power_divide:
  "a \<in> carrier R \<Longrightarrow> b \<in> carrier R \<Longrightarrow> b \<noteq> \<zero> \<Longrightarrow>
    (a \<oslash> b) [^] (n::nat) = a [^] n \<oslash> b [^] n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; b \<noteq> \<zero>\<rbrakk> \<Longrightarrow> (a \<oslash> b) [^] n = a [^] n \<oslash> b [^] n
[PROOF STEP]
by (induct n) (simp_all add: nonzero_divide_divide_eq_left)


[STATEMENT]
lemma has_vector_derivative_pair_within:
  fixes f :: "real \<Rightarrow> 'a::euclidean_space" and g :: "real \<Rightarrow> 'b::euclidean_space"
  assumes "\<And>u. u \<in> Basis \<Longrightarrow> ((\<lambda>x. f x \<bullet> u) has_vector_derivative f' \<bullet> u) (at x within S)"
    "\<And>u. u \<in> Basis \<Longrightarrow> ((\<lambda>x. g x \<bullet> u) has_vector_derivative g' \<bullet> u) (at x within S)"
  shows "((\<lambda>x. (f x, g x)) has_vector_derivative (f',g')) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (f x, g x)) has_vector_derivative (f', g')) (at x within S)
[PROOF STEP]
apply (subst has_vector_derivative_componentwise_within)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>Basis. ((\<lambda>x. (f x, g x) \<bullet> i) has_vector_derivative (f', g') \<bullet> i) (at x within S)
[PROOF STEP]
apply (auto simp: assms Basis_prod_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bij_betw_restrict0 : "bij_betw f A B \<Longrightarrow> bij_betw (f \<down> A) A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f A B \<Longrightarrow> bij_betw (f \<down> A) A B
[PROOF STEP]
using     bij_betw_imp_inj_on bij_betw_imp_surj_on
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> inj_on ?f ?A
bij_betw ?f ?A ?B \<Longrightarrow> ?f ` ?A = ?B

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

goal (1 subgoal):
 1. (\<forall>x\<in>A. \<forall>y\<in>A. f x = f y \<longrightarrow> x = y) \<and> f ` A = B \<Longrightarrow> (\<forall>x\<in>A. \<forall>y\<in>A. (f \<down> A) x = (f \<down> A) y \<longrightarrow> x = y) \<and> (f \<down> A) ` A = B
[PROOF STEP]
by        auto


[STATEMENT]
lemma pmin_pmax:
  assumes "pgte x (pmin a b)"
  shows "x = pmin (pmax x a) (pmax x b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = pmin (pmax x a) (pmax x b)
[PROOF STEP]
proof (cases "pgte x a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pgte x a \<Longrightarrow> x = pmin (pmax x a) (pmax x b)
 2. \<not> pgte x a \<Longrightarrow> x = pmin (pmax x a) (pmax x b)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
pgte x a

goal (2 subgoals):
 1. pgte x a \<Longrightarrow> x = pmin (pmax x a) (pmax x b)
 2. \<not> pgte x a \<Longrightarrow> x = pmin (pmax x a) (pmax x b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pgte x a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pgte x a

goal (1 subgoal):
 1. x = pmin (pmax x a) (pmax x b)
[PROOF STEP]
by (metis pmax_is pmax_smaller pmin_comm pmin_is)
[PROOF STATE]
proof (state)
this:
x = pmin (pmax x a) (pmax x b)

goal (1 subgoal):
 1. \<not> pgte x a \<Longrightarrow> x = pmin (pmax x a) (pmax x b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> pgte x a \<Longrightarrow> x = pmin (pmax x a) (pmax x b)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> pgte x a

goal (1 subgoal):
 1. \<not> pgte x a \<Longrightarrow> x = pmin (pmax x a) (pmax x b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> pgte x a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> pgte x a

goal (1 subgoal):
 1. x = pmin (pmax x a) (pmax x b)
[PROOF STEP]
by (metis assms not_pgte_charact pgt_implies_pgte pmax_is pmax_smaller pmin_comm pmin_is)
[PROOF STATE]
proof (state)
this:
x = pmin (pmax x a) (pmax x b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lem_ge_sum:
  fixes l x y::real
  assumes "l>x+y"
  shows "\<exists>lx ly. l = lx + ly \<and> lx > x \<and> ly > y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>lx ly. l = lx + ly \<and> x < lx \<and> y < ly
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>lx ly. l = lx + ly \<and> x < lx \<and> y < ly
[PROOF STEP]
define lx ly where "lx = x + (l-(x+y))/2" and "ly = y + (l-(x+y))/2"
[PROOF STATE]
proof (state)
this:
lx = x + (l - (x + y)) / 2
ly = y + (l - (x + y)) / 2

goal (1 subgoal):
 1. \<exists>lx ly. l = lx + ly \<and> x < lx \<and> y < ly
[PROOF STEP]
have "l = lx + ly \<and> lx > x \<and> ly > y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = lx + ly \<and> x < lx \<and> y < ly
[PROOF STEP]
unfolding lx_def ly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = x + (l - (x + y)) / 2 + (y + (l - (x + y)) / 2) \<and> x < x + (l - (x + y)) / 2 \<and> y < y + (l - (x + y)) / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x + y < l

goal (1 subgoal):
 1. l = x + (l - (x + y)) / 2 + (y + (l - (x + y)) / 2) \<and> x < x + (l - (x + y)) / 2 \<and> y < y + (l - (x + y)) / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l = lx + ly \<and> x < lx \<and> y < ly

goal (1 subgoal):
 1. \<exists>lx ly. l = lx + ly \<and> x < lx \<and> y < ly
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l = lx + ly \<and> x < lx \<and> y < ly
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
l = lx + ly \<and> x < lx \<and> y < ly

goal (1 subgoal):
 1. \<exists>lx ly. l = lx + ly \<and> x < lx \<and> y < ly
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>lx ly. l = lx + ly \<and> x < lx \<and> y < ly

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma antisymE: "\<lbrakk>(a, b) \<in> r; (b, a) \<in> r\<rbrakk> \<Longrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(a, b) \<in> r; (b, a) \<in> r\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
using cl_po
[PROOF STATE]
proof (prove)
using this:
cl \<in> PartialOrder

goal (1 subgoal):
 1. \<lbrakk>(a, b) \<in> r; (b, a) \<in> r\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
by (simp add: PartialOrder_def antisym_def r_def)


[STATEMENT]
lemma real_sqrt_has_derivative_generic:
  "x \<noteq> 0 \<Longrightarrow> (sqrt has_derivative (*) ((if x > 0 then 1 else -1) * inverse (sqrt x) / 2)) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (sqrt has_derivative (*) ((if 0 < x then 1 else - 1) * inverse (sqrt x) / 2)) (at x within S)
[PROOF STEP]
apply (rule has_derivative_at_withinI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (sqrt has_derivative (*) ((if 0 < x then 1 else - 1) * inverse (sqrt x) / 2)) (at x)
[PROOF STEP]
using DERIV_real_sqrt_generic[of x "(if x > 0 then 1 else -1) * inverse (sqrt x) / 2"] at_within_open[of x "UNIV - {0}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<noteq> 0; 0 < x \<Longrightarrow> (if 0 < x then 1 else - 1) * inverse (sqrt x) / 2 = inverse (sqrt x) / 2; x < 0 \<Longrightarrow> (if 0 < x then 1 else - 1) * inverse (sqrt x) / 2 = - inverse (sqrt x) / 2\<rbrakk> \<Longrightarrow> (sqrt has_real_derivative (if 0 < x then 1 else - 1) * inverse (sqrt x) / 2) (at x)
\<lbrakk>x \<in> UNIV - {0}; open (UNIV - {0})\<rbrakk> \<Longrightarrow> at x within UNIV - {0} = at x

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (sqrt has_derivative (*) ((if 0 < x then 1 else - 1) * inverse (sqrt x) / 2)) (at x)
[PROOF STEP]
by (auto simp: has_field_derivative_def open_delete ac_simps split: if_splits)


[STATEMENT]
lemma mat_rep_num_alt:
  assumes "i < dim_row M"
  shows "mat_rep_num M i = card {j . j < dim_col M \<and> M $$ (i, j) = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rep_num M i = card {j. j < dim_col M \<and> M $$ (i, j) = (1::'b)}
[PROOF STEP]
proof (simp add: mat_rep_num_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count_vec (row M i) (1::'b) = card {j. j < dim_col M \<and> M $$ (i, j) = (1::'b)}
[PROOF STEP]
have eq: "\<And> j. (j < dim_col M \<and> M $$ (i, j) = 1) = (row M i $ j = 1 \<and> j < dim_vec (row M i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. (j < dim_col M \<and> M $$ (i, j) = (1::'b)) = (row M i $ j = (1::'b) \<and> j < dim_vec (row M i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row M

goal (1 subgoal):
 1. \<And>j. (j < dim_col M \<and> M $$ (i, j) = (1::'b)) = (row M i $ j = (1::'b) \<and> j < dim_vec (row M i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(?j < dim_col M \<and> M $$ (i, ?j) = (1::'b)) = (row M i $ ?j = (1::'b) \<and> ?j < dim_vec (row M i))

goal (1 subgoal):
 1. count_vec (row M i) (1::'b) = card {j. j < dim_col M \<and> M $$ (i, j) = (1::'b)}
[PROOF STEP]
have "count_vec (row M i) 1 = card {j. (row M i) $ j = 1 \<and>  j < dim_vec (row M i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_vec (row M i) (1::'b) = card {j. row M i $ j = (1::'b) \<and> j < dim_vec (row M i)}
[PROOF STEP]
using count_vec_alt[of "row M i" "1"]
[PROOF STATE]
proof (prove)
using this:
count_vec (row M i) (1::'b) = card {ia. row M i $ ia = (1::'b) \<and> ia < dim_vec (row M i)}

goal (1 subgoal):
 1. count_vec (row M i) (1::'b) = card {j. row M i $ j = (1::'b) \<and> j < dim_vec (row M i)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count_vec (row M i) (1::'b) = card {j. row M i $ j = (1::'b) \<and> j < dim_vec (row M i)}

goal (1 subgoal):
 1. count_vec (row M i) (1::'b) = card {j. j < dim_col M \<and> M $$ (i, j) = (1::'b)}
[PROOF STEP]
thus "count_vec (row M i) 1 = card {j. j < dim_col M \<and> M $$ (i, j) = 1}"
[PROOF STATE]
proof (prove)
using this:
count_vec (row M i) (1::'b) = card {j. row M i $ j = (1::'b) \<and> j < dim_vec (row M i)}

goal (1 subgoal):
 1. count_vec (row M i) (1::'b) = card {j. j < dim_col M \<and> M $$ (i, j) = (1::'b)}
[PROOF STEP]
using eq Collect_cong
[PROOF STATE]
proof (prove)
using this:
count_vec (row M i) (1::'b) = card {j. row M i $ j = (1::'b) \<and> j < dim_vec (row M i)}
(?j < dim_col M \<and> M $$ (i, ?j) = (1::'b)) = (row M i $ ?j = (1::'b) \<and> ?j < dim_vec (row M i))
(\<And>x. ?P x = ?Q x) \<Longrightarrow> {x. ?P x} = {x. ?Q x}

goal (1 subgoal):
 1. count_vec (row M i) (1::'b) = card {j. j < dim_col M \<and> M $$ (i, j) = (1::'b)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count_vec (row M i) (1::'b) = card {j. j < dim_col M \<and> M $$ (i, j) = (1::'b)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_mset_size_eq_card: "distinct_mset C \<Longrightarrow> size C = card (set_mset C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct_mset C \<Longrightarrow> size C = card (set_mset C)
[PROOF STEP]
by (induction C) auto


[STATEMENT]
lemma degree_prod_eq_sum_degree:
  fixes A :: "'a set"
  and f :: "'a \<Rightarrow> 'b::idom poly"
  assumes f0: "\<forall>i\<in>A. f i \<noteq> 0"
  shows "degree (\<Prod>i\<in>A. (f i)) = (\<Sum>i\<in>A. degree (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod f A) = (\<Sum>i\<in>A. degree (f i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>A. f i \<noteq> 0

goal (1 subgoal):
 1. degree (prod f A) = (\<Sum>i\<in>A. degree (f i))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto simp: degree_mult_eq)


[STATEMENT]
lemma rank_I: "rank(mat 1::real^'n^'n) = CARD('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (mat 1) = CARD('n)
[PROOF STEP]
by (simp add: full_rank_injective inj_on_def)


[STATEMENT]
lemma "dist a d \<le> dist a b + dist b c + dist c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist a d \<le> dist a b + dist b c + dist c d
[PROOF STEP]
by metric


[STATEMENT]
lemma primes_omega_primorial: "primes_omega (primorial x) = nat \<lfloor>primes_pi x\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primes_omega (primorial x) = nat \<lfloor>primes_pi x\<rfloor>
[PROOF STEP]
by (simp add: primes_omega_def primes_pi_def prime_sum_upto_def)


[STATEMENT]
lemma resultant_as_poly:
  fixes p q :: "'a :: comm_ring_1 poly"
  assumes degp: "degree p > 0" and degq: "degree q > 0"
  shows "\<exists>p' q'. degree p' < degree q \<and> degree q' < degree p \<and>
         [: resultant p q :] = p' * p + q' * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p' q'. degree p' < degree q \<and> degree q' < degree p \<and> [:resultant p q:] = p' * p + q' * q
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
define m where "m = degree p"
[PROOF STATE]
proof (state)
this:
m = degree p

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
define n where "n = degree q"
[PROOF STATE]
proof (state)
this:
n = degree q

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
define d where "d = dim_row (mk_poly (sylvester_mat p q))"
[PROOF STATE]
proof (state)
this:
d = dim_row (mk_poly (sylvester_mat p q))

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
define c where "c = (\<lambda>i. coeff_lift (cofactor (sylvester_mat p q) i (m+n-1)))"
[PROOF STATE]
proof (state)
this:
c = (\<lambda>i. [:cofactor (sylvester_mat p q) i (m + n - 1):])

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
define p' where "p' = (\<Sum>i<n. monom 1 (n - Suc i) * c i)"
[PROOF STATE]
proof (state)
this:
p' = (\<Sum>i<n. monom (1::'a) (n - Suc i) * c i)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
define q' where "q' = (\<Sum>i<m. monom 1 (m - Suc i) * c (n+i))"
[PROOF STATE]
proof (state)
this:
q' = (\<Sum>i<m. monom (1::'a) (m - Suc i) * c (n + i))

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have degc: "\<And>i. degree (c i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. degree (c i) = 0
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. degree [:cofactor (sylvester_mat p q) i (m + n - 1):] = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (c ?i) = 0

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have dmn: "d = m+n" and mnd: "m + n = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d = m + n &&& m + n = d
[PROOF STEP]
unfolding d_def m_def n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mk_poly (sylvester_mat p q)) = degree p + degree q &&& degree p + degree q = dim_row (mk_poly (sylvester_mat p q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d = m + n
m + n = d

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "[: resultant p q :] =
    (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i,m+n-1) *
        cofactor (mk_poly (sylvester_mat p q)) i (m+n-1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:resultant p q:] = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1))
[PROOF STEP]
unfolding resultant_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:det (sylvester_mat p q):] = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1))
[PROOF STEP]
unfolding det_mk_poly[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mk_poly (sylvester_mat p q)) = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1))
[PROOF STEP]
unfolding m_def n_def d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mk_poly (sylvester_mat p q)) = (\<Sum>i<dim_row (mk_poly (sylvester_mat p q)). mk_poly (sylvester_mat p q) $$ (i, degree p + degree q - 1) * cofactor (mk_poly (sylvester_mat p q)) i (degree p + degree q - 1))
[PROOF STEP]
apply(rule laplace_expansion_column[of _ _ "degree p + degree q - 1"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. mk_poly (sylvester_mat p q) \<in> carrier_mat (dim_row (mk_poly (sylvester_mat p q))) (dim_row (mk_poly (sylvester_mat p q)))
 2. degree p + degree q - 1 < dim_row (mk_poly (sylvester_mat p q))
[PROOF STEP]
apply(rule carrier_matI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. dim_row (mk_poly (sylvester_mat p q)) = dim_row (mk_poly (sylvester_mat p q))
 2. dim_col (mk_poly (sylvester_mat p q)) = dim_row (mk_poly (sylvester_mat p q))
 3. degree p + degree q - 1 < dim_row (mk_poly (sylvester_mat p q))
[PROOF STEP]
using degp
[PROOF STATE]
proof (prove)
using this:
0 < degree p

goal (3 subgoals):
 1. dim_row (mk_poly (sylvester_mat p q)) = dim_row (mk_poly (sylvester_mat p q))
 2. dim_col (mk_poly (sylvester_mat p q)) = dim_row (mk_poly (sylvester_mat p q))
 3. degree p + degree q - 1 < dim_row (mk_poly (sylvester_mat p q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[:resultant p q:] = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1))

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[:resultant p q:] = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1))

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
[:resultant p q:] = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1))

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
assume i: "i<d"
[PROOF STATE]
proof (state)
this:
i < d

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have d2: "d = dim_row (sylvester_mat p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d = dim_row (sylvester_mat p q)
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mk_poly (sylvester_mat p q)) = dim_row (sylvester_mat p q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d = dim_row (sylvester_mat p q)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "cofactor (mk_poly (sylvester_mat p q)) i (m+n-1) =
      (- 1) ^ (i + (m+n-1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m+n-1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1) = (- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1))
[PROOF STEP]
using cofactor_def
[PROOF STATE]
proof (prove)
using this:
cofactor ?A ?i ?j = (- (1::?'a)) ^ (?i + ?j) * det (mat_delete ?A ?i ?j)

goal (1 subgoal):
 1. cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1) = (- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1) = (- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1))

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1) = (- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1))

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "... =
      (- 1) ^ (i+m+n-1) * coeff_lift (det (mat_delete (sylvester_mat p q) i (m+n-1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (- 1) ^ (i + m + n - 1) * [:det (mat_delete (sylvester_mat p q) i (m + n - 1)):]
[PROOF STEP]
using mk_poly_delete[OF i[unfolded d2]] degp degq
[PROOF STATE]
proof (prove)
using this:
mat_delete (mk_poly (sylvester_mat p q)) i (dim_col (sylvester_mat p q) - 1) = coeff_lift_hom.mat_hom (mat_delete (sylvester_mat p q) i (dim_col (sylvester_mat p q) - 1))
0 < degree p
0 < degree q

goal (1 subgoal):
 1. (- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (- 1) ^ (i + m + n - 1) * [:det (mat_delete (sylvester_mat p q) i (m + n - 1)):]
[PROOF STEP]
unfolding m_def n_def
[PROOF STATE]
proof (prove)
using this:
mat_delete (mk_poly (sylvester_mat p q)) i (dim_col (sylvester_mat p q) - 1) = coeff_lift_hom.mat_hom (mat_delete (sylvester_mat p q) i (dim_col (sylvester_mat p q) - 1))
0 < degree p
0 < degree q

goal (1 subgoal):
 1. (- 1) ^ (i + (degree p + degree q - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (degree p + degree q - 1)) = (- 1) ^ (i + degree p + degree q - 1) * [:det (mat_delete (sylvester_mat p q) i (degree p + degree q - 1)):]
[PROOF STEP]
by (auto simp add: add.assoc)
[PROOF STATE]
proof (state)
this:
(- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (- 1) ^ (i + m + n - 1) * [:det (mat_delete (sylvester_mat p q) i (m + n - 1)):]

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (- 1) ^ (i + m + n - 1) * [:det (mat_delete (sylvester_mat p q) i (m + n - 1)):]

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "i+m+n-1 = i+(m+n-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + m + n - 1 = i + (m + n - 1)
[PROOF STEP]
using i[folded mnd]
[PROOF STATE]
proof (prove)
using this:
i < m + n

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

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1) = (- 1) ^ (i + (m + n - 1)) * [:det (mat_delete (sylvester_mat p q) i (m + n - 1)):]
[PROOF STEP]
have "cofactor (mk_poly (sylvester_mat p q)) i (m+n-1) = c i"
[PROOF STATE]
proof (prove)
using this:
cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1) = (- 1) ^ (i + (m + n - 1)) * [:det (mat_delete (sylvester_mat p q) i (m + n - 1)):]

goal (1 subgoal):
 1. cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1) = c i
[PROOF STEP]
unfolding c_def cofactor_def hom_distribs
[PROOF STATE]
proof (prove)
using this:
(- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (- 1) ^ (i + (m + n - 1)) * [:det (mat_delete (sylvester_mat p q) i (m + n - 1)):]

goal (1 subgoal):
 1. (- 1) ^ (i + (m + n - 1)) * det (mat_delete (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (- [:1::'a:]) ^ (i + (m + n - 1)) * [:det (mat_delete (sylvester_mat p q) i (m + n - 1)):]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1) = c i

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 < d \<Longrightarrow> cofactor (mk_poly (sylvester_mat p q)) ?i2 (m + n - 1) = c ?i2

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
hence "... = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m+n-1) * c i)"
    (is "_ = sum ?f _")
[PROOF STATE]
proof (prove)
using this:
?i2 < d \<Longrightarrow> cofactor (mk_poly (sylvester_mat p q)) ?i2 (m + n - 1) = c ?i2

goal (1 subgoal):
 1. (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * cofactor (mk_poly (sylvester_mat p q)) i (m + n - 1)) = (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "... = sum ?f ({..<n} \<union> {n ..<d})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i\<in>{..<n} \<union> {n..<d}. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)
[PROOF STEP]
unfolding dmn
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<m + n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i\<in>{..<n} \<union> {n..<m + n}. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)
[PROOF STEP]
apply(subst ivl_disj_un(8))
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n \<le> m + n
 2. (\<Sum>i<m + n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i<m + n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i\<in>{..<n} \<union> {n..<d}. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i\<in>{..<n} \<union> {n..<d}. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "... = sum ?f {..<n} + sum ?f {n..<d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{..<n} \<union> {n..<d}. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) + (\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)
[PROOF STEP]
apply(subst sum.union_disjoint)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. finite {..<n}
 2. finite {n..<d}
 3. {..<n} \<inter> {n..<d} = {}
 4. (\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) + (\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) + (\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{..<n} \<union> {n..<d}. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) + (\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{..<n} \<union> {n..<d}. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) + (\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{..<n} \<union> {n..<d}. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) + (\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i)

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
assume i: "i < n"
[PROOF STATE]
proof (state)
this:
i < n

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "?f i = monom 1 (n - Suc i) * c i * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i = monom (1::'a) (n - Suc i) * c i * p
[PROOF STEP]
unfolding m_def n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_poly (sylvester_mat p q) $$ (i, degree p + degree q - 1) * c i = monom (1::'a) (degree q - Suc i) * c i * p
[PROOF STEP]
apply(subst mk_poly_sylvester_upper)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. i < degree q
 2. monom (1::'a) (degree q - Suc i) * p * c i = monom (1::'a) (degree q - Suc i) * c i * p
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < n

goal (2 subgoals):
 1. i < degree q
 2. monom (1::'a) (degree q - Suc i) * p * c i = monom (1::'a) (degree q - Suc i) * c i * p
[PROOF STEP]
unfolding n_def
[PROOF STATE]
proof (prove)
using this:
i < degree q

goal (2 subgoals):
 1. i < degree q
 2. monom (1::'a) (degree q - Suc i) * p * c i = monom (1::'a) (degree q - Suc i) * c i * p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i = monom (1::'a) (n - Suc i) * c i * p

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 < n \<Longrightarrow> mk_poly (sylvester_mat p q) $$ (?i2, m + n - 1) * c ?i2 = monom (1::'a) (n - Suc ?i2) * c ?i2 * p

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
hence "sum ?f {..<n} = p' * p"
[PROOF STATE]
proof (prove)
using this:
?i2 < n \<Longrightarrow> mk_poly (sylvester_mat p q) $$ (?i2, m + n - 1) * c ?i2 = monom (1::'a) (n - Suc ?i2) * c ?i2 * p

goal (1 subgoal):
 1. (\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = p' * p
[PROOF STEP]
unfolding p'_def sum_distrib_right
[PROOF STATE]
proof (prove)
using this:
?i2 < n \<Longrightarrow> mk_poly (sylvester_mat p q) $$ (?i2, m + n - 1) * c ?i2 = monom (1::'a) (n - Suc ?i2) * c ?i2 * p

goal (1 subgoal):
 1. (\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>na<n. monom (1::'a) (n - Suc na) * c na * p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = p' * p

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = p' * p

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = p' * p

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
assume i: "i \<in> {n..<d}"
[PROOF STATE]
proof (state)
this:
i \<in> {n..<d}

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "?f i = monom 1 (m + n - Suc i) * c i * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i = monom (1::'a) (m + n - Suc i) * c i * q
[PROOF STEP]
unfolding m_def n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_poly (sylvester_mat p q) $$ (i, degree p + degree q - 1) * c i = monom (1::'a) (degree p + degree q - Suc i) * c i * q
[PROOF STEP]
apply(subst mk_poly_sylvester_lower)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. degree q \<le> i
 2. i < degree p + degree q
 3. monom (1::'a) (degree p + degree q - Suc i) * q * c i = monom (1::'a) (degree p + degree q - Suc i) * c i * q
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i \<in> {n..<d}

goal (3 subgoals):
 1. degree q \<le> i
 2. i < degree p + degree q
 3. monom (1::'a) (degree p + degree q - Suc i) * q * c i = monom (1::'a) (degree p + degree q - Suc i) * c i * q
[PROOF STEP]
unfolding dmn n_def m_def
[PROOF STATE]
proof (prove)
using this:
i \<in> {degree q..<degree p + degree q}

goal (3 subgoals):
 1. degree q \<le> i
 2. i < degree p + degree q
 3. monom (1::'a) (degree p + degree q - Suc i) * q * c i = monom (1::'a) (degree p + degree q - Suc i) * c i * q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i = monom (1::'a) (m + n - Suc i) * c i * q

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 \<in> {n..<d} \<Longrightarrow> mk_poly (sylvester_mat p q) $$ (?i2, m + n - 1) * c ?i2 = monom (1::'a) (m + n - Suc ?i2) * c ?i2 * q

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
hence "sum ?f {n..<d} = (\<Sum>i=n..<d. monom 1 (m + n - Suc i) * c i) * q"
    (is "_ = sum ?h _ * _")
[PROOF STATE]
proof (prove)
using this:
?i2 \<in> {n..<d} \<Longrightarrow> mk_poly (sylvester_mat p q) $$ (?i2, m + n - 1) * c ?i2 = monom (1::'a) (m + n - Suc ?i2) * c ?i2 * q

goal (1 subgoal):
 1. (\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i = n..<d. monom (1::'a) (m + n - Suc i) * c i) * q
[PROOF STEP]
unfolding sum_distrib_right
[PROOF STATE]
proof (prove)
using this:
?i2 \<in> {n..<d} \<Longrightarrow> mk_poly (sylvester_mat p q) $$ (?i2, m + n - 1) * c ?i2 = monom (1::'a) (m + n - Suc ?i2) * c ?i2 * q

goal (1 subgoal):
 1. (\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>na = n..<d. monom (1::'a) (m + n - Suc na) * c na * q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i = n..<d. monom (1::'a) (m + n - Suc i) * c i) * q

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = n..<d. mk_poly (sylvester_mat p q) $$ (i, m + n - 1) * c i) = (\<Sum>i = n..<d. monom (1::'a) (m + n - Suc i) * c i) * q

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "{n..<d} = (\<lambda>i. i+n) ` {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {n..<d} = (\<lambda>i. i + n) ` {0..<m}
[PROOF STEP]
by (simp add: dmn)
[PROOF STATE]
proof (state)
this:
{n..<d} = (\<lambda>i. i + n) ` {0..<m}

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{n..<d} = (\<lambda>i. i + n) ` {0..<m}

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "sum ?h ... = sum (?h \<circ> (\<lambda>i. i+n)) {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>(\<lambda>i. i + n) ` {0..<m}. monom (1::'a) (m + n - Suc i) * c i) = sum ((\<lambda>i. monom (1::'a) (m + n - Suc i) * c i) \<circ> (\<lambda>i. i + n)) {0..<m}
[PROOF STEP]
apply(subst sum.reindex[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on (\<lambda>i. i + n) {0..<m}
 2. (\<Sum>i\<in>(\<lambda>i. i + n) ` {0..<m}. monom (1::'a) (m + n - Suc i) * c i) = (\<Sum>i\<in>(\<lambda>i. i + n) ` {0..<m}. monom (1::'a) (m + n - Suc i) * c i)
[PROOF STEP]
apply (rule inj_onI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> {0..<m}; y \<in> {0..<m}; x + n = y + n\<rbrakk> \<Longrightarrow> x = y
 2. (\<Sum>i\<in>(\<lambda>i. i + n) ` {0..<m}. monom (1::'a) (m + n - Suc i) * c i) = (\<Sum>i\<in>(\<lambda>i. i + n) ` {0..<m}. monom (1::'a) (m + n - Suc i) * c i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>(\<lambda>i. i + n) ` {0..<m}. monom (1::'a) (m + n - Suc i) * c i) = sum ((\<lambda>i. monom (1::'a) (m + n - Suc i) * c i) \<circ> (\<lambda>i. i + n)) {0..<m}

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>(\<lambda>i. i + n) ` {0..<m}. monom (1::'a) (m + n - Suc i) * c i) = sum ((\<lambda>i. monom (1::'a) (m + n - Suc i) * c i) \<circ> (\<lambda>i. i + n)) {0..<m}

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
have "... = q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>i. monom (1::'a) (m + n - Suc i) * c i) \<circ> (\<lambda>i. i + n)) {0..<m} = q'
[PROOF STEP]
unfolding q'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>i. monom (1::'a) (m + n - Suc i) * c i) \<circ> (\<lambda>i. i + n)) {0..<m} = (\<Sum>i<m. monom (1::'a) (m - Suc i) * c (n + i))
[PROOF STEP]
apply(rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {0..<m} = {..<m}
 2. \<And>x. x \<in> {..<m} \<Longrightarrow> ((\<lambda>i. monom (1::'a) (m + n - Suc i) * c i) \<circ> (\<lambda>i. i + n)) x = monom (1::'a) (m - Suc x) * c (n + x)
[PROOF STEP]
by (auto simp add: add.commute)
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>i. monom (1::'a) (m + n - Suc i) * c i) \<circ> (\<lambda>i. i + n)) {0..<m} = q'

goal (3 subgoals):
 1. degree ?p' < degree q
 2. degree ?q'1 < degree p
 3. [:resultant p q:] = ?p' * p + ?q'1 * q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[:resultant p q:] = p' * p + q' * q
[PROOF STEP]
show main: "[:resultant p q:] = p' * p + q' * q"
[PROOF STATE]
proof (prove)
using this:
[:resultant p q:] = p' * p + q' * q

goal (1 subgoal):
 1. [:resultant p q:] = p' * p + q' * q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
[:resultant p q:] = p' * p + q' * q

goal (2 subgoals):
 1. degree (\<Sum>i<degree q. monom (1::'a) (degree q - Suc i) * [:cofactor (sylvester_mat p q) i (degree p + degree q - 1):]) < degree q
 2. degree (\<Sum>i<degree p. monom (1::'a) (degree p - Suc i) * [:cofactor (sylvester_mat p q) (degree q + i) (degree p + degree q - 1):]) < degree p
[PROOF STEP]
show "degree p' < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p' < n
[PROOF STEP]
unfolding p'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Sum>i<n. monom (1::'a) (n - Suc i) * c i) < n
[PROOF STEP]
apply(rule degree_sum_smaller)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 < n
 2. finite {..<n}
 3. \<And>i. i \<in> {..<n} \<Longrightarrow> degree (monom (1::'a) (n - Suc i) * c i) < n
[PROOF STEP]
using degq[folded n_def]
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (3 subgoals):
 1. 0 < n
 2. finite {..<n}
 3. \<And>i. i \<in> {..<n} \<Longrightarrow> degree (monom (1::'a) (n - Suc i) * c i) < n
[PROOF STEP]
apply force+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<n} \<Longrightarrow> degree (monom (1::'a) (n - Suc i) * c i) < n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<n} \<Longrightarrow> degree (monom (1::'a) (n - Suc i) * c i) < n
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<n} \<Longrightarrow> degree (monom (1::'a) (n - Suc i) * c i) < n
[PROOF STEP]
assume i: "i \<in> {..<n}"
[PROOF STATE]
proof (state)
this:
i \<in> {..<n}

goal (1 subgoal):
 1. \<And>i. i \<in> {..<n} \<Longrightarrow> degree (monom (1::'a) (n - Suc i) * c i) < n
[PROOF STEP]
show "degree (monom 1 (n - Suc i) * c i) < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) (n - Suc i) * c i) < n
[PROOF STEP]
apply (rule order.strict_trans1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree (monom (1::'a) (n - Suc i) * c i) \<le> ?b
 2. ?b < n
[PROOF STEP]
apply (rule degree_mult_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) (n - Suc i)) + degree (c i) < n
[PROOF STEP]
unfolding add.right_neutral degc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) (n - Suc i)) < n
[PROOF STEP]
apply (rule order.strict_trans1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree (monom (1::'a) (n - Suc i)) \<le> ?b4
 2. ?b4 < n
[PROOF STEP]
apply (rule degree_monom_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - Suc i < n
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i \<in> {..<n}

goal (1 subgoal):
 1. n - Suc i < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (monom (1::'a) (n - Suc i) * c i) < n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree p' < n

goal (1 subgoal):
 1. degree (\<Sum>i<degree p. monom (1::'a) (degree p - Suc i) * [:cofactor (sylvester_mat p q) (degree q + i) (degree p + degree q - 1):]) < degree p
[PROOF STEP]
show "degree q' < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree q' < m
[PROOF STEP]
unfolding q'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Sum>i<m. monom (1::'a) (m - Suc i) * c (n + i)) < m
[PROOF STEP]
apply (rule degree_sum_smaller)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 < m
 2. finite {..<m}
 3. \<And>i. i \<in> {..<m} \<Longrightarrow> degree (monom (1::'a) (m - Suc i) * c (n + i)) < m
[PROOF STEP]
using degp[folded m_def]
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (3 subgoals):
 1. 0 < m
 2. finite {..<m}
 3. \<And>i. i \<in> {..<m} \<Longrightarrow> degree (monom (1::'a) (m - Suc i) * c (n + i)) < m
[PROOF STEP]
apply force+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<m} \<Longrightarrow> degree (monom (1::'a) (m - Suc i) * c (n + i)) < m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<m} \<Longrightarrow> degree (monom (1::'a) (m - Suc i) * c (n + i)) < m
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<m} \<Longrightarrow> degree (monom (1::'a) (m - Suc i) * c (n + i)) < m
[PROOF STEP]
assume i: "i \<in> {..<m}"
[PROOF STATE]
proof (state)
this:
i \<in> {..<m}

goal (1 subgoal):
 1. \<And>i. i \<in> {..<m} \<Longrightarrow> degree (monom (1::'a) (m - Suc i) * c (n + i)) < m
[PROOF STEP]
show "degree (monom 1 (m-Suc i) * c (n+i)) < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) (m - Suc i) * c (n + i)) < m
[PROOF STEP]
apply (rule order.strict_trans1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree (monom (1::'a) (m - Suc i) * c (n + i)) \<le> ?b
 2. ?b < m
[PROOF STEP]
apply (rule degree_mult_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) (m - Suc i)) + degree (c (n + i)) < m
[PROOF STEP]
unfolding add.right_neutral degc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) (m - Suc i)) < m
[PROOF STEP]
apply (rule order.strict_trans1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree (monom (1::'a) (m - Suc i)) \<le> ?b4
 2. ?b4 < m
[PROOF STEP]
apply (rule degree_monom_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m - Suc i < m
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i \<in> {..<m}

goal (1 subgoal):
 1. m - Suc i < m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (monom (1::'a) (m - Suc i) * c (n + i)) < m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree q' < m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma epi_group_mul_eq:
   "(\<lambda>(x,y). x \<otimes> y) \<in> epi (subgroup_generated G A \<times>\<times> subgroup_generated G B) G
     \<longleftrightarrow> A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>(x, y). x \<otimes> y) \<in> epi (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>(x, y). x \<otimes> y) \<in> epi (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x))
[PROOF STEP]
have subGA: "generate G (carrier G \<inter> A) \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generate G (carrier G \<inter> A) \<subseteq> A
[PROOF STEP]
by (simp add: AG.subgroup_axioms generate_subgroup_incl)
[PROOF STATE]
proof (state)
this:
generate G (carrier G \<inter> A) \<subseteq> A

goal (1 subgoal):
 1. ((\<lambda>(x, y). x \<otimes> y) \<in> epi (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x))
[PROOF STEP]
have subGB: "generate G (carrier G \<inter> B) \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generate G (carrier G \<inter> B) \<subseteq> B
[PROOF STEP]
by (simp add: BG.subgroup_axioms generate_subgroup_incl)
[PROOF STATE]
proof (state)
this:
generate G (carrier G \<inter> B) \<subseteq> B

goal (1 subgoal):
 1. ((\<lambda>(x, y). x \<otimes> y) \<in> epi (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x))
[PROOF STEP]
have "(((\<lambda>(x, y). x \<otimes> y) ` (generate G (carrier G \<inter> A) \<times> generate G (carrier G \<inter> B)))) = ((A <#> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). x \<otimes> y) ` (generate G (carrier G \<inter> A) \<times> generate G (carrier G \<inter> B)) = A <#> B
[PROOF STEP]
by (auto simp: set_mult_def generate.incl pair_imageI dest: subsetD [OF subGA] subsetD [OF subGB])
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). x \<otimes> y) ` (generate G (carrier G \<inter> A) \<times> generate G (carrier G \<inter> B)) = A <#> B

goal (1 subgoal):
 1. ((\<lambda>(x, y). x \<otimes> y) \<in> epi (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>(x, y). x \<otimes> y) ` (generate G (carrier G \<inter> A) \<times> generate G (carrier G \<inter> B)) = A <#> B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). x \<otimes> y) ` (generate G (carrier G \<inter> A) \<times> generate G (carrier G \<inter> B)) = A <#> B

goal (1 subgoal):
 1. ((\<lambda>(x, y). x \<otimes> y) \<in> epi (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x))
[PROOF STEP]
by (auto simp: epi_def hom_group_mul_eq carrier_subgroup_generated)
[PROOF STATE]
proof (state)
this:
((\<lambda>(x, y). x \<otimes> y) \<in> epi (subgroup_generated G A \<times>\<times> subgroup_generated G B) G) = (A <#> B = carrier G \<and> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distrib_not_N5_M5: "(class.distrib_lattice (\<sqinter>) ((\<le>)::'a \<Rightarrow> 'a \<Rightarrow> bool) (<) (\<squnion>)) =
   ((\<forall> a b c::'a . \<not> N5_lattice a b c) \<and> (\<forall> a b c::'a . \<not> M5_lattice a b c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>) = ((\<forall>a b c. \<not> N5_lattice a b c) \<and> (\<forall>a b c. \<not> M5_lattice a b c))
[PROOF STEP]
apply (cut_tac not_distrib_N5_M5)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)) = ((\<exists>a b c. N5_lattice a b c) \<or> (\<exists>a b c. M5_lattice a b c)) \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>) = ((\<forall>a b c. \<not> N5_lattice a b c) \<and> (\<forall>a b c. \<not> M5_lattice a b c))
[PROOF STEP]
by auto


[STATEMENT]
lemma set_gen2':
  "(\<lambda>(x, y). (fst x, fst y)) ` set (alls2 A B a b) =
    {(x, y). x \<le>\<^sub>v replicate (length a) A \<and> y \<le>\<^sub>v replicate (length b) B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (fst x, fst y)) ` set (alls2 A B a b) = {(x, y). x \<le>\<^sub>v replicate (length a) A \<and> y \<le>\<^sub>v replicate (length b) B}
[PROOF STEP]
using set_gen2
[PROOF STATE]
proof (prove)
using this:
set (Algorithm.gen2 ?A ?B ?a ?b) = {(x, y). x \<le>\<^sub>v replicate (length ?a) ?A \<and> y \<le>\<^sub>v replicate (length ?b) ?B}

goal (1 subgoal):
 1. (\<lambda>(x, y). (fst x, fst y)) ` set (alls2 A B a b) = {(x, y). x \<le>\<^sub>v replicate (length a) A \<and> y \<le>\<^sub>v replicate (length b) B}
[PROOF STEP]
by simp


[STATEMENT]
lemma "(\<lambda>n::nat. n div 2 * ln (n div 2)) \<in> \<Theta>(\<lambda>n::nat. n * ln n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real (n div 2) * ln (real (n div 2))) \<in> \<Theta>(\<lambda>n. real n * ln (real n))
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma multiset_inter_left_commute: "A \<inter># (B \<inter># C) = B \<inter># (A \<inter># C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter># (B \<inter># C) = B \<inter># (A \<inter># C)
[PROOF STEP]
by (fact subset_mset.inf.left_commute)


[STATEMENT]
lemma calc_ideal_point2_mix:
  assumes "(z1, z2) = calc_ideal_point2_cvec A B" "is_real A" "(cmod B)\<^sup>2 > (cmod A)\<^sup>2"
  shows "B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
have "B*cnj z1 + cnj B*z1 = -2*A*B*cnj B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * cnj z1 + cnj B * z1 = - 2 * A * B * cnj B
[PROOF STEP]
using assms eq_cnj_iff_real[of A]
[PROOF STATE]
proof (prove)
using this:
(z1, z2) = calc_ideal_point2_cvec A B
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(cnj A = A) = is_real A

goal (1 subgoal):
 1. B * cnj z1 + cnj B * z1 = - 2 * A * B * cnj B
[PROOF STEP]
by (simp, simp add: field_simps)
[PROOF STATE]
proof (state)
this:
B * cnj z1 + cnj B * z1 = - 2 * A * B * cnj B

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
B * cnj z1 + cnj B * z1 = - 2 * A * B * cnj B

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
have "cnj z2 = z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj z2 = z2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(z1, z2) = calc_ideal_point2_cvec A B
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2

goal (1 subgoal):
 1. cnj z2 = z2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cnj z2 = z2

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
hence "B*cnj z1*z2 + cnj B*z1*cnj z2 = (B*cnj z1 + cnj B*z1)*z2"
[PROOF STATE]
proof (prove)
using this:
cnj z2 = z2

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = (B * cnj z1 + cnj B * z1) * z2
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = (B * cnj z1 + cnj B * z1) * z2

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
B * cnj z1 + cnj B * z1 = - 2 * A * B * cnj B
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = (B * cnj z1 + cnj B * z1) * z2
[PROOF STEP]
have "B*cnj z1*z2 + cnj B*z1*cnj z2 = -2*A*(B* cnj B)*z2"
[PROOF STATE]
proof (prove)
using this:
B * cnj z1 + cnj B * z1 = - 2 * A * B * cnj B
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = (B * cnj z1 + cnj B * z1) * z2

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B) * z2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B) * z2

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B) * z2

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
have "\<dots> = -2*A*(B * cnj B)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 2 * A * (B * cnj B) * z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(z1, z2) = calc_ideal_point2_cvec A B
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2

goal (1 subgoal):
 1. - 2 * A * (B * cnj B) * z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
using complex_mult_cnj_cmod[of B]
[PROOF STATE]
proof (prove)
using this:
(z1, z2) = calc_ideal_point2_cvec A B
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
B * cnj B = cor ((cmod B)\<^sup>2)

goal (1 subgoal):
 1. - 2 * A * (B * cnj B) * z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
- 2 * A * (B * cnj B) * z2 = - 2 * A * (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
B * cnj z1 * z2 + cnj B * z1 * cnj z2 = - 2 * A * (B * cnj B)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_sccs_verts: "card sccs_verts = card sccs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card sccs_verts = card sccs
[PROOF STEP]
by (auto simp: sccs_verts_conv intro: inj_on_verts_sccs card_image)


[STATEMENT]
lemma infinity_evalUni_NeqUni : "(\<exists>x. \<forall>y<x. aEvalUni (NeqUni p) y) = (evalUni (substNegInfinityUni (NeqUni p)) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. \<forall>y<x. aEvalUni (NeqUni p) y) = evalUni (substNegInfinityUni (NeqUni p)) x
[PROOF STEP]
proof(cases p)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b c. p = (a, b, c) \<Longrightarrow> (\<exists>x. \<forall>y<x. aEvalUni (NeqUni p) y) = evalUni (substNegInfinityUni (NeqUni p)) x
[PROOF STEP]
case (fields a b c)
[PROOF STATE]
proof (state)
this:
p = (a, b, c)

goal (1 subgoal):
 1. \<And>a b c. p = (a, b, c) \<Longrightarrow> (\<exists>x. \<forall>y<x. aEvalUni (NeqUni p) y) = evalUni (substNegInfinityUni (NeqUni p)) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. \<forall>y<x. aEvalUni (NeqUni p) y) = evalUni (substNegInfinityUni (NeqUni p)) x
[PROOF STEP]
unfolding fields
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. \<forall>y<x. aEvalUni (NeqUni (a, b, c)) y) = evalUni (substNegInfinityUni (NeqUni (a, b, c))) x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. \<forall>y<x. a * y\<^sup>2 + b * y + c \<noteq> 0) = (a = 0 \<longrightarrow> b = 0 \<longrightarrow> c \<noteq> 0)
[PROOF STEP]
using inequality_case[of a b c]
[PROOF STATE]
proof (prove)
using this:
(\<exists>x. \<forall>y<x. a * y\<^sup>2 + b * y + c < 0) = (a < 0 \<or> a = 0 \<and> (0 < b \<or> b = 0 \<and> c < 0))

goal (1 subgoal):
 1. (\<exists>x. \<forall>y<x. a * y\<^sup>2 + b * y + c \<noteq> 0) = (a = 0 \<longrightarrow> b = 0 \<longrightarrow> c \<noteq> 0)
[PROOF STEP]
using inequality_case_geq[of a b c]
[PROOF STATE]
proof (prove)
using this:
(\<exists>x. \<forall>y<x. a * y\<^sup>2 + b * y + c < 0) = (a < 0 \<or> a = 0 \<and> (0 < b \<or> b = 0 \<and> c < 0))
(\<exists>x. \<forall>y<x. 0 < a * y\<^sup>2 + b * y + c) = (0 < a \<or> a = 0 \<and> (b < 0 \<or> b = 0 \<and> 0 < c))

goal (1 subgoal):
 1. (\<exists>x. \<forall>y<x. a * y\<^sup>2 + b * y + c \<noteq> 0) = (a = 0 \<longrightarrow> b = 0 \<longrightarrow> c \<noteq> 0)
[PROOF STEP]
by (metis less_numeral_extra(3) linorder_neqE_linordered_idom mult_eq_0_iff)
[PROOF STATE]
proof (state)
this:
(\<exists>x. \<forall>y<x. aEvalUni (NeqUni p) y) = evalUni (substNegInfinityUni (NeqUni p)) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LPDs_Times: "LPDs (MTimes r s) \<subseteq> {MTimes r s} \<union> MTimesR (LPDs r) s \<union> LPDs s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LPDs (MTimes r s) \<subseteq> {MTimes r s} \<union> MTimesR (LPDs r) s \<union> LPDs s
[PROOF STEP]
unfolding LPDs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i. LPDi i (MTimes r s)) \<subseteq> {MTimes r s} \<union> MTimesR (\<Union>i. LPDi i r) s \<union> (\<Union>i. LPDi i s)
[PROOF STEP]
using LPDi_Times[of _ r s]
[PROOF STATE]
proof (prove)
using this:
LPDi ?i (MTimes r s) \<subseteq> {MTimes r s} \<union> MTimesR (\<Union>j\<le>?i. LPDi j r) s \<union> (\<Union>j\<le>?i. LPDi j s)

goal (1 subgoal):
 1. (\<Union>i. LPDi i (MTimes r s)) \<subseteq> {MTimes r s} \<union> MTimesR (\<Union>i. LPDi i r) s \<union> (\<Union>i. LPDi i s)
[PROOF STEP]
by (force simp: MTimesR_def)


[STATEMENT]
lemma sum_upto_\<psi>_x_over_n_asymptotics:
        "(\<lambda>x. sum_upto (\<lambda>n. primes_psi (x / n)) x - x * ln x + x) \<in> O(ln)"
  and sum_upto_\<theta>_x_over_n_asymptotics:
        "(\<lambda>x. sum_upto (\<lambda>n. primes_theta (x / n)) x - x * ln x) \<in> O(\<lambda>x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>xa. primes_psi (x / real xa)) x - x * ln x + x) \<in> O(ln) &&& (\<lambda>x. sum_upto (\<lambda>xa. primes_theta (x / real xa)) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
using dirichlet_prod_mangoldt1_floor_bigo dirichlet_prod'_mangoldt_floor_asymptotics
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
(\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>xa. primes_psi (x / real xa)) x - x * ln x + x) \<in> O(ln) &&& (\<lambda>x. sum_upto (\<lambda>xa. primes_theta (x / real xa)) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
by (simp_all add: dirichlet_prod'_floor_conv_sum_upto primes_theta_def
                    primes_psi_def prime_sum_upto_altdef1)


[STATEMENT]
lemma "(-84::int) * 51 = -4284"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 84 * 51 = - 4284
[PROOF STEP]
by simp


[STATEMENT]
lemma size_log_if_complete:
  "complete kdt \<Longrightarrow> height kdt = log 2 (size_kdt kdt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.complete kdt \<Longrightarrow> real (height kdt) = log 2 (real (KD_Tree.size_kdt kdt))
[PROOF STEP]
using complete_iff_size log2_of_power_eq
[PROOF STATE]
proof (prove)
using this:
KD_Tree.complete ?kdt = (KD_Tree.size_kdt ?kdt = 2 ^ height ?kdt)
?m = 2 ^ ?n \<Longrightarrow> real ?n = log 2 (real ?m)

goal (1 subgoal):
 1. KD_Tree.complete kdt \<Longrightarrow> real (height kdt) = log 2 (real (KD_Tree.size_kdt kdt))
[PROOF STEP]
by blast


[STATEMENT]
lemma g_orbital_eq: "g_orbital f G U S t\<^sub>0 s =
  {X t |t X. t \<in> U s \<and> \<P> X (down (U s) t) \<subseteq> {s. G s} \<and> X \<in> Sols f U S t\<^sub>0 s }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g_orbital f G U S t\<^sub>0 s = {X t |t X. t \<in> U s \<and> \<P> X (down (U s) t) \<subseteq> {s. G s} \<and> X \<in> Sols f U S t\<^sub>0 s}
[PROOF STEP]
unfolding g_orbital_def ivp_sols_def g_orbit_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {{X t |t. t \<in> U s \<and> (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>))} |X. X \<in> {X \<in> U s \<rightarrow> S.  D X = (\<lambda>t. f t (X t)) on U s \<and> X t\<^sub>0 = s \<and> t\<^sub>0 \<in> U s}} = {X t |t X. t \<in> U s \<and> \<P> X (down (U s) t) \<subseteq> {s. G s} \<and> X \<in> {X \<in> U s \<rightarrow> S.  D X = (\<lambda>t. f t (X t)) on U s \<and> X t\<^sub>0 = s \<and> t\<^sub>0 \<in> U s}}
[PROOF STEP]
by auto


[STATEMENT]
lemma cnorm_eq: "norm x = norm y \<longleftrightarrow> cinner x x = cinner y y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x = norm y) = (cinner x x = cinner y y)
[PROOF STEP]
by (metis norm_eq_sqrt_cinner power2_norm_eq_cinner)


[STATEMENT]
lemma shortest_augmenting_path:
  assumes "NFlow c s t f"
  and "\<exists>p. NPreflow.isAugmentingPath c s t f p"
  shows "Graph.isShortestPath (residualGraph c f) s (shortest_augmenting_path f) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Graph.isShortestPath (cf_of f) s (shortest_augmenting_path f) t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
NFlow c s t f
\<exists>p. NPreflow.isAugmentingPath c s t f p

goal (1 subgoal):
 1. Graph.isShortestPath (cf_of f) s (shortest_augmenting_path f) t
[PROOF STEP]
unfolding shortest_augmenting_path_def
[PROOF STATE]
proof (prove)
using this:
NFlow c s t f
\<exists>p. NPreflow.isAugmentingPath c s t f p

goal (1 subgoal):
 1. Graph.isShortestPath (cf_of f) s (SOME p. Graph.isShortestPath (cf_of f) s p t) t
[PROOF STEP]
by clarify(rule someI_ex, rule NFlow.augmenting_path_imp_shortest)


[STATEMENT]
lemma (in module) lincomb_insert:
  fixes S a v
  assumes h1: "finite S" and h2: "S\<subseteq> carrier M" and h3: "a\<in>(S\<union>{v}\<rightarrow>carrier R)" and h4:"v\<notin>S" and
h5:"v\<in> carrier M"
  shows "lincomb a (S\<union>{v}) = ((a v) \<odot>\<^bsub>M\<^esub> v) \<oplus>\<^bsub>M\<^esub> lincomb a S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb a (S \<union> {v}) = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
S \<subseteq> carrier M
a \<in> S \<union> {v} \<rightarrow> carrier R
v \<notin> S
v \<in> carrier M

goal (1 subgoal):
 1. lincomb a (S \<union> {v}) = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a S
[PROOF STEP]
by (auto cong: finsum_cong2
        simp add: lincomb_def finsum_Un_disjoint summands_valid ring_subset_carrier disj_if)


[STATEMENT]
lemma locally_injective_linear_image:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes f: "linear f" "inj f" and iff: "\<And>S. P (f ` S) \<longleftrightarrow> Q S"
  shows "locally P (f ` S) \<longleftrightarrow> locally Q S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally P (f ` S) = locally Q S
[PROOF STEP]
using homeomorphism_locally [of "f`S" _ _ f] linear_homeomorphism_image [OF f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>homeomorphism (f ` S) ?T ?f f; \<And>S T. homeomorphism S T ?f f \<Longrightarrow> ?P S = ?Q T\<rbrakk> \<Longrightarrow> locally ?P (f ` S) = locally ?Q ?T
(\<And>g. homeomorphism (f ` ?S) ?S g f \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. locally P (f ` S) = locally Q S
[PROOF STEP]
by (metis (no_types, lifting) homeomorphism_image2 iff)


[STATEMENT]
lemma MSB_Cons[simp]: "MSB (I # Is) = max (if I = {||} then 0 else Suc (fMax I)) (MSB Is)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MSB (I # Is) = max (if I = {||} then 0 else Suc (fMax I)) (MSB Is)
[PROOF STEP]
unfolding MSB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<forall>P\<in>set (I # Is). P = {||} then 0 else Suc (Max (\<Union> (fset ` set (I # Is))))) = max (if I = {||} then 0 else Suc (fMax I)) (if \<forall>P\<in>set Is. P = {||} then 0 else Suc (Max (\<Union> (fset ` set Is))))
[PROOF STEP]
including fset.lifting
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<forall>P\<in>set (I # Is). P = {||} then 0 else Suc (Max (\<Union> (fset ` set (I # Is))))) = max (if I = {||} then 0 else Suc (fMax I)) (if \<forall>P\<in>set Is. P = {||} then 0 else Suc (Max (\<Union> (fset ` set Is))))
[PROOF STEP]
by transfer (auto simp: Max_Un list_all_iff Sup_bot_conv(2)[symmetric] simp del: Sup_bot_conv(2))


[STATEMENT]
lemma supp_fin_union:
  fixes X::"('a set)"
  and   Y::"('a set)"
  assumes pt: "pt TYPE('a) TYPE('x)"
  and     at: "at TYPE('x)"
  and     fs: "fs TYPE('a) TYPE('x)"
  and     f1: "finite X"
  and     f2: "finite Y"
  shows "(supp (X\<union>Y)) = (supp X)\<union>((supp Y)::'x set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp (X \<union> Y) = supp X \<union> supp Y
[PROOF STEP]
using f1 f2
[PROOF STATE]
proof (prove)
using this:
finite X
finite Y

goal (1 subgoal):
 1. supp (X \<union> Y) = supp X \<union> supp Y
[PROOF STEP]
by (force simp add: supp_of_fin_sets[OF pt, OF at, OF fs])


[STATEMENT]
lemma sin_less_zero_pi:
  "\<lbrakk>- pi < x; x < 0\<rbrakk> \<Longrightarrow> sin x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- pi < x; x < 0\<rbrakk> \<Longrightarrow> sin x < 0
[PROOF STEP]
by (metis add.inverse_inverse add.inverse_neutral neg_less_iff_less sin_gt_zero sin_minus)


[STATEMENT]
lemma Suc_times_binomial_add: "Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)"
  \<comment> \<open>by Lukas Bulwahn\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
have dvd: "Suc a * (fact a * fact b) dvd fact (Suc (a + b))" for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc a * (fact a * fact b) dvd fact (Suc (a + b))
[PROOF STEP]
using fact_fact_dvd_fact[of "Suc a" "b", where 'a=nat]
[PROOF STATE]
proof (prove)
using this:
fact (Suc a) * fact b dvd fact (Suc a + b)

goal (1 subgoal):
 1. Suc a * (fact a * fact b) dvd fact (Suc (a + b))
[PROOF STEP]
by (simp only: fact_Suc add_Suc[symmetric] of_nat_id mult.assoc)
[PROOF STATE]
proof (state)
this:
Suc ?a * (fact ?a * fact ?b) dvd fact (Suc (?a + ?b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
have "Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) =
      Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b))
[PROOF STEP]
by (subst div_mult_swap[symmetric]; simp only: mult.assoc dvd)
[PROOF STATE]
proof (state)
this:
Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
have "\<dots> = Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b)) = Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b))
[PROOF STEP]
by (simp only: div_mult_mult1)
[PROOF STATE]
proof (state)
this:
Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b)) = Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b)) = Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
have "\<dots> = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))
[PROOF STEP]
using dvd[of b a]
[PROOF STATE]
proof (prove)
using this:
Suc b * (fact b * fact a) dvd fact (Suc (b + a))

goal (1 subgoal):
 1. Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))
[PROOF STEP]
by (subst div_mult_swap[symmetric]; simp only: ac_simps dvd)
[PROOF STATE]
proof (state)
this:
Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
by (subst (1 2) binomial_altdef_nat)
      (simp_all only: ac_simps diff_Suc_Suc Suc_diff_le diff_add_inverse fact_Suc of_nat_id)
[PROOF STATE]
proof (state)
this:
Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_inverse_irred_power_poly:
  assumes "c \<noteq> 0"
  shows   "degree (inverse_irred_power_poly c n) = n - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (inverse_irred_power_poly c n) = n - 1
[PROOF STEP]
unfolding inverse_irred_power_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (Poly (map (\<lambda>k. c * of_nat (stirling n (k + 1)) / fact (n - 1)) [0..<n])) = n - 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. degree (Poly (map (\<lambda>k. c * of_nat (stirling n (k + 1)) / fact (n - 1)) [0..<n])) = n - 1
[PROOF STEP]
by (subst degree_Poly_eq) (auto simp: last_conv_nth)


[STATEMENT]
lemma numeral_eq_zero_mod_ring_iff [simp]:
  "numeral a = (0 :: 'a :: nontriv mod_ring) \<longleftrightarrow> (numeral a mod CARD('a)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (numeral a = 0) = (numeral a mod CARD('a) = 0)
[PROOF STEP]
using of_nat_mod_ring_eq_iff[of "numeral a" 0, where ?'a = 'a]
[PROOF STATE]
proof (prove)
using this:
(of_nat (numeral a) = of_nat 0) = (numeral a mod CARD('a) = 0 mod CARD('a))

goal (1 subgoal):
 1. (numeral a = 0) = (numeral a mod CARD('a) = 0)
[PROOF STEP]
by (simp del: of_nat_mod_ring_eq_iff)


[STATEMENT]
lemma integrable_restrict_Int:
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
  shows "(\<lambda>x. if x \<in> S then f x else 0) integrable_on T \<longleftrightarrow> f integrable_on (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on T) = (f integrable_on S \<inter> T)
[PROOF STEP]
using has_integral_restrict_Int
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x \<in> ?S then ?f x else (0::?'b)) has_integral ?i) ?T = (?f has_integral ?i) (?S \<inter> ?T)

goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on T) = (f integrable_on S \<inter> T)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma l2norm_eq:
   "(l2norm S f = l2norm S g \<longleftrightarrow> l2product S f f = l2product S g g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l2norm S f = l2norm S g) = (l2product S f f = l2product S g g)
[PROOF STEP]
by (simp add: l2norm_def)


[STATEMENT]
lemma accepts_star:
 "accepts (star A) w = (\<exists>us. (\<forall>u \<in> set us. accepts A u) \<and> w = concat us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. accepts (RegExp2NA.star A) w = (\<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us)
[PROOF STEP]
apply(unfold star_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. accepts (RegExp2NA.or epsilon (RegExp2NA.plus A)) w = (\<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. accepts (RegExp2NA.or epsilon (RegExp2NA.plus A)) w \<Longrightarrow> \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us
 2. \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us \<Longrightarrow> accepts (RegExp2NA.or epsilon (RegExp2NA.plus A)) w
[PROOF STEP]
apply (clarify)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. accepts epsilon w \<or> accepts (RegExp2NA.plus A) w \<Longrightarrow> \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us
 2. \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us \<Longrightarrow> accepts (RegExp2NA.or epsilon (RegExp2NA.plus A)) w
[PROOF STEP]
apply (erule disjE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. accepts epsilon w \<Longrightarrow> \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us
 2. accepts (RegExp2NA.plus A) w \<Longrightarrow> \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us
 3. \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us \<Longrightarrow> accepts (RegExp2NA.or epsilon (RegExp2NA.plus A)) w
[PROOF STEP]
apply (rule_tac x = "[]" in exI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. accepts epsilon w \<Longrightarrow> (\<forall>u\<in>set []. accepts A u) \<and> w = concat []
 2. accepts (RegExp2NA.plus A) w \<Longrightarrow> \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us
 3. \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us \<Longrightarrow> accepts (RegExp2NA.or epsilon (RegExp2NA.plus A)) w
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. accepts (RegExp2NA.plus A) w \<Longrightarrow> \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us
 2. \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us \<Longrightarrow> accepts (RegExp2NA.or epsilon (RegExp2NA.plus A)) w
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>us. (\<forall>u\<in>set us. accepts A u) \<and> w = concat us \<Longrightarrow> accepts (RegExp2NA.or epsilon (RegExp2NA.plus A)) w
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma triangle_norm_vec_le_sum: "\<parallel>x\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>x\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel>)
[PROOF STEP]
by (simp add: L2_set_le_sum norm_vec_def)


[STATEMENT]
lemma "\<exists>(x::'a::linordered_field) y. \<forall>z<0. (z < x \<longrightarrow> z \<le> y) \<and> (z > y \<longrightarrow> z \<ge> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. \<forall>z<0::'a. (z < x \<longrightarrow> z \<le> y) \<and> (y < z \<longrightarrow> x \<le> z)
[PROOF STEP]
by ferrack


[STATEMENT]
lemma totient_2 [simp]: "totient 2 = 1"
  and totient_3 [simp]: "totient 3 = 2"
  and totient_5 [simp]: "totient 5 = 4"
  and totient_7 [simp]: "totient 7 = 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (totient 2 = 1 &&& totient 3 = 2) &&& totient 5 = 4 &&& totient 7 = 6
[PROOF STEP]
by (subst totient_prime; simp)+


[STATEMENT]
lemma  amod_adiv_equality:
       "(ant a) = (a div b) *\<^sub>a (ant b) + ant (a mod b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ant a = (a div b) *\<^sub>a ant b + ant (a mod b)
[PROOF STEP]
apply (simp add:adiv_def tna_ant a_z_z a_zpz  asprod_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filterlim_pow_at_bot_even:
  fixes f :: "real \<Rightarrow> real"
  shows "0 < n \<Longrightarrow> LIM x F. f x :> at_bot \<Longrightarrow> even n \<Longrightarrow> LIM x F. (f x)^n :> at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; filterlim f at_bot F; even n\<rbrakk> \<Longrightarrow> LIM x F. f x ^ n :> at_top
[PROOF STEP]
using filterlim_pow_at_top[of n "\<lambda>x. - f x" F]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < n; LIM x F. - f x :> at_top\<rbrakk> \<Longrightarrow> LIM x F. (- f x) ^ n :> at_top

goal (1 subgoal):
 1. \<lbrakk>0 < n; filterlim f at_bot F; even n\<rbrakk> \<Longrightarrow> LIM x F. f x ^ n :> at_top
[PROOF STEP]
by (simp add: filterlim_uminus_at_top)


[STATEMENT]
lemma integral_scaleR_left[simp]: "(c \<noteq> 0 \<Longrightarrow> integrable M f) \<Longrightarrow> (\<integral> x. f x *\<^sub>R c \<partial>M) = integral\<^sup>L M f *\<^sub>R c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c \<noteq> (0::'a) \<Longrightarrow> integrable M f) \<Longrightarrow> LINT x|M. f x *\<^sub>R c = integral\<^sup>L M f *\<^sub>R c
[PROOF STEP]
by (intro has_bochner_integral_integral_eq has_bochner_integral_integrable has_bochner_integral_scaleR_left)


[STATEMENT]
theorem distinct_IDs:
assumes a: "reach s"
shows "distinct (confIDs s) \<and> distinct (userIDs s) \<and> (\<forall> confID. distinct (paperIDs s confID))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (confIDs s) \<and> distinct (userIDs s) \<and> (\<forall>confID. distinct (paperIDs s confID))
[PROOF STEP]
using distinct_IDs1[OF a]
[PROOF STATE]
proof (prove)
using this:
distinct_IDs s

goal (1 subgoal):
 1. distinct (confIDs s) \<and> distinct (userIDs s) \<and> (\<forall>confID. distinct (paperIDs s confID))
[PROOF STEP]
unfolding distinct_IDs_def
[PROOF STATE]
proof (prove)
using this:
distinct (confIDs s) \<and> distinct (userIDs s) \<and> (\<forall>confID. distinct (paperIDs s confID))

goal (1 subgoal):
 1. distinct (confIDs s) \<and> distinct (userIDs s) \<and> (\<forall>confID. distinct (paperIDs s confID))
[PROOF STEP]
by auto


[STATEMENT]
lemma mat_equal_list_lem:
  fixes A:: "'a::field mat"
  fixes B:: "'a::field mat"
  shows "(dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B)
    \<Longrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B \<Longrightarrow> A = B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B \<Longrightarrow> A = B
[PROOF STEP]
assume hyp: "dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B"
[PROOF STATE]
proof (state)
this:
dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B

goal (1 subgoal):
 1. dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B \<Longrightarrow> A = B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B
[PROOF STEP]
have "\<And>i j. i < dim_row A \<Longrightarrow> j < dim_col A \<Longrightarrow> B $$ (i, j) = A $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row A; j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (i, j) = A $$ (i, j)
[PROOF STEP]
unfolding mat_to_list_def
[PROOF STATE]
proof (prove)
using this:
dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> map (\<lambda>i. map (\<lambda>j. A $$ (i, j)) [0..<dim_col A]) [0..<dim_row A] = map (\<lambda>i. map (\<lambda>j. B $$ (i, j)) [0..<dim_col B]) [0..<dim_row B]

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row A; j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (i, j) = A $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < dim_row A; ?j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (?i, ?j) = A $$ (?i, ?j)

goal (1 subgoal):
 1. dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B \<Longrightarrow> A = B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?i < dim_row A; ?j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (?i, ?j) = A $$ (?i, ?j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < dim_row A; ?j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (?i, ?j) = A $$ (?i, ?j)

goal (1 subgoal):
 1. A = B
[PROOF STEP]
using hyp
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < dim_row A; ?j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (?i, ?j) = A $$ (?i, ?j)
dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> mat_to_list A = mat_to_list B

goal (1 subgoal):
 1. A = B
[PROOF STEP]
unfolding mat_to_list_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < dim_row A; ?j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (?i, ?j) = A $$ (?i, ?j)
dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> map (\<lambda>i. map (\<lambda>j. A $$ (i, j)) [0..<dim_col A]) [0..<dim_row A] = map (\<lambda>i. map (\<lambda>j. B $$ (i, j)) [0..<dim_col B]) [0..<dim_row B]

goal (1 subgoal):
 1. A = B
[PROOF STEP]
using eq_matI[of A B]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < dim_row A; ?j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (?i, ?j) = A $$ (?i, ?j)
dim_row A = dim_row B \<and> dim_col A = dim_col B \<and> map (\<lambda>i. map (\<lambda>j. A $$ (i, j)) [0..<dim_col A]) [0..<dim_row A] = map (\<lambda>i. map (\<lambda>j. B $$ (i, j)) [0..<dim_col B]) [0..<dim_row B]
\<lbrakk>\<And>i j. \<lbrakk>i < dim_row A; j < dim_col A\<rbrakk> \<Longrightarrow> B $$ (i, j) = A $$ (i, j); dim_row B = dim_row A; dim_col B = dim_col A\<rbrakk> \<Longrightarrow> B = A

goal (1 subgoal):
 1. A = B
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
A = B

goal:
No subgoals!
[PROOF STEP]
qed