[STATEMENT]
lemma lhs_dot_rewrite:
  fixes p:: "real poly"
  fixes qs:: "real poly list"
  fixes I:: "nat list*nat list"
  fixes signs:: "rat list list"
  assumes nonzero: "p\<noteq>0"
  shows
    "(vec_of_list (mtx_row_R signs I) \<bullet> (construct_lhs_vector_R p qs signs)) =
   sum_list (map (\<lambda>s. (z_R I s)  *  rat_of_int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})) signs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))
[PROOF STEP]
have "p \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
using nonzero
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

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

goal (1 subgoal):
 1. vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))
[PROOF STEP]
from construct_lhs_vector_cleaner[OF this]
[PROOF STATE]
proof (chain)
picking this:
w_vec p ?qs ?signs = vec_of_list (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr ?qs x = s}))) ?signs)
[PROOF STEP]
have rhseq: "construct_lhs_vector_R p qs signs =
    vec_of_list
    (map (\<lambda>s. rat_of_int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})) signs)"
[PROOF STATE]
proof (prove)
using this:
w_vec p ?qs ?signs = vec_of_list (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr ?qs x = s}))) ?signs)

goal (1 subgoal):
 1. construct_lhs_vector_R p qs signs = vec_of_list (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs)
[PROOF STEP]
using construct_lhs_vector_cleaner_R nonzero
[PROOF STATE]
proof (prove)
using this:
w_vec p ?qs ?signs = vec_of_list (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr ?qs x = s}))) ?signs)
?p \<noteq> 0 \<Longrightarrow> construct_lhs_vector_R ?p ?qs ?signs = vec_of_list (map (\<lambda>s. rat_of_int (int (card {x. poly ?p x = 0 \<and> consistent_sign_vec ?qs x = s}))) ?signs)
p \<noteq> 0

goal (1 subgoal):
 1. construct_lhs_vector_R p qs signs = vec_of_list (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
construct_lhs_vector_R p qs signs = vec_of_list (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs)

goal (1 subgoal):
 1. vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))
[PROOF STEP]
have "(vec_of_list (mtx_row_R signs I) \<bullet> (construct_lhs_vector_R p qs signs)) =
    sum_list (map2 (*) (mtx_row_R signs I) (map (\<lambda>s. rat_of_int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})) signs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = sum_list (map2 (*) (mtx_row_R signs I) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs))
[PROOF STEP]
unfolding rhseq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (mtx_row_R signs I) \<bullet> vec_of_list (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs) = sum_list (map2 (*) (mtx_row_R signs I) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs))
[PROOF STEP]
apply (intro vec_of_list_dot_rewrite)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (mtx_row_R signs I) = length (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs)
[PROOF STEP]
by (auto simp add: mtx_row_R_def)
[PROOF STATE]
proof (state)
this:
vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = sum_list (map2 (*) (mtx_row_R signs I) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs))

goal (1 subgoal):
 1. vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = sum_list (map2 (*) (mtx_row_R signs I) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs))

goal (1 subgoal):
 1. vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))
[PROOF STEP]
unfolding mtx_row_R_def
[PROOF STATE]
proof (prove)
using this:
vec_of_list (map (z_R I) signs) \<bullet> construct_lhs_vector_R p qs signs = sum_list (map2 (*) (map (z_R I) signs) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs))

goal (1 subgoal):
 1. vec_of_list (map (z_R I) signs) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))
[PROOF STEP]
using map2_map_map
[PROOF STATE]
proof (prove)
using this:
vec_of_list (map (z_R I) signs) \<bullet> construct_lhs_vector_R p qs signs = sum_list (map2 (*) (map (z_R I) signs) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s}))) signs))
map2 ?h (map ?f ?xs) (map ?g ?xs) = map (\<lambda>x. ?h (?f x) (?g x)) ?xs

goal (1 subgoal):
 1. vec_of_list (map (z_R I) signs) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))
[PROOF STEP]
by (auto simp add: map2_map_map)
[PROOF STATE]
proof (state)
this:
vec_of_list (mtx_row_R signs I) \<bullet> construct_lhs_vector_R p qs signs = (\<Sum>s\<leftarrow>signs. z_R I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = s})))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fetch_left_moving_o:
  "(fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 5) Oc)
 = (L, 2*n + 6)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 5) Oc = (L, 2 * n + 6)
