[STATEMENT]
lemma powr_less_eq_inverse_iff:
  fixes x y z::real
  assumes "x>0" "y>0" "z>0"
  shows "x powr y \<le> z \<longleftrightarrow> x \<le> z powr (inverse y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x powr y \<le> z) = (x \<le> z powr inverse y)
[PROOF STEP]
by (meson assms not_less powr_less_inverse_iff')


[STATEMENT]
lemma degree_polymul:
  fixes p :: "'a::field poly"
  assumes np: "isnpolyh p n0"
    and nq: "isnpolyh q n1"
  shows "degree (p *\<^sub>p q) \<le> degree p + degree q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial_Expression.degree (p *\<^sub>p q) \<le> Polynomial_Expression.degree p + Polynomial_Expression.degree q
[PROOF STEP]
using polymul_degreen[OF np nq, where m="0"]
[PROOF STATE]
proof (prove)
using this:
0 \<le> min n0 n1 \<Longrightarrow> degreen (p *\<^sub>p q) 0 = (if p = 0\<^sub>p \<or> q = 0\<^sub>p then 0 else degreen p 0 + degreen q 0)

goal (1 subgoal):
 1. Polynomial_Expression.degree (p *\<^sub>p q) \<le> Polynomial_Expression.degree p + Polynomial_Expression.degree q
[PROOF STEP]
by (simp add: degree_eq_degreen0)


[STATEMENT]
lemma real_sqrt_inverse: "sqrt (inverse x) = inverse (sqrt x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (inverse x) = inverse (sqrt x)
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root 2 (inverse x) = inverse (root 2 x)
[PROOF STEP]
by (rule real_root_inverse)


[STATEMENT]
theorem set_vebt_mint': "invar_vebt t n \<Longrightarrow> vebt_mint t = Some x \<longleftrightarrow> (x\<in>set_vebt t \<and> (\<forall>y\<in>set_vebt t. x\<le>y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_mint t = Some x) = (x \<in> set_vebt t \<and> (\<forall>y\<in>set_vebt t. x \<le> y))
[PROOF STEP]
using set_vebt_mint
[PROOF STATE]
proof (prove)
using this:
invar_vebt ?t n \<Longrightarrow> (vebt_mint ?t = Some ?x) = min_in_set (set_vebt ?t) ?x

goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_mint t = Some x) = (x \<in> set_vebt t \<and> (\<forall>y\<in>set_vebt t. x \<le> y))
[PROOF STEP]
unfolding min_in_set_def
[PROOF STATE]
proof (prove)
using this:
invar_vebt ?t n \<Longrightarrow> (vebt_mint ?t = Some ?x) = (?x \<in> set_vebt ?t \<and> Ball (set_vebt ?t) ((\<le>) ?x))

goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_mint t = Some x) = (x \<in> set_vebt t \<and> (\<forall>y\<in>set_vebt t. x \<le> y))
[PROOF STEP]
by blast


[STATEMENT]
lemma lsc_liminf_at:
  fixes f :: "'a::metric_space \<Rightarrow> ereal"
  shows "lsc_at x0 f \<longleftrightarrow> f x0 \<le> Liminf (at x0) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lsc_at x0 f = (f x0 \<le> Liminf (at x0) f)
[PROOF STEP]
unfolding lst_at_ball le_Liminf_iff eventually_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>C<f x0. \<exists>d>0. \<forall>y\<in>ball x0 d. C < f y) = (\<forall>y<f x0. \<exists>d>0. \<forall>x\<in>UNIV. x \<noteq> x0 \<and> dist x x0 < d \<longrightarrow> y < f x)
[PROOF STEP]
by (intro arg_cong[where f=All] imp_cong refl ext ex_cong)
     (auto simp: dist_commute zero_less_dist_iff)


[STATEMENT]
lemma log_one [simp]: "log a 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log a 1 = 0
[PROOF STEP]
by (simp add: log_def)


[STATEMENT]
theorem equiv_listrel: "equiv A r \<Longrightarrow> equiv (lists A) (listrel r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equiv A r \<Longrightarrow> equiv (lists A) (listrel r)
[PROOF STEP]
by (simp add: equiv_def listrel_refl_on listrel_sym listrel_trans)


[STATEMENT]
lemma DERIV_powr:
  assumes "x > 0"
  shows   "((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)
[PROOF STEP]
have "((\<lambda>x. exp (p * ln x)) has_real_derivative
         exp (p * ln x) * (p * inverse x)) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp (p * ln x)) has_real_derivative exp (p * ln x) * (p * inverse x)) (at x)
[PROOF STEP]
unfolding powr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp (p * ln x)) has_real_derivative exp (p * ln x) * (p * inverse x)) (at x)
[PROOF STEP]
by (intro DERIV_fun_exp DERIV_cmult DERIV_ln) fact
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp (p * ln x)) has_real_derivative exp (p * ln x) * (p * inverse x)) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp (p * ln x)) has_real_derivative exp (p * ln x) * (p * inverse x)) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)
[PROOF STEP]
have "exp (p * ln x) * (p * inverse x) = p * x powr (p - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (p * ln x) * (p * inverse x) = p * x powr (p - 1)
[PROOF STEP]
unfolding powr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (p * ln x) * (p * inverse x) = p * (if x = 0 then 0 else exp ((p - 1) * ln x))
[PROOF STEP]
by (simp add: field_simps exp_diff assms)
[PROOF STATE]
proof (state)
this:
exp (p * ln x) * (p * inverse x) = p * x powr (p - 1)

goal (1 subgoal):
 1. ((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. exp (p * ln x)) has_real_derivative p * x powr (p - 1)) (at x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. exp (p * ln x)) has_real_derivative p * x powr (p - 1)) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. exp (p * ln x)) has_real_derivative p * x powr (p - 1)) (at x)
0 < x

goal (1 subgoal):
 1. ((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)
[PROOF STEP]
by (subst DERIV_cong_ev[OF refl powr_eventually_exp_ln' refl])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr p) has_real_derivative p * x powr (p - 1)) (at x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dist_triangle_eq:
  fixes x y z :: "'a::real_inner"
  shows "dist x z = dist x y + dist y z \<longleftrightarrow>
    norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist x z = dist x y + dist y z) = (norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (dist x z = dist x y + dist y z) = (norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y))
[PROOF STEP]
have *: "x - y + (y - z) = x - z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - y + (y - z) = x - z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x - y + (y - z) = x - z

goal (1 subgoal):
 1. (dist x z = dist x y + dist y z) = (norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist x z = dist x y + dist y z) = (norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y))
[PROOF STEP]
unfolding dist_norm norm_triangle_eq[of "x - y" "y - z", unfolded *]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y)) = (norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y))
[PROOF STEP]
by (auto simp:norm_minus_commute)
[PROOF STATE]
proof (state)
this:
(dist x z = dist x y + dist y z) = (norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sinh_add: "sinh (x + y) = sinh x * cosh y + cosh x * sinh y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sinh (x + y) = sinh x * cosh y + cosh x * sinh y
[PROOF STEP]
by (simp add: sinh_def cosh_def algebra_simps scaleR_conv_of_real exp_add [symmetric])


[STATEMENT]
lemma vec_hom_mset: "image_mset hom (vec_mset v) = vec_mset (map_vec hom v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset hom (vec_mset v) = vec_mset (map_vec hom v)
[PROOF STEP]
apply (induction v)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. image_mset hom (vec_mset vNil) = vec_mset (map_vec hom vNil)
 2. \<And>a v. image_mset hom (vec_mset v) = vec_mset (map_vec hom v) \<Longrightarrow> image_mset hom (vec_mset (vCons a v)) = vec_mset (map_vec hom (vCons a v))
[PROOF STEP]
apply (metis mset.simps(1) vec_mset_img_map vec_mset_vNil vec_of_list_Nil)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a v. image_mset hom (vec_mset v) = vec_mset (map_vec hom v) \<Longrightarrow> image_mset hom (vec_mset (vCons a v)) = vec_mset (map_vec hom (vCons a v))
[PROOF STEP]
by (metis mset_vec_eq_mset_list vec_list vec_mset_img_map)


[STATEMENT]
lemma LIMSEQ_powa_inverse_of_nat:
   "a \<ge> 1 \<Longrightarrow> (\<lambda>n. a powa inverse (real_of_nat n)) \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> a \<Longrightarrow> (\<lambda>n. a powa inverse (real n)) \<longlonglongrightarrow> 1
[PROOF STEP]
by (simp add:  inverse_of_real_nat_of_rat_of_nat powa_powrat_eq
      LIMSEQ_powrat_inverse_of_nat)


[STATEMENT]
lemma dot_norm: "inner x y = ((norm (x + y))\<^sup>2 - (norm x)\<^sup>2 - (norm y)\<^sup>2) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner x y = ((norm (x + y))\<^sup>2 - (norm x)\<^sup>2 - (norm y)\<^sup>2) / 2
[PROOF STEP]
by (simp only: power2_norm_eq_inner inner_simps inner_commute) auto


[STATEMENT]
lemma card_surjective_functions_range_permutation:
  assumes "finite A" "finite B"
  shows "card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)
[PROOF STEP]
have "bij_betw (partitions_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) {P. partition_on A P \<and> card P = card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (partitions_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) {P. partition_on A P \<and> card P = card B}
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. bij_betw (partitions_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) {P. partition_on A P \<and> card P = card B}
[PROOF STEP]
by (rule bij_betw_partitions_of)
[PROOF STATE]
proof (state)
this:
bij_betw (partitions_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) {P. partition_on A P \<and> card P = card B}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
bij_betw (partitions_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) {P. partition_on A P \<and> card P = card B}
[PROOF STEP]
have "card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = card {P. partition_on A P \<and> card P = card B}"
[PROOF STATE]
proof (prove)
using this:
bij_betw (partitions_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) {P. partition_on A P \<and> card P = card B}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = card {P. partition_on A P \<and> card P = card B}
[PROOF STEP]
by (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = card {P. partition_on A P \<and> card P = card B}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = card {P. partition_on A P \<and> card P = card B}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)
[PROOF STEP]
have "card {P. partition_on A P \<and> card P = card B} = Stirling (card A) (card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {P. partition_on A P \<and> card P = card B} = Stirling (card A) (card B)
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card {P. partition_on A P \<and> card P = card B} = Stirling (card A) (card B)
[PROOF STEP]
by (rule card_partition_on)
[PROOF STATE]
proof (state)
this:
card {P. partition_on A P \<and> card P = card B} = Stirling (card A) (card B)

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // range_permutation A B) = Stirling (card A) (card B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem edr_characterization:
  "(\<forall>(A::'a mat). admits_diagonal_reduction A) = ((\<forall>(A::'a mat). admits_triangular_reduction A)
  \<and> (\<forall>a b c::'a. ideal_generated{a,b,c} = ideal_generated{1}
                      \<longrightarrow> (\<exists>p q. ideal_generated {p*a,p*b+q*c} = ideal_generated {1})))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A. admits_diagonal_reduction A) = ((\<forall>A. admits_triangular_reduction A) \<and> (\<forall>a b c. ideal_generated {a, b, c} = ideal_generated {1::'a} \<longrightarrow> (\<exists>p q. ideal_generated {p * a, p * b + q * c} = ideal_generated {1::'a})))
