[STATEMENT]
lemma Re_winding_number_half_upper:
  assumes pimage:"\<forall>p\<in>path_image \<gamma>. Im p \<ge> Im z" and "valid_path \<gamma>" and "z\<notin>path_image \<gamma>"
  shows "Re(winding_number \<gamma> z) =
            (Im (Ln (\<i>*z - \<i>*pathfinish \<gamma>)) - Im (Ln (\<i>*z - \<i>*pathstart \<gamma> )))/(2*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
define \<gamma>' where "\<gamma>'=(\<lambda>t. - \<i> * (\<gamma> t - z) + z)"
[PROOF STATE]
proof (state)
this:
\<gamma>' = (\<lambda>t. - \<i> * (\<gamma> t - z) + z)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
have "Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)
[PROOF STEP]
unfolding \<gamma>'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number (\<lambda>t. - \<i> * (\<gamma> t - z) + z) z) = (Im (Ln (pathfinish (\<lambda>t. - \<i> * (\<gamma> t - z) + z) - z)) - Im (Ln (pathstart (\<lambda>t. - \<i> * (\<gamma> t - z) + z) - z))) / (2 * pi)
[PROOF STEP]
apply (rule Re_winding_number_half_right)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>p\<in>path_image (\<lambda>t. - \<i> * (\<gamma> t - z) + z). Re z \<le> Re p
 2. valid_path (\<lambda>t. - \<i> * (\<gamma> t - z) + z)
 3. z \<notin> path_image (\<lambda>t. - \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>path_image (\<lambda>t. - \<i> * (\<gamma> t - z) + z). Re z \<le> Re p
[PROOF STEP]
using pimage
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>path_image \<gamma>. Im z \<le> Im p

goal (1 subgoal):
 1. \<forall>p\<in>path_image (\<lambda>t. - \<i> * (\<gamma> t - z) + z). Re z \<le> Re p
[PROOF STEP]
unfolding path_image_def
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>\<gamma> ` {0..1}. Im z \<le> Im p

goal (1 subgoal):
 1. \<forall>p\<in>(\<lambda>t. - \<i> * (\<gamma> t - z) + z) ` {0..1}. Re z \<le> Re p
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. valid_path (\<lambda>t. - \<i> * (\<gamma> t - z) + z)
 2. z \<notin> path_image (\<lambda>t. - \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path (\<lambda>t. - \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
apply (rule valid_path_compose_holomorphic[OF \<open>valid_path \<gamma>\<close>,of "\<lambda>x. -\<i> * (x-z) + z" UNIV
            , unfolded comp_def])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>t. - \<i> * (t - z) + z) holomorphic_on UNIV
 2. open UNIV
 3. path_image \<gamma> \<subseteq> UNIV
[PROOF STEP]
by (auto intro!:holomorphic_intros)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> path_image (\<lambda>t. - \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> path_image (\<lambda>t. - \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
using \<open>z\<notin>path_image \<gamma>\<close>
[PROOF STATE]
proof (prove)
using this:
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. z \<notin> path_image (\<lambda>t. - \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
unfolding path_image_def
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<gamma> ` {0..1}

goal (1 subgoal):
 1. z \<notin> (\<lambda>t. - \<i> * (\<gamma> t - z) + z) ` {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
have "winding_number \<gamma>' z = winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
define f where "f=(\<lambda>x. -\<i> * (x-z) + z)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. - \<i> * (x - z) + z)

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
define c where "c= 1 / (complex_of_real (2 * pi) * \<i>)"
[PROOF STATE]
proof (state)
this:
c = 1 / (complex_of_real (2 * pi) * \<i>)

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
have "winding_number \<gamma>' z = winding_number (f o \<gamma>) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number (f \<circ> \<gamma>) z
[PROOF STEP]
unfolding \<gamma>'_def comp_def f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (\<lambda>t. - \<i> * (\<gamma> t - z) + z) z = winding_number (\<lambda>x. - \<i> * (\<gamma> x - z) + z) z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number (f \<circ> \<gamma>) z

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number (f \<circ> \<gamma>) z

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
have "... = c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
proof (rule winding_number_comp[of UNIV])
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. open UNIV
 2. f holomorphic_on UNIV
 3. path_image \<gamma> \<subseteq> UNIV
 4. valid_path \<gamma>
 5. z \<notin> path_image (f \<circ> \<gamma>)
[PROOF STEP]
show "z \<notin> path_image (f \<circ> \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> path_image (f \<circ> \<gamma>)
[PROOF STEP]
using \<open>z\<notin>path_image \<gamma>\<close>
[PROOF STATE]
proof (prove)
using this:
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. z \<notin> path_image (f \<circ> \<gamma>)
[PROOF STEP]
unfolding f_def path_image_def
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<gamma> ` {0..1}

goal (1 subgoal):
 1. z \<notin> ((\<lambda>x. - \<i> * (x - z) + z) \<circ> \<gamma>) ` {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<notin> path_image (f \<circ> \<gamma>)

goal (4 subgoals):
 1. open UNIV
 2. f holomorphic_on UNIV
 3. path_image \<gamma> \<subseteq> UNIV
 4. valid_path \<gamma>
[PROOF STEP]
qed (auto simp add:f_def \<open>valid_path \<gamma>\<close> intro!:holomorphic_intros)
[PROOF STATE]
proof (state)
this:
winding_number (f \<circ> \<gamma>) z = c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
winding_number (f \<circ> \<gamma>) z = c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
have "... = c * contour_integral \<gamma> (\<lambda>w.  1 / (w - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
have "deriv f x = -\<i>" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv f x = - \<i>
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. - \<i> * (x - z) + z) x = - \<i>
[PROOF STEP]
by (auto intro!:derivative_eq_intros DERIV_imp_deriv)
[PROOF STATE]
proof (state)
this:
deriv f ?x = - \<i>

goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deriv f ?x = - \<i>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deriv f ?x = - \<i>

goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
unfolding f_def c_def
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. - \<i> * (x - z) + z) ?x = - \<i>

goal (1 subgoal):
 1. 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv (\<lambda>x. - \<i> * (x - z) + z) w / (- \<i> * (w - z) + z - z)) = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
by (auto simp add:field_simps divide_simps intro!:arg_cong2[where f=contour_integral])
[PROOF STATE]
proof (state)
this:
c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
have "... = winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z)) = winding_number \<gamma> z
[PROOF STEP]
using winding_number_valid_path[OF \<open>valid_path \<gamma>\<close> \<open>z\<notin>path_image \<gamma>\<close>,folded c_def]
[PROOF STATE]
proof (prove)
using this:
winding_number \<gamma> z = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z)) = winding_number \<gamma> z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z)) = winding_number \<gamma> z

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
winding_number \<gamma>' z = winding_number \<gamma> z

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number \<gamma> z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number \<gamma> z

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number \<gamma> z

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
have "pathfinish \<gamma>' = z+ \<i>*z -\<i>* pathfinish \<gamma>" "pathstart \<gamma>' = z+ \<i>*z -\<i>*pathstart \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pathfinish \<gamma>' = z + \<i> * z - \<i> * pathfinish \<gamma> &&& pathstart \<gamma>' = z + \<i> * z - \<i> * pathstart \<gamma>
[PROOF STEP]
unfolding \<gamma>'_def path_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<i> * (\<gamma> 1 - z) + z = z + \<i> * z - \<i> * \<gamma> 1 &&& - \<i> * (\<gamma> 0 - z) + z = z + \<i> * z - \<i> * \<gamma> 0
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
pathfinish \<gamma>' = z + \<i> * z - \<i> * pathfinish \<gamma>
pathstart \<gamma>' = z + \<i> * z - \<i> * pathstart \<gamma>

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)
winding_number \<gamma>' z = winding_number \<gamma> z
pathfinish \<gamma>' = z + \<i> * z - \<i> * pathfinish \<gamma>
pathstart \<gamma>' = z + \<i> * z - \<i> * pathstart \<gamma>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)
winding_number \<gamma>' z = winding_number \<gamma> z
pathfinish \<gamma>' = z + \<i> * z - \<i> * pathfinish \<gamma>
pathstart \<gamma>' = z + \<i> * z - \<i> * pathstart \<gamma>

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re (winding_number \<gamma> z) = (Im (Ln (\<i> * z - \<i> * pathfinish \<gamma>)) - Im (Ln (\<i> * z - \<i> * pathstart \<gamma>))) / (2 * pi)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_int_dirichlet_inverse:
  "of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