[PROOF STEP]
apply(subgoal_tac "length (mopup_a n) = 4 * n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (mopup_a n) = 4 * n \<Longrightarrow> fetch (mopup_a n @ shift mopup_b (2 * n)) (2 * n + 5) Oc = (L, 2 * n + 6)
 2. length (mopup_a n) = 4 * n
[PROOF STEP]
apply(subgoal_tac "2*n + 5 = Suc (2*n + 4)", simp only: fetch.simps)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>length (mopup_a n) = 4 * n; 2 * n + 5 = Suc (2 * n + 4)\<rbrakk> \<Longrightarrow> (case nth_of (mopup_a n @ shift mopup_b (2 * n)) (2 * (2 * n + 4) + 1) of None \<Rightarrow> (Nop, 0) | Some i \<Rightarrow> i) = (L, 2 * n + 6)
 2. length (mopup_a n) = 4 * n \<Longrightarrow> 2 * n + 5 = Suc (2 * n + 4)
 3. length (mopup_a n) = 4 * n
[PROOF STEP]
apply(auto simp: mopup_b_def nth_append shift.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Re_divide: "Re (x / y) = (Re x * Re y + Im x * Im y) / ((Re y)\<^sup>2 + (Im y)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (x / y) = (Re x * Re y + Im x * Im y) / ((Re y)\<^sup>2 + (Im y)\<^sup>2)
[PROOF STEP]
by (simp add: divide_complex_def add_divide_distrib)


[STATEMENT]
lemma matrix_to_iarray_inverse:
  fixes A::"'a::{euclidean_ring_gcd}^'n::{mod_type}^'n::{mod_type}"
  shows"matrix_to_iarray_option (inverse_matrix A) = inverse_matrix_ring_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray_option (inverse_matrix A) = inverse_matrix_ring_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding inverse_matrix_ring_iarray_def inverse_matrix_code_rings matrix_to_iarray_option_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if (let d = det A in if is_unit d then Some ((1::'a) div d *k adjugate A) else None) \<noteq> None then Some (matrix_to_iarray (the (let d = det A in if is_unit d then Some ((1::'a) div d *k adjugate A) else None))) else None) = (let d = det_iarrays_rings (matrix_to_iarray A) in if is_unit d then Some ((1::'a) div d *ssi adjugate_iarrays (matrix_to_iarray A)) else None)
[PROOF STEP]
unfolding matrix_to_iarray_det_euclidean_ring matrix_to_iarray_adjugate
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if (let d = det_iarrays_rings (matrix_to_iarray A) in if is_unit d then Some ((1::'a) div d *k adjugate A) else None) \<noteq> None then Some (matrix_to_iarray (the (let d = det_iarrays_rings (matrix_to_iarray A) in if is_unit d then Some ((1::'a) div d *k adjugate A) else None))) else None) = (let d = det_iarrays_rings (matrix_to_iarray A) in if is_unit d then Some ((1::'a) div d *ssi adjugate_iarrays (matrix_to_iarray A)) else None)
[PROOF STEP]
by (simp add: matrix_to_iarray_adjugate matrix_to_iarray_scalar_matrix_mult Let_def)


[STATEMENT]
lemma Pr_before_C:
  assumes L: "L \<subseteq> H"
  shows "\<P>(\<omega> in \<PP>. before_C L \<omega> \<bar> hit_C \<omega> ) =
    card L * p_j * p_f + (\<Sum>l\<in>L. p_i l) * (1 - p_H * p_f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
have "\<P>(\<omega> in \<PP>. before_C L \<omega> \<bar> hit_C \<omega> ) =
    \<P>(\<omega> in \<PP>. visit H J \<omega> \<and> before_C L \<omega> \<bar> hit_C \<omega> )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cond_prob \<PP> (before_C L) hit_C = cond_prob \<PP> (\<lambda>\<omega>. visit H J \<omega> \<and> before_C L \<omega>) hit_C
[PROOF STEP]
using AE_visit
[PROOF STATE]
proof (prove)
using this:
almost_everywhere \<PP> (visit H J)

goal (1 subgoal):
 1. cond_prob \<PP> (before_C L) hit_C = cond_prob \<PP> (\<lambda>\<omega>. visit H J \<omega> \<and> before_C L \<omega>) hit_C
[PROOF STEP]
by (auto intro!: T.cond_prob_eq_AE)
[PROOF STATE]
proof (state)
this:
cond_prob \<PP> (before_C L) hit_C = cond_prob \<PP> (\<lambda>\<omega>. visit H J \<omega> \<and> before_C L \<omega>) hit_C

goal (1 subgoal):
 1. cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cond_prob \<PP> (before_C L) hit_C = cond_prob \<PP> (\<lambda>\<omega>. visit H J \<omega> \<and> before_C L \<omega>) hit_C

goal (1 subgoal):
 1. cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
have "\<dots> = card L * p_j * p_f + (\<Sum>i\<in>L. p_i i) * (1 - p_H * p_f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cond_prob \<PP> (\<lambda>\<omega>. visit H J \<omega> \<and> before_C L \<omega>) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
using L
[PROOF STATE]
proof (prove)
using this:
L \<subseteq> H

goal (1 subgoal):
 1. cond_prob \<PP> (\<lambda>\<omega>. visit H J \<omega> \<and> before_C L \<omega>) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
by (subst Pr_visit_before_C[OF L order_refl]) (auto simp: Int_absorb1)
[PROOF STATE]
proof (state)
this:
cond_prob \<PP> (\<lambda>\<omega>. visit H J \<omega> \<and> before_C L \<omega>) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)

goal (1 subgoal):
 1. cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)

goal (1 subgoal):
 1. cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cond_prob \<PP> (before_C L) hit_C = real (card L) * p_j * p_f + sum p_i L * (1 - p_H * p_f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mk_poly2_sylvester_upper:
  fixes p q :: "'a :: comm_semiring_1 poly"
  assumes i: "i < degree q"
  shows "mk_poly2 (sylvester_mat p q) $ i = monom 1 (degree q - Suc i) * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_poly2 (sylvester_mat p q) $ i = monom (1::'a) (degree q - Suc i) * p
[PROOF STEP]
apply (subst mk_poly2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. i < dim_row (sylvester_mat p q)
 2. 0 < dim_col (sylvester_mat p q)
 3. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree q - Suc i) * p
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < degree q

goal (3 subgoals):
 1. i < dim_row (sylvester_mat p q)
 2. 0 < dim_col (sylvester_mat p q)
 3. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree q - Suc i) * p
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < dim_col (sylvester_mat p q)
 2. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree q - Suc i) * p
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < degree q

goal (2 subgoals):
 1. 0 < dim_col (sylvester_mat p q)
 2. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree q - Suc i) * p
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree q - Suc i) * p
[PROOF STEP]
apply (subst sylvester_sum_mat_upper[OF i,symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = (\<Sum>j<degree p + degree q. monom (sylvester_mat p q $$ (i, j)) (degree p + degree q - Suc j))
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {..<dim_col (sylvester_mat p q)} = {..<degree p + degree q}
 2. \<And>x. x \<in> {..<degree p + degree q} \<Longrightarrow> monom (sylvester_mat p q $$ (i, x)) (dim_col (sylvester_mat p q) - Suc x) = monom (sylvester_mat p q $$ (i, x)) (degree p + degree q - Suc x)
[PROOF STEP]
unfolding sylvester_mat_dim lessThan_Suc_atMost
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {..<degree p + degree q} = {..<degree p + degree q}
 2. \<And>x. x \<in> {..<degree p + degree q} \<Longrightarrow> monom (sylvester_mat p q $$ (i, x)) (degree p + degree q - Suc x) = monom (sylvester_mat p q $$ (i, x)) (degree p + degree q - Suc x)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<degree p + degree q} \<Longrightarrow> monom (sylvester_mat p q $$ (i, x)) (degree p + degree q - Suc x) = monom (sylvester_mat p q $$ (i, x)) (degree p + degree q - Suc x)
[PROOF STEP]
by auto


[STATEMENT]
lemma prod_exp:
  fixes x::real
  shows "4*(x*y) = (x+y)^2 - (x-y)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * (x * y) = (x + y)\<^sup>2 - (x - y)\<^sup>2
[PROOF STEP]
by (simp add: power2_diff power2_sum)


[STATEMENT]
lemma matrix_vector_mul_component: "(A *v x)$k = inner (A$k) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A *v x) $ k = inner (A $ k) x
[PROOF STEP]
by (simp add: matrix_vector_mult_def inner_vec_def)


[STATEMENT]
lemma independent_image_matrix_vector_mult:
  fixes P::"'a::{field}^'n^'m"
  assumes ind_B: "vec.independent B" and inv_P: "invertible P"
  shows "vec.independent (((*v) P)` B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent ((*v) P ` B)
[PROOF STEP]
proof (rule vec.independent_injective_image)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vec.independent B
 2. inj_on ((*v) P) (vec.span B)
[PROOF STEP]
show "vec.independent B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent B
[PROOF STEP]
using ind_B
[PROOF STATE]
proof (prove)
using this:
vec.independent B

goal (1 subgoal):
 1. vec.independent B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec.independent B

goal (1 subgoal):
 1. inj_on ((*v) P) (vec.span B)
[PROOF STEP]
show "inj_on ((*v) P) (vec.span B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((*v) P) (vec.span B)
[PROOF STEP]
using inj_matrix_vector_mult[OF inv_P]
[PROOF STATE]
proof (prove)
using this:
inj ((*v) P)

goal (1 subgoal):
 1. inj_on ((*v) P) (vec.span B)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. P *v x = P *v y \<longrightarrow> x = y

goal (1 subgoal):
 1. \<forall>x\<in>vec.span B. \<forall>y\<in>vec.span B. P *v x = P *v y \<longrightarrow> x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj_on ((*v) P) (vec.span B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_one [simp]: "\<lfloor>1\<rfloor> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>1::'a\<rfloor> = 1
[PROOF STEP]
using floor_of_int [of 1]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_int 1\<rfloor> = 1

goal (1 subgoal):
 1. \<lfloor>1::'a\<rfloor> = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma integrable_affinity:
  assumes "f integrable_on cbox a b"
    and "m \<noteq> 0"
  shows "(\<lambda>x. f(m *\<^sub>R x + c)) integrable_on ((\<lambda>x. (1 / m) *\<^sub>R x + -((1/m) *\<^sub>R c)) ` cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (m *\<^sub>R x + c)) integrable_on (\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b
[PROOF STEP]
using has_integral_affinity assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f has_integral ?i) (cbox ?a ?b); ?m \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. ?f (?m *\<^sub>R x + ?c)) has_integral (1 / \<bar>?m\<bar> ^ DIM(?'a)) *\<^sub>R ?i) ((\<lambda>x. (1 / ?m) *\<^sub>R x + - ((1 / ?m) *\<^sub>R ?c)) ` cbox ?a ?b)
f integrable_on cbox a b
m \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>x. f (m *\<^sub>R x + c)) integrable_on (\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f has_integral ?i) (cbox ?a ?b); ?m \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. ?f (?m *\<^sub>R x + ?c)) has_integral (1 / \<bar>?m\<bar> ^ DIM(?'a)) *\<^sub>R ?i) ((\<lambda>x. (1 / ?m) *\<^sub>R x + - ((1 / ?m) *\<^sub>R ?c)) ` cbox ?a ?b)
\<exists>y. (f has_integral y) (cbox a b)
m \<noteq> 0

goal (1 subgoal):
 1. \<exists>y. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral y) ((\<lambda>x. (1 / m) *\<^sub>R x + - ((1 / m) *\<^sub>R c)) ` cbox a b)
[PROOF STEP]
by blast


[STATEMENT]
lemma list_of_permutation_element_n_conv':
  assumes "x \<in> set L" "0 < n"
  shows "set (list_of_permutation_element_n x n L) =
      {xs. set xs \<subseteq> insert x (set L) \<and> length xs = n \<and> x \<in> set xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (list_of_permutation_element_n x n L) = {xs. set xs \<subseteq> insert x (set L) \<and> length xs = n \<and> x \<in> set xs}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (list_of_permutation_element_n x n L) = {xs. set xs \<subseteq> insert x (set L) \<and> length xs = n \<and> x \<in> set xs}
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have *: "n \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. n \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. set (list_of_permutation_element_n x n L) = {xs. set xs \<subseteq> insert x (set L) \<and> length xs = n \<and> x \<in> set xs}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (list_of_permutation_element_n x n L) = {xs. set xs \<subseteq> insert x (set L) \<and> length xs = n \<and> x \<in> set xs}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> set L
0 < n

goal (1 subgoal):
 1. set (list_of_permutation_element_n x n L) = {xs. set xs \<subseteq> insert x (set L) \<and> length xs = n \<and> x \<in> set xs}
[PROOF STEP]
unfolding list_of_permutation_element_n_conv[OF *]
[PROOF STATE]
proof (prove)
using this:
x \<in> set L
0 < n

goal (1 subgoal):
 1. {uu_. \<exists>xs i. uu_ = xs \<and> i < length xs \<and> (\<forall>j<length xs. j \<noteq> i \<longrightarrow> xs ! j \<in> set L) \<and> length xs = n \<and> xs ! i = x} = {xs. set xs \<subseteq> insert x (set L) \<and> length xs = n \<and> x \<in> set xs}
[PROOF STEP]
by (auto simp: in_set_conv_nth)
       (metis in_set_conv_nth insert_absorb subsetD)+
[PROOF STATE]
proof (state)
this:
set (list_of_permutation_element_n x n L) = {xs. set xs \<subseteq> insert x (set L) \<and> length xs = n \<and> x \<in> set xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_add:
  fixes x :: real
  assumes "0 < x" and "0 < y"
  shows "ln (x + y) = ln x + ln (1 + y / x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (x + y) = ln x + ln (1 + y / x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (x + y) = ln x + ln (1 + y / x)
[PROOF STEP]
have "x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < y

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

goal (1 subgoal):
 1. ln (x + y) = ln x + ln (1 + y / x)
[PROOF STEP]
have "x + y = x * (1 + y / x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + y = x * (1 + y / x)
[PROOF STEP]
unfolding distrib_left times_divide_eq_right nonzero_mult_div_cancel_left[OF \<open>x \<noteq> 0\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + y = x * 1 + y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x + y = x * (1 + y / x)

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

goal (1 subgoal):
 1. ln (x + y) = ln x + ln (1 + y / x)
[PROOF STEP]
have "0 < y / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y / x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < y

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

goal (1 subgoal):
 1. ln (x + y) = ln x + ln (1 + y / x)
[PROOF STEP]
hence "0 < 1 + y / x"
[PROOF STATE]
proof (prove)
using this:
0 < y / x

goal (1 subgoal):
 1. 0 < 1 + y / x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < 1 + y / x

goal (1 subgoal):
 1. ln (x + y) = ln x + ln (1 + y / x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x + y = x * (1 + y / x)
0 < 1 + y / x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x + y = x * (1 + y / x)
0 < 1 + y / x

goal (1 subgoal):
 1. ln (x + y) = ln x + ln (1 + y / x)
[PROOF STEP]
using ln_mult assms
[PROOF STATE]
proof (prove)
using this:
x + y = x * (1 + y / x)
0 < 1 + y / x
\<lbrakk>0 < ?x; 0 < ?y\<rbrakk> \<Longrightarrow> ln (?x * ?y) = ln ?x + ln ?y
0 < x
0 < y

goal (1 subgoal):
 1. ln (x + y) = ln x + ln (1 + y / x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ln (x + y) = ln x + ln (1 + y / x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_abs_convergent_euler_product':
  fixes f :: "'a :: {nat_power, real_normed_field, banach, second_countable_topology} fds"
  assumes "completely_multiplicative_function (fds_nth f)" and "fds_abs_converges f s"
  shows   "abs_convergent_prod
             (\<lambda>p. if prime p then inverse (1 - fds_nth f p / nat_power p s) else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_convergent_prod (\<lambda>p. if prime p then inverse ((1::'a) - fds_nth f p / nat_power p s) else (1::'a))
[PROOF STEP]
unfolding eval_fds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_convergent_prod (\<lambda>p. if prime p then inverse ((1::'a) - fds_nth f p / nat_power p s) else (1::'a))
[PROOF STEP]
proof (rule abs_convergent_euler_product')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable (\<lambda>n. norm (fds_nth f n / nat_power n s))
 2. completely_multiplicative_function (\<lambda>p. fds_nth f p / nat_power p s)
[PROOF STEP]
show "completely_multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)
[PROOF STEP]
by (rule completely_multiplicative_function_divide_nat_power) fact+
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)

goal (1 subgoal):
 1. summable (\<lambda>n. norm (fds_nth f n / nat_power n s))
[PROOF STEP]
qed (insert assms, auto simp: fds_abs_converges_def)


[STATEMENT]
lemma abs_cos_le_one [simp]: "\<bar>cos x\<bar> \<le> 1"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>cos x\<bar> \<le> 1
[PROOF STEP]
by (rule power2_le_imp_le) (simp_all add: cos_squared_eq)


[STATEMENT]
lemma sylvester_mat_dim[simp]:
  fixes p q
  defines "d \<equiv> degree p + degree q"
  shows "dim_row (sylvester_mat p q) = d" "dim_col (sylvester_mat p q) = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (sylvester_mat p q) = d &&& dim_col (sylvester_mat p q) = d
[PROOF STEP]
unfolding sylvester_mat_def d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (sylvester_mat_sub (degree p) (degree q) p q) = degree p + degree q &&& dim_col (sylvester_mat_sub (degree p) (degree q) p q) = degree p + degree q
[PROOF STEP]
by auto


[STATEMENT]
lemma Ord_lt_succ_iff_le: "Ord k \<Longrightarrow> Ord l \<Longrightarrow> k < succ l \<longleftrightarrow> k \<le> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ord k; Ord l\<rbrakk> \<Longrightarrow> (k < succ l) = (k \<le> l)
[PROOF STEP]
by (metis Ord_mem_iff_lt Ord_succ_iff less_le_not_le order_eq_iff succ_iff)


[STATEMENT]
lemma repeat_zmset_distrib: "repeat_zmset (m + n) A = repeat_zmset m A + repeat_zmset n A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. repeat_zmset (m + n) A = repeat_zmset m A + repeat_zmset n A
[PROOF STEP]
by (auto simp: zmultiset_eq_iff Nat.add_mult_distrib int_distrib(1))


[STATEMENT]
lemma desargues_config_3D_coplanar_6 :
  assumes "desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma>"
  shows "rk {A, B, C, \<alpha>, \<beta>, \<gamma>} = 3" and "rk {A', B', C', \<alpha>, \<beta>, \<gamma>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>, \<gamma>} = 3 &&& rk {A', B', C', \<alpha>, \<beta>, \<gamma>} = 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rk {A, B, C, \<alpha>, \<beta>, \<gamma>} = 3
 2. rk {A', B', C', \<alpha>, \<beta>, \<gamma>} = 3
[PROOF STEP]
show "rk {A, B, C, \<alpha>, \<beta>, \<gamma>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>, \<gamma>} = 3
[PROOF STEP]
using assms desargues_config_3D_def[of A B C A' B' C' P \<alpha> \<beta> \<gamma>] coplanar_6
[PROOF STATE]
proof (prove)
using this:
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma>
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma> \<equiv> rk {A, B, C} = 3 \<and> rk {A', B', C'} = 3 \<and> rk {A, A', P} = 2 \<and> rk {B, B', P} = 2 \<and> rk {C, C', P} = 2 \<and> 4 \<le> rk {A, B, C, A', B', C'} \<and> rk {B, C, \<alpha>} = 2 \<and> rk {B', C', \<alpha>} = 2 \<and> rk {A, C, \<beta>} = 2 \<and> rk {A', C', \<beta>} = 2 \<and> rk {A, B, \<gamma>} = 2 \<and> rk {A', B', \<gamma>} = 2
\<lbrakk>rk {?A, ?B, ?C} = 3; rk {?B, ?C, ?\<alpha>} = 2; rk {?A, ?B, ?\<gamma>} = 2; rk {?A, ?C, ?\<beta>} = 2\<rbrakk> \<Longrightarrow> rk {?A, ?B, ?C, ?\<alpha>, ?\<beta>, ?\<gamma>} = 3

goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>, \<gamma>} = 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rk {A, B, C, \<alpha>, \<beta>, \<gamma>} = 3

goal (1 subgoal):
 1. rk {A', B', C', \<alpha>, \<beta>, \<gamma>} = 3
[PROOF STEP]
show "rk {A', B', C', \<alpha>, \<beta>, \<gamma>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A', B', C', \<alpha>, \<beta>, \<gamma>} = 3
[PROOF STEP]
using assms desargues_config_3D_def[of A B C A' B' C' P \<alpha> \<beta> \<gamma>] coplanar_6
[PROOF STATE]
proof (prove)
using this:
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma>
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma> \<equiv> rk {A, B, C} = 3 \<and> rk {A', B', C'} = 3 \<and> rk {A, A', P} = 2 \<and> rk {B, B', P} = 2 \<and> rk {C, C', P} = 2 \<and> 4 \<le> rk {A, B, C, A', B', C'} \<and> rk {B, C, \<alpha>} = 2 \<and> rk {B', C', \<alpha>} = 2 \<and> rk {A, C, \<beta>} = 2 \<and> rk {A', C', \<beta>} = 2 \<and> rk {A, B, \<gamma>} = 2 \<and> rk {A', B', \<gamma>} = 2
\<lbrakk>rk {?A, ?B, ?C} = 3; rk {?B, ?C, ?\<alpha>} = 2; rk {?A, ?B, ?\<gamma>} = 2; rk {?A, ?C, ?\<beta>} = 2\<rbrakk> \<Longrightarrow> rk {?A, ?B, ?C, ?\<alpha>, ?\<beta>, ?\<gamma>} = 3

goal (1 subgoal):
 1. rk {A', B', C', \<alpha>, \<beta>, \<gamma>} = 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rk {A', B', C', \<alpha>, \<beta>, \<gamma>} = 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_of_uint64_bij_betw : "bij_betw nat_of_uint64  (UNIV :: uint64 set) {..<2 ^ 64}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw nat_of_uint64 UNIV {..<2 ^ 64}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj nat_of_uint64 \<and> range nat_of_uint64 = {..<2 ^ 64}
[PROOF STEP]
using uint64_range
[PROOF STATE]
proof (prove)
using this:
range nat_of_uint64 = {..<2 ^ 64}

goal (1 subgoal):
 1. inj nat_of_uint64 \<and> range nat_of_uint64 = {..<2 ^ 64}
[PROOF STEP]
by transfer (auto)


[STATEMENT]
lemma  vec_hom_smult2:
  assumes "dim_vec v2 \<le> dim_vec v1"
  shows "hom (v1 \<bullet> v2) = vec\<^sub>h v1 \<bullet> vec\<^sub>h v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom (v1 \<bullet> v2) = vec\<^sub>h v1 \<bullet> vec\<^sub>h v2
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom (\<Sum>i = 0..<dim_vec v2. v1 $ i * v2 $ i) = (\<Sum>i = 0..<dim_vec (vec\<^sub>h v2). vec\<^sub>h v1 $ i * vec\<^sub>h v2 $ i)
[PROOF STEP]
using index_map_vec assms
[PROOF STATE]
proof (prove)
using this:
?i < dim_vec ?v \<Longrightarrow> map_vec ?f ?v $ ?i = ?f (?v $ ?i)
dim_vec (map_vec ?f ?v) = dim_vec ?v
dim_vec v2 \<le> dim_vec v1

goal (1 subgoal):
 1. hom (\<Sum>i = 0..<dim_vec v2. v1 $ i * v2 $ i) = (\<Sum>i = 0..<dim_vec (vec\<^sub>h v2). vec\<^sub>h v1 $ i * vec\<^sub>h v2 $ i)
[PROOF STEP]
by (auto simp add: hom_distribs)


[STATEMENT]
lemma sorted_alist_product:
  assumes xs: "linorder.sorted leq_a (map fst xs)" "distinct (map fst xs)"
  and ys: "linorder.sorted (\<sqsubseteq>\<^sub>b) (map fst ys)"
  shows "linorder.sorted (\<sqsubseteq>) (map fst (alist_product f xs ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))
[PROOF STEP]
interpret a: linorder "(\<sqsubseteq>\<^sub>a)" "(\<sqsubset>\<^sub>a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.linorder (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a)
[PROOF STEP]
by(fact lin_a)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))
[PROOF STEP]
note [simp] =
    linorder.sorted0[OF linorder_prod] linorder.sorted1[OF linorder_prod]
    linorder.sorted_append[OF linorder_prod]
    linorder.sorted1[OF lin_b]
[PROOF STATE]
proof (state)
this:
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) [] = True
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) [?x] = True
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (?xs @ ?ys) = (sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) ?xs \<and> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) ?ys \<and> (\<forall>x\<in>set ?xs. \<forall>y\<in>set ?ys. less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b) x y))
sorted_wrt (\<sqsubseteq>\<^sub>b) [?x] = True

goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))
[PROOF STEP]
using xs
[PROOF STATE]
proof (prove)
using this:
a.sorted (map fst xs)
distinct (map fst xs)

goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))
[PROOF STEP]
proof(induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>a.sorted (map fst []); distinct (map fst [])\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f [] ys))
 2. \<And>a xs. \<lbrakk>\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys)); a.sorted (map fst (a # xs)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (a # xs) ys))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
a.sorted (map fst [])
distinct (map fst [])

goal (2 subgoals):
 1. \<lbrakk>a.sorted (map fst []); distinct (map fst [])\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f [] ys))
 2. \<And>a xs. \<lbrakk>\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys)); a.sorted (map fst (a # xs)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (a # xs) ys))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f [] ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f [] ys))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys)); a.sorted (map fst (a # xs)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (a # xs) ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys)); a.sorted (map fst (a # xs)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (a # xs) ys))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))
a.sorted (map fst (x # xs))
distinct (map fst (x # xs))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys)); a.sorted (map fst (a # xs)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (a # xs) ys))
[PROOF STEP]
obtain a b where x: "x = (a, b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. x = (a, b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(cases x)
[PROOF STATE]
proof (state)
this:
x = (a, b)

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys)); a.sorted (map fst (a # xs)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (a # xs) ys))
[PROOF STEP]
have "linorder.sorted (\<sqsubseteq>) (map fst (map (\<lambda>(c, d). ((a, c), f a b c d)) ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (map (\<lambda>(c, d). ((a, c), f a b c d)) ys))
[PROOF STEP]
using ys
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (\<sqsubseteq>\<^sub>b) (map fst ys)

goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (map (\<lambda>(c, d). ((a, c), f a b c d)) ys))
[PROOF STEP]
by(induct ys) auto
[PROOF STATE]
proof (state)
this:
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (map (\<lambda>(c, d). ((a, c), f a b c d)) ys))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys)); a.sorted (map fst (a # xs)); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (a # xs) ys))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (map (\<lambda>(c, d). ((a, c), f a b c d)) ys))

goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (x # xs) ys))
[PROOF STEP]
using x Cons
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (map (\<lambda>(c, d). ((a, c), f a b c d)) ys))
x = (a, b)
\<lbrakk>a.sorted (map fst xs); distinct (map fst xs)\<rbrakk> \<Longrightarrow> sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))
a.sorted (map fst (x # xs))
distinct (map fst (x # xs))

goal (1 subgoal):
 1. sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (x # xs) ys))
[PROOF STEP]
by(fastforce simp add: set_alist_product a.not_less dest: bspec a.order_antisym intro: rev_image_eqI)
[PROOF STATE]
proof (state)
this:
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f (x # xs) ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt (less_eq_prod (\<sqsubseteq>\<^sub>a) (\<sqsubset>\<^sub>a) (\<sqsubseteq>\<^sub>b)) (map fst (alist_product f xs ys))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma comp_tensor_op: "(tensor_op a b) o\<^sub>C\<^sub>L (tensor_op c d) = tensor_op (a o\<^sub>C\<^sub>L c) (b o\<^sub>C\<^sub>L d)"
  for a :: "'e::finite ell2 \<Rightarrow>\<^sub>C\<^sub>L 'c::finite ell2" and b :: "'f::finite ell2 \<Rightarrow>\<^sub>C\<^sub>L 'd::finite ell2" and
      c :: "'a::finite ell2 \<Rightarrow>\<^sub>C\<^sub>L 'e ell2" and d :: "'b::finite ell2 \<Rightarrow>\<^sub>C\<^sub>L 'f ell2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes>\<^sub>o b o\<^sub>C\<^sub>L c \<otimes>\<^sub>o d = (a o\<^sub>C\<^sub>L c) \<otimes>\<^sub>o (b o\<^sub>C\<^sub>L d)
[PROOF STEP]
apply (rule equal_ket)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (a \<otimes>\<^sub>o b o\<^sub>C\<^sub>L c \<otimes>\<^sub>o d) *\<^sub>V ket x = ((a o\<^sub>C\<^sub>L c) \<otimes>\<^sub>o (b o\<^sub>C\<^sub>L d)) *\<^sub>V ket x
[PROOF STEP]
apply (rename_tac ij, case_tac ij, rename_tac i j, hypsubst_thin)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ij i j. (a \<otimes>\<^sub>o b o\<^sub>C\<^sub>L c \<otimes>\<^sub>o d) *\<^sub>V ket (i, j) = ((a o\<^sub>C\<^sub>L c) \<otimes>\<^sub>o (b o\<^sub>C\<^sub>L d)) *\<^sub>V ket (i, j)
[PROOF STEP]
by (simp flip: tensor_ell2_ket add: tensor_op_ell2 cblinfun_apply_cblinfun_compose)


[STATEMENT]
lemma integral_subset_component_le:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
  assumes "k \<in> Basis"
    and "s \<subseteq> t"
    and "f integrable_on s"
    and "f integrable_on t"
    and "\<forall>x \<in> t. 0 \<le> f x \<bullet> k"
  shows "(integral s f)\<bullet>k \<le> (integral t f)\<bullet>k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral s f \<bullet> k \<le> integral t f \<bullet> k
[PROOF STEP]
by (meson assms has_integral_subset_component_le integrable_integral)


[STATEMENT]
lemma bezout_ring_imp_diagonal_admits_SNF_mod_ring_admits:
  assumes of: "class.bezout_ring (*) (1::'a::comm_ring_1) (+) 0 (-) uminus" (*It is equivalent to the statement based on OFCLASS*)
  shows "\<forall>A::'a^'n::nontriv mod_ring^'n::nontriv mod_ring. admits_SNF_HA A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A. admits_SNF_HA A
[PROOF STEP]
using bezout_ring_imp_diagonal_admits_SNF
        [OF Rings2.class.Rings2.bezout_ring.of_class.intro[OF of]]
[PROOF STATE]
proof (prove)
using this:
\<forall>A. isDiagonal A \<longrightarrow> (\<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q))

goal (1 subgoal):
 1. \<forall>A. admits_SNF_HA A
[PROOF STEP]
unfolding admits_SNF_HA_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. isDiagonal A \<longrightarrow> (\<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q))

goal (1 subgoal):
 1. \<forall>A. isDiagonal A \<longrightarrow> (\<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q))
[PROOF STEP]
by auto


[STATEMENT]
lemma is_projection_on_exists:
  fixes M :: \<open>'a::chilbert_space set\<close>
  assumes \<open>convex M\<close> and \<open>closed M\<close> and \<open>M \<noteq> {}\<close>
  shows "\<exists>\<pi>. is_projection_on \<pi> M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<pi>. is_projection_on \<pi> M
[PROOF STEP]
unfolding is_projection_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<pi>. \<forall>h. is_arg_min (\<lambda>x. dist x h) (\<lambda>x. x \<in> M) (\<pi> h)
[PROOF STEP]
apply (rule choice)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>h. \<exists>y. is_arg_min (\<lambda>x. dist x h) (\<lambda>x. x \<in> M) y
[PROOF STEP]
using smallest_dist_exists[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>k. is_arg_min (\<lambda>x. dist x ?h) (\<lambda>x. x \<in> M) k

goal (1 subgoal):
 1. \<forall>h. \<exists>y. is_arg_min (\<lambda>x. dist x h) (\<lambda>x. x \<in> M) y
[PROOF STEP]
by auto


[STATEMENT]
lemma norm_le_transpose: "\<parallel>A\<parallel> \<le> \<parallel>A\<^sup>\<dagger>\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A\<parallel> \<le> \<parallel>A\<^sup>\<dagger>\<parallel>
[PROOF STEP]
unfolding norm_sq_mtx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>to_vec A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>to_vec A\<^sup>\<dagger>\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
by transfer (rule op_norm_le_transpose)


[STATEMENT]
lemma zero_neq_succ [simp]: "zero \<noteq> succ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zero \<noteq> succ m
[PROOF STEP]
by (rule succ_neq_zero [symmetric])


[STATEMENT]
lemma path_translation_eq:
  fixes g :: "real \<Rightarrow> 'a :: real_normed_vector"
  shows "path((\<lambda>x. a + x) \<circ> g) = path g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path ((+) a \<circ> g) = path g
[PROOF STEP]
using continuous_on_translation_eq path_def
[PROOF STATE]
proof (prove)
using this:
continuous_on ?A ((+) ?a \<circ> ?g) = continuous_on ?A ?g
path ?g = continuous_on {0..1} ?g

goal (1 subgoal):
 1. path ((+) a \<circ> g) = path g
[PROOF STEP]
by blast


[STATEMENT]
lemma cos_paired: "(\<lambda>n. (- 1) ^ n / (fact (2 * n)) * x ^ (2 * n)) sums cos x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n / fact (2 * n) * x ^ (2 * n)) sums cos x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n / fact (2 * n) * x ^ (2 * n)) sums cos x
[PROOF STEP]
have "(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. cos_coeff k * x ^ k) sums cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. cos_coeff k * x ^ k) sums cos x
[PROOF STEP]
by (rule sums_group) (use cos_converges [of x, unfolded scaleR_conv_of_real] in auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. cos_coeff k * x ^ k) sums cos x

goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n / fact (2 * n) * x ^ (2 * n)) sums cos x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. cos_coeff k * x ^ k) sums cos x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. cos_coeff k * x ^ k) sums cos x

goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n / fact (2 * n) * x ^ (2 * n)) sums cos x
[PROOF STEP]
by (simp add: cos_coeff_def ac_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- 1) ^ n / fact (2 * n) * x ^ (2 * n)) sums cos x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coprime_linear_poly:
  fixes c :: "'a :: field_gcd"
  assumes "c \<noteq> c'"
  shows   "coprime [:c,1:] [:c',1:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
have "gcd [:c,1:] [:c',1:] = gcd ([:c,1:] - [:c',1:]) [:c',1:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd [:c, 1::'a:] [:c', 1::'a:] = gcd ([:c, 1::'a:] - [:c', 1::'a:]) [:c', 1::'a:]
[PROOF STEP]
by (rule gcd_diff1 [symmetric])
[PROOF STATE]
proof (state)
this:
gcd [:c, 1::'a:] [:c', 1::'a:] = gcd ([:c, 1::'a:] - [:c', 1::'a:]) [:c', 1::'a:]

goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd [:c, 1::'a:] [:c', 1::'a:] = gcd ([:c, 1::'a:] - [:c', 1::'a:]) [:c', 1::'a:]

goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
have "[:c,1:] - [:c',1:] = [:c-c':]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:c, 1::'a:] - [:c', 1::'a:] = [:c - c':]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[:c, 1::'a:] - [:c', 1::'a:] = [:c - c':]

goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[:c, 1::'a:] - [:c', 1::'a:] = [:c - c':]

goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> c'
[PROOF STEP]
have "gcd \<dots> [:c',1:] = normalize [:c-c':]"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> c'

goal (1 subgoal):
 1. gcd [:c - c':] [:c', 1::'a:] = normalize [:c - c':]
[PROOF STEP]
by (intro gcd_proj1_if_dvd) (auto simp: const_poly_dvd_iff dvd_field_iff)
[PROOF STATE]
proof (state)
this:
gcd [:c - c':] [:c', 1::'a:] = normalize [:c - c':]

goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd [:c - c':] [:c', 1::'a:] = normalize [:c - c':]

goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> c'
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> c'

goal (1 subgoal):
 1. normalize [:c - c':] = 1
[PROOF STEP]
by (simp add: normalize_poly_def)
[PROOF STATE]
proof (state)
this:
normalize [:c - c':] = 1

goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
gcd [:c, 1::'a:] [:c', 1::'a:] = 1
[PROOF STEP]
show "coprime [:c,1:] [:c',1:]"
[PROOF STATE]
proof (prove)
using this:
gcd [:c, 1::'a:] [:c', 1::'a:] = 1

goal (1 subgoal):
 1. coprime [:c, 1::'a:] [:c', 1::'a:]
[PROOF STEP]
by (simp add: gcd_eq_1_imp_coprime)
[PROOF STATE]
proof (state)
this:
coprime [:c, 1::'a:] [:c', 1::'a:]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma openin_contains_cball:
   "openin (top_of_set T) S \<longleftrightarrow>
        S \<subseteq> T \<and> (\<forall>x \<in> S. \<exists>e. 0 < e \<and> cball x e \<inter> T \<subseteq> S)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set T) S = (S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. openin (top_of_set T) S \<Longrightarrow> S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S)
 2. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
openin (top_of_set T) S

goal (2 subgoals):
 1. openin (top_of_set T) S \<Longrightarrow> S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S)
 2. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
openin (top_of_set T) S
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
openin (top_of_set T) S

goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S)
[PROOF STEP]
by (force simp add: openin_contains_ball intro: exI [where x="_/2"])
[PROOF STATE]
proof (state)
this:
S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S)

goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S)

goal (1 subgoal):
 1. S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S) \<Longrightarrow> openin (top_of_set T) S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S)
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> T \<and> (\<forall>x\<in>S. \<exists>e>0. cball x e \<inter> T \<subseteq> S)

goal (1 subgoal):
 1. openin (top_of_set T) S
[PROOF STEP]
by (force simp add: openin_contains_ball)
[PROOF STATE]
proof (state)
this:
openin (top_of_set T) S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rank_of_image:
  assumes "finite S"
  shows "(\<lambda>x. rank_of x S) ` S = {0..<card S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. rank_of x S) ` S = {0..<card S}
[PROOF STEP]
proof (rule card_seteq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite {0..<card S}
 2. (\<lambda>x. rank_of x S) ` S \<subseteq> {0..<card S}
 3. card {0..<card S} \<le> card ((\<lambda>x. rank_of x S) ` S)
[PROOF STEP]
show "finite {0..<card S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..<card S}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {0..<card S}

goal (2 subgoals):
 1. (\<lambda>x. rank_of x S) ` S \<subseteq> {0..<card S}
 2. card {0..<card S} \<le> card ((\<lambda>x. rank_of x S) ` S)
[PROOF STEP]
have "\<And>x. x \<in> S \<Longrightarrow> card {y \<in> S. y < x} < card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> card {y \<in> S. y < x} < card S
[PROOF STEP]
by (rule psubset_card_mono, metis assms, blast)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> card {y \<in> S. y < ?x} < card S

goal (2 subgoals):
 1. (\<lambda>x. rank_of x S) ` S \<subseteq> {0..<card S}
 2. card {0..<card S} \<le> card ((\<lambda>x. rank_of x S) ` S)
[PROOF STEP]
thus "(\<lambda>x. rank_of x S) ` S \<subseteq> {0..<card S}"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> card {y \<in> S. y < ?x} < card S

goal (1 subgoal):
 1. (\<lambda>x. rank_of x S) ` S \<subseteq> {0..<card S}
[PROOF STEP]
by (intro image_subsetI, simp add:rank_of_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. rank_of x S) ` S \<subseteq> {0..<card S}

goal (1 subgoal):
 1. card {0..<card S} \<le> card ((\<lambda>x. rank_of x S) ` S)
[PROOF STEP]
have "inj_on (\<lambda>x. rank_of x S) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>x. rank_of x S) S
[PROOF STEP]
by (metis strict_mono_on_imp_inj_on rank_strict_mono assms)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>x. rank_of x S) S

goal (1 subgoal):
 1. card {0..<card S} \<le> card ((\<lambda>x. rank_of x S) ` S)
[PROOF STEP]
thus "card {0..<card S} \<le> card ((\<lambda>x. rank_of x S) ` S)"
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>x. rank_of x S) S

goal (1 subgoal):
 1. card {0..<card S} \<le> card ((\<lambda>x. rank_of x S) ` S)
[PROOF STEP]
by (simp add:card_image)
[PROOF STATE]
proof (state)
this:
card {0..<card S} \<le> card ((\<lambda>x. rank_of x S) ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_relI[intro?]:
  assumes "\<And>x. x\<in>A \<Longrightarrow> \<exists>y\<in>B. (x,y)\<in>R"
  assumes "\<And>y. y\<in>B \<Longrightarrow> \<exists>x\<in>A. (x,y)\<in>R"
  shows "(A,B)\<in>\<langle>R\<rangle>set_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A, B) \<in> \<langle>R\<rangle>set_rel
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> \<exists>y\<in>B. (?x, y) \<in> R
?y \<in> B \<Longrightarrow> \<exists>x\<in>A. (x, ?y) \<in> R

goal (1 subgoal):
 1. (A, B) \<in> \<langle>R\<rangle>set_rel
[PROOF STEP]
unfolding set_rel_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> \<exists>y\<in>B. (?x, y) \<in> R
?y \<in> B \<Longrightarrow> \<exists>x\<in>A. (x, ?y) \<in> R

goal (1 subgoal):
 1. (A, B) \<in> {(A, B). (\<forall>x\<in>A. \<exists>y\<in>B. (x, y) \<in> R) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. (x, y) \<in> R)}
[PROOF STEP]
by blast


[STATEMENT]
lemma bij_betw_image_fixed_card_subset:
  assumes "inj_on f A"
  shows   "bij_betw (\<lambda>X. f ` X) {X. X \<subseteq> A \<and> card X = k} {X. X \<subseteq> f ` A \<and> card X = k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((`) f) {X. X \<subseteq> A \<and> card X = k} {X. X \<subseteq> f ` A \<and> card X = k}
[PROOF STEP]
using assms inj_on_subset[OF assms]
[PROOF STATE]
proof (prove)
using this:
inj_on f A
?B \<subseteq> A \<Longrightarrow> inj_on f ?B

goal (1 subgoal):
 1. bij_betw ((`) f) {X. X \<subseteq> A \<and> card X = k} {X. X \<subseteq> f ` A \<and> card X = k}
[PROOF STEP]
by (intro bij_betwI[of _ _ _ "\<lambda>X. f -` X \<inter> A"]) (auto simp: card_image card_vimage_inter)


[STATEMENT]
lemma cosh_add: "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]
lemma is_nth_power_conv_multiplicity_nat:
  assumes "n > 0"
  shows   "is_nth_power n (x :: nat) \<longleftrightarrow> (\<forall>p. prime p \<longrightarrow> n dvd multiplicity p x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_nth_power n x = (\<forall>p. prime p \<longrightarrow> n dvd multiplicity p x)
[PROOF STEP]
using is_nth_power_conv_multiplicity[OF assms, of x]
[PROOF STATE]
proof (prove)
using this:
is_nth_power n (normalize x) = (\<forall>p. prime p \<longrightarrow> n dvd multiplicity p x)

goal (1 subgoal):
 1. is_nth_power n x = (\<forall>p. prime p \<longrightarrow> n dvd multiplicity p x)
[PROOF STEP]
by simp


[STATEMENT]
lemma dtree_size_img_le:
  assumes "\<forall>t \<in> fst ` fset xs. size (f t) \<le> size t"
  shows "size (Node r ((\<lambda>(t,e). (f t, e)) |`| xs)) \<le> size (Node r xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) \<le> size (Node r xs)
[PROOF STEP]
using sum_img_le[of xs "\<lambda>x. size x + 2"] dtree_size_alt assms
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>fst ` fset xs. size (?f t) + 2 \<le> size t + 2 \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (?f t, e)) |`| xs). size x + 2) \<le> (\<Sum>(x, y)\<in>fset xs. size x + 2)
size (Node ?r ?xs) = (\<Sum>(x, y)\<in>fset ?xs. size x + 2) + 1
\<forall>t\<in>fst ` fset xs. size (f t) \<le> size t

goal (1 subgoal):
 1. size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) \<le> size (Node r xs)
[PROOF STEP]
by (metis (mono_tags, lifting) add_right_mono)


[STATEMENT]
lemma cInf_unique: "b <=* (S::'a :: {conditionally_complete_linorder, no_top} set) \<Longrightarrow> (\<forall>b'>b. \<exists>x\<in>S. b' > x) \<Longrightarrow> Inf S = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b <=* S; \<forall>b'>b. \<exists>x\<in>S. x < b'\<rbrakk> \<Longrightarrow> Inf S = b
[PROOF STEP]
by (rule cInf_eq) (auto simp: not_le[symmetric] setge_def)


[STATEMENT]
lemma supp_of_finite_sets:
  fixes S::"('a::fs set)"
  assumes fin: "finite S"
  shows "(supp S) = (\<Union>x\<in>S. supp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp S = \<Union> (supp ` S)