[PROOF STEP]
using necessity sufficiency
[PROOF STATE]
proof (prove)
using this:
\<forall>A. admits_diagonal_reduction A \<Longrightarrow> \<forall>A. admits_triangular_reduction A
\<forall>A. admits_diagonal_reduction A \<Longrightarrow> \<forall>a b c. ideal_generated {a, b, c} = ideal_generated {1::'a} \<longrightarrow> (\<exists>p q. ideal_generated {p * a, p * b + q * c} = ideal_generated {1::'a})
\<lbrakk>\<forall>A. admits_triangular_reduction A; \<forall>a b c. ideal_generated {a, b, c} = ideal_generated {1::'a} \<longrightarrow> (\<exists>p q. ideal_generated {p * a, p * b + q * c} = ideal_generated {1::'a})\<rbrakk> \<Longrightarrow> \<forall>A. admits_diagonal_reduction A

goal (1 subgoal):
 1. (\<forall>A. admits_diagonal_reduction A) = ((\<forall>A. admits_triangular_reduction A) \<and> (\<forall>a b c. ideal_generated {a, b, c} = ideal_generated {1::'a} \<longrightarrow> (\<exists>p q. ideal_generated {p * a, p * b + q * c} = ideal_generated {1::'a})))
[PROOF STEP]
by blast