proof (induction n rule: dirichlet_inverse_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. of_int (dirichlet_inverse f i 0) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) 0
 2. of_int (dirichlet_inverse f i (Suc 0)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) (Suc 0)
 3. \<And>n. \<lbrakk>1 < n; \<And>k. k < n \<Longrightarrow> of_int (dirichlet_inverse f i k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) k\<rbrakk> \<Longrightarrow> of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
case (gt1 n)
[PROOF STATE]
proof (state)
this:
1 < n
?k < n \<Longrightarrow> of_int (dirichlet_inverse f i ?k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) ?k

goal (3 subgoals):
 1. of_int (dirichlet_inverse f i 0) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) 0
 2. of_int (dirichlet_inverse f i (Suc 0)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) (Suc 0)
 3. \<And>n. \<lbrakk>1 < n; \<And>k. k < n \<Longrightarrow> of_int (dirichlet_inverse f i k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) k\<rbrakk> \<Longrightarrow> of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
from gt1
[PROOF STATE]
proof (chain)
picking this:
1 < n
?k < n \<Longrightarrow> of_int (dirichlet_inverse f i ?k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) ?k
[PROOF STEP]
have "(of_int (dirichlet_inverse f i n) :: 'a) =
    - (of_int i * (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d) * dirichlet_inverse f i d)))"
     (is "_ = - (_ * ?A)")
[PROOF STATE]
proof (prove)
using this:
1 < n
?k < n \<Longrightarrow> of_int (dirichlet_inverse f i ?k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) ?k

goal (1 subgoal):
 1. of_int (dirichlet_inverse f i n) = - (of_int i * (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d) * dirichlet_inverse f i d)))
[PROOF STEP]
by (simp add: dirichlet_inverse_gt_1 of_int_dirichlet_prod)
[PROOF STATE]
proof (state)
this:
of_int (dirichlet_inverse f i n) = - (of_int i * (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d) * dirichlet_inverse f i d)))

goal (3 subgoals):
 1. of_int (dirichlet_inverse f i 0) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) 0
 2. of_int (dirichlet_inverse f i (Suc 0)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) (Suc 0)
 3. \<And>n. \<lbrakk>1 < n; \<And>k. k < n \<Longrightarrow> of_int (dirichlet_inverse f i k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) k\<rbrakk> \<Longrightarrow> of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (dirichlet_inverse f i n) = - (of_int i * (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d) * dirichlet_inverse f i d)))

goal (3 subgoals):
 1. of_int (dirichlet_inverse f i 0) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) 0
 2. of_int (dirichlet_inverse f i (Suc 0)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) (Suc 0)
 3. \<And>n. \<lbrakk>1 < n; \<And>k. k < n \<Longrightarrow> of_int (dirichlet_inverse f i k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) k\<rbrakk> \<Longrightarrow> of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
have "?A = (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d)) *
                  dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d) * dirichlet_inverse f i d)) = (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d)) * dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) d)
[PROOF STEP]
by (intro sum.cong refl) (auto simp: gt1)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d) * dirichlet_inverse f i d)) = (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d)) * dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) d)