[PROOF STEP]
apply(rule subset_antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. supp S \<subseteq> \<Union> (supp ` S)
 2. \<Union> (supp ` S) \<subseteq> supp S
[PROOF STEP]
apply(rule supp_is_subset)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<Union> (supp ` S) supports S
 2. finite (\<Union> (supp ` S))
 3. \<Union> (supp ` S) \<subseteq> supp S
[PROOF STEP]
apply(rule Union_supports_set)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (\<Union> (supp ` S))
 2. \<Union> (supp ` S) \<subseteq> supp S
[PROOF STEP]
apply(rule Union_of_finite_supp_sets[OF fin])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (supp ` S) \<subseteq> supp S
[PROOF STEP]
apply(rule Union_included_in_supp[OF fin])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma split_cube:
  assumes "x \<in> cube (k+1) t"
  shows "(\<lambda>y \<in> {..<1}. x y) \<in> cube 1 t"
    and "(\<lambda>y \<in> {..<k}. x (y + 1)) \<in> cube k t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict x {..<1} \<in> cube 1 t &&& (\<lambda>y\<in>{..<k}. x (y + 1)) \<in> cube k t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> cube (k + 1) t

goal (1 subgoal):
 1. restrict x {..<1} \<in> cube 1 t &&& (\<lambda>y\<in>{..<k}. x (y + 1)) \<in> cube k t