[STATEMENT]
lemma card_sccs_verts: "card G.sccs_verts = card H.sccs_verts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card G.sccs_verts = card H.sccs_verts
[PROOF STEP]
unfolding sccs_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((`) proj_verts_H ` H.sccs_verts) = card H.sccs_verts
[PROOF STEP]
by (intro card_image inj_on_proj_verts_H)


[STATEMENT]
theorem (in finite_comm_group) card_character_extensions:
  assumes "subgroup H G" "character (G\<lparr>carrier := H\<rparr>) \<chi>"
  shows   "card {\<chi>'\<in>characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
interpret H: subgroup H G
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup H G
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
interpret H: finite_comm_group "G\<lparr>carrier := H\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_comm_group (G\<lparr>carrier := H\<rparr>)
[PROOF STEP]
using subgroup_imp_finite_comm_group[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
finite_comm_group (G\<lparr>carrier := H\<rparr>)

goal (1 subgoal):
 1. finite_comm_group (G\<lparr>carrier := H\<rparr>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
interpret chi: character "G\<lparr>carrier := H\<rparr>" \<chi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. character (G\<lparr>carrier := H\<rparr>) \<chi>
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
interpret C: finite_comm_group "Characters G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_comm_group (Characters G)
[PROOF STEP]
using finite_comm_group_Characters
[PROOF STATE]
proof (prove)
using this:
finite_comm_group (Characters G)

goal (1 subgoal):
 1. finite_comm_group (Characters G)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
interpret Mod: finite_comm_group "G Mod H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_comm_group (G Mod H)
[PROOF STEP]
using finite_comm_FactGroup[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
finite_comm_group (G Mod H)

goal (1 subgoal):
 1. finite_comm_group (G Mod H)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
obtain a where a: "a \<in> carrier (Characters G)" "restrict_char H a = \<chi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> carrier (Characters G); restrict_char H a = \<chi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> carrier (Characters G); restrict_char H a = \<chi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<exists>a\<in>carrier (Characters G). restrict_char H a = \<chi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a\<in>carrier (Characters G). restrict_char H a = \<chi>
[PROOF STEP]
using restrict_char_image[OF assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
restrict_char H ` carrier (Characters G) = carrier (Characters (G\<lparr>carrier := H\<rparr>))
character (G\<lparr>carrier := H\<rparr>) \<chi>

goal (1 subgoal):
 1. \<exists>a\<in>carrier (Characters G). restrict_char H a = \<chi>
[PROOF STEP]
unfolding carrier_Characters characters_def image_def
[PROOF STATE]
proof (prove)
using this:
{y. \<exists>x\<in>Collect (character G). y = restrict_char H x} = Collect (character (G\<lparr>carrier := H\<rparr>))
character (G\<lparr>carrier := H\<rparr>) \<chi>

goal (1 subgoal):
 1. \<exists>a\<in>Collect (character G). restrict_char H a = \<chi>
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>carrier (Characters G). restrict_char H a = \<chi>

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> carrier (Characters G); restrict_char H a = \<chi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>a\<in>carrier (Characters G). restrict_char H a = \<chi>

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<exists>a\<in>carrier (Characters G). restrict_char H a = \<chi>
\<lbrakk>?a2 \<in> carrier (Characters G); restrict_char H ?a2 = \<chi>\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<in> carrier (Characters G)
restrict_char H a = \<chi>

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
have p: "{\<chi>\<in>characters G. \<forall>x\<in>H. \<chi> x = 1} = {\<chi>\<in>characters G. \<forall>x\<in>H. \<chi> x = principal_char G x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = principal_char G x}
[PROOF STEP]
unfolding principal_char_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = (if x \<in> carrier G then 1 else 0)}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = principal_char G x}

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
have ac: "{\<chi>'\<in>characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} = {\<chi>'\<in>characters G. \<forall>x\<in>H. \<chi>' x = a x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} = {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = a x}
[PROOF STEP]
using a(2)
[PROOF STATE]
proof (prove)
using this:
restrict_char H a = \<chi>

goal (1 subgoal):
 1. {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} = {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = a x}
[PROOF STEP]
unfolding restrict_char_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>e. if e \<in> H then a e else 0) = \<chi>

goal (1 subgoal):
 1. {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} = {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = a x}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} = {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = a x}

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
have "card {\<chi>\<in>characters G. \<forall>x\<in>H. \<chi> x = 1} = card {\<chi>'\<in>characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x}
[PROOF STEP]
by (unfold ac p; intro character_restrict_card[OF assms(1)],
          use a[unfolded Characters_def characters_def] in auto)
[PROOF STATE]
proof (state)
this:
card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x}

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x}

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
have "card {\<chi>\<in>characters G. \<forall>x\<in>H. \<chi> x = 1} = card (carrier (G Mod H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card (carrier (G Mod H))
[PROOF STEP]
using iso_same_card[OF is_iso_Characters_FactGroup[OF assms(1)]]
            Mod.order_Characters[unfolded order_def]
[PROOF STATE]
proof (prove)
using this:
card (carrier (Characters (G Mod H))) = card (carrier (Characters G\<lparr>carrier := {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1}\<rparr>))
card (carrier (Characters (G Mod H))) = card (carrier (G Mod H))

goal (1 subgoal):
 1. card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card (carrier (G Mod H))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card (carrier (G Mod H))

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card (carrier (G Mod H))

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
have "card (carrier (G Mod H)) * card H = order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier (G Mod H)) * card H = order G
[PROOF STEP]
using lagrange[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
card (rcosets H) * card H = order G

goal (1 subgoal):
 1. card (carrier (G Mod H)) * card H = order G
[PROOF STEP]
unfolding FactGroup_def
[PROOF STATE]
proof (prove)
using this:
card (rcosets H) * card H = order G

goal (1 subgoal):
 1. card (carrier \<lparr>carrier = rcosets H, monoid.mult = (<#>), one = H\<rparr>) * card H = order G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (carrier (G Mod H)) * card H = order G

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x}
card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card (carrier (G Mod H))
card (carrier (G Mod H)) * card H = order G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x}
card {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1} = card (carrier (G Mod H))
card (carrier (G Mod H)) * card H = order G

goal (1 subgoal):
 1. card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {\<chi>' \<in> characters G. \<forall>x\<in>H. \<chi>' x = \<chi> x} * card H = order G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pythagoras:
  defines ort:"orthogonal \<equiv> (\<lambda>(A::point) B. fst A * fst B + snd A * snd B = 0)"
       and vc:"vector \<equiv> (\<lambda>(A::point) B. (fst A  - fst B, snd A - snd B))"
      and vcn:"vecsqnorm \<equiv> (\<lambda>A::point. fst A ^ 2 + snd A ^2)"
 assumes o: "orthogonal (vector A B) (vector C B)"
 shows "vecsqnorm(vector C A) = vecsqnorm(vector B  A) + vecsqnorm(vector C B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vecsqnorm (vector C A) = vecsqnorm (vector B A) + vecsqnorm (vector C B)
[PROOF STEP]
using o
[PROOF STATE]
proof (prove)
using this:
orthogonal (vector A B) (vector C B)

goal (1 subgoal):
 1. vecsqnorm (vector C A) = vecsqnorm (vector B A) + vecsqnorm (vector C B)
[PROOF STEP]
unfolding ort vc vcn
[PROOF STATE]
proof (prove)
using this:
fst (fst A - fst B, snd A - snd B) * fst (fst C - fst B, snd C - snd B) + snd (fst A - fst B, snd A - snd B) * snd (fst C - fst B, snd C - snd B) = 0

goal (1 subgoal):
 1. (fst (fst C - fst A, snd C - snd A))\<^sup>2 + (snd (fst C - fst A, snd C - snd A))\<^sup>2 = (fst (fst B - fst A, snd B - snd A))\<^sup>2 + (snd (fst B - fst A, snd B - snd A))\<^sup>2 + ((fst (fst C - fst B, snd C - snd B))\<^sup>2 + (snd (fst C - fst B, snd C - snd B))\<^sup>2)
[PROOF STEP]
by (algebra add: fst_conv snd_conv)


[STATEMENT]
theorem impossibility_of_trisecting_angle_pi_over_3:
  "Point (cos (pi / 9)) 0 \<notin> constructible"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
have "cos (3 *(pi/9)) = 4 * (cos (pi/9))^3 - 3 * cos (pi/9)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (3 * (pi / 9)) = 4 * cos (pi / 9) ^ 3 - 3 * cos (pi / 9)
[PROOF STEP]
using cos_treble_cos [of "pi / 9"]
[PROOF STATE]
proof (prove)
using this:
cos (3 * (pi / 9)) = 4 * cos (pi / 9) ^ 3 - 3 * cos (pi / 9)

goal (1 subgoal):
 1. cos (3 * (pi / 9)) = 4 * cos (pi / 9) ^ 3 - 3 * cos (pi / 9)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (3 * (pi / 9)) = 4 * cos (pi / 9) ^ 3 - 3 * cos (pi / 9)

goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
hence "1/2 = 4 * (cos (pi/9))^3 - 3 * cos (pi/9)"
[PROOF STATE]
proof (prove)
using this:
cos (3 * (pi / 9)) = 4 * cos (pi / 9) ^ 3 - 3 * cos (pi / 9)

goal (1 subgoal):
 1. 1 / 2 = 4 * cos (pi / 9) ^ 3 - 3 * cos (pi / 9)
[PROOF STEP]
by (simp add: cos_60)
[PROOF STATE]
proof (state)
this:
1 / 2 = 4 * cos (pi / 9) ^ 3 - 3 * cos (pi / 9)

goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
hence "8 * (cos (pi/9))^3 - 6 * cos (pi/9) - 1 = 0"
[PROOF STATE]
proof (prove)
using this:
1 / 2 = 4 * cos (pi / 9) ^ 3 - 3 * cos (pi / 9)

goal (1 subgoal):
 1. 8 * cos (pi / 9) ^ 3 - 6 * cos (pi / 9) - 1 = 0
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
8 * cos (pi / 9) ^ 3 - 6 * cos (pi / 9) - 1 = 0

goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
hence "(2 * cos (pi / 9)) ^3 - 3 * (2 * cos (pi / 9)) - 1 = 0"
[PROOF STATE]
proof (prove)
using this:
8 * cos (pi / 9) ^ 3 - 6 * cos (pi / 9) - 1 = 0

goal (1 subgoal):
 1. (2 * cos (pi / 9)) ^ 3 - 3 * (2 * cos (pi / 9)) - 1 = 0
[PROOF STEP]
by (simp add: algebra_simps power_def)
[PROOF STATE]
proof (state)
this:
(2 * cos (pi / 9)) ^ 3 - 3 * (2 * cos (pi / 9)) - 1 = 0

goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
hence "\<not> (2 * cos (pi / 9)) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
using this:
(2 * cos (pi / 9)) ^ 3 - 3 * (2 * cos (pi / 9)) - 1 = 0

goal (1 subgoal):
 1. 2 * cos (pi / 9) \<notin> radical_sqrt
[PROOF STEP]
by (metis impossibility_of_trisecting_pi_over_3_lemma)
[PROOF STATE]
proof (state)
this:
2 * cos (pi / 9) \<notin> radical_sqrt

goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
hence "\<not> (cos (pi / 9)) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
using this:
2 * cos (pi / 9) \<notin> radical_sqrt

goal (1 subgoal):
 1. cos (pi / 9) \<notin> radical_sqrt
[PROOF STEP]
by (metis divide_self_if mult_zero_right one_add_one radical_sqrt.intros(4) radical_sqrt.intros(5) radical_sqrt_rule_division)
[PROOF STATE]
proof (state)
this:
cos (pi / 9) \<notin> radical_sqrt

goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cos (pi / 9) \<notin> radical_sqrt

goal (1 subgoal):
 1. Point (cos (pi / 9)) 0 \<notin> constructible
[PROOF STEP]
by (metis abscissa.simps constructible_radical_sqrt)
[PROOF STATE]
proof (state)
this:
Point (cos (pi / 9)) 0 \<notin> constructible

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma llist_all2_trans:
  "\<lbrakk> llist_all2 P xs ys; llist_all2 P ys zs; transp P \<rbrakk>
  \<Longrightarrow> llist_all2 P xs zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>llist_all2 P xs ys; llist_all2 P ys zs; transp P\<rbrakk> \<Longrightarrow> llist_all2 P xs zs
[PROOF STEP]
apply(rule llist_all2_all_lnthI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>llist_all2 P xs ys; llist_all2 P ys zs; transp P\<rbrakk> \<Longrightarrow> llength xs = llength zs
 2. \<And>n. \<lbrakk>llist_all2 P xs ys; llist_all2 P ys zs; transp P; enat n < llength xs\<rbrakk> \<Longrightarrow> P (lnth xs n) (lnth zs n)
[PROOF STEP]
apply(simp add: llist_all2_llengthD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>llist_all2 P xs ys; llist_all2 P ys zs; transp P; enat n < llength xs\<rbrakk> \<Longrightarrow> P (lnth xs n) (lnth zs n)
[PROOF STEP]
apply(frule llist_all2_llengthD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>llist_all2 P xs ys; llist_all2 P ys zs; transp P; enat n < llength xs; llength xs = llength ys\<rbrakk> \<Longrightarrow> P (lnth xs n) (lnth zs n)
[PROOF STEP]
apply(drule (1) llist_all2_lnthD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>llist_all2 P ys zs; transp P; enat n < llength xs; llength xs = llength ys; P (lnth xs n) (lnth ys n)\<rbrakk> \<Longrightarrow> P (lnth xs n) (lnth zs n)
[PROOF STEP]
apply(drule llist_all2_lnthD)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>transp P; enat n < llength xs; llength xs = llength ys; P (lnth xs n) (lnth ys n)\<rbrakk> \<Longrightarrow> enat (?n8 n) < llength ys
 2. \<And>n. \<lbrakk>transp P; enat n < llength xs; llength xs = llength ys; P (lnth xs n) (lnth ys n); P (lnth ys (?n8 n)) (lnth zs (?n8 n))\<rbrakk> \<Longrightarrow> P (lnth xs n) (lnth zs n)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>transp P; enat n < llength xs; llength xs = llength ys; P (lnth xs n) (lnth ys n); P (lnth ys n) (lnth zs n)\<rbrakk> \<Longrightarrow> P (lnth xs n) (lnth zs n)
[PROOF STEP]
apply(erule (2) transpD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma arctan_diff_small:
  assumes "\<bar>x*y::real\<bar> < 1"
  shows   "arctan x - arctan y = arctan ((x - y) / (1 + x * y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
have "arctan x - arctan y = arctan x + arctan (-y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x - arctan y = arctan x + arctan (- y)
[PROOF STEP]
by (simp add: arctan_minus)
[PROOF STATE]
proof (state)
this:
arctan x - arctan y = arctan x + arctan (- y)

goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arctan x - arctan y = arctan x + arctan (- y)

goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<bar>x * y\<bar> < 1
[PROOF STEP]
have "\<dots> = arctan ((x - y) / (1 + x * y))"
[PROOF STATE]
proof (prove)
using this:
\<bar>x * y\<bar> < 1

goal (1 subgoal):
 1. arctan x + arctan (- y) = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
by (subst arctan_add_small) simp_all
[PROOF STATE]
proof (state)
this:
arctan x + arctan (- y) = arctan ((x - y) / (1 + x * y))

goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arctan x - arctan y = arctan ((x - y) / (1 + x * y))

goal (1 subgoal):
 1. arctan x - arctan y = arctan ((x - y) / (1 + x * y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
arctan x - arctan y = arctan ((x - y) / (1 + x * y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma relInvImage_Id_on:
  "(\<And>a1 a2. f a1 = f a2 \<longleftrightarrow> a1 = a2) \<Longrightarrow> relInvImage A (Id_on B) f \<subseteq> Id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a1 a2. (f a1 = f a2) = (a1 = a2)) \<Longrightarrow> relInvImage A (Id_on B) f \<subseteq> Id
[PROOF STEP]
unfolding relInvImage_def Id_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a1 a2. (f a1 = f a2) = (a1 = a2)) \<Longrightarrow> {(a1, a2) |a1 a2. a1 \<in> A \<and> a2 \<in> A \<and> (f a1, f a2) \<in> (\<Union>x\<in>B. {(x, x)})} \<subseteq> Id
[PROOF STEP]
by auto


[STATEMENT]
lemma Sup_ccsubspace_code[code]:
  \<comment> \<open>Supremum (sum) of a set of subspaces. Implemented
     by repeated pairwise sum.\<close>
  "Sup (Set_Monad l :: 'a::onb_enum ccsubspace set) = fold sup l bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> Set_Monad l = fold (\<squnion>) l \<bottom>
[PROOF STEP]
unfolding Set_Monad_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> set l = fold (\<squnion>) l \<bottom>
[PROOF STEP]
by (simp add: Sup_set_fold)


[STATEMENT]
lemma finite_product_group:
  assumes "\<And>i. i \<in> I \<Longrightarrow> group (G i)"
  shows
   "finite (carrier (product_group I G)) \<longleftrightarrow>
    finite {i. i \<in> I \<and> ~ trivial_group(G i)} \<and> (\<forall>i \<in> I. finite(carrier(G i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier (product_group I G)) = (finite {i \<in> I. \<not> trivial_group (G i)} \<and> (\<forall>i\<in>I. finite (carrier (G i))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (carrier (product_group I G)) = (finite {i \<in> I. \<not> trivial_group (G i)} \<and> (\<forall>i\<in>I. finite (carrier (G i))))
[PROOF STEP]
have [simp]: "\<And>i. i \<in> I \<Longrightarrow> carrier (G i) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> carrier (G i) \<noteq> {}
[PROOF STEP]
using assms group.is_monoid
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> Group.group (G ?i)
Group.group ?G \<Longrightarrow> Group.monoid ?G

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> carrier (G i) \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?i \<in> I \<Longrightarrow> carrier (G ?i) \<noteq> {}

goal (1 subgoal):
 1. finite (carrier (product_group I G)) = (finite {i \<in> I. \<not> trivial_group (G i)} \<and> (\<forall>i\<in>I. finite (carrier (G i))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier (product_group I G)) = (finite {i \<in> I. \<not> trivial_group (G i)} \<and> (\<forall>i\<in>I. finite (carrier (G i))))
[PROOF STEP]
by (auto simp: finite_PiE_iff PiE_eq_empty_iff group.trivial_group_alt [OF assms] cong: Collect_cong conj_cong)
[PROOF STATE]
proof (state)
this:
finite (carrier (product_group I G)) = (finite {i \<in> I. \<not> trivial_group (G i)} \<and> (\<forall>i\<in>I. finite (carrier (G i))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma UINF_Suc_shift: "(\<Sqinter> i \<in> {Suc 0..<Suc n} \<bullet> P(i)) = (\<Sqinter> i \<in> {0..<n} \<bullet> P(Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter> i \<in> {Suc 0..<Suc n} \<bullet> P i) = (\<Sqinter> i \<in> {0..<n} \<bullet> P (Suc i))
[PROOF STEP]
apply (rel_simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<Sqinter>{uu_. \<exists>x. uu_ = \<lbrakk>P x\<rbrakk>\<^sub>e b \<and> Suc 0 \<le> x \<and> x < Suc n} = \<Sqinter>{uu_. \<exists>x. uu_ = \<lbrakk>P (Suc x)\<rbrakk>\<^sub>e b \<and> x < n}
[PROOF STEP]
apply (rule cong[of Sup], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b xa. \<lbrakk>Suc 0 \<le> xa; xa < Suc n\<rbrakk> \<Longrightarrow> \<exists>x. \<lbrakk>P xa\<rbrakk>\<^sub>e b = \<lbrakk>P (Suc x)\<rbrakk>\<^sub>e b \<and> x < n
[PROOF STEP]
using less_Suc_eq_0_disj
[PROOF STATE]
proof (prove)
using this:
(?m < Suc ?n) = (?m = 0 \<or> (\<exists>j. ?m = Suc j \<and> j < ?n))

goal (1 subgoal):
 1. \<And>b xa. \<lbrakk>Suc 0 \<le> xa; xa < Suc n\<rbrakk> \<Longrightarrow> \<exists>x. \<lbrakk>P xa\<rbrakk>\<^sub>e b = \<lbrakk>P (Suc x)\<rbrakk>\<^sub>e b \<and> x < n
[PROOF STEP]
by auto


[STATEMENT]
lemma summable_rabs: "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)"
  for f :: "nat \<Rightarrow> real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)
[PROOF STEP]
by (fold real_norm_def) (rule summable_norm)


[STATEMENT]
lemma height_size1_log_Delta: assumes "wbt t"
shows "height t \<le> log 2 (size1 t) / log 2 (1 + 1/\<Delta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)
[PROOF STEP]
from height_size1_Delta[OF assms]
[PROOF STATE]
proof (chain)
picking this:
(1 + 1 / \<Delta>) ^ height t \<le> real (size1 t)
[PROOF STEP]
have "height t \<le> log (1 + 1/\<Delta>) (size1 t)"
[PROOF STATE]
proof (prove)
using this:
(1 + 1 / \<Delta>) ^ height t \<le> real (size1 t)

goal (1 subgoal):
 1. real (height t) \<le> log (1 + 1 / \<Delta>) (real (size1 t))
[PROOF STEP]
using Delta le_log_of_power
[PROOF STATE]
proof (prove)
using this:
(1 + 1 / \<Delta>) ^ height t \<le> real (size1 t)
1 \<le> \<Delta>
\<lbrakk>?b ^ ?n \<le> ?m; 1 < ?b\<rbrakk> \<Longrightarrow> real ?n \<le> log ?b ?m

goal (1 subgoal):
 1. real (height t) \<le> log (1 + 1 / \<Delta>) (real (size1 t))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (height t) \<le> log (1 + 1 / \<Delta>) (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (height t) \<le> log (1 + 1 / \<Delta>) (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)
[PROOF STEP]
have "\<dots> = log 2 (size1 t) / log 2 (1 + 1/\<Delta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log (1 + 1 / \<Delta>) (real (size1 t)) = log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)
[PROOF STEP]
by (simp add: log_base_change)
[PROOF STATE]
proof (state)
this:
log (1 + 1 / \<Delta>) (real (size1 t)) = log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)

goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)

goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 + 1 / \<Delta>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ld_sum_inequality:
  assumes "x > 0" "y > 0"
  shows   "log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
have 0: "0 \<le> (x-y)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (x - y)\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < y

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

goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
have "2 powr (2 + log 2 x + log 2 y) = 4 * x * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (2 + log 2 x + log 2 y) = 4 * x * y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < y

goal (1 subgoal):
 1. 2 powr (2 + log 2 x + log 2 y) = 4 * x * y
[PROOF STEP]
by(simp add: powr_add)
[PROOF STATE]
proof (state)
this:
2 powr (2 + log 2 x + log 2 y) = 4 * x * y

goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr (2 + log 2 x + log 2 y) = 4 * x * y

goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
have "4*x*y \<le> (x+y)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * x * y \<le> (x + y)\<^sup>2
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
0 \<le> (x - y)\<^sup>2

goal (1 subgoal):
 1. 4 * x * y \<le> (x + y)\<^sup>2
[PROOF STEP]
by(simp add: algebra_simps numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
4 * x * y \<le> (x + y)\<^sup>2

goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
4 * x * y \<le> (x + y)\<^sup>2

goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
have "\<dots> = 2 powr (log 2 (x + y) * 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y)\<^sup>2 = 2 powr (log 2 (x + y) * 2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < y

goal (1 subgoal):
 1. (x + y)\<^sup>2 = 2 powr (log 2 (x + y) * 2)
[PROOF STEP]
by(simp add: powr_powr[symmetric] powr_numeral)
[PROOF STATE]
proof (state)
this:
(x + y)\<^sup>2 = 2 powr (log 2 (x + y) * 2)

goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 powr (2 + log 2 x + log 2 y) \<le> 2 powr (log 2 (x + y) * 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 powr (2 + log 2 x + log 2 y) \<le> 2 powr (log 2 (x + y) * 2)

goal (1 subgoal):
 1. log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uncountable_closed_interval: "uncountable {a..b} \<longleftrightarrow> a < b" for a b :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncountable {a..b} = (a < b)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. uncountable {a..b} \<Longrightarrow> a < b
 2. a < b \<Longrightarrow> uncountable {a..b}
[PROOF STEP]
apply (metis atLeastAtMost_singleton atLeastatMost_empty countable_finite finite.emptyI finite_insert linorder_neqE_linordered_idom)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < b \<Longrightarrow> uncountable {a..b}
[PROOF STEP]
using real_interval_avoid_countable_set
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < ?b; countable ?A\<rbrakk> \<Longrightarrow> \<exists>x\<in>{?a<..<?b}. x \<notin> ?A

goal (1 subgoal):
 1. a < b \<Longrightarrow> uncountable {a..b}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma type_definition_Domainp:
  fixes Rep Abs A T
  assumes type: "type_definition Rep Abs A"
  assumes T_def: "T \<equiv> (\<lambda>(x::'a) (y::'b). x = Rep y)"
  shows "Domainp T = (\<lambda>x. x \<in> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Domainp T = (\<lambda>x. x \<in> A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Domainp T = (\<lambda>x. x \<in> A)
[PROOF STEP]
interpret type_definition Rep Abs A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. type_definition Rep Abs A
[PROOF STEP]
by(rule type)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Domainp T = (\<lambda>x. x \<in> A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Domainp T = (\<lambda>x. x \<in> A)
[PROOF STEP]
unfolding Domainp_iff[abs_def] T_def fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (\<exists>y. x = Rep y) = (x \<in> A)
[PROOF STEP]
by(metis Abs_inverse Rep)
[PROOF STATE]
proof (state)
this:
Domainp T = (\<lambda>x. x \<in> A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma kernel_basis_exists: assumes A: "A \<in> carrier_mat nr nc"
  shows "\<exists> B. finite B \<and> kernel.basis nc A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
obtain C where gj: "gauss_jordan_single A = C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C. gauss_jordan_single A = C \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gauss_jordan_single A = C

goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
from gauss_jordan_single[OF A gj]
[PROOF STATE]
proof (chain)
picking this:
?x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v ?x = 0\<^sub>v nr) = (C *\<^sub>v ?x = 0\<^sub>v nr)
C \<in> carrier_mat nr nc
row_echelon_form C
\<exists>P Q. C = P * A \<and> P \<in> carrier_mat nr nr \<and> Q \<in> carrier_mat nr nr \<and> P * Q = 1\<^sub>m nr \<and> Q * P = 1\<^sub>m nr
[PROOF STEP]
obtain P Q where CPA: "C = P * A" and QP: "Q * P = 1\<^sub>m nr"
    and P: "P \<in> carrier_mat nr nr" and Q: "Q \<in> carrier_mat nr nr"
    and C: "C \<in> carrier_mat nr nc" and row: "row_echelon_form C"
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v ?x = 0\<^sub>v nr) = (C *\<^sub>v ?x = 0\<^sub>v nr)
C \<in> carrier_mat nr nc
row_echelon_form C
\<exists>P Q. C = P * A \<and> P \<in> carrier_mat nr nr \<and> Q \<in> carrier_mat nr nr \<and> P * Q = 1\<^sub>m nr \<and> Q * P = 1\<^sub>m nr

goal (1 subgoal):
 1. (\<And>P Q. \<lbrakk>C = P * A; Q * P = 1\<^sub>m nr; P \<in> carrier_mat nr nr; Q \<in> carrier_mat nr nr; C \<in> carrier_mat nr nc; row_echelon_form C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C = P * A
Q * P = 1\<^sub>m nr
P \<in> carrier_mat nr nr
Q \<in> carrier_mat nr nr
C \<in> carrier_mat nr nc
row_echelon_form C

goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
from find_base_vectors[OF row C]
[PROOF STATE]
proof (chain)
picking this:
set (find_base_vectors C) \<subseteq> mat_kernel C
0\<^sub>v nc \<notin> set (find_base_vectors C)
vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel C\<rparr>) (set (find_base_vectors C))
card (set (find_base_vectors C)) = nc - card {i. i < nr \<and> row C i \<noteq> 0\<^sub>v nc}
length (pivot_positions C) = card {i. i < nr \<and> row C i \<noteq> 0\<^sub>v nc}
vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel C\<rparr>) = nc - card {i. i < nr \<and> row C i \<noteq> 0\<^sub>v nc}
[PROOF STEP]
have "\<exists> B. finite B \<and> kernel.basis nc C B"
[PROOF STATE]
proof (prove)
using this:
set (find_base_vectors C) \<subseteq> mat_kernel C
0\<^sub>v nc \<notin> set (find_base_vectors C)
vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel C\<rparr>) (set (find_base_vectors C))
card (set (find_base_vectors C)) = nc - card {i. i < nr \<and> row C i \<noteq> 0\<^sub>v nc}
length (pivot_positions C) = card {i. i < nr \<and> row C i \<noteq> 0\<^sub>v nc}
vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel C\<rparr>) = nc - card {i. i < nr \<and> row C i \<noteq> 0\<^sub>v nc}

goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel C\<rparr>) B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel C\<rparr>) B

goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel C\<rparr>) B

goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
have "mat_kernel C = mat_kernel A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_kernel C = mat_kernel A
[PROOF STEP]
unfolding CPA
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_kernel (P * A) = mat_kernel A
[PROOF STEP]
by (rule mat_kernel_mult_eq[OF A P Q QP])
[PROOF STATE]
proof (state)
this:
mat_kernel C = mat_kernel A

goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B

goal (1 subgoal):
 1. \<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<exists>B. finite B \<and> vectorspace.basis class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm2_norm1_main_inequality: fixes f :: "nat \<Rightarrow> 'a :: linordered_idom"
  shows "(\<Sum>i = 0..<n. f i * f i) \<le> (\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. f i * f i) \<le> (\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2
[PROOF STEP]
unfolding norm2_norm1_main_equality
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. f i * f i) \<le> (\<Sum>i = 0..<n. f i * f i) + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
[PROOF STEP]
by (auto intro!: sum_nonneg)


[STATEMENT]
lemma onorm_eq_0:
  assumes f: "bounded_linear f"
  shows "onorm f = 0 \<longleftrightarrow> (\<forall>x. f x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (onorm f = 0) = (\<forall>x. f x = (0::'b))
[PROOF STEP]
using onorm [OF f]
[PROOF STATE]
proof (prove)
using this:
norm (f ?x) \<le> onorm f * norm ?x

goal (1 subgoal):
 1. (onorm f = 0) = (\<forall>x. f x = (0::'b))
[PROOF STEP]
by (auto simp: fun_eq_iff [symmetric] onorm_zero)


[STATEMENT]
lemma Sum_any_eq_zero_iff [simp]:
  fixes f :: "'a \<Rightarrow> nat"
  assumes "finite {a. f a \<noteq> 0}"
  shows "Sum_any f = 0 \<longleftrightarrow> f = (\<lambda>_. 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Sum_any f = 0) = (f = (\<lambda>_. 0))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite {a. f a \<noteq> 0}

goal (1 subgoal):
 1. (Sum_any f = 0) = (f = (\<lambda>_. 0))
[PROOF STEP]
by (simp add: Sum_any.expand_set fun_eq_iff)


[STATEMENT]
lemma sum_eq:
  fixes x :: "'a::ordered_ab_group_add"
  shows "x + t = 0 \<equiv> x = - t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + t = (0::'a) \<equiv> x = - t
[PROOF STEP]
using eq_diff_eq[where a= x and b=t and c=0]
[PROOF STATE]
proof (prove)
using this:
(x = (0::'a) - t) = (x + t = (0::'a))

goal (1 subgoal):
 1. x + t = (0::'a) \<equiv> x = - t
[PROOF STEP]
by simp


[STATEMENT]
theorem rank_eq_dim_col_space:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  shows "rank A = vec.dim (col_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = vec.dim (col_space A)
[PROOF STEP]
using rank_col_rank
[PROOF STATE]
proof (prove)
using this:
rank ?A = col_rank ?A

goal (1 subgoal):
 1. rank A = vec.dim (col_space A)
[PROOF STEP]
unfolding col_rank_def
[PROOF STATE]
proof (prove)
using this:
rank ?A = vec.dim (col_space ?A)

goal (1 subgoal):
 1. rank A = vec.dim (col_space A)
[PROOF STEP]
.


[STATEMENT]
lemma finite_imp_exists_enumeration:
  assumes "finite A"
  shows "\<exists>f. enumerates A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. enumerates A f
[PROOF STEP]
unfolding enumerates_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. finite A \<and> A = f ` {..<card A} \<and> inj_on f {..<card A}
[PROOF STEP]
using assms finite_imp_nat_seg_image_inj_on[of A]
[PROOF STATE]
proof (prove)
using this:
finite A
finite A \<Longrightarrow> \<exists>n f. A = f ` {i. i < n} \<and> inj_on f {i. i < n}

goal (1 subgoal):
 1. \<exists>f. finite A \<and> A = f ` {..<card A} \<and> inj_on f {..<card A}
[PROOF STEP]
by (metis card_Collect_less_nat card_image lessThan_def)


[STATEMENT]
lemma "map (\<lambda>x. (f x, g x)) xs = zip (map f xs) (map g xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>x. (f x, g x)) xs = zip (map f xs) (map g xs)
[PROOF STEP]
apply (induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. map (\<lambda>x. (f x, g x)) [] = zip (map f []) (map g [])
 2. \<And>a xs. map (\<lambda>x. (f x, g x)) xs = zip (map f xs) (map g xs) \<Longrightarrow> map (\<lambda>x. (f x, g x)) (a # xs) = zip (map f (a # xs)) (map g (a # xs))
[PROOF STEP]
apply (metis list.map(1) zip_Nil)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. map (\<lambda>x. (f x, g x)) xs = zip (map f xs) (map g xs) \<Longrightarrow> map (\<lambda>x. (f x, g x)) (a # xs) = zip (map f (a # xs)) (map g (a # xs))
[PROOF STEP]
by auto


[STATEMENT]
lemma setsum_cut_off_less:
  fixes f::"nat \<Rightarrow> nat"
  assumes h1: "m \<le> n"
    and     h2: "\<forall>i \<in> {m..<n}. f i = 0"
  shows "(\<Sum>i < n. f i) = (\<Sum>i < m. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m}
[PROOF STEP]
have eq_zero: "(\<Sum>i \<in> {m..<n}. f i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {m..<n} = 0
[PROOF STEP]
using h2
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{m..<n}. f i = 0

goal (1 subgoal):
 1. sum f {m..<n} = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum f {m..<n} = 0

goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m}
[PROOF STEP]
have "(\<Sum>i < n. f i) = (\<Sum>i \<in> {..<m}. f i) + (\<Sum>i \<in> {m..<n}. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m} + sum f {m..<n}
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m} + sum f {m..<n}
[PROOF STEP]
by (metis atLeast0LessThan le0 sum.atLeastLessThan_concat)
[PROOF STATE]
proof (state)
this:
sum f {..<n} = sum f {..<m} + sum f {m..<n}

goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {..<n} = sum f {..<m} + sum f {m..<n}

goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m}
[PROOF STEP]
have "... = (\<Sum>i \<in> {..<m}. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<m} + sum f {m..<n} = sum f {..<m}
[PROOF STEP]
using eq_zero
[PROOF STATE]
proof (prove)
using this:
sum f {m..<n} = 0

goal (1 subgoal):
 1. sum f {..<m} + sum f {m..<n} = sum f {..<m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {..<m} + sum f {m..<n} = sum f {..<m}

goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f {..<n} = sum f {..<m}
[PROOF STEP]
show "(\<Sum>i < n. f i) = (\<Sum>i < m. f i)"
[PROOF STATE]
proof (prove)
using this:
sum f {..<n} = sum f {..<m}

goal (1 subgoal):
 1. sum f {..<n} = sum f {..<m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {..<n} = sum f {..<m}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsetsum_nat:
  assumes "f abs_summable_on A"
  shows   "infsetsum f A = (\<Sum>n. if n \<in> A then f n else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f abs_summable_on A
[PROOF STEP]
have "infsetsum f A = (\<Sum>n. indicator A n *\<^sub>R f n)"
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on A

goal (1 subgoal):
 1. infsetsum f A = (\<Sum>n. indicat_real A n *\<^sub>R f n)
[PROOF STEP]
unfolding infsetsum_altdef abs_summable_on_altdef set_lebesgue_integral_def set_integrable_def
[PROOF STATE]
proof (prove)
using this:
integrable (count_space UNIV) (\<lambda>x. indicat_real A x *\<^sub>R f x)

goal (1 subgoal):
 1. LINT x|count_space UNIV. indicat_real A x *\<^sub>R f x = (\<Sum>n. indicat_real A n *\<^sub>R f n)
[PROOF STEP]
by (subst integral_count_space_nat) auto
[PROOF STATE]
proof (state)
this:
infsetsum f A = (\<Sum>n. indicat_real A n *\<^sub>R f n)

goal (1 subgoal):
 1. infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
infsetsum f A = (\<Sum>n. indicat_real A n *\<^sub>R f n)

goal (1 subgoal):
 1. infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))
[PROOF STEP]
have "(\<lambda>n. indicator A n *\<^sub>R f n) = (\<lambda>n. if n \<in> A then f n else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. indicat_real A n *\<^sub>R f n) = (\<lambda>n. if n \<in> A then f n else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. indicat_real A n *\<^sub>R f n) = (\<lambda>n. if n \<in> A then f n else (0::'a))

goal (1 subgoal):
 1. infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))

goal (1 subgoal):
 1. infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
infsetsum f A = (\<Sum>n. if n \<in> A then f n else (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stereographic_inv_stereographic':
  assumes
  z: "z = z1/z2" and "z2 \<noteq> 0" and
  X: "X = Re (2*z / (1 + z*cnj z))" and Y: "Y = Im (2*z / (1 + z*cnj z))" and Z: "Z = ((cmod z)\<^sup>2 - 1) / (1 + (cmod z)\<^sup>2)"
  shows "\<exists> k. k \<noteq> 0 \<and> (X + \<i>*Y, complex_of_real (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
have "1 + (cmod z)\<^sup>2 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (cmod z)\<^sup>2 \<noteq> 0
[PROOF STEP]
by (metis one_power2 sum_power2_eq_zero_iff zero_neq_one)
[PROOF STATE]
proof (state)
this:
1 + (cmod z)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
hence "(1 - Z) = 2 / (1 + (cmod z)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
1 + (cmod z)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. 1 - Z = 2 / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
using Z
[PROOF STATE]
proof (prove)
using this:
1 + (cmod z)\<^sup>2 \<noteq> 0
Z = ((cmod z)\<^sup>2 - 1) / (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. 1 - Z = 2 / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
1 - Z = 2 / (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
hence "cor (1 - Z) = 2 / cor (1 + (cmod z)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
1 - Z = 2 / (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. cor (1 - Z) = 2 / cor (1 + (cmod z)\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cor (1 - Z) = 2 / cor (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cor (1 - Z) = 2 / cor (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
have "X = 2 * Re(z) / (1 + (cmod z)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X = 2 * Re z / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
X = Re (2 * z / (1 + z * cnj z))

goal (1 subgoal):
 1. X = 2 * Re z / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
by (simp add: Re_stereographic)
[PROOF STATE]
proof (state)
this:
X = 2 * Re z / (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
have "Y = 2 * Im(z) / (1 + (cmod z)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y = 2 * Im z / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
using Y
[PROOF STATE]
proof (prove)
using this:
Y = Im (2 * z / (1 + z * cnj z))

goal (1 subgoal):
 1. Y = 2 * Im z / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
by (simp add: Im_stereographic)
[PROOF STATE]
proof (state)
this:
Y = 2 * Im z / (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
have "X + \<i>*Y = 2 * z / cor (1 + (cmod z)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cor X + \<i> * cor Y = 2 * z / cor (1 + (cmod z)\<^sup>2)
[PROOF STEP]
using \<open>1 + (cmod z)\<^sup>2 \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
1 + (cmod z)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. cor X + \<i> * cor Y = 2 * z / cor (1 + (cmod z)\<^sup>2)
[PROOF STEP]
unfolding Complex_eq[of X Y, symmetric]
[PROOF STATE]
proof (prove)
using this:
1 + (cmod z)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. Complex X Y = 2 * z / cor (1 + (cmod z)\<^sup>2)
[PROOF STEP]
by (subst \<open>X = 2*Re(z) / (1 + (cmod z)\<^sup>2)\<close>, subst \<open>Y = 2*Im(z) / (1 + (cmod z)\<^sup>2)\<close>, simp add: Complex_scale4 Complex_scale1)
[PROOF STATE]
proof (state)
this:
cor X + \<i> * cor Y = 2 * z / cor (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cor X + \<i> * cor Y = 2 * z / cor (1 + (cmod z)\<^sup>2)

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
have "1 + (cor (cmod (z1 / z2)))\<^sup>2 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (cor (cmod (z1 / z2)))\<^sup>2 \<noteq> 0
[PROOF STEP]
by (rule one_plus_square_neq_zero)
[PROOF STATE]
proof (state)
this:
1 + (cor (cmod (z1 / z2)))\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cor (1 - Z) = 2 / cor (1 + (cmod z)\<^sup>2)
cor X + \<i> * cor Y = 2 * z / cor (1 + (cmod z)\<^sup>2)
1 + (cor (cmod (z1 / z2)))\<^sup>2 \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cor (1 - Z) = 2 / cor (1 + (cmod z)\<^sup>2)
cor X + \<i> * cor Y = 2 * z / cor (1 + (cmod z)\<^sup>2)
1 + (cor (cmod (z1 / z2)))\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
using \<open>z2 \<noteq> 0\<close> \<open>1 + (cmod z)\<^sup>2 \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
cor (1 - Z) = 2 / cor (1 + (cmod z)\<^sup>2)
cor X + \<i> * cor Y = 2 * z / cor (1 + (cmod z)\<^sup>2)
1 + (cor (cmod (z1 / z2)))\<^sup>2 \<noteq> 0
z2 \<noteq> 0
1 + (cmod z)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)
[PROOF STEP]
by (simp, subst z)+
       (rule_tac x="(2 / (1 + (cor (cmod (z1 / z2)))\<^sup>2)) / z2" in exI, auto)
[PROOF STATE]
proof (state)
this:
\<exists>k. k \<noteq> 0 \<and> (cor X + \<i> * cor Y, cor (1 - Z)) = k *\<^sub>s\<^sub>v (z1, z2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_add_elem_step_eq:
  assumes "size (A \<times># B) = size A * size B"
  shows "size (add_mset x A \<times># B) = size (add_mset x A) * size B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (add_mset x A) * size B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (add_mset x A) * size B
[PROOF STEP]
have "(add_mset x A \<times># B) = A \<times># B + {#x#} \<times># B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset x A \<times># B = A \<times># B + {#x#} \<times># B
[PROOF STEP]
by (metis Sigma_mset_plus_distrib1 add_mset_add_single)
[PROOF STATE]
proof (state)
this:
add_mset x A \<times># B = A \<times># B + {#x#} \<times># B

goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (add_mset x A) * size B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
add_mset x A \<times># B = A \<times># B + {#x#} \<times># B
[PROOF STEP]
have "size (add_mset x A \<times># B) = size (A \<times># B) + size B"
[PROOF STATE]
proof (prove)
using this:
add_mset x A \<times># B = A \<times># B + {#x#} \<times># B

goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (A \<times># B) + size B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size (add_mset x A \<times># B) = size (A \<times># B) + size B

goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (add_mset x A) * size B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size (add_mset x A \<times># B) = size (A \<times># B) + size B

goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (add_mset x A) * size B
[PROOF STEP]
have "... = size A * size B + size B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (A \<times># B) + size B = size A * size B + size B
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
size (A \<times># B) + size B = size A * size B + size B

goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (add_mset x A) * size B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size (add_mset x A \<times># B) = size A * size B + size B
[PROOF STEP]
have "size (add_mset x A \<times># B) = (size A + 1) * size B"
[PROOF STATE]
proof (prove)
using this:
size (add_mset x A \<times># B) = size A * size B + size B

goal (1 subgoal):
 1. size (add_mset x A \<times># B) = (size A + 1) * size B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size (add_mset x A \<times># B) = (size A + 1) * size B

goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (add_mset x A) * size B
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
size (add_mset x A \<times># B) = (size A + 1) * size B

goal (1 subgoal):
 1. size (add_mset x A \<times># B) = size (add_mset x A) * size B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size (add_mset x A \<times># B) = size (add_mset x A) * size B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_edges_loops_alt: "all_edges_loops S = {e . e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_edges_loops S = {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. all_edges_loops S = {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}
[PROOF STEP]
have 1: " {{v} | v. v \<in> S} = {e . e \<subseteq> S \<and> card e = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {{v} |v. v \<in> S} = {e. e \<subseteq> S \<and> card e = 1}
[PROOF STEP]
by (metis One_nat_def card.empty card_Suc_eq empty_iff empty_subsetI insert_subset is_singleton_altdef is_singleton_the_elem )
[PROOF STATE]
proof (state)
this:
{{v} |v. v \<in> S} = {e. e \<subseteq> S \<and> card e = 1}

goal (1 subgoal):
 1. all_edges_loops S = {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}
[PROOF STEP]
have "{e . e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = {e . e \<subseteq> S \<and> card e = 2} \<union> {e . e \<subseteq> S \<and> card e = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = {e. e \<subseteq> S \<and> card e = 2} \<union> {e. e \<subseteq> S \<and> card e = 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = {e. e \<subseteq> S \<and> card e = 2} \<union> {e. e \<subseteq> S \<and> card e = 1}

goal (1 subgoal):
 1. all_edges_loops S = {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = {e. e \<subseteq> S \<and> card e = 2} \<union> {e. e \<subseteq> S \<and> card e = 1}
[PROOF STEP]
have "{e . e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = all_edges S \<union> {{v} | v. v \<in> S}"
[PROOF STATE]
proof (prove)
using this:
{e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = {e. e \<subseteq> S \<and> card e = 2} \<union> {e. e \<subseteq> S \<and> card e = 1}

goal (1 subgoal):
 1. {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = all_edges S \<union> {{v} |v. v \<in> S}
[PROOF STEP]
by (simp add: all_edges_def 1)
[PROOF STATE]
proof (state)
this:
{e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = all_edges S \<union> {{v} |v. v \<in> S}

goal (1 subgoal):
 1. all_edges_loops S = {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = all_edges S \<union> {{v} |v. v \<in> S}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = all_edges S \<union> {{v} |v. v \<in> S}

goal (1 subgoal):
 1. all_edges_loops S = {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}
[PROOF STEP]
unfolding all_edges_loops_def
[PROOF STATE]
proof (prove)
using this:
{e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)} = all_edges S \<union> {{v} |v. v \<in> S}

goal (1 subgoal):
 1. all_edges S \<union> {{v} |v. v \<in> S} = {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
all_edges_loops S = {e. e \<subseteq> S \<and> (card e = 2 \<or> card e = 1)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_add_offset_less:
  fixes x :: nat
  assumes yv: "y < 2 ^ n"
  and     xv: "x < 2 ^ m"
  and     mn: "sz = m + n"
  shows   "x * 2 ^ n + y < 2 ^ sz"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ sz
[PROOF STEP]
proof (subst mn)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
from yv
[PROOF STATE]
proof (chain)
picking this:
y < 2 ^ n
[PROOF STEP]
obtain qy where "y + qy = 2 ^ n" and "0 < qy"
[PROOF STATE]
proof (prove)
using this:
y < 2 ^ n

goal (1 subgoal):
 1. (\<And>qy. \<lbrakk>y + qy = 2 ^ n; 0 < qy\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto dest: less_imp_add_positive)
[PROOF STATE]
proof (state)
this:
y + qy = 2 ^ n
0 < qy

goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
have "x * 2 ^ n + y < x * 2 ^ n + 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * 2 ^ n + y < x * 2 ^ n + 2 ^ n
[PROOF STEP]
by simp fact+
[PROOF STATE]
proof (state)
this:
x * 2 ^ n + y < x * 2 ^ n + 2 ^ n

goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * 2 ^ n + y < x * 2 ^ n + 2 ^ n

goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
have "\<dots> = (x + 1) * 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * 2 ^ n + 2 ^ n = (x + 1) * 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x * 2 ^ n + 2 ^ n = (x + 1) * 2 ^ n

goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * 2 ^ n + 2 ^ n = (x + 1) * 2 ^ n

goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
have "\<dots> \<le> 2 ^ (m + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + 1) * 2 ^ n \<le> 2 ^ (m + n)
[PROOF STEP]
using xv
[PROOF STATE]
proof (prove)
using this:
x < 2 ^ m

goal (1 subgoal):
 1. (x + 1) * 2 ^ n \<le> 2 ^ (m + n)
[PROOF STEP]
by (subst power_add) (rule mult_le_mono1, simp)
[PROOF STATE]
proof (state)
this:
(x + 1) * 2 ^ n \<le> 2 ^ (m + n)

goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
show "x * 2 ^ n + y < 2 ^ (m + n)"
[PROOF STATE]
proof (prove)
using this:
x * 2 ^ n + y < 2 ^ (m + n)

goal (1 subgoal):
 1. x * 2 ^ n + y < 2 ^ (m + n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x * 2 ^ n + y < 2 ^ (m + n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powreal_IVT_upper_lemma:
  assumes "a > (1::real)" and "x > 0"
  shows "\<exists>n::nat. a pow\<^sub>\<real> (-real n) < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. a pow\<^sub>\<real> - real n < x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>n. a pow\<^sub>\<real> - real n < x
[PROOF STEP]
have "(\<lambda>n. a pow\<^sub>\<real> - real n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. a pow\<^sub>\<real> - real n) \<longlonglongrightarrow> 0
[PROOF STEP]
by (simp add: LIMSEQ_powreal_minus_nat assms(1))
[PROOF STATE]
proof (state)
this:
(\<lambda>n. a pow\<^sub>\<real> - real n) \<longlonglongrightarrow> 0

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

goal (1 subgoal):
 1. \<exists>n. a pow\<^sub>\<real> - real n < x
[PROOF STEP]
using LIMSEQ_less_Ex assms(2)
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. a pow\<^sub>\<real> - real n) \<longlonglongrightarrow> 0
\<lbrakk>?X \<longlonglongrightarrow> ?x; ?x < ?y\<rbrakk> \<Longrightarrow> \<exists>n. ?X n < ?y
0 < x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_le_nth_prime [simp]: "card {q. prime q \<and> q \<le> nth_prime n} = Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {q. prime q \<and> q \<le> nth_prime n} = Suc n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {q. prime q \<and> q \<le> nth_prime n} = Suc n
[PROOF STEP]
have "{q. prime q \<and> q \<le> nth_prime n} = insert (nth_prime n) {q. prime q \<and> q < nth_prime n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q. prime q \<and> q \<le> nth_prime n} = insert (nth_prime n) {q. prime q \<and> q < nth_prime n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{q. prime q \<and> q \<le> nth_prime n} = insert (nth_prime n) {q. prime q \<and> q < nth_prime n}

goal (1 subgoal):
 1. card {q. prime q \<and> q \<le> nth_prime n} = Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{q. prime q \<and> q \<le> nth_prime n} = insert (nth_prime n) {q. prime q \<and> q < nth_prime n}

goal (1 subgoal):
 1. card {q. prime q \<and> q \<le> nth_prime n} = Suc n
[PROOF STEP]
have "card \<dots> = Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert (nth_prime n) {q. prime q \<and> q < nth_prime n}) = Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (insert (nth_prime n) {q. prime q \<and> q < nth_prime n}) = Suc n

goal (1 subgoal):
 1. card {q. prime q \<and> q \<le> nth_prime n} = Suc n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {q. prime q \<and> q \<le> nth_prime n} = Suc n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {q. prime q \<and> q \<le> nth_prime n} = Suc n

goal (1 subgoal):
 1. card {q. prime q \<and> q \<le> nth_prime n} = Suc n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {q. prime q \<and> q \<le> nth_prime n} = Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_sqrt_four [simp]: "sqrt 4 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt 4 = 2
[PROOF STEP]
using real_sqrt_abs[of 2]
[PROOF STATE]
proof (prove)
using this:
sqrt (2\<^sup>2) = \<bar>2\<bar>

goal (1 subgoal):
 1. sqrt 4 = 2
[PROOF STEP]
by simp


[STATEMENT]
lemma rec_disjointify_finite_set:
  assumes "enumerates A f"
  shows "\<Union> (rec_disjointify (card A) f) = \<Union> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (rec_disjointify (card A) f) = \<Union> A
[PROOF STEP]
unfolding rec_disjointify_union[of "card A" f]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (f ` {..<card A}) = \<Union> A
[PROOF STEP]
using enumeratesE[of A f] assms
[PROOF STATE]
proof (prove)
using this:
enumerates A f \<Longrightarrow> finite A
enumerates A f \<Longrightarrow> A = f ` {..<card A}
enumerates A f \<Longrightarrow> inj_on f {..<card A}
enumerates A f

goal (1 subgoal):
 1. \<Union> (f ` {..<card A}) = \<Union> A
[PROOF STEP]
by auto


[STATEMENT]
lemma cosh_diff: "cosh (x - y) = cosh x * cosh y - sinh x * sinh y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh (x - y) = cosh x * cosh y - sinh x * sinh y
[PROOF STEP]
by (simp add: sinh_def cosh_def algebra_simps scaleR_conv_of_real exp_add [symmetric])


[STATEMENT]
theorem Beta_plus1_left:
  assumes "x \<notin> \<int>\<^sub>\<le>\<^sub>0"
  shows   "(x + y) * Beta (x + 1) y = x * Beta x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) * Beta (x + (1::'a)) y = x * Beta x y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x + y) * Beta (x + (1::'a)) y = x * Beta x y
[PROOF STEP]
have "(x + y) * Beta (x + 1) y = Gamma (x + 1) * Gamma y * ((x + y) * rGamma ((x + y) + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) * Beta (x + (1::'a)) y = Gamma (x + (1::'a)) * Gamma y * ((x + y) * rGamma (x + y + (1::'a)))
[PROOF STEP]
unfolding Beta_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) * (Gamma (x + (1::'a)) * Gamma y * rGamma (x + (1::'a) + y)) = Gamma (x + (1::'a)) * Gamma y * ((x + y) * rGamma (x + y + (1::'a)))
[PROOF STEP]
by (simp only: ac_simps)
[PROOF STATE]
proof (state)
this:
(x + y) * Beta (x + (1::'a)) y = Gamma (x + (1::'a)) * Gamma y * ((x + y) * rGamma (x + y + (1::'a)))

goal (1 subgoal):
 1. (x + y) * Beta (x + (1::'a)) y = x * Beta x y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y) * Beta (x + (1::'a)) y = Gamma (x + (1::'a)) * Gamma y * ((x + y) * rGamma (x + y + (1::'a)))

goal (1 subgoal):
 1. (x + y) * Beta (x + (1::'a)) y = x * Beta x y
[PROOF STEP]
have "\<dots> = x * Beta x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gamma (x + (1::'a)) * Gamma y * ((x + y) * rGamma (x + y + (1::'a))) = x * Beta x y
[PROOF STEP]
unfolding Beta_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gamma (x + (1::'a)) * Gamma y * ((x + y) * rGamma (x + y + (1::'a))) = x * (Gamma x * Gamma y * rGamma (x + y))
[PROOF STEP]
by (subst assms[THEN Gamma_plus1] rGamma_plus1)+ (simp only: ac_simps)
[PROOF STATE]
proof (state)
this:
Gamma (x + (1::'a)) * Gamma y * ((x + y) * rGamma (x + y + (1::'a))) = x * Beta x y

goal (1 subgoal):
 1. (x + y) * Beta (x + (1::'a)) y = x * Beta x y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x + y) * Beta (x + (1::'a)) y = x * Beta x y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x + y) * Beta (x + (1::'a)) y = x * Beta x y

goal (1 subgoal):
 1. (x + y) * Beta (x + (1::'a)) y = x * Beta x y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(x + y) * Beta (x + (1::'a)) y = x * Beta x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fundamental_theorem_algebra_factorized':
  fixes p :: "complex poly"
  shows "p = Polynomial.smult (Polynomial.lead_coeff p)
               (prod_mset (image_mset (\<lambda>x. [:-x, 1:]) (poly_roots p)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
proof (cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
obtain xs where
    xs: "Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<leftarrow>xs. [:-x, 1:]) = p"
        "length xs = Polynomial.degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<leftarrow>xs. [:- x, 1:]) = p; length xs = Polynomial.degree p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using fundamental_theorem_algebra_factorized[of p]
[PROOF STATE]
proof (prove)
using this:
\<exists>as. Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>a\<leftarrow>as. [:- a, 1:]) = p \<and> length as = Polynomial.degree p

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<leftarrow>xs. [:- x, 1:]) = p; length xs = Polynomial.degree p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<leftarrow>xs. [:- x, 1:]) = p
length xs = Polynomial.degree p

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
define A where "A = mset xs"
[PROOF STATE]
proof (state)
this:
A = mset xs

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
note xs(1)
[PROOF STATE]
proof (state)
this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<leftarrow>xs. [:- x, 1:]) = p

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<leftarrow>xs. [:- x, 1:]) = p

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
have "(\<Prod>x\<leftarrow>xs. [:-x, 1:]) = prod_mset (image_mset (\<lambda>x. [:-x, 1:]) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<leftarrow>xs. [:- x, 1:]) = (\<Prod>x\<in>#A. [:- x, 1:])
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<leftarrow>xs. [:- x, 1:]) = (\<Prod>x\<in>#mset xs. [:- x, 1:])
[PROOF STEP]
by (induction xs) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<leftarrow>xs. [:- x, 1:]) = (\<Prod>x\<in>#A. [:- x, 1:])

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#A. [:- x, 1:]) = p
[PROOF STEP]
have *: "Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#A. [:- x, 1:]) = p"
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#A. [:- x, 1:]) = p

goal (1 subgoal):
 1. Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#A. [:- x, 1:]) = p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#A. [:- x, 1:]) = p

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#A. [:- x, 1:]) = p

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
have "A = poly_roots p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = poly_roots p
[PROOF STEP]
using poly_roots_factorization[of "Polynomial.lead_coeff p" A]
[PROOF STATE]
proof (prove)
using this:
Polynomial.lead_coeff p \<noteq> 0 \<Longrightarrow> poly_roots (Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#A. [:- x, 1:])) = A

goal (1 subgoal):
 1. A = poly_roots p
[PROOF STEP]
by (subst * [symmetric]) auto
[PROOF STATE]
proof (state)
this:
A = poly_roots p

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
 2. p \<noteq> 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:]) = p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:]) = p

goal (1 subgoal):
 1. p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])

goal (1 subgoal):
 1. p = 0 \<Longrightarrow> p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
qed auto


[STATEMENT]
lemma path_connectedin:
     "path_connectedin X S \<longleftrightarrow>
        S \<subseteq> topspace X \<and>
        (\<forall>x \<in> S. \<forall>y \<in> S. \<exists>g. pathin X g \<and> g ` {0..1} \<subseteq> S \<and> g 0 = x \<and> g 1 = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connectedin X S = (S \<subseteq> topspace X \<and> (\<forall>x\<in>S. \<forall>y\<in>S. \<exists>g. pathin X g \<and> g ` {0..1} \<subseteq> S \<and> g 0 = x \<and> g 1 = y))
[PROOF STEP]
unfolding path_connectedin_def path_connected_space_def pathin_def continuous_map_in_subtopology
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<subseteq> topspace X \<and> (\<forall>x\<in>topspace (subtopology X S). \<forall>y\<in>topspace (subtopology X S). \<exists>g. (continuous_map (top_of_set {0..1}) X g \<and> g ` topspace (top_of_set {0..1}) \<subseteq> S) \<and> g 0 = x \<and> g 1 = y)) = (S \<subseteq> topspace X \<and> (\<forall>x\<in>S. \<forall>y\<in>S. \<exists>g. continuous_map (top_of_set {0..1}) X g \<and> g ` {0..1} \<subseteq> S \<and> g 0 = x \<and> g 1 = y))
[PROOF STEP]
by (intro conj_cong refl ball_cong) (simp_all add: inf.absorb_iff2)


[STATEMENT]
lemma pcompose_diff: "pcompose (p - q) r = pcompose p r - pcompose q r"
  for p q r :: "'a::comm_ring poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p - q) \<circ>\<^sub>p r = p \<circ>\<^sub>p r - q \<circ>\<^sub>p r
[PROOF STEP]
using pcompose_add[of p "-q"]
[PROOF STATE]
proof (prove)
using this:
(p + - q) \<circ>\<^sub>p ?r = p \<circ>\<^sub>p ?r + - q \<circ>\<^sub>p ?r

goal (1 subgoal):
 1. (p - q) \<circ>\<^sub>p r = p \<circ>\<^sub>p r - q \<circ>\<^sub>p r
[PROOF STEP]
by (simp add: pcompose_uminus)


[STATEMENT]
lemma "((a::int) - b - c) ^ 2 = a ^ 2 + b ^ 2 + c ^ 2 - 2 * a * b + 2 * b * c - 2 * a * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b - c)\<^sup>2 = a\<^sup>2 + b\<^sup>2 + c\<^sup>2 - 2 * a * b + 2 * b * c - 2 * a * c
[PROOF STEP]
by ring


[STATEMENT]
lemma gauge_Inter:
  assumes "finite S"
    and "\<And>u. u\<in>S \<Longrightarrow> gauge (f u)"
  shows "gauge (\<lambda>x. \<Inter>{f u x | u. u \<in> S})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauge (\<lambda>x. \<Inter> {f u x |u. u \<in> S})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gauge (\<lambda>x. \<Inter> {f u x |u. u \<in> S})
[PROOF STEP]
have *: "\<And>x. {f u x |u. u \<in> S} = (\<lambda>u. f u x) ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. {f u x |u. u \<in> S} = (\<lambda>u. f u x) ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f u ?x |u. u \<in> S} = (\<lambda>u. f u ?x) ` S

goal (1 subgoal):
 1. gauge (\<lambda>x. \<Inter> {f u x |u. u \<in> S})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauge (\<lambda>x. \<Inter> {f u x |u. u \<in> S})
[PROOF STEP]
unfolding gauge_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<in> \<Inter> {f u x |u. u \<in> S} \<and> open (\<Inter> {f u x |u. u \<in> S})
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<in> (\<Inter>u\<in>S. f u x) \<and> open (\<Inter>u\<in>S. f u x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
?u \<in> S \<Longrightarrow> gauge (f ?u)

goal (1 subgoal):
 1. \<forall>x. x \<in> (\<Inter>u\<in>S. f u x) \<and> open (\<Inter>u\<in>S. f u x)
[PROOF STEP]
unfolding Ball_def Inter_iff mem_Collect_eq gauge_def
[PROOF STATE]
proof (prove)
using this:
finite S
?u \<in> S \<Longrightarrow> \<forall>x. x \<in> f ?u x \<and> open (f ?u x)

goal (1 subgoal):
 1. \<forall>x. (\<forall>xa. xa \<in> (\<lambda>u. f u x) ` S \<longrightarrow> x \<in> xa) \<and> open (\<Inter>u\<in>S. f u x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gauge (\<lambda>x. \<Inter> {f u x |u. u \<in> S})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma out_arcs_single_per_vert:
  assumes "v \<in> verts G" and "u \<in> verts G"
  assumes "e1 \<in> out_arcs G v" and " e2 \<in> out_arcs G v"
  assumes "head G e1 = u" and "head G e2 = u"
  shows "e1 = e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e1 = e2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e1 = e2
[PROOF STEP]
have in_arcs1: "e1 \<in> arcs G" and in_arcs2: "e2 \<in> arcs G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e1 \<in> arcs G &&& e2 \<in> arcs G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> verts G
u \<in> verts G
e1 \<in> out_arcs G v
e2 \<in> out_arcs G v
head G e1 = u
head G e2 = u

goal (1 subgoal):
 1. e1 \<in> arcs G &&& e2 \<in> arcs G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e1 \<in> arcs G
e2 \<in> arcs G

goal (1 subgoal):
 1. e1 = e2
[PROOF STEP]
have "arc_to_ends G e1 = arc_to_ends G e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arc_to_ends G e1 = arc_to_ends G e2
[PROOF STEP]
using assms arc_to_ends_def
[PROOF STATE]
proof (prove)
using this:
v \<in> verts G
u \<in> verts G
e1 \<in> out_arcs G v
e2 \<in> out_arcs G v
head G e1 = u
head G e2 = u
arc_to_ends ?G ?e \<equiv> (tail ?G ?e, head ?G ?e)

goal (1 subgoal):
 1. arc_to_ends G e1 = arc_to_ends G e2
[PROOF STEP]
by (metis in_out_arcs_conv)
[PROOF STATE]
proof (state)
this:
arc_to_ends G e1 = arc_to_ends G e2

goal (1 subgoal):
 1. e1 = e2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
arc_to_ends G e1 = arc_to_ends G e2

goal (1 subgoal):
 1. e1 = e2
[PROOF STEP]
using in_arcs1 in_arcs2 no_multi_arcs
[PROOF STATE]
proof (prove)
using this:
arc_to_ends G e1 = arc_to_ends G e2
e1 \<in> arcs G
e2 \<in> arcs G
\<lbrakk>?e1.0 \<in> arcs G; ?e2.0 \<in> arcs G; arc_to_ends G ?e1.0 = arc_to_ends G ?e2.0\<rbrakk> \<Longrightarrow> ?e1.0 = ?e2.0

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

goal:
No subgoals!
[PROOF STEP]
qed