goal (3 subgoals):
 1. of_int (dirichlet_inverse f i 0) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) 0
 2. of_int (dirichlet_inverse f i (Suc 0)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) (Suc 0)
 3. \<And>n. \<lbrakk>1 < n; \<And>k. k < n \<Longrightarrow> of_int (dirichlet_inverse f i k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) k\<rbrakk> \<Longrightarrow> of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d) * dirichlet_inverse f i d)) = (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d)) * dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) d)

goal (3 subgoals):
 1. of_int (dirichlet_inverse f i 0) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) 0
 2. of_int (dirichlet_inverse f i (Suc 0)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) (Suc 0)
 3. \<And>n. \<lbrakk>1 < n; \<And>k. k < n \<Longrightarrow> of_int (dirichlet_inverse f i k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) k\<rbrakk> \<Longrightarrow> of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
have "-(of_int i * \<dots>) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (of_int i * (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d)) * dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) d)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
using gt1.hyps
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. - (of_int i * (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d)) * dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) d)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
by (simp add: dirichlet_inverse_gt_1)
[PROOF STATE]
proof (state)
this:
- (of_int i * (\<Sum>d | d dvd n \<and> d < n. of_int (f (n div d)) * dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) d)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n

goal (3 subgoals):
 1. of_int (dirichlet_inverse f i 0) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) 0
 2. of_int (dirichlet_inverse f i (Suc 0)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) (Suc 0)
 3. \<And>n. \<lbrakk>1 < n; \<And>k. k < n \<Longrightarrow> of_int (dirichlet_inverse f i k) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) k\<rbrakk> \<Longrightarrow> of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n

goal (1 subgoal):
 1. of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
of_int (dirichlet_inverse f i n) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) n

goal (2 subgoals):
 1. of_int (dirichlet_inverse f i 0) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) 0
 2. of_int (dirichlet_inverse f i (Suc 0)) = dirichlet_inverse (\<lambda>n. of_int (f n)) (of_int i) (Suc 0)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma Ints_sum:
  assumes "\<And>a. a \<in> A \<Longrightarrow> f a \<in> \<int>"
  shows "sum f A \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A \<in> \<int>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?a \<in> A \<Longrightarrow> f ?a \<in> \<int>

goal (1 subgoal):
 1. sum f A \<in> \<int>
[PROOF STEP]
by (induction A rule: infinite_finite_induct) auto


[STATEMENT]
lemma oprod_Linear_order: "\<lbrakk>Linear_order r; Linear_order r'\<rbrakk> \<Longrightarrow> Linear_order (r *o r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Linear_order r; Linear_order r'\<rbrakk> \<Longrightarrow> Linear_order (r *o r')
[PROOF STEP]
unfolding linear_order_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Partial_order r \<and> Total r; Partial_order r' \<and> Total r'\<rbrakk> \<Longrightarrow> Partial_order (r *o r') \<and> Total (r *o r')
[PROOF STEP]
using oprod_Partial_order oprod_Total
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Partial_order ?r; Partial_order ?r'\<rbrakk> \<Longrightarrow> Partial_order (?r *o ?r')
\<lbrakk>Total ?r; Total ?r'\<rbrakk> \<Longrightarrow> Total (?r *o ?r')

goal (1 subgoal):
 1. \<lbrakk>Partial_order r \<and> Total r; Partial_order r' \<and> Total r'\<rbrakk> \<Longrightarrow> Partial_order (r *o r') \<and> Total (r *o r')
[PROOF STEP]
by blast


[STATEMENT]
lemma filtered_prop: "X \<noteq> {} \<Longrightarrow> (\<forall>x \<in> X. \<forall>y \<in> X. \<exists>z \<in> X. z \<le> x \<and> z \<le> y) \<Longrightarrow> filtered X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<noteq> {}; \<forall>x\<in>X. \<forall>y\<in>X. \<exists>z\<in>X. z \<le> x \<and> z \<le> y\<rbrakk> \<Longrightarrow> filtered X
[PROOF STEP]
by (simp add: dual_filtered dual_preorder.directed_prop)


[STATEMENT]
lemma typ_substitutions_only_on_free_variables:
  "(\<forall>x\<in>free_tv t. (S x) = (S' x)) \<Longrightarrow> $ S (t::typ) = $ S' t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>free_tv t. S x = S' x \<Longrightarrow> $ S t = $ S' t
[PROOF STEP]
by (induct t) simp_all


[STATEMENT]
lemma div_rounding_down[simp]: "(2*q - Suc 0) div 2 = (q - 1)" "(Suc (2*q)) div 2 = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 * q - Suc 0) div 2 = q - 1 &&& Suc (2 * q) div 2 = q
[PROOF STEP]
by arith+


[STATEMENT]
lemma fps_conv_radius_exp [simp]:
  fixes c :: "'a :: {banach, real_normed_field}"
  shows "fps_conv_radius (fps_exp c) = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_conv_radius (fps_exp c) = \<infinity>
[PROOF STEP]
unfolding fps_conv_radius_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius (fps_nth (fps_exp c)) = \<infinity>
[PROOF STEP]
proof (rule conv_radius_inftyI'')
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z. summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)
[PROOF STEP]
fix z :: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z. summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)
[PROOF STEP]
have "(\<lambda>n. norm (c * z) ^ n /\<^sub>R fact n) sums exp (norm (c * z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. norm (c * z) ^ n /\<^sub>R fact n) sums exp (norm (c * z))
[PROOF STEP]
by (rule exp_converges)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. norm (c * z) ^ n /\<^sub>R fact n) sums exp (norm (c * z))

goal (1 subgoal):
 1. \<And>z. summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. norm (c * z) ^ n /\<^sub>R fact n) sums exp (norm (c * z))

goal (1 subgoal):
 1. \<And>z. summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)
[PROOF STEP]
have "(\<lambda>n. norm (c * z) ^ n /\<^sub>R fact n) = (\<lambda>n. norm (fps_nth (fps_exp c) n * z ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. norm (c * z) ^ n /\<^sub>R fact n) = (\<lambda>n. norm (fps_nth (fps_exp c) n * z ^ n))
[PROOF STEP]
by (rule ext) (simp add: norm_divide norm_mult norm_power field_split_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. norm (c * z) ^ n /\<^sub>R fact n) = (\<lambda>n. norm (fps_nth (fps_exp c) n * z ^ n))