[PROOF STEP]
unfolding cube_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {..<k + 1} \<rightarrow>\<^sub>E {..<t}

goal (1 subgoal):
 1. restrict x {..<1} \<in> {..<1} \<rightarrow>\<^sub>E {..<t} &&& (\<lambda>y\<in>{..<k}. x (y + 1)) \<in> {..<k} \<rightarrow>\<^sub>E {..<t}
[PROOF STEP]
by auto


[STATEMENT]
lemma jj_squared [simp]: "\<j>^2 = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<j>\<^sup>2 = - 1
[PROOF STEP]
by (simp add: power2_eq_square quat.expand)


[STATEMENT]
lemma holomorphic_on_inverse [holomorphic_intros]:
  "\<lbrakk>f holomorphic_on s; \<And>z. z \<in> s \<Longrightarrow> f z \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>z. inverse (f z)) holomorphic_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f holomorphic_on s; \<And>z. z \<in> s \<Longrightarrow> f z \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>z. inverse (f z)) holomorphic_on s
[PROOF STEP]
unfolding holomorphic_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>s. f field_differentiable at x within s; \<And>z. z \<in> s \<Longrightarrow> f z \<noteq> 0\<rbrakk> \<Longrightarrow> \<forall>x\<in>s. (\<lambda>z. inverse (f z)) field_differentiable at x within s
[PROOF STEP]
by (metis field_differentiable_inverse)


[STATEMENT]
lemma surj_on_minus:
  assumes inj: "inj_on  (\<lambda>(b :: nat). (y + (q - b)) mod q ) {..<q}"
  shows "(\<lambda>(b :: nat). (y + (q - b)) mod q) ` {..< q} = {..< q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. (y + (q - b)) mod q) ` {..<q} = {..<q}
[PROOF STEP]
apply(rule endo_inj_surj)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {..<q}
 2. (\<lambda>b. (y + (q - b)) mod q) ` {..<q} \<subseteq> {..<q}
 3. inj_on (\<lambda>b. (y + (q - b)) mod q) {..<q}
[PROOF STEP]
using inj
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>b. (y + (q - b)) mod q) {..<q}

goal (3 subgoals):
 1. finite {..<q}
 2. (\<lambda>b. (y + (q - b)) mod q) ` {..<q} \<subseteq> {..<q}
 3. inj_on (\<lambda>b. (y + (q - b)) mod q) {..<q}
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_add_ldistrib: "(A ** (B + C)) = (A ** B) + (A ** C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ** (B + C) = A ** B + A ** C
[PROOF STEP]
by (vector matrix_matrix_mult_def sum.distrib[symmetric] field_simps)


[STATEMENT]
lemma deriv_divide [simp]:
  "\<lbrakk>f field_differentiable at z; g field_differentiable at z; g z \<noteq> 0\<rbrakk>
   \<Longrightarrow> deriv (\<lambda>w. f w / g w) z = (deriv f z * g z - f z * deriv g z) / g z ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f field_differentiable at z; g field_differentiable at z; g z \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> deriv (\<lambda>w. f w / g w) z = (deriv f z * g z - f z * deriv g z) / (g z)\<^sup>2