goal (1 subgoal):
 1. \<And>z. summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. norm (fps_nth (fps_exp c) n * z ^ n)) sums exp (norm (c * z))
[PROOF STEP]
have "summable \<dots>"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. norm (fps_nth (fps_exp c) n * z ^ n)) sums exp (norm (c * z))

goal (1 subgoal):
 1. summable (\<lambda>n. norm (fps_nth (fps_exp c) n * z ^ n))
[PROOF STEP]
by (simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. norm (fps_nth (fps_exp c) n * z ^ n))

goal (1 subgoal):
 1. \<And>z. summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)
[PROOF STEP]
thus "summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. norm (fps_nth (fps_exp c) n * z ^ n))

goal (1 subgoal):
 1. summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)
[PROOF STEP]
by (rule summable_norm_cancel)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. fps_nth (fps_exp c) n * z ^ n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power_minor_var:
  assumes "\<forall>w\<in>X. k\<le>|w|"
  shows "\<forall>w\<in>X\<^bsup>Suc n\<^esup>. n*k\<le>|w|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>w\<in>X\<^bsup>Suc n\<^esup>. n \<cdot> k \<le> |w|
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>w\<in>X. k \<le> |w|

goal (1 subgoal):
 1. \<forall>w\<in>X\<^bsup>Suc n\<^esup>. n \<cdot> k \<le> |w|
[PROOF STEP]
apply (auto simp add: l_prod_elim)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v. \<lbrakk>\<forall>w\<in>X. k \<le> |w|; u \<in> X; v \<in> X\<^bsup>n\<^esup>\<rbrakk> \<Longrightarrow> n \<cdot> k \<le> |u| + |v|
[PROOF STEP]
using length_lang_pow_lb trans_le_add2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<in>?X. ?k \<le> |x|; ?x \<in> ?X\<^bsup>?n\<^esup>\<rbrakk> \<Longrightarrow> ?k \<cdot> ?n \<le> |?x|
?i \<le> ?j \<Longrightarrow> ?i \<le> ?m + ?j

goal (1 subgoal):
 1. \<And>u v. \<lbrakk>\<forall>w\<in>X. k \<le> |w|; u \<in> X; v \<in> X\<^bsup>n\<^esup>\<rbrakk> \<Longrightarrow> n \<cdot> k \<le> |u| + |v|
[PROOF STEP]
by (simp add: length_lang_pow_lb trans_le_add2 mult.commute)


[STATEMENT]
lemma mirror_elem_Max: "
  \<lbrakk> finite I; I \<noteq> {} \<rbrakk> \<Longrightarrow> mirror_elem (Max I) I = iMin I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> mirror_elem (Max I) I = iMin I
[PROOF STEP]
unfolding mirror_elem_def nat_mirror_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> iMin I + Max I - Max I = iMin I
[PROOF STEP]
by simp


[STATEMENT]
lemma of_rat_power: "(of_rat (a ^ n) :: 'a::field_char_0) = of_rat a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (a ^ n) = of_rat a ^ n
[PROOF STEP]
by (induct n) (simp_all add: of_rat_mult)


[STATEMENT]
lemma in_box_complex_iff:
  "x \<in> box a b \<longleftrightarrow> Re x \<in> {Re a<..<Re b} \<and> Im x \<in> {Im a<..<Im b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> box a b) = (Re x \<in> {Re a<..<Re b} \<and> Im x \<in> {Im a<..<Im b})
[PROOF STEP]
by (cases x; cases a; cases b) (auto simp: box_Complex_eq)


[STATEMENT]
lemma sum_intro' [intro]:
  "\<lbrakk>finite (A :: 'a::join_semilattice_zero set); finite B; \<forall>a\<in>A. \<exists>b\<in>B. a \<le> b \<rbrakk> \<Longrightarrow> \<Sum>A \<le> \<Sum>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; \<forall>a\<in>A. \<exists>b\<in>B. a \<le> b\<rbrakk> \<Longrightarrow> \<Sum> A \<le> \<Sum> B
[PROOF STEP]
by (metis sum_intro)


[STATEMENT]
lemma mset_factorsD:
  assumes "mset_factors F p"
  shows "f \<in># F \<Longrightarrow> irreducible f" and "F \<noteq> {#}" and "prod_mset F = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in># F \<Longrightarrow> irreducible f) &&& F \<noteq> {#} &&& \<Prod>\<^sub># F = p