[PROOF STEP]
by (simp add: field_class.field_divide_inverse field_differentiable_inverse)
     (simp add: field_split_simps power2_eq_square)


[STATEMENT]
lemma supp_of_fin_sets:
  fixes X::"('a set)"
  assumes pt: "pt TYPE('a) TYPE('x)"
  and     at: "at TYPE('x)"
  and     fs: "fs TYPE('a) TYPE('x)"
  and     fi: "finite X"
  shows "(supp X) = (\<Union>x\<in>X. ((supp x)::'x set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp X = \<Union> (supp ` X)
[PROOF STEP]
apply(rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. supp X \<subseteq> \<Union> (supp ` X)
 2. \<Union> (supp ` X) \<subseteq> supp X
[PROOF STEP]
apply(rule supp_is_subset)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<Union> (supp ` X) supports X
 2. finite (\<Union> (supp ` X))
 3. \<Union> (supp ` X) \<subseteq> supp X
[PROOF STEP]
apply(rule Union_supports_set[OF pt, OF at])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (\<Union> (supp ` X))
 2. \<Union> (supp ` X) \<subseteq> supp X
[PROOF STEP]
apply(rule Union_of_fin_supp_sets[OF fs, OF fi])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (supp ` X) \<subseteq> supp X
[PROOF STEP]
apply(rule Union_included_in_supp[OF pt, OF at, OF fs, OF fi])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma all_conj: "(\<forall>x. A x & B x) = ((\<forall>x. A x) & (\<forall>x. B x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. A x \<and> B x) = ((\<forall>x. A x) \<and> (\<forall>x. B x))
[PROOF STEP]
by blast


[STATEMENT]
lemma card_length_sum_list: "card {l::nat list. size l = m \<and> sum_list l = N} = (N + m - 1) choose N"
  \<comment> \<open>by Holden Lee, tidied by Tobias Nipkow\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
proof (cases m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
 2. \<And>nat. m = Suc nat \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
m = 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
 2. \<And>nat. m = Suc nat \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = 0

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
by (cases N) (auto cong: conj_cong)
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
case (Suc m')
[PROOF STATE]
proof (state)
this:
m = Suc m'

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
have m: "m \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> m
[PROOF STEP]
by (simp add: Suc)
[PROOF STATE]
proof (state)
this:
1 \<le> m

goal (1 subgoal):
 1. \<And>nat. m = Suc nat \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<le> m

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
proof (induct "N + m - 1" arbitrary: N m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>N m. \<lbrakk>0 = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
 2. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
case 0  \<comment> \<open>In the base case, the only solution is [0].\<close>
[PROOF STATE]
proof (state)
this:
0 = N + m - 1
1 \<le> m

goal (2 subgoals):
 1. \<And>N m. \<lbrakk>0 = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
 2. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
have [simp]: "{l::nat list. length l = Suc 0 \<and> (\<forall>n\<in>set l. n = 0)} = {[0]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l. length l = Suc 0 \<and> (\<forall>n\<in>set l. n = 0)} = {[0]}
[PROOF STEP]
by (auto simp: length_Suc_conv)
[PROOF STATE]
proof (state)
this:
{l. length l = Suc 0 \<and> (\<forall>n\<in>set l. n = 0)} = {[0]}

goal (2 subgoals):
 1. \<And>N m. \<lbrakk>0 = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
 2. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
have "m = 1 \<and> N = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = 1 \<and> N = 0
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
0 = N + m - 1
1 \<le> m

goal (1 subgoal):
 1. m = 1 \<and> N = 0
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
m = 1 \<and> N = 0

goal (2 subgoals):
 1. \<And>N m. \<lbrakk>0 = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
 2. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = 1 \<and> N = 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
m = 1 \<and> N = 0

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N

goal (1 subgoal):
 1. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<lbrakk>k = ?N + ?m - 1; 1 \<le> ?m\<rbrakk> \<Longrightarrow> card {l. length l = ?m \<and> sum_list l = ?N} = ?N + ?m - 1 choose ?N
Suc k = N + m - 1
1 \<le> m

goal (1 subgoal):
 1. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
have c1: "card {l::nat list. size l = (m - 1) \<and> sum_list l =  N} = (N + (m - 1) - 1) choose N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
proof (cases "m = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
 2. m \<noteq> 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
m = 1

goal (2 subgoals):
 1. m = 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
 2. m \<noteq> 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
with Suc.hyps
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>k = ?N + ?m - 1; 1 \<le> ?m\<rbrakk> \<Longrightarrow> card {l. length l = ?m \<and> sum_list l = ?N} = ?N + ?m - 1 choose ?N
Suc k = N + m - 1
m = 1
[PROOF STEP]
have "N \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k = ?N + ?m - 1; 1 \<le> ?m\<rbrakk> \<Longrightarrow> card {l. length l = ?m \<and> sum_list l = ?N} = ?N + ?m - 1 choose ?N
Suc k = N + m - 1
m = 1

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

goal (2 subgoals):
 1. m = 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
 2. m \<noteq> 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
m = 1
1 \<le> N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = 1
1 \<le> N

goal (1 subgoal):
 1. card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
by (simp add: binomial_eq_0)
[PROOF STATE]
proof (state)
this:
card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N

goal (1 subgoal):
 1. m \<noteq> 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m \<noteq> 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
m \<noteq> 1

goal (1 subgoal):
 1. m \<noteq> 1 \<Longrightarrow> card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 1

goal (1 subgoal):
 1. card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 1
\<lbrakk>k = ?N + ?m - 1; 1 \<le> ?m\<rbrakk> \<Longrightarrow> card {l. length l = ?m \<and> sum_list l = ?N} = ?N + ?m - 1 choose ?N
Suc k = N + m - 1
1 \<le> m

goal (1 subgoal):
 1. card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {l. length l = m - 1 \<and> sum_list l = N} = N + (m - 1) - 1 choose N

goal (1 subgoal):
 1. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>k = ?N + ?m - 1; 1 \<le> ?m\<rbrakk> \<Longrightarrow> card {l. length l = ?m \<and> sum_list l = ?N} = ?N + ?m - 1 choose ?N
Suc k = N + m - 1
1 \<le> m
[PROOF STEP]
have c2: "card {l::nat list. size l = m \<and> sum_list l + 1 = N} =
      (if N > 0 then ((N - 1) + m - 1) choose (N - 1) else 0)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k = ?N + ?m - 1; 1 \<le> ?m\<rbrakk> \<Longrightarrow> card {l. length l = ?m \<and> sum_list l = ?N} = ?N + ?m - 1 choose ?N
Suc k = N + m - 1
1 \<le> m

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l + 1 = N} = (if 0 < N then N - 1 + m - 1 choose (N - 1) else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>N m. \<lbrakk>k = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc k = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l + 1 = N} = (if 0 < N then N - 1 + m - 1 choose (N - 1) else 0)
[PROOF STEP]
have *: "n > 0 \<Longrightarrow> Suc m = n \<longleftrightarrow> m = n - 1" for m n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> (Suc m = n) = (m = n - 1)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
0 < ?n \<Longrightarrow> (Suc ?m = ?n) = (?m = ?n - 1)

goal (1 subgoal):
 1. \<lbrakk>\<And>N m. \<lbrakk>k = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc k = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l + 1 = N} = (if 0 < N then N - 1 + m - 1 choose (N - 1) else 0)
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>k = ?N + ?m - 1; 1 \<le> ?m\<rbrakk> \<Longrightarrow> card {l. length l = ?m \<and> sum_list l = ?N} = ?N + ?m - 1 choose ?N
Suc k = N + m - 1
1 \<le> m
[PROOF STEP]
have "N > 0 \<Longrightarrow>
        card {l::nat list. size l = m \<and> sum_list l + 1 = N} =
          ((N - 1) + m - 1) choose (N - 1)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k = ?N + ?m - 1; 1 \<le> ?m\<rbrakk> \<Longrightarrow> card {l. length l = ?m \<and> sum_list l = ?N} = ?N + ?m - 1 choose ?N
Suc k = N + m - 1
1 \<le> m

goal (1 subgoal):
 1. 0 < N \<Longrightarrow> card {l. length l = m \<and> sum_list l + 1 = N} = N - 1 + m - 1 choose (N - 1)
[PROOF STEP]
by (simp add: *)
[PROOF STATE]
proof (state)
this:
0 < N \<Longrightarrow> card {l. length l = m \<and> sum_list l + 1 = N} = N - 1 + m - 1 choose (N - 1)

goal (1 subgoal):
 1. \<lbrakk>\<And>N m. \<lbrakk>k = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc k = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l + 1 = N} = (if 0 < N then N - 1 + m - 1 choose (N - 1) else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < N \<Longrightarrow> card {l. length l = m \<and> sum_list l + 1 = N} = N - 1 + m - 1 choose (N - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < N \<Longrightarrow> card {l. length l = m \<and> sum_list l + 1 = N} = N - 1 + m - 1 choose (N - 1)

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l + 1 = N} = (if 0 < N then N - 1 + m - 1 choose (N - 1) else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l + 1 = N} = (if 0 < N then N - 1 + m - 1 choose (N - 1) else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l + 1 = N} = (if 0 < N then N - 1 + m - 1 choose (N - 1) else 0)

goal (1 subgoal):
 1. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
from Suc.prems
[PROOF STATE]
proof (chain)
picking this:
1 \<le> m
[PROOF STEP]
have "(card {l::nat list. size l = (m - 1) \<and> sum_list l = N} +
          card {l::nat list. size l = m \<and> sum_list l + 1 = N}) = (N + m - 1) choose N"
[PROOF STATE]
proof (prove)
using this:
1 \<le> m

goal (1 subgoal):
 1. card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N} = N + m - 1 choose N