[PROOF STEP]
using assms[unfolded mset_factors_def]
[PROOF STATE]
proof (prove)
using this:
F \<noteq> {#} \<and> (\<forall>f. f \<in># F \<longrightarrow> irreducible f) \<and> p = \<Prod>\<^sub># F

goal (1 subgoal):
 1. (f \<in># F \<Longrightarrow> irreducible f) &&& F \<noteq> {#} &&& \<Prod>\<^sub># F = p
[PROOF STEP]
by auto


[STATEMENT]
lemma not_in_iff_zmset: "x \<notin>#\<^sub>z M \<longleftrightarrow> zcount M x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<notin>#\<^sub>z M) = (zcount M x = 0)
[PROOF STEP]
by (auto simp add: zcount_eq_zero_iff)


[STATEMENT]
lemma negate_eq2: "x \<in> V \<Longrightarrow> (- 1) \<cdot> x = - x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> V \<Longrightarrow> - 1 \<cdot> x = - x
[PROOF STEP]
by (rule negate_eq1 [symmetric])


[STATEMENT]
lemma first_coeff_le_tail:"(cmod (lead_coeff g))^2 \<le> (\<Sum>a\<leftarrow>coeffs g. (cmod a)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (lead_coeff g))\<^sup>2 \<le> norm2 g
[PROOF STEP]
proof(induct g)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (cmod (lead_coeff 0))\<^sup>2 \<le> norm2 0
 2. \<And>a g. \<lbrakk>a \<noteq> 0 \<or> g \<noteq> 0; (cmod (lead_coeff g))\<^sup>2 \<le> norm2 g\<rbrakk> \<Longrightarrow> (cmod (lead_coeff (pCons a g)))\<^sup>2 \<le> norm2 (pCons a g)
[PROOF STEP]
case (pCons a p)
[PROOF STATE]
proof (state)
this:
a \<noteq> 0 \<or> p \<noteq> 0
(cmod (lead_coeff p))\<^sup>2 \<le> norm2 p

goal (2 subgoals):
 1. (cmod (lead_coeff 0))\<^sup>2 \<le> norm2 0
 2. \<And>a g. \<lbrakk>a \<noteq> 0 \<or> g \<noteq> 0; (cmod (lead_coeff g))\<^sup>2 \<le> norm2 g\<rbrakk> \<Longrightarrow> (cmod (lead_coeff (pCons a g)))\<^sup>2 \<le> norm2 (pCons a g)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0 \<or> p \<noteq> 0
(cmod (lead_coeff p))\<^sup>2 \<le> norm2 p

goal (1 subgoal):
 1. (cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)
[PROOF STEP]
proof(cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (cmod (lead_coeff p))\<^sup>2 \<le> norm2 p; p = 0\<rbrakk> \<Longrightarrow> (cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)
 2. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (cmod (lead_coeff p))\<^sup>2 \<le> norm2 p; p \<noteq> 0\<rbrakk> \<Longrightarrow> (cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (2 subgoals):
 1. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (cmod (lead_coeff p))\<^sup>2 \<le> norm2 p; p = 0\<rbrakk> \<Longrightarrow> (cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)
 2. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (cmod (lead_coeff p))\<^sup>2 \<le> norm2 p; p \<noteq> 0\<rbrakk> \<Longrightarrow> (cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)
[PROOF STEP]
using pCons
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0 \<or> p \<noteq> 0
(cmod (lead_coeff p))\<^sup>2 \<le> norm2 p

goal (1 subgoal):
 1. (cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)
[PROOF STEP]
unfolding lead_coeff_pCons(1)[OF False]
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0 \<or> p \<noteq> 0
(cmod (lead_coeff p))\<^sup>2 \<le> norm2 p

goal (1 subgoal):
 1. (cmod (lead_coeff p))\<^sup>2 \<le> norm2 (pCons a p)
[PROOF STEP]
by(cases "a = 0",simp_all add:ineq_about_squares)
[PROOF STATE]
proof (state)
this:
(cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)

goal (1 subgoal):
 1. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (cmod (lead_coeff p))\<^sup>2 \<le> norm2 p; p = 0\<rbrakk> \<Longrightarrow> (cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
(cmod (lead_coeff (pCons a p)))\<^sup>2 \<le> norm2 (pCons a p)

goal (1 subgoal):
 1. (cmod (lead_coeff 0))\<^sup>2 \<le> norm2 0
[PROOF STEP]
qed simp


[STATEMENT]
lemma approx_FreeUltrafilterNat_iff2:
  "star_n X \<approx> star_n Y \<longleftrightarrow> (\<forall>m. eventually (\<lambda>n. norm (X n - Y n) < inverse (real (Suc m))) \<U>)"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))
[PROOF STEP]
have "?lhs = (star_n X - star_n Y \<approx> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (star_n X \<approx> star_n Y) = (star_n X - star_n Y \<approx> 0)
[PROOF STEP]
using approx_minus_iff
[PROOF STATE]
proof (prove)
using this:
(?x \<approx> ?y) = (?x - ?y \<approx> 0)

goal (1 subgoal):
 1. (star_n X \<approx> star_n Y) = (star_n X - star_n Y \<approx> 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(star_n X \<approx> star_n Y) = (star_n X - star_n Y \<approx> 0)

goal (1 subgoal):
 1. (star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(star_n X \<approx> star_n Y) = (star_n X - star_n Y \<approx> 0)

goal (1 subgoal):
 1. (star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))
[PROOF STEP]
have "... = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (star_n X - star_n Y \<approx> 0) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))
[PROOF STEP]
by (metis (full_types) Infinitesimal_FreeUltrafilterNat_iff2 mem_infmal_iff star_n_diff)
[PROOF STATE]
proof (state)
this:
(star_n X - star_n Y \<approx> 0) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))

goal (1 subgoal):
 1. (star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))

goal (1 subgoal):
 1. (star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(star_n X \<approx> star_n Y) = (\<forall>m. \<forall>\<^sub>F n in \<U>. norm (X n - Y n) < inverse (real (Suc m)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rats_eq_range_nat_to_rat_surj: "\<rat> = range nat_to_rat_surj"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rat> = range nat_to_rat_surj
[PROOF STEP]
by (simp add: Rats_def surj_nat_to_rat_surj)


[STATEMENT]
lemma cot_minus [simp]: "cot (- x) = - cot x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot (- x) = - cot x
[PROOF STEP]
by (simp add: cot_def)


[STATEMENT]
lemma Ball_rangeC_iff:
  "(\<forall>x \<in> rangeC A. P x) \<longleftrightarrow> (\<forall>f \<in> A. \<forall>x. P (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>rangeC A. P x) = (\<forall>f\<in>A. \<forall>x. P (f x))
[PROOF STEP]
by(auto intro: in_rangeC elim: in_rangeCE)


[STATEMENT]
lemma closed_seqs_memE:
  assumes "s \<in> closed_seqs R"
  shows "s k \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s k \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s \<in> carrier R\<^bsup>\<omega>\<^esup>

goal (1 subgoal):
 1. s k \<in> carrier R
[PROOF STEP]
unfolding nat_seqs_def function_ring_def
[PROOF STATE]
proof (prove)
using this:
s \<in> carrier \<lparr>carrier = UNIV \<rightarrow>\<^sub>E carrier R, mult = function_mult UNIV R, one = function_one UNIV R, zero = function_zero UNIV R, add = function_add UNIV R, smult = function_scalar_mult UNIV R\<rparr>

goal (1 subgoal):
 1. s k \<in> carrier R
[PROOF STEP]
by (simp add: PiE_iff)


[STATEMENT]
lemma relative_to_Int:
   "\<lbrakk>(P relative_to S) C; (P relative_to S) D; \<And>X Y. \<lbrakk>P X; P Y\<rbrakk> \<Longrightarrow> P(X \<inter> Y)\<rbrakk>
         \<Longrightarrow>  (P relative_to S) (C \<inter> D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(P relative_to S) C; (P relative_to S) D; \<And>X Y. \<lbrakk>P X; P Y\<rbrakk> \<Longrightarrow> P (X \<inter> Y)\<rbrakk> \<Longrightarrow> (P relative_to S) (C \<inter> D)
[PROOF STEP]
unfolding relative_to_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>U. P U \<and> S \<inter> U = C; \<exists>U. P U \<and> S \<inter> U = D; \<And>X Y. \<lbrakk>P X; P Y\<rbrakk> \<Longrightarrow> P (X \<inter> Y)\<rbrakk> \<Longrightarrow> \<exists>U. P U \<and> S \<inter> U = C \<inter> D
[PROOF STEP]
by auto


[STATEMENT]
theorem binsert_sorted: "sorted t --> sorted (binsert x t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. BinaryTree_TacticStyle.sorted t \<longrightarrow> BinaryTree_TacticStyle.sorted (binsert x t)
[PROOF STEP]
by (induct t) (auto simp add: set_of_binsert)


[STATEMENT]
lemma gcd_impl_rec_code:
  "gcd_impl_rec Gi_1 Gi ni_1 d1_1 hi_2 = (
    let pmod = pseudo_mod Gi_1 Gi
     in
     if pmod = 0 then Gi
        else let
           ni = degree Gi;
           d1 = ni_1 - ni;
           gi_1 = lead_coeff Gi_1;
           hi_1 = (if d1_1 = 1 then gi_1 else div_exp gi_1 hi_2 d1_1);
           divisor = if d1 = 1 then gi_1 * hi_1 else if even d1 then - gi_1 * hi_1 ^ d1 else gi_1 * hi_1 ^ d1;
           Gi_p1 = sdiv_poly pmod divisor
       in gcd_impl_rec Gi Gi_p1 ni d1 hi_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd_impl_rec Gi_1 Gi ni_1 d1_1 hi_2 = (let pmod = pseudo_mod Gi_1 Gi in if pmod = 0 then Gi else let ni = degree Gi; d1 = ni_1 - ni; gi_1 = lead_coeff Gi_1; hi_1 = if d1_1 = 1 then gi_1 else div_exp gi_1 hi_2 d1_1; divisor = if d1 = 1 then gi_1 * hi_1 else if even d1 then - gi_1 * hi_1 ^ d1 else gi_1 * hi_1 ^ d1; Gi_p1 = sdiv_poly pmod divisor in gcd_impl_rec Gi Gi_p1 ni d1 hi_1)
[PROOF STEP]
unfolding gcd_impl_rec_def subresultant_prs_main_impl.simps[of _ Gi_1] split Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if pseudo_mod Gi_1 Gi = 0 then fst (Gi, if ni_1 - degree Gi = 1 then lead_coeff Gi else div_exp (lead_coeff Gi) (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) (ni_1 - degree Gi)) else subresultant_prs_main_impl fst Gi (sdiv_poly (pseudo_mod Gi_1 Gi) ((- (1::'a)) ^ (ni_1 - degree Gi + 1) * lead_coeff Gi_1 * (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) ^ (ni_1 - degree Gi))) (degree Gi) (ni_1 - degree Gi) (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1)) = (if pseudo_mod Gi_1 Gi = 0 then Gi else subresultant_prs_main_impl fst Gi (sdiv_poly (pseudo_mod Gi_1 Gi) (if ni_1 - degree Gi = 1 then lead_coeff Gi_1 * (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) else if even (ni_1 - degree Gi) then - lead_coeff Gi_1 * (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) ^ (ni_1 - degree Gi) else lead_coeff Gi_1 * (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) ^ (ni_1 - degree Gi))) (degree Gi) (ni_1 - degree Gi) (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1))
[PROOF STEP]
unfolding gcd_impl_rec_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if pseudo_mod Gi_1 Gi = 0 then fst (Gi, if ni_1 - degree Gi = 1 then lead_coeff Gi else div_exp (lead_coeff Gi) (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) (ni_1 - degree Gi)) else gcd_impl_rec Gi (sdiv_poly (pseudo_mod Gi_1 Gi) ((- (1::'a)) ^ (ni_1 - degree Gi + 1) * lead_coeff Gi_1 * (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) ^ (ni_1 - degree Gi))) (degree Gi) (ni_1 - degree Gi) (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1)) = (if pseudo_mod Gi_1 Gi = 0 then Gi else gcd_impl_rec Gi (sdiv_poly (pseudo_mod Gi_1 Gi) (if ni_1 - degree Gi = 1 then lead_coeff Gi_1 * (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) else if even (ni_1 - degree Gi) then - lead_coeff Gi_1 * (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) ^ (ni_1 - degree Gi) else lead_coeff Gi_1 * (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1) ^ (ni_1 - degree Gi))) (degree Gi) (ni_1 - degree Gi) (if d1_1 = 1 then lead_coeff Gi_1 else div_exp (lead_coeff Gi_1) hi_2 d1_1))
[PROOF STEP]
by (rule if_cong, auto)


[STATEMENT]
lemma val_of_power:
  assumes "a \<in> nonzero Q\<^sub>p"
  shows "val (a[^](n::nat)) = n*(val a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (a [^] n) = eint (int n) * val a
[PROOF STEP]
unfolding val_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if a [^] n = \<zero> then \<infinity> else eint (ord (a [^] n))) = eint (int n) * (if a = \<zero> then \<infinity> else eint (ord a))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. (if a [^] n = \<zero> then \<infinity> else eint (ord (a [^] n))) = eint (int n) * (if a = \<zero> then \<infinity> else eint (ord a))
[PROOF STEP]
by (simp add: Qp.nonzero_memE(2) Qp_nat_pow_nonzero nonzero_nat_pow_ord)


[STATEMENT]
lemma ccINF_inf_distrib: "countable A \<Longrightarrow> inf (INF a\<in>A. f a) (INF a\<in>A. g a) = (INF a\<in>A. inf (f a) (g a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable A \<Longrightarrow> inf (Inf (f ` A)) (Inf (g ` A)) = (INF a\<in>A. inf (f a) (g a))
[PROOF STEP]
by (rule order.antisym) (rule ccINF_greatest, auto intro: le_infI1 le_infI2 ccINF_lower ccINF_mono)


[STATEMENT]
lemma "(\<forall>x. (\<exists>y. P(y) \<and> x=f(y)) \<longrightarrow> P(x)) = (\<forall>x. P(x) \<longrightarrow> P(f(x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. (\<exists>y. P y \<and> x = f y) \<longrightarrow> P x) = (\<forall>x. P x \<longrightarrow> P (f x))
[PROOF STEP]
by iprover


[STATEMENT]
lemma extreme_point_of_convex_hull_affine_independent:
  fixes S :: "'a::euclidean_space set"
  shows
   "\<not> affine_dependent S
         \<Longrightarrow> (x extreme_point_of (convex hull S) \<longleftrightarrow> x \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> (x extreme_point_of convex hull S) = (x \<in> S)
[PROOF STEP]
by (metis aff_independent_finite affine_dependent_def affine_hull_convex_hull extreme_point_of_convex_hull_convex_independent finite_imp_compact hull_inc)


[STATEMENT]
lemma "p < q \<Longrightarrow> (\<lambda>x::real. c * x powr p * ln x powr r) \<in> o(\<lambda>x::real. x powr q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p < q \<Longrightarrow> (\<lambda>x. c * x powr p * ln x powr r) \<in> o(\<lambda>x. x powr q)
[PROOF STEP]
by simp


[STATEMENT]
lemma rtranclp_eqvt[eqvt]: "\<pi> \<bullet> rtranclp P v\<^sub>1 v\<^sub>2 = rtranclp (\<pi> \<bullet> P) (\<pi> \<bullet> v\<^sub>1) (\<pi> \<bullet> v\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> \<bullet> P\<^sup>*\<^sup>* v\<^sub>1 v\<^sub>2 = (\<pi> \<bullet> P)\<^sup>*\<^sup>* (\<pi> \<bullet> v\<^sub>1) (\<pi> \<bullet> v\<^sub>2)
[PROOF STEP]
unfolding rtranclp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> \<bullet> lfp (\<lambda>p x1 x2. (\<exists>a. x1 = a \<and> x2 = a) \<or> (\<exists>a b c. x1 = a \<and> x2 = c \<and> p a b \<and> P b c)) v\<^sub>1 v\<^sub>2 = lfp (\<lambda>p x1 x2. (\<exists>a. x1 = a \<and> x2 = a) \<or> (\<exists>a b c. x1 = a \<and> x2 = c \<and> p a b \<and> (\<pi> \<bullet> P) b c)) (\<pi> \<bullet> v\<^sub>1) (\<pi> \<bullet> v\<^sub>2)
[PROOF STEP]
by perm_simp rule


[STATEMENT]
lemma det_row_add_iterate_upt_n:
fixes A::"'a::{comm_ring_1}^'n::{mod_type}^'n::{mod_type}"
assumes n: "n<nrows A"
shows "det (row_add_iterate A n i j) = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add_iterate A n i j) = det A
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
n < nrows A

goal (1 subgoal):
 1. det (row_add_iterate A n i j) = det A
[PROOF STEP]
proof (induct n arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. 0 < nrows A \<Longrightarrow> det (row_add_iterate A 0 i j) = det A
 2. \<And>n A. \<lbrakk>\<And>A. n < nrows A \<Longrightarrow> det (row_add_iterate A n i j) = det A; Suc n < nrows A\<rbrakk> \<Longrightarrow> det (row_add_iterate A (Suc n) i j) = det A
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < nrows A

goal (2 subgoals):
 1. \<And>A. 0 < nrows A \<Longrightarrow> det (row_add_iterate A 0 i j) = det A
 2. \<And>n A. \<lbrakk>\<And>A. n < nrows A \<Longrightarrow> det (row_add_iterate A n i j) = det A; Suc n < nrows A\<rbrakk> \<Longrightarrow> det (row_add_iterate A (Suc n) i j) = det A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add_iterate A 0 i j) = det A
[PROOF STEP]
unfolding row_add_iterate.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (if i = (0::'n) then A else row_add A (0::'n) i (- A $ (0::'n) $ j)) = det A
[PROOF STEP]
using det_row_add'[of 0 i A]
[PROOF STATE]
proof (prove)
using this:
(0::'n) \<noteq> i \<Longrightarrow> det (row_add A (0::'n) i ?q) = det A

goal (1 subgoal):
 1. det (if i = (0::'n) then A else row_add A (0::'n) i (- A $ (0::'n) $ j)) = det A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det (row_add_iterate A 0 i j) = det A

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. n < nrows A \<Longrightarrow> det (row_add_iterate A n i j) = det A; Suc n < nrows A\<rbrakk> \<Longrightarrow> det (row_add_iterate A (Suc n) i j) = det A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. n < nrows A \<Longrightarrow> det (row_add_iterate A n i j) = det A; Suc n < nrows A\<rbrakk> \<Longrightarrow> det (row_add_iterate A (Suc n) i j) = det A
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
n < nrows ?A \<Longrightarrow> det (row_add_iterate ?A n i j) = det ?A
Suc n < nrows A

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. n < nrows A \<Longrightarrow> det (row_add_iterate A n i j) = det A; Suc n < nrows A\<rbrakk> \<Longrightarrow> det (row_add_iterate A (Suc n) i j) = det A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add_iterate A (Suc n) i j) = det A
[PROOF STEP]
unfolding row_add_iterate.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (if Suc n = mod_type_class.to_nat i then row_add_iterate A n i j else row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc n = mod_type_class.to_nat i \<Longrightarrow> det (row_add_iterate A n i j) = det A
 2. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
show "det (row_add_iterate A n i j) = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add_iterate A n i j) = det A
[PROOF STEP]
using Suc.hyps Suc.prems
[PROOF STATE]
proof (prove)
using this:
n < nrows ?A \<Longrightarrow> det (row_add_iterate ?A n i j) = det ?A
Suc n < nrows A

goal (1 subgoal):
 1. det (row_add_iterate A n i j) = det A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (row_add_iterate A n i j) = det A

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
assume Suc_n_not_i: "Suc n \<noteq> to_nat i"
[PROOF STATE]
proof (state)
this:
Suc n \<noteq> mod_type_class.to_nat i

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
have "det (row_add_iterate (row_add A (from_nat (Suc n)) i (- A $ from_nat (Suc n) $ j)) n i j)
= det (row_add A (from_nat (Suc n)) i (- A $ from_nat (Suc n) $ j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j))
[PROOF STEP]
proof (rule Suc.hyps, unfold nrows_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n < CARD('n)
[PROOF STEP]
show " n < CARD('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < CARD('n)
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc n < nrows A

goal (1 subgoal):
 1. n < CARD('n)
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
Suc n < CARD('n)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j))

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j))

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
have "... = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) = det A
[PROOF STEP]
proof (rule det_row_add',rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mod_type_class.from_nat (Suc n) = i \<Longrightarrow> False
[PROOF STEP]
assume "from_nat (Suc n) = i"
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat (Suc n) = i

goal (1 subgoal):
 1. mod_type_class.from_nat (Suc n) = i \<Longrightarrow> False
[PROOF STEP]
hence "to_nat (from_nat (Suc n)::'n) = to_nat i"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.from_nat (Suc n) = i

goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat (Suc n)) = mod_type_class.to_nat i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (mod_type_class.from_nat (Suc n)) = mod_type_class.to_nat i

goal (1 subgoal):
 1. mod_type_class.from_nat (Suc n) = i \<Longrightarrow> False
[PROOF STEP]
hence "(Suc n) = to_nat i"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat (mod_type_class.from_nat (Suc n)) = mod_type_class.to_nat i

goal (1 subgoal):
 1. Suc n = mod_type_class.to_nat i
[PROOF STEP]
unfolding to_nat_from_nat_id[OF Suc.prems[unfolded nrows_def]]
[PROOF STATE]
proof (prove)
using this:
Suc n = mod_type_class.to_nat i

goal (1 subgoal):
 1. Suc n = mod_type_class.to_nat i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Suc n = mod_type_class.to_nat i

goal (1 subgoal):
 1. mod_type_class.from_nat (Suc n) = i \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
Suc n = mod_type_class.to_nat i

goal (1 subgoal):
 1. False
[PROOF STEP]
using Suc_n_not_i
[PROOF STATE]
proof (prove)
using this:
Suc n = mod_type_class.to_nat i
Suc n \<noteq> mod_type_class.to_nat i

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) = det A

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
show "det (row_add_iterate (row_add A (from_nat (Suc n)) i (- A $ from_nat (Suc n) $ j)) n i j) = det A"
[PROOF STATE]
proof (prove)
using this:
det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A

goal (1 subgoal):
 1. det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det (row_add_iterate (row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)) n i j) = det A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (row_add_iterate A (Suc n) i j) = det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_Sum_any_not_eq_zero_weakenI:
  assumes "finite {a. \<exists>b. f a b \<noteq> 0}"
  shows "finite {a. Sum_any (f a) \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {a. Sum_any (f a) \<noteq> (0::'c)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {a. Sum_any (f a) \<noteq> (0::'c)}
[PROOF STEP]
have "{a. Sum_any (f a) \<noteq> 0} \<subseteq> {a. \<exists>b. f a b \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a. Sum_any (f a) \<noteq> (0::'c)} \<subseteq> {a. \<exists>b. f a b \<noteq> (0::'c)}
[PROOF STEP]
by (auto elim: Sum_any.not_neutral_obtains_not_neutral)
[PROOF STATE]
proof (state)
this:
{a. Sum_any (f a) \<noteq> (0::'c)} \<subseteq> {a. \<exists>b. f a b \<noteq> (0::'c)}

goal (1 subgoal):
 1. finite {a. Sum_any (f a) \<noteq> (0::'c)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{a. Sum_any (f a) \<noteq> (0::'c)} \<subseteq> {a. \<exists>b. f a b \<noteq> (0::'c)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{a. Sum_any (f a) \<noteq> (0::'c)} \<subseteq> {a. \<exists>b. f a b \<noteq> (0::'c)}

goal (1 subgoal):
 1. finite {a. Sum_any (f a) \<noteq> (0::'c)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{a. Sum_any (f a) \<noteq> (0::'c)} \<subseteq> {a. \<exists>b. f a b \<noteq> (0::'c)}
finite {a. \<exists>b. f a b \<noteq> (0::'c)}

goal (1 subgoal):
 1. finite {a. Sum_any (f a) \<noteq> (0::'c)}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {a. Sum_any (f a) \<noteq> (0::'c)}

goal:
No subgoals!
[PROOF STEP]
qed