[PROOF STEP]
by (auto simp: c1 c2 choose_reduce_nat[of "N + m - 1" N] simp del: One_nat_def)
[PROOF STATE]
proof (state)
this:
card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N} = N + m - 1 choose N

goal (1 subgoal):
 1. \<And>x N m. \<lbrakk>\<And>N m. \<lbrakk>x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N; Suc x = N + m - 1; 1 \<le> m\<rbrakk> \<Longrightarrow> card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N} = N + m - 1 choose N
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N} = N + m - 1 choose N

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
using card_length_sum_list_rec[OF Suc.prems]
[PROOF STATE]
proof (prove)
using this:
card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N} = N + m - 1 choose N
card {l. length l = m \<and> sum_list l = ?N} = card {l. length l = m - 1 \<and> sum_list l = ?N} + card {l. length l = m \<and> sum_list l + 1 = ?N}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l = N} = N + m - 1 choose N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma avl_size_lowerbound:
  defines "\<phi> \<equiv> (1 + sqrt 5) / 2"
  assumes "avl t"
  shows   "\<phi> ^ (height t) \<le> size1 t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ^ height t \<le> real (size1 t)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<phi> ^ height t \<le> real (size1 t)
[PROOF STEP]
have "\<phi> ^ height t \<le> fib (height t + 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ^ height t \<le> real (fib (height t + 2))
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1 + sqrt 5) / 2) ^ height t \<le> real (fib (height t + 2))
[PROOF STEP]
by(rule fib_lowerbound)
[PROOF STATE]
proof (state)
this:
\<phi> ^ height t \<le> real (fib (height t + 2))

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

goal (1 subgoal):
 1. \<phi> ^ height t \<le> real (size1 t)
[PROOF STEP]
have "\<dots> \<le> size1 t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (fib (height t + 2)) \<le> real (size1 t)
[PROOF STEP]
using avl_fib_bound[of t] assms
[PROOF STATE]
proof (prove)
using this:
avl t \<Longrightarrow> fib (height t + 2) \<le> size1 t
\<phi> \<equiv> (1 + sqrt 5) / 2
avl t

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

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

goal (1 subgoal):
 1. \<phi> ^ height t \<le> real (size1 t)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<phi> ^ height t \<le> real (size1 t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma setdist_eq_0_bounded:
  fixes S :: "'a::heine_borel set"
  assumes "bounded S \<or> bounded T"
  shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (setdist S T = 0) = (S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {})
[PROOF STEP]
proof (cases "S = {} \<or> T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<or> T = {} \<Longrightarrow> (setdist S T = 0) = (S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {})
 2. \<not> (S = {} \<or> T = {}) \<Longrightarrow> (setdist S T = 0) = (S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {})
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (S = {} \<or> T = {})

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

goal (1 subgoal):
 1. (setdist S T = 0) = (S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {})
[PROOF STEP]
using setdist_eq_0_compact_closed [of "closure S" "closure T"]
          setdist_eq_0_closed_compact [of "closure S" "closure T"] assms
[PROOF STATE]
proof (prove)
using this:
\<not> (S = {} \<or> T = {})
\<lbrakk>compact (closure S); closed (closure T)\<rbrakk> \<Longrightarrow> (setdist (closure S) (closure T) = 0) = (closure S = {} \<or> closure T = {} \<or> closure S \<inter> closure T \<noteq> {})
\<lbrakk>closed (closure S); compact (closure T)\<rbrakk> \<Longrightarrow> (setdist (closure S) (closure T) = 0) = (closure S = {} \<or> closure T = {} \<or> closure S \<inter> closure T \<noteq> {})
bounded S \<or> bounded T

goal (1 subgoal):
 1. (setdist S T = 0) = (S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {})
[PROOF STEP]
by (force simp:  bounded_closure compact_eq_bounded_closed)
[PROOF STATE]
proof (state)
this:
(setdist S T = 0) = (S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {})

goal (1 subgoal):
 1. S = {} \<or> T = {} \<Longrightarrow> (setdist S T = 0) = (S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {})
[PROOF STEP]
qed force


[STATEMENT]
lemma vector_derivative_cnj:
  assumes "f differentiable at x"
  shows   "vector_derivative (\<lambda>z. cnj (f z)) (at x) = cnj (vector_derivative f (at x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x) = cnj (vector_derivative f (at x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f differentiable at x

goal (1 subgoal):
 1. vector_derivative (\<lambda>z. cnj (f z)) (at x) = cnj (vector_derivative f (at x))
[PROOF STEP]
by (intro vector_derivative_cnj_within) auto


[STATEMENT]
lemma poincare_between_poincare_line_uvz:
  assumes "u \<noteq> v" and "u \<in> unit_disc" and "v \<in> unit_disc" and
          "z \<in> unit_disc" and "poincare_between u v z"
  shows "z \<in> circline_set (poincare_line u v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> circline_set (poincare_line u v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<noteq> v
u \<in> unit_disc
v \<in> unit_disc
z \<in> unit_disc
poincare_between u v z

goal (1 subgoal):
 1. z \<in> circline_set (poincare_line u v)
[PROOF STEP]
using poincare_between_poincare_collinear[of u v z]
[PROOF STATE]
proof (prove)
using this:
u \<noteq> v
u \<in> unit_disc
v \<in> unit_disc
z \<in> unit_disc
poincare_between u v z
\<lbrakk>u \<in> unit_disc; v \<in> unit_disc; z \<in> unit_disc; poincare_between u v z\<rbrakk> \<Longrightarrow> poincare_collinear {u, v, z}

goal (1 subgoal):
 1. z \<in> circline_set (poincare_line u v)
[PROOF STEP]
using unique_poincare_line[OF assms(1-3)]
[PROOF STATE]
proof (prove)
using this:
u \<noteq> v
u \<in> unit_disc
v \<in> unit_disc
z \<in> unit_disc
poincare_between u v z
\<lbrakk>u \<in> unit_disc; v \<in> unit_disc; z \<in> unit_disc; poincare_between u v z\<rbrakk> \<Longrightarrow> poincare_collinear {u, v, z}
\<lbrakk>u \<in> circline_set ?l; v \<in> circline_set ?l; is_poincare_line ?l\<rbrakk> \<Longrightarrow> ?l = poincare_line u v

goal (1 subgoal):
 1. z \<in> circline_set (poincare_line u v)
[PROOF STEP]
unfolding poincare_collinear_def
[PROOF STATE]
proof (prove)
using this:
u \<noteq> v
u \<in> unit_disc
v \<in> unit_disc
z \<in> unit_disc
poincare_between u v z
\<lbrakk>u \<in> unit_disc; v \<in> unit_disc; z \<in> unit_disc; poincare_between u v z\<rbrakk> \<Longrightarrow> \<exists>p. is_poincare_line p \<and> {u, v, z} \<subseteq> circline_set p
\<lbrakk>u \<in> circline_set ?l; v \<in> circline_set ?l; is_poincare_line ?l\<rbrakk> \<Longrightarrow> ?l = poincare_line u v

goal (1 subgoal):
 1. z \<in> circline_set (poincare_line u v)
[PROOF STEP]
by auto


[STATEMENT]
lemma uniform_limit_norm[uniform_limit_intros]:
  assumes "uniform_limit S g l f"
  shows "uniform_limit S (\<lambda>x y. norm (g x y)) (\<lambda>x. norm (l x)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit S (\<lambda>x y. norm (g x y)) (\<lambda>x. norm (l x)) f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
uniform_limit S g l f

goal (1 subgoal):
 1. uniform_limit S (\<lambda>x y. norm (g x y)) (\<lambda>x. norm (l x)) f
[PROOF STEP]
apply (rule metric_uniform_limit_imp_uniform_limit)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in f. \<forall>y\<in>S. dist (norm (g x y)) (norm (l y)) \<le> dist (g x y) (l y)
[PROOF STEP]
apply (rule eventuallyI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<forall>y\<in>S. dist (norm (g x y)) (norm (l y)) \<le> dist (g x y) (l y)
[PROOF STEP]
by (metis dist_norm norm_triangle_ineq3 real_norm_def)


[STATEMENT]
lemma rel_vset_equivp:
  assumes e: "equivp R"
  shows "rel_vset R xs ys \<longleftrightarrow> xs = ys \<and> (\<forall>x y. x \<in> xs \<longrightarrow> R x y \<longrightarrow> y \<in> xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_vset R xs ys = (xs = ys \<and> (\<forall>x y. x \<in> xs \<longrightarrow> R x y \<longrightarrow> y \<in> xs))
[PROOF STEP]
unfolding rel_vset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. R x y \<longrightarrow> (x \<in> xs) = (y \<in> ys)) = (xs = ys \<and> (\<forall>x y. x \<in> xs \<longrightarrow> R x y \<longrightarrow> y \<in> xs))
[PROOF STEP]
using equivp_reflp[OF e]
[PROOF STATE]
proof (prove)
using this:
R ?x ?x

goal (1 subgoal):
 1. (\<forall>x y. R x y \<longrightarrow> (x \<in> xs) = (y \<in> ys)) = (xs = ys \<and> (\<forall>x y. x \<in> xs \<longrightarrow> R x y \<longrightarrow> y \<in> xs))
[PROOF STEP]
by auto (metis, metis equivp_symp[OF e])


[STATEMENT]
lemma cindex_polyE_mod:
  fixes p q::"real poly"
  shows "cindex_polyE a b q p =  cindex_polyE a b (q mod p) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q p = cindex_polyE a b (q mod p) p
[PROOF STEP]
unfolding cindex_polyE_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyR q p a + real_of_int (cindex_poly a b q p) - jumpF_polyL q p b = jumpF_polyR (q mod p) p a + real_of_int (cindex_poly a b (q mod p) p) - jumpF_polyL (q mod p) p b
[PROOF STEP]
apply (subst cindex_poly_mod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyR q p a + real_of_int (cindex_poly a b (q mod p) p) - jumpF_polyL q p b = jumpF_polyR (q mod p) p a + real_of_int (cindex_poly a b (q mod p) p) - jumpF_polyL (q mod p) p b
[PROOF STEP]
apply (subst jumpF_polyR_mod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyR (q mod p) p a + real_of_int (cindex_poly a b (q mod p) p) - jumpF_polyL q p b = jumpF_polyR (q mod p) p a + real_of_int (cindex_poly a b (q mod p) p) - jumpF_polyL (q mod p) p b
[PROOF STEP]
apply (subst jumpF_polyL_mod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyR (q mod p) p a + real_of_int (cindex_poly a b (q mod p) p) - jumpF_polyL (q mod p) p b = jumpF_polyR (q mod p) p a + real_of_int (cindex_poly a b (q mod p) p) - jumpF_polyL (q mod p) p b
[PROOF STEP]
by simp


[STATEMENT]
lemma power5:
  fixes z :: "'a :: monoid_mult"
  shows "z ^ 5 = z * z * z * z * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z ^ 5 = z * z * z * z * z
[PROOF STEP]
by (simp add: mult.assoc power2_eq_square power_numeral_odd)


[STATEMENT]
lemma path_connectedin_PiE:
   "path_connectedin (product_topology X I) (PiE I S) \<longleftrightarrow>
    PiE I S = {} \<or> (\<forall>i \<in> I. path_connectedin (X i) (S i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connectedin (product_topology X I) (Pi\<^sub>E I S) = (Pi\<^sub>E I S = {} \<or> (\<forall>i\<in>I. path_connectedin (X i) (S i)))
[PROOF STEP]
by (fastforce simp add: path_connectedin_def subtopology_PiE path_connected_space_product_topology subset_PiE PiE_eq_empty_iff topspace_subtopology_subset)


[STATEMENT]
lemma dagger_of_mat_on_ket:
  fixes v:: "complex vec" and A :: "complex mat"
  assumes "dim_col A = dim_vec v"
  shows "(A * |v\<rangle> )\<^sup>\<dagger> = \<langle>v| * (A\<^sup>\<dagger>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * |v\<rangle>\<^sup>\<dagger> = \<langle>|v\<rangle>| * A\<^sup>\<dagger>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_col A = dim_vec v

goal (1 subgoal):
 1. A * |v\<rangle>\<^sup>\<dagger> = \<langle>|v\<rangle>| * A\<^sup>\<dagger>
[PROOF STEP]
by (metis bra_mat_on_vec dagger_of_ket_is_bra mat_on_ket)


[STATEMENT]
lemma ldrop_llist_of: "ldrop (enat n) (llist_of xs) = llist_of (drop n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldrop (enat n) (llist_of xs) = llist_of (drop n xs)
[PROOF STEP]
proof(induct xs arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. ldrop (enat n) (llist_of []) = llist_of (drop n [])
 2. \<And>a xs n. (\<And>n. ldrop (enat n) (llist_of xs) = llist_of (drop n xs)) \<Longrightarrow> ldrop (enat n) (llist_of (a # xs)) = llist_of (drop n (a # xs))
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
ldrop (enat ?n) (llist_of xs_) = llist_of (drop ?n xs_)

goal (2 subgoals):
 1. \<And>n. ldrop (enat n) (llist_of []) = llist_of (drop n [])
 2. \<And>a xs n. (\<And>n. ldrop (enat n) (llist_of xs) = llist_of (drop n xs)) \<Longrightarrow> ldrop (enat n) (llist_of (a # xs)) = llist_of (drop n (a # xs))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ldrop (enat ?n) (llist_of xs_) = llist_of (drop ?n xs_)

goal (1 subgoal):
 1. ldrop (enat n) (llist_of (a_ # xs_)) = llist_of (drop n (a_ # xs_))
[PROOF STEP]
by(cases n)(simp_all add: zero_enat_def[symmetric] eSuc_enat[symmetric])
[PROOF STATE]
proof (state)
this:
ldrop (enat n) (llist_of (a_ # xs_)) = llist_of (drop n (a_ # xs_))

goal (1 subgoal):
 1. \<And>n. ldrop (enat n) (llist_of []) = llist_of (drop n [])
[PROOF STEP]
qed simp


[STATEMENT]
lemma conjugate_exponent_real:
  assumes "p > (1::real)"
  shows "1/p + 1/(conjugate_exponent p) = 1"
        "conjugate_exponent p > 1"
        "conjugate_exponent(conjugate_exponent p) = p"
        "(p-1) * conjugate_exponent p = p"
        "p - p / conjugate_exponent p = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / p + 1 / conjugate_exponent p = 1 &&& 1 < conjugate_exponent p) &&& conjugate_exponent (conjugate_exponent p) = p &&& (p - 1) * conjugate_exponent p = p &&& p - p / conjugate_exponent p = 1
[PROOF STEP]
unfolding conjugate_exponent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / p + 1 / (1 + 1 / (p - 1)) = 1 &&& 1 < 1 + 1 / (p - 1)) &&& 1 + 1 / (1 + 1 / (p - 1) - 1) = p &&& (p - 1) * (1 + 1 / (p - 1)) = p &&& p - p / (1 + 1 / (p - 1)) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. (1 / p + 1 / (1 + 1 / (p - 1)) = 1 &&& 1 < 1 + 1 / (p - 1)) &&& 1 + 1 / (1 + 1 / (p - 1) - 1) = p &&& (p - 1) * (1 + 1 / (p - 1)) = p &&& p - p / (1 + 1 / (p - 1)) = 1
[PROOF STEP]
by (auto simp add: algebra_simps divide_simps)


[STATEMENT]
lemma covering_space_locally_path_connected_eq:
  fixes p :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
  assumes "covering_space C p S"
    shows "locally path_connected S \<longleftrightarrow> locally path_connected C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally path_connected S = locally path_connected C
[PROOF STEP]
proof (rule covering_space_locally_eq [OF assms])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>T. \<lbrakk>T \<subseteq> C; path_connected T\<rbrakk> \<Longrightarrow> path_connected (p ` T)
 2. \<And>q U. \<lbrakk>U \<subseteq> S; continuous_on U q; path_connected U\<rbrakk> \<Longrightarrow> path_connected (q ` U)
[PROOF STEP]
show "\<And>T. \<lbrakk>T \<subseteq> C; path_connected T\<rbrakk> \<Longrightarrow> path_connected (p ` T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>T. \<lbrakk>T \<subseteq> C; path_connected T\<rbrakk> \<Longrightarrow> path_connected (p ` T)
[PROOF STEP]
by (meson path_connected_continuous_image assms continuous_on_subset covering_space_imp_continuous)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?T \<subseteq> C; path_connected ?T\<rbrakk> \<Longrightarrow> path_connected (p ` ?T)

goal (1 subgoal):
 1. \<And>q U. \<lbrakk>U \<subseteq> S; continuous_on U q; path_connected U\<rbrakk> \<Longrightarrow> path_connected (q ` U)
[PROOF STEP]
qed (use path_connected_continuous_image in blast)


[STATEMENT]
lemma (in group) inv_solve_right:
  "\<lbrakk> a \<in> carrier G; b \<in> carrier G; c \<in> carrier G \<rbrakk> \<Longrightarrow> a = b \<otimes> inv c \<longleftrightarrow> b = a \<otimes> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier G; b \<in> carrier G; c \<in> carrier G\<rbrakk> \<Longrightarrow> (a = b \<otimes> inv c) = (b = a \<otimes> c)
[PROOF STEP]
by (metis inv_equality l_inv_ex l_one m_assoc r_inv)


[STATEMENT]
lemma of_int_hom_le: "(of_int_hom.vec_hom v :: 'a :: linordered_field vec) \<le> of_int_hom.vec_hom w \<longleftrightarrow> v \<le> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_int_hom.vec_hom v \<le> of_int_hom.vec_hom w) = (v \<le> w)
[PROOF STEP]
unfolding less_eq_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dim_vec (of_int_hom.vec_hom v) = dim_vec (of_int_hom.vec_hom w) \<and> (\<forall>i<dim_vec (of_int_hom.vec_hom w). of_int_hom.vec_hom v $ i \<le> of_int_hom.vec_hom w $ i)) = (dim_vec v = dim_vec w \<and> (\<forall>i<dim_vec w. v $ i \<le> w $ i))
[PROOF STEP]
by auto