[STATEMENT]
lemma test_sup_neg_1:
  assumes "test x"
      and "test y"
    shows "(x \<squnion> y) \<squnion> (!x \<sqinter> !y) = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> y \<squnion> ! x \<sqinter> ! y = top
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<squnion> y \<squnion> ! x \<sqinter> ! y = top
[PROOF STEP]
have "x \<squnion> !x = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> ! x = top
[PROOF STEP]
by (simp add: assms(1) neg_char)
[PROOF STATE]
proof (state)
this:
x \<squnion> ! x = top

goal (1 subgoal):
 1. x \<squnion> y \<squnion> ! x \<sqinter> ! y = top
[PROOF STEP]
hence "x \<squnion> (y \<squnion> !x) = top"
[PROOF STATE]
proof (prove)
using this:
x \<squnion> ! x = top

goal (1 subgoal):
 1. x \<squnion> (y \<squnion> ! x) = top
[PROOF STEP]
by (metis assms(2) il_associative il_commutative il_idempotent)
[PROOF STATE]
proof (state)
this:
x \<squnion> (y \<squnion> ! x) = top

goal (1 subgoal):
 1. x \<squnion> y \<squnion> ! x \<sqinter> ! y = top
[PROOF STEP]
hence "x \<squnion> (y \<squnion> !x \<sqinter> !y) = top"
[PROOF STATE]
proof (prove)
using this:
x \<squnion> (y \<squnion> ! x) = top

goal (1 subgoal):
 1. x \<squnion> (y \<squnion> ! x \<sqinter> ! y) = top
[PROOF STEP]
by (simp add: assms neg_test test_import_2)
[PROOF STATE]
proof (state)
this:
x \<squnion> (y \<squnion> ! x \<sqinter> ! y) = top

goal (1 subgoal):
 1. x \<squnion> y \<squnion> ! x \<sqinter> ! y = top
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<squnion> (y \<squnion> ! x \<sqinter> ! y) = top

goal (1 subgoal):
 1. x \<squnion> y \<squnion> ! x \<sqinter> ! y = top
[PROOF STEP]
by (simp add: il_associative)
[PROOF STATE]
proof (state)
this:
x \<squnion> y \<squnion> ! x \<sqinter> ! y = top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_of_odds: "(\<Sum>i=0..<n. Suc (i + i)) = n * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. Suc (i + i)) = n * n
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma lhs_dot_rewrite:
  fixes p:: "real poly"
  fixes qs:: "real poly list"
  fixes I:: "nat list"
  fixes signs:: "rat list list"
  assumes nonzero: "p\<noteq>0"
  shows
    "(vec_of_list (mtx_row signs I) \<bullet> (construct_lhs_vector p qs signs)) =
   sum_list (map (\<lambda>s. (z I s)  *  rat_of_int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})) signs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr 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 signs I) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})))
[PROOF STEP]
from construct_lhs_vector_cleaner[OF this]
[PROOF STATE]
proof (chain)
picking this:
construct_lhs_vector 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 p qs signs =
    vec_of_list
    (map (\<lambda>s. rat_of_int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})) signs)"
[PROOF STATE]
proof (prove)
using this:
construct_lhs_vector 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 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]
by auto
[PROOF STATE]
proof (state)
this:
construct_lhs_vector 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. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})))
[PROOF STEP]
have "(vec_of_list (mtx_row signs I) \<bullet> (construct_lhs_vector p qs signs)) =
    sum_list (map2 (*) (mtx_row signs I) (map (\<lambda>s. rat_of_int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})) signs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = sum_list (map2 (*) (mtx_row signs I) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s}))) signs))
[PROOF STEP]
unfolding rhseq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (mtx_row signs I) \<bullet> 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) = sum_list (map2 (*) (mtx_row signs I) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s}))) signs))
[PROOF STEP]
apply (intro vec_of_list_dot_rewrite)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (mtx_row signs I) = length (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s}))) signs)
[PROOF STEP]
by (auto simp add: mtx_row_def)
[PROOF STATE]
proof (state)
this:
vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = sum_list (map2 (*) (mtx_row signs I) (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. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = sum_list (map2 (*) (mtx_row signs I) (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. vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})))
[PROOF STEP]
unfolding mtx_row_def
[PROOF STATE]
proof (prove)
using this:
vec_of_list (map (z I) signs) \<bullet> construct_lhs_vector p qs signs = sum_list (map2 (*) (map (z I) signs) (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. vec_of_list (map (z I) signs) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})))
[PROOF STEP]
using map2_map_map
[PROOF STATE]
proof (prove)
using this:
vec_of_list (map (z I) signs) \<bullet> construct_lhs_vector p qs signs = sum_list (map2 (*) (map (z I) signs) (map (\<lambda>s. rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr 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 I) signs) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})))
[PROOF STEP]
by (auto simp add: map2_map_map)
[PROOF STATE]
proof (state)
this:
vec_of_list (mtx_row signs I) \<bullet> construct_lhs_vector p qs signs = (\<Sum>s\<leftarrow>signs. z I s * rat_of_int (int (card {x. poly p x = 0 \<and> consistent_sign_vec_copr qs x = s})))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_sing_prop:\<open>card {i. i = n \<and> P i} = (if P n then 1 else 0)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
proof (cases \<open>P n\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
 2. \<not> P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
P n

goal (2 subgoals):
 1. P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
 2. \<not> P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
hence \<open>{i. i = n \<and> P i} = {n}\<close>
[PROOF STATE]
proof (prove)
using this:
P n

goal (1 subgoal):
 1. {i. i = n \<and> P i} = {n}
[PROOF STEP]
by (simp add: Collect_conv_if)
[PROOF STATE]
proof (state)
this:
{i. i = n \<and> P i} = {n}

goal (2 subgoals):
 1. P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
 2. \<not> P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
with \<open>P n\<close>
[PROOF STATE]
proof (chain)
picking this:
P n
{i. i = n \<and> P i} = {n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P n
{i. i = n \<and> P i} = {n}

goal (1 subgoal):
 1. card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {i. i = n \<and> P i} = (if P n then 1 else 0)

goal (1 subgoal):
 1. \<not> P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> P n

goal (1 subgoal):
 1. \<not> P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
hence \<open>{i. i = n \<and> P i} = {}\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> P n

goal (1 subgoal):
 1. {i. i = n \<and> P i} = {}
[PROOF STEP]
by (simp add: Collect_conv_if)
[PROOF STATE]
proof (state)
this:
{i. i = n \<and> P i} = {}

goal (1 subgoal):
 1. \<not> P n \<Longrightarrow> card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
with \<open>\<not>P n\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> P n
{i. i = n \<and> P i} = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> P n
{i. i = n \<and> P i} = {}

goal (1 subgoal):
 1. card {i. i = n \<and> P i} = (if P n then 1 else 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {i. i = n \<and> P i} = (if P n then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_set_Un_simp: "(\<forall>x\<in>A \<union> B. P x) = ((\<forall>x \<in> A. P x) \<and> (\<forall>x \<in> B. P x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>A \<union> B. P x) = ((\<forall>x\<in>A. P x) \<and> (\<forall>x\<in>B. P x))
[PROOF STEP]
by auto


[STATEMENT]
lemma continuous_on_sum [continuous_intros]:
  fixes f :: "'a \<Rightarrow> 'b::topological_space \<Rightarrow> 'c::topological_comm_monoid_add"
  shows "(\<And>i. i \<in> I \<Longrightarrow> continuous_on S (f i)) \<Longrightarrow> continuous_on S (\<lambda>x. \<Sum>i\<in>I. f i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> continuous_on S (f i)) \<Longrightarrow> continuous_on S (\<lambda>x. \<Sum>i\<in>I. f i x)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> \<forall>x\<in>S. (f i \<longlongrightarrow> f i x) (at x within S)) \<Longrightarrow> \<forall>x\<in>S. ((\<lambda>x. \<Sum>i\<in>I. f i x) \<longlongrightarrow> (\<Sum>i\<in>I. f i x)) (at x within S)
[PROOF STEP]
by (auto intro: tendsto_sum)


[STATEMENT]
lemma Im_interval_times: "Im_interval (A * B) = Re_interval A * Im_interval B + Im_interval A * Re_interval B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im_interval (A * B) = Re_interval A * Im_interval B + Im_interval A * Re_interval B
[PROOF STEP]
by (cases A; cases B, auto)


[STATEMENT]
lemma fds_commutes:
  assumes "\<And>m n. m > 0 \<Longrightarrow> n > 0 \<Longrightarrow> fds_nth f m * fds_nth g n = fds_nth g n * fds_nth f m"
  shows   "f * g = g * f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f * g = g * f
[PROOF STEP]
by (intro fds_eqI, unfold fds_nth_mult, subst dirichlet_prod_def,
      subst dirichlet_prod_altdef1, intro sum.cong refl assms) (auto elim: dvdE)


[STATEMENT]
lemma Min_ex: "\<lbrakk> finite F; F \<noteq> {} \<rbrakk> \<Longrightarrow> \<exists>m \<in> F. \<forall>n \<in> F. m \<le> (n::_::linorder)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite F; F \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>m\<in>F. \<forall>n\<in>F. m \<le> n
[PROOF STEP]
using eq_Min_iff[of F "Min F"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite F; F \<noteq> {}\<rbrakk> \<Longrightarrow> (Min F = Min F) = (Min F \<in> F \<and> (\<forall>a\<in>F. Min F \<le> a))

goal (1 subgoal):
 1. \<lbrakk>finite F; F \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>m\<in>F. \<forall>n\<in>F. m \<le> n
[PROOF STEP]
by (fastforce)


[STATEMENT]
lemma length_filter_replace1:
 "\<lbrakk> x \<in> set xs; \<not> P x \<rbrakk> \<Longrightarrow>
  length(filter P (replace x ys xs)) =
  length(filter P xs) + length(filter P ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> set xs; \<not> P x\<rbrakk> \<Longrightarrow> |filter P (replace x ys xs)| = |filter P xs| + |filter P ys|
[PROOF STEP]
apply(induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> set []; \<not> P x\<rbrakk> \<Longrightarrow> |filter P (replace x ys [])| = |filter P []| + |filter P ys|
 2. \<And>a xs. \<lbrakk>\<lbrakk>x \<in> set xs; \<not> P x\<rbrakk> \<Longrightarrow> |filter P (replace x ys xs)| = |filter P xs| + |filter P ys|; x \<in> set (a # xs); \<not> P x\<rbrakk> \<Longrightarrow> |filter P (replace x ys (a # xs))| = |filter P (a # xs)| + |filter P ys|
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>x \<in> set xs; \<not> P x\<rbrakk> \<Longrightarrow> |filter P (replace x ys xs)| = |filter P xs| + |filter P ys|; x \<in> set (a # xs); \<not> P x\<rbrakk> \<Longrightarrow> |filter P (replace x ys (a # xs))| = |filter P (a # xs)| + |filter P ys|
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma construct_NofI_R_relation:
  fixes p:: "real poly"
  fixes I1:: "real poly list"
  fixes I2:: "real poly list"
  shows "construct_NofI_R p I1 I2 =
    construct_NofI (sum_list (map power2 (p # I1))) I2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. construct_NofI_R p I1 I2 = construct_NofI (sum_list (map power2 (p # I1))) I2
[PROOF STEP]
unfolding construct_NofI_R_def construct_NofI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (let new_p = sum_list (map power2 (p # I1)) in rat_of_int (changes_R_smods new_p (pderiv new_p * prod_list I2))) = rat_of_int (changes_R_smods (sum_list (map power2 (p # I1))) (pderiv (sum_list (map power2 (p # I1))) * prod_list I2))
[PROOF STEP]
by metis


[STATEMENT]
lemma transpose_apply_matrix: "f 0 = 0 \<Longrightarrow> transpose_matrix (apply_matrix f A) = apply_matrix f (transpose_matrix A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (0::'b) = (0::'a) \<Longrightarrow> transpose_matrix (apply_matrix f A) = apply_matrix f (transpose_matrix A)
[PROOF STEP]
apply (simp add: Rep_matrix_inject[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (0::'b) = (0::'a) \<Longrightarrow> Rep_matrix (transpose_matrix (apply_matrix f A)) = Rep_matrix (apply_matrix f (transpose_matrix A))
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. f (0::'b) = (0::'a) \<Longrightarrow> Rep_matrix (transpose_matrix (apply_matrix f A)) x xa = Rep_matrix (apply_matrix f (transpose_matrix A)) x xa
[PROOF STEP]
by simp


[STATEMENT]
lemma repeat_mset_distrib:
  "repeat_mset (m + n) A = repeat_mset m A + repeat_mset n A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. repeat_mset (m + n) A = repeat_mset m A + repeat_mset n A
[PROOF STEP]
by (auto simp: multiset_eq_iff Nat.add_mult_distrib)


[STATEMENT]
lemma (in cpx_sq_mat) rank_1_proj_sum_density:
  assumes "finite I"
  and "\<forall>i\<in> I. \<parallel>u i\<parallel> = 1"
  and "\<forall>i\<in> I. dim_vec (u i) = dimR"
  and "\<forall>i\<in> I. 0 \<le> p i"
  and "(\<Sum>i\<in> I. p i) = 1"
shows "density_operator (sum_mat (\<lambda>i. p i \<cdot>\<^sub>m (rank_1_proj (u i))) I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. density_operator (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
[PROOF STEP]
unfolding density_operator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) \<and> Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
 2. Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
have "Complex_Matrix.trace (sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) =
    (\<Sum>i\<in> I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i)))
[PROOF STEP]
proof (rule trace_sum_mat, (simp add: assms))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats
[PROOF STEP]
show "\<And>i. i \<in> I \<Longrightarrow> p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats
[PROOF STEP]
using assms smult_mem fc_mats_carrier
        dim_eq
[PROOF STATE]
proof (prove)
using this:
finite I
\<forall>i\<in>I. \<parallel>u i\<parallel> = 1
\<forall>i\<in>I. dim_vec (u i) = dimR
\<forall>i\<in>I. 0 \<le> p i
sum p I = 1
?A \<in> fc_mats \<Longrightarrow> ?a \<cdot>\<^sub>m ?A \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i2 \<in> I \<Longrightarrow> p ?i2 \<cdot>\<^sub>m rank_1_proj (u ?i2) \<in> fc_mats

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i)))

goal (2 subgoals):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
 2. Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i)))

goal (2 subgoals):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
 2. Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
have "... = (\<Sum>i\<in> I. p i * Complex_Matrix.trace (rank_1_proj (u i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))
[PROOF STEP]
assume "i \<in> I"
[PROOF STATE]
proof (state)
this:
i \<in> I

goal (1 subgoal):
 1. (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))
[PROOF STEP]
hence "Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i)) =
        p i * Complex_Matrix.trace (rank_1_proj (u i))"
[PROOF STATE]
proof (prove)
using this:
i \<in> I

goal (1 subgoal):
 1. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i)) = p i * Complex_Matrix.trace (rank_1_proj (u i))
[PROOF STEP]
using trace_smult[of "rank_1_proj (u i)" dimR] assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
i \<in> I
rank_1_proj (u i) \<in> carrier_mat dimR dimR \<Longrightarrow> Complex_Matrix.trace (?c \<cdot>\<^sub>m rank_1_proj (u i)) = ?c * Complex_Matrix.trace (rank_1_proj (u i))
finite I
\<forall>i\<in>I. \<parallel>u i\<parallel> = 1
\<forall>i\<in>I. dim_vec (u i) = dimR
\<forall>i\<in>I. 0 \<le> p i
sum p I = 1
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i)) = p i * Complex_Matrix.trace (rank_1_proj (u i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i)) = p i * Complex_Matrix.trace (rank_1_proj (u i))

goal (1 subgoal):
 1. (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i4 \<in> I \<Longrightarrow> Complex_Matrix.trace (p ?i4 \<cdot>\<^sub>m rank_1_proj (u ?i4)) = p ?i4 * Complex_Matrix.trace (rank_1_proj (u ?i4))

goal (1 subgoal):
 1. (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?i4 \<in> I \<Longrightarrow> Complex_Matrix.trace (p ?i4 \<cdot>\<^sub>m rank_1_proj (u ?i4)) = p ?i4 * Complex_Matrix.trace (rank_1_proj (u ?i4))

goal (1 subgoal):
 1. (\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))

goal (2 subgoals):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
 2. Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>I. Complex_Matrix.trace (p i \<cdot>\<^sub>m rank_1_proj (u i))) = (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i)))

goal (2 subgoals):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
 2. Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i))) = 1
[PROOF STEP]
using assms rank_1_proj_trace assms
[PROOF STATE]
proof (prove)
using this:
finite I
\<forall>i\<in>I. \<parallel>u i\<parallel> = 1
\<forall>i\<in>I. dim_vec (u i) = dimR
\<forall>i\<in>I. 0 \<le> p i
sum p I = 1
\<parallel>?v\<parallel> = 1 \<Longrightarrow> Complex_Matrix.trace (rank_1_proj ?v) = 1
finite I
\<forall>i\<in>I. \<parallel>u i\<parallel> = 1
\<forall>i\<in>I. dim_vec (u i) = dimR
\<forall>i\<in>I. 0 \<le> p i
sum p I = 1

goal (1 subgoal):
 1. (\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i))) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>I. p i * Complex_Matrix.trace (rank_1_proj (u i))) = 1

goal (2 subgoals):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
 2. Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
show "Complex_Matrix.trace (sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1"
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1

goal (1 subgoal):
 1. Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I) = 1

goal (1 subgoal):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
[PROOF STEP]
show "Complex_Matrix.positive (sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)
[PROOF STEP]
proof (rule sum_mat_positive, (simp add: assms))
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.positive (p i \<cdot>\<^sub>m rank_1_proj (u i))
 2. \<And>i. i \<in> I \<Longrightarrow> p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.positive (p i \<cdot>\<^sub>m rank_1_proj (u i))
 2. \<And>i. i \<in> I \<Longrightarrow> p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats
[PROOF STEP]
assume "i\<in> I"
[PROOF STATE]
proof (state)
this:
i \<in> I

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.positive (p i \<cdot>\<^sub>m rank_1_proj (u i))
 2. \<And>i. i \<in> I \<Longrightarrow> p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats
[PROOF STEP]
thus "p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats"
[PROOF STATE]
proof (prove)
using this:
i \<in> I

goal (1 subgoal):
 1. p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats
[PROOF STEP]
using assms smult_mem fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
i \<in> I
finite I
\<forall>i\<in>I. \<parallel>u i\<parallel> = 1
\<forall>i\<in>I. dim_vec (u i) = dimR
\<forall>i\<in>I. 0 \<le> p i
sum p I = 1
?A \<in> fc_mats \<Longrightarrow> ?a \<cdot>\<^sub>m ?A \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p i \<cdot>\<^sub>m rank_1_proj (u i) \<in> fc_mats

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> Complex_Matrix.positive (p i \<cdot>\<^sub>m rank_1_proj (u i))
[PROOF STEP]
show "Complex_Matrix.positive (p i \<cdot>\<^sub>m rank_1_proj (u i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.positive (p i \<cdot>\<^sub>m rank_1_proj (u i))
[PROOF STEP]
using assms \<open>i\<in> I\<close>
        rank_1_proj_positive positive_smult[of "rank_1_proj (u i)" dimR] dim_eq
[PROOF STATE]
proof (prove)
using this:
finite I
\<forall>i\<in>I. \<parallel>u i\<parallel> = 1
\<forall>i\<in>I. dim_vec (u i) = dimR
\<forall>i\<in>I. 0 \<le> p i
sum p I = 1
i \<in> I
\<parallel>?v\<parallel> = 1 \<Longrightarrow> Complex_Matrix.positive (rank_1_proj ?v)
\<lbrakk>rank_1_proj (u i) \<in> carrier_mat dimR dimR; Complex_Matrix.positive (rank_1_proj (u i)); 0 \<le> ?c\<rbrakk> \<Longrightarrow> Complex_Matrix.positive (?c \<cdot>\<^sub>m rank_1_proj (u i))
dimR = dimC

goal (1 subgoal):
 1. Complex_Matrix.positive (p i \<cdot>\<^sub>m rank_1_proj (u i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Complex_Matrix.positive (p i \<cdot>\<^sub>m rank_1_proj (u i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Complex_Matrix.positive (local.sum_mat (\<lambda>i. p i \<cdot>\<^sub>m rank_1_proj (u i)) I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_prefix:
  "(take (length xs) ys = xs) = prefix xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (take (length xs) ys = xs) = prefix xs ys
[PROOF STEP]
proof (induct xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. (take (length []) ys = []) = prefix [] ys
 2. \<And>a xs ys. (\<And>ys. (take (length xs) ys = xs) = prefix xs ys) \<Longrightarrow> (take (length (a # xs)) ys = a # xs) = prefix (a # xs) ys
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>ys. (take (length []) ys = []) = prefix [] ys
 2. \<And>a xs ys. (\<And>ys. (take (length xs) ys = xs) = prefix xs ys) \<Longrightarrow> (take (length (a # xs)) ys = a # xs) = prefix (a # xs) ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (take (length []) ys = []) = prefix [] ys
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(take (length []) ys = []) = prefix [] ys

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (take (length xs) ys = xs) = prefix xs ys) \<Longrightarrow> (take (length (a # xs)) ys = a # xs) = prefix (a # xs) ys
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (take (length xs) ys = xs) = prefix xs ys) \<Longrightarrow> (take (length (a # xs)) ys = a # xs) = prefix (a # xs) ys
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
(take (length xs_) ?ys = xs_) = prefix xs_ ?ys

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (take (length xs) ys = xs) = prefix xs ys) \<Longrightarrow> (take (length (a # xs)) ys = a # xs) = prefix (a # xs) ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(take (length xs_) ?ys = xs_) = prefix xs_ ?ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(take (length xs_) ?ys = xs_) = prefix xs_ ?ys

goal (1 subgoal):
 1. (take (length (a_ # xs_)) ys = a_ # xs_) = prefix (a_ # xs_) ys
[PROOF STEP]
by (cases ys) auto
[PROOF STATE]
proof (state)
this:
(take (length (a_ # xs_)) ys = a_ # xs_) = prefix (a_ # xs_) ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_lists_distinct_length_eq':
  assumes "k < card A"
  shows "card {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - k + 1 .. card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - k + 1..card A}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - k + 1..card A}
[PROOF STEP]
from \<open>k < card A\<close>
[PROOF STATE]
proof (chain)
picking this:
k < card A
[PROOF STEP]
have "finite A" and "k \<le> card A"
[PROOF STATE]
proof (prove)
using this:
k < card A

goal (1 subgoal):
 1. finite A &&& k \<le> card A
[PROOF STEP]
using card.infinite
[PROOF STATE]
proof (prove)
using this:
k < card A
infinite ?A \<Longrightarrow> card ?A = 0

goal (1 subgoal):
 1. finite A &&& k \<le> card A
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
finite A
k \<le> card A

goal (1 subgoal):
 1. card {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - k + 1..card A}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
finite A
k \<le> card A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A
k \<le> card A

goal (1 subgoal):
 1. card {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - k + 1..card A}
[PROOF STEP]
by (rule card_lists_distinct_length_eq)
[PROOF STATE]
proof (state)
this:
card {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - k + 1..card A}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma div_distrib: assumes "i<n"
  shows "(a*base^n + b) div base^i mod base = b div base^i mod base"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * base ^ n + b) div base ^ i mod base = b div base ^ i mod base
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a * base ^ n + b) div base ^ i mod base = b div base ^ i mod base
[PROOF STEP]
have "base^i dvd (a*base^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. base ^ i dvd a * base ^ n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. base ^ i dvd a * base ^ n
[PROOF STEP]
by (simp add: le_imp_power_dvd)
[PROOF STATE]
proof (state)
this:
base ^ i dvd a * base ^ n

goal (1 subgoal):
 1. (a * base ^ n + b) div base ^ i mod base = b div base ^ i mod base
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
base ^ i dvd a * base ^ n

goal (1 subgoal):
 1. (a * base ^ n + b) div base ^ i mod base = b div base ^ i mod base
[PROOF STEP]
have "a*base^n div base^i mod base = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * base ^ n div base ^ i mod base = 0
[PROOF STEP]
by (metis Suc_leI assms dvd_imp_mod_0 dvd_mult
        dvd_mult_imp_div le_imp_power_dvd power_Suc)
[PROOF STATE]
proof (state)
this:
a * base ^ n div base ^ i mod base = 0

goal (1 subgoal):
 1. (a * base ^ n + b) div base ^ i mod base = b div base ^ i mod base
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
base ^ i dvd a * base ^ n
a * base ^ n div base ^ i mod base = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
base ^ i dvd a * base ^ n
a * base ^ n div base ^ i mod base = 0

goal (1 subgoal):
 1. (a * base ^ n + b) div base ^ i mod base = b div base ^ i mod base
[PROOF STEP]
by (metis add.right_neutral div_mult_mod_eq
        div_plus_div_distrib_dvd_left mod_mult_self3)
[PROOF STATE]
proof (state)
this:
(a * base ^ n + b) div base ^ i mod base = b div base ^ i mod base

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sig_inv_set_mono:
  assumes "i \<le> j"
  shows "sig_inv_set' i \<subseteq> sig_inv_set' j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sig_inv_set' i \<subseteq> sig_inv_set' j
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sig_inv_set' i \<Longrightarrow> x \<in> sig_inv_set' j
[PROOF STEP]
fix r
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sig_inv_set' i \<Longrightarrow> x \<in> sig_inv_set' j
[PROOF STEP]
assume "r \<in> sig_inv_set' i"
[PROOF STATE]
proof (state)
this:
r \<in> sig_inv_set' i

goal (1 subgoal):
 1. \<And>x. x \<in> sig_inv_set' i \<Longrightarrow> x \<in> sig_inv_set' j
[PROOF STEP]
hence "keys (vectorize_poly r) \<subseteq> {0..<i}"
[PROOF STATE]
proof (prove)
using this:
r \<in> sig_inv_set' i

goal (1 subgoal):
 1. keys (vectorize_poly r) \<subseteq> {0..<i}
[PROOF STEP]
by (rule sig_inv_setD)
[PROOF STATE]
proof (state)
this:
keys (vectorize_poly r) \<subseteq> {0..<i}

goal (1 subgoal):
 1. \<And>x. x \<in> sig_inv_set' i \<Longrightarrow> x \<in> sig_inv_set' j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
keys (vectorize_poly r) \<subseteq> {0..<i}

goal (1 subgoal):
 1. \<And>x. x \<in> sig_inv_set' i \<Longrightarrow> x \<in> sig_inv_set' j
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
i \<le> j
[PROOF STEP]
have "... \<subseteq> {0..<j}"
[PROOF STATE]
proof (prove)
using this:
i \<le> j

goal (1 subgoal):
 1. {0..<i} \<subseteq> {0..<j}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{0..<i} \<subseteq> {0..<j}

goal (1 subgoal):
 1. \<And>x. x \<in> sig_inv_set' i \<Longrightarrow> x \<in> sig_inv_set' j
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
keys (vectorize_poly r) \<subseteq> {0..<j}
[PROOF STEP]
show "r \<in> sig_inv_set' j"
[PROOF STATE]
proof (prove)
using this:
keys (vectorize_poly r) \<subseteq> {0..<j}

goal (1 subgoal):
 1. r \<in> sig_inv_set' j
[PROOF STEP]
by (rule sig_inv_setI)
[PROOF STATE]
proof (state)
this:
r \<in> sig_inv_set' j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vprojection_vrange_vsubset:
  assumes "i \<in>\<^sub>\<circ> I"
  shows "\<R>\<^sub>\<circ> (vprojection I A i) \<subseteq>\<^sub>\<circ> A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (vprojection I A i) \<subseteq>\<^sub>\<circ> A i
[PROOF STEP]
unfolding vprojection_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<lambda>f\<in>\<^sub>\<circ>vproduct I A. f\<lparr>i\<rparr>) \<subseteq>\<^sub>\<circ> A i
[PROOF STEP]
proof(intro vrange_VLambda_vsubset)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> vproduct I A \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A i
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> vproduct I A \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A i
[PROOF STEP]
assume prems: "f \<in>\<^sub>\<circ> (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i)"
[PROOF STATE]
proof (state)
this:
f \<in>\<^sub>\<circ> vproduct I A

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> vproduct I A \<Longrightarrow> x\<lparr>i\<rparr> \<in>\<^sub>\<circ> A i
[PROOF STEP]
show "f\<lparr>i\<rparr> \<in>\<^sub>\<circ> A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f\<lparr>i\<rparr> \<in>\<^sub>\<circ> A i
[PROOF STEP]
by (intro vproductD(3)[OF prems, rule_format] assms)
[PROOF STATE]
proof (state)
this:
f\<lparr>i\<rparr> \<in>\<^sub>\<circ> A i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bouncing_ball_inv: "g < 0 \<Longrightarrow> h \<ge> 0 \<Longrightarrow>
  (\<lambda>s. s$1 = h \<and> s$2 = 0) \<le>
  |LOOP (
    (x\<acute>=(f g) & (\<lambda> s. s$1 \<ge> 0) DINV (\<lambda>s. 2 * g * s$1 - 2 * g * h - s$2 * s$2 = 0)) ;
    (IF (\<lambda> s. s$1 = 0) THEN (2 ::= (\<lambda>s. - s$2)) ELSE skip))
  INV (\<lambda>s. 0 \<le> s$1 \<and> 2 * g * s$1 - 2 * g * h - s$2 * s$2 = 0)]
  (\<lambda>s. 0 \<le> s$1 \<and> s$1 \<le> h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> (\<lambda>s. s $ 1 = h \<and> s $ 2 = 0) \<le> |LOOP x\<acute>=\<lambda>t. f g & \<lambda>s. 0 \<le> s $ 1 on \<lambda>s. {t. 0 \<le> t} UNIV @ 0 DINV \<lambda>s. 2 * g * s $ 1 - 2 * g * h - s $ 2 * s $ 2 = 0  ; (IF (\<lambda>s. s $ 1 = 0) THEN (2 ::= (\<lambda>s. - s $ 2)) ELSE skip) INV (\<lambda>s. 0 \<le> s $ 1 \<and> 2 * g * s $ 1 - 2 * g * h - s $ 2 * s $ 2 = 0) ] (\<lambda>s. 0 \<le> s $ 1 \<and> s $ 1 \<le> h)
[PROOF STEP]
apply(rule fbox_loopI, simp_all, force, force simp: bb_real_arith)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> (\<lambda>s. 0 \<le> s $ 1 \<and> 2 * g * s $ 1 - 2 * g * h = s $ 2 * s $ 2) \<le> |x\<acute>=\<lambda>t. f g & \<lambda>s. 0 \<le> s $ 1 on \<lambda>s. Collect ((\<le>) 0) UNIV @ 0 DINV \<lambda>s. 2 * g * s $ 1 - 2 * g * h = s $ 2 * s $ 2 ] (\<lambda>s. (s $ 1 = 0 \<longrightarrow> - (2 * g * h) = s $ 2 * s $ 2) \<and> (s $ 1 \<noteq> 0 \<longrightarrow> 0 \<le> s $ 1 \<and> 2 * g * s $ 1 - 2 * g * h = s $ 2 * s $ 2))
[PROOF STEP]
by (rule fbox_g_odei) (auto intro!: poly_derivatives diff_invariant_rules)

\<comment> \<open>Verified with annotated dynamics. \<close>


[STATEMENT]
lemma det_echelon_form:
  fixes A::"'a::{bezout_domain}^'n::{mod_type}^'n::{mod_type}"
  assumes ef: "echelon_form A"
  shows "det A = prod (\<lambda>i. A $ i $ i) (UNIV:: 'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
using det_upperdiagonal echelon_form_imp_upper_triagular[OF ef]
[PROOF STATE]
proof (prove)
using this:
(\<And>i j. j < i \<Longrightarrow> ?A $ i $ j = (0::?'a)) \<Longrightarrow> det ?A = (\<Prod>i\<in>UNIV. ?A $ i $ i)
upper_triangular A

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
unfolding upper_triangular_def
[PROOF STATE]
proof (prove)
using this:
(\<And>i j. j < i \<Longrightarrow> ?A $ i $ j = (0::?'a)) \<Longrightarrow> det ?A = (\<Prod>i\<in>UNIV. ?A $ i $ i)
\<forall>i j. j < i \<longrightarrow> A $ i $ j = (0::'a)

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
by blast


[STATEMENT]
lemma hyperbola_method:
  fixes f g :: "nat \<Rightarrow> 'a :: comm_ring"
  assumes "A \<ge> 0" "B \<ge> 0" "A * B = x"
  shows   "sum_upto (dirichlet_prod f g) x =
             sum_upto (\<lambda>n. f n * sum_upto g (x / real n)) A +
             sum_upto (\<lambda>n. sum_upto f (x / real n) * g n) B -
             sum_upto f A * sum_upto g B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (dirichlet_prod f g) x = sum_upto (\<lambda>n. f n * sum_upto g (x / real n)) A + sum_upto (\<lambda>n. sum_upto f (x / real n) * g n) B - sum_upto f A * sum_upto g B
[PROOF STEP]
using hyperbola_method_semiring[OF assms, of f g]
[PROOF STATE]
proof (prove)
using this:
sum_upto (dirichlet_prod f g) x + sum_upto f A * sum_upto g B = sum_upto (\<lambda>n. f n * sum_upto g (x / real n)) A + sum_upto (\<lambda>n. sum_upto f (x / real n) * g n) B

goal (1 subgoal):
 1. sum_upto (dirichlet_prod f g) x = sum_upto (\<lambda>n. f n * sum_upto g (x / real n)) A + sum_upto (\<lambda>n. sum_upto f (x / real n) * g n) B - sum_upto f A * sum_upto g B
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma ai_exists0_less_than_sum:
  assumes "\<And>n. a n \<in> {0,1}"
          "i \<ge> m"
      and "a i = 0"
    shows "(\<Sum>n::nat. real (a (n + m)) * (1/2)^(Suc (n + m))) < (1 / 2) ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m
[PROOF STEP]
have "(\<Sum>n::nat. real (a (n + m)) * (1/2)^(Suc (n + m))) = (\<Sum>n<i-m. real (a (n + m)) * (1/2)^(Suc (n + m))) + (\<Sum>n::nat. real (a (n + i)) * (1/2)^(Suc (n + i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) = (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i))
[PROOF STEP]
using suminf_split_initial_segment[of "\<lambda>n. real (a (n + m)) * (1/2)^(Suc (n + m))" "i-m"] assms(1) binary_expression_summable[of a] summable_iff_shift[of "\<lambda>n. real (a n) * (1 / 2) ^ Suc n" m] assms(2)
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<Longrightarrow> (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) = (\<Sum>n. real (a (n + (i - m) + m)) * (1 / 2) ^ Suc (n + (i - m) + m)) + (\<Sum>i<i - m. real (a (i + m)) * (1 / 2) ^ Suc (i + m))
a ?n \<in> {0, 1}
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
summable (\<lambda>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) = summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
m \<le> i

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) = (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) = (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i))

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) = (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i))

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m
[PROOF STEP]
have "... < (1 / 2) ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
have "(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
have "(\<Sum>n::nat. real (a (n + i)) * (1/2)^(Suc (n + i))) = (\<Sum>n::nat. real (a (Suc n + i)) * (1/2)^(Suc (Suc n + i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) = (\<Sum>n. real (a (Suc n + i)) * (1 / 2) ^ Suc (Suc n + i))
[PROOF STEP]
using suminf_split_head[of "\<lambda>n. real (a (n + i)) * (1/2)^(Suc (n + i))"] assms(1,3) binary_expression_summable[of a] summable_iff_shift[of "\<lambda>n. real (a n) * (1 / 2) ^ Suc n" i]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<Longrightarrow> (\<Sum>n. real (a (Suc n + i)) * (1 / 2) ^ Suc (Suc n + i)) = (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) - real (a (0 + i)) * (1 / 2) ^ Suc (0 + i)
a ?n \<in> {0, 1}
a i = 0
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)
summable (\<lambda>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) = summable (\<lambda>n. real (a n) * (1 / 2) ^ Suc n)

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) = (\<Sum>n. real (a (Suc n + i)) * (1 / 2) ^ Suc (Suc n + i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) = (\<Sum>n. real (a (Suc n + i)) * (1 / 2) ^ Suc (Suc n + i))

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) = (\<Sum>n. real (a (Suc n + i)) * (1 / 2) ^ Suc (Suc n + i))

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
have "... = (\<Sum>n::nat. real (a (n + Suc i)) * (1/2)^(Suc n + Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (a (Suc n + i)) * (1 / 2) ^ Suc (Suc n + i)) = (\<Sum>n. real (a (n + Suc i)) * (1 / 2) ^ (Suc n + Suc i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (Suc n + i)) * (1 / 2) ^ Suc (Suc n + i)) = (\<Sum>n. real (a (n + Suc i)) * (1 / 2) ^ (Suc n + Suc i))

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (Suc n + i)) * (1 / 2) ^ Suc (Suc n + i)) = (\<Sum>n. real (a (n + Suc i)) * (1 / 2) ^ (Suc n + Suc i))

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
have "... \<le> (\<Sum>n::nat. (1/2)^(Suc n + Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real (a (n + Suc i)) * (1 / 2) ^ (Suc n + Suc i)) \<le> (\<Sum>n. (1 / 2) ^ (Suc n + Suc i))
[PROOF STEP]
using binary_expression_less_than[of a "Suc i"] assms(1)
[PROOF STATE]
proof (prove)
using this:
(\<And>n. a n \<in> {0, 1}) \<Longrightarrow> (\<Sum>n. real (a (n + Suc i)) * (1 / 2) ^ Suc (n + Suc i)) \<le> (\<Sum>n. (1 / 2) ^ Suc (n + Suc i))
a ?n \<in> {0, 1}

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + Suc i)) * (1 / 2) ^ (Suc n + Suc i)) \<le> (\<Sum>n. (1 / 2) ^ (Suc n + Suc i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + Suc i)) * (1 / 2) ^ (Suc n + Suc i)) \<le> (\<Sum>n. (1 / 2) ^ (Suc n + Suc i))

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + Suc i)) * (1 / 2) ^ (Suc n + Suc i)) \<le> (\<Sum>n. (1 / 2) ^ (Suc n + Suc i))

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
have "... = (1/2)^(Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. (1 / 2) ^ (Suc n + Suc i)) = (1 / 2) ^ Suc i
[PROOF STEP]
using half_sum[of "Suc i"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. (1 / 2) ^ Suc (n + Suc i)) = (1 / 2) ^ Suc i

goal (1 subgoal):
 1. (\<Sum>n. (1 / 2) ^ (Suc n + Suc i)) = (1 / 2) ^ Suc i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. (1 / 2) ^ (Suc n + Suc i)) = (1 / 2) ^ Suc i

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
have "(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1/2)^m - (1/2)^i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
have "(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m))
[PROOF STEP]
have "real (a i) * (1 / 2) ^ Suc i \<le> (1 / 2) ^ Suc i" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (a i) * (1 / 2) ^ Suc i \<le> (1 / 2) ^ Suc i
[PROOF STEP]
using assms(1)[of i]
[PROOF STATE]
proof (prove)
using this:
a i \<in> {0, 1}

goal (1 subgoal):
 1. real (a i) * (1 / 2) ^ Suc i \<le> (1 / 2) ^ Suc i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (a ?i) * (1 / 2) ^ Suc ?i \<le> (1 / 2) ^ Suc ?i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real (a ?i) * (1 / 2) ^ Suc ?i \<le> (1 / 2) ^ Suc ?i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m))
[PROOF STEP]
by (simp add: sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m))

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m))

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
have "... = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m)) = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m))
[PROOF STEP]
using suminf_split_initial_segment[of "\<lambda>n. (1 / 2) ^ Suc (n + m)" "i-m"] power_half_summable summable_iff_shift[of "\<lambda>n. ((1::real) / 2) ^ Suc n" m]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. ((1::?'a1) / (2::?'a1)) ^ Suc (n + m)) \<Longrightarrow> (\<Sum>n. ((1::?'a1) / (2::?'a1)) ^ Suc (n + m)) = (\<Sum>n. ((1::?'a1) / (2::?'a1)) ^ Suc (n + (i - m) + m)) + (\<Sum>i<i - m. ((1::?'a1) / (2::?'a1)) ^ Suc (i + m))
summable (\<lambda>n. (1 / 2) ^ Suc n)
summable (\<lambda>n. (1 / 2) ^ Suc (n + m)) = summable (\<lambda>n. (1 / 2) ^ Suc n)

goal (1 subgoal):
 1. (\<Sum>n<i - m. (1 / 2) ^ Suc (n + m)) = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. (1 / 2) ^ Suc (n + m)) = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m))

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. (1 / 2) ^ Suc (n + m)) = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m))

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
have "... = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m)) = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + i))
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
m \<le> i

goal (1 subgoal):
 1. (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m)) = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m)) = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + i))

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + (i - m) + m)) = (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + i))

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
have "... = (1/2)^m - (1/2)^i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + i)) = (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
using half_sum
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. (1 / 2) ^ Suc (n + ?k)) = (1 / 2) ^ ?k

goal (1 subgoal):
 1. (\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + i)) = (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>n. (1 / 2) ^ Suc (n + m)) - (\<Sum>n. (1 / 2) ^ Suc (n + i)) = (1 / 2) ^ m - (1 / 2) ^ i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
have "(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i + (1 / 2) ^ m - (1 / 2) ^ i"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) \<le> (1 / 2) ^ m - (1 / 2) ^ i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i + (1 / 2) ^ m - (1 / 2) ^ i
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i + (1 / 2) ^ m - (1 / 2) ^ i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) \<le> (1 / 2) ^ Suc i + (1 / 2) ^ m - (1 / 2) ^ i

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
have "... < (1 / 2) ^ m "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 2) ^ Suc i + (1 / 2) ^ m - (1 / 2) ^ i < (1 / 2) ^ m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 / 2) ^ Suc i + (1 / 2) ^ m - (1 / 2) ^ i < (1 / 2) ^ m

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m

goal (1 subgoal):
 1. (\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>n<i - m. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) + (\<Sum>n. real (a (n + i)) * (1 / 2) ^ Suc (n + i)) < (1 / 2) ^ m

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m

goal (1 subgoal):
 1. (\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>n. real (a (n + m)) * (1 / 2) ^ Suc (n + m)) < (1 / 2) ^ m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in PolynRg) polyn_n_m:"\<lbrakk>pol_coeff S c; n < m; m \<le> (fst c)\<rbrakk> \<Longrightarrow>
      polyn_expr R X m (m, (snd c)) = polyn_expr R X n (n, (snd c)) \<plusminus>
                        (fSum R (\<lambda>j. ((snd c) j) \<cdot>\<^sub>r (X^\<^bsup>R j\<^esup>)) (Suc n) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c\<rbrakk> \<Longrightarrow> polyn_expr R X m (m, snd c) = polyn_expr R X n (n, snd c) \<plusminus> \<Sigma>\<^sub>f R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n m
[PROOF STEP]
apply (simp add:polyn_expr_def, cut_tac ring_is_ag)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c; aGroup R\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) m = \<Sigma>\<^sub>e R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> \<Sigma>\<^sub>f R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n m
[PROOF STEP]
apply (rule aGroup.nsum_split1[of "R" m "\<lambda>j. ((snd c) j) \<cdot>\<^sub>r (X^\<^bsup>R j\<^esup>)" n],
         assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c; aGroup R\<rbrakk> \<Longrightarrow> \<forall>j\<le>m. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> \<in> carrier R
 2. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c; aGroup R\<rbrakk> \<Longrightarrow> n < m
[PROOF STEP]
apply (rule allI, rule impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c; aGroup R; j \<le> m\<rbrakk> \<Longrightarrow> snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> \<in> carrier R
 2. \<lbrakk>pol_coeff S c; n < m; m \<le> fst c; aGroup R\<rbrakk> \<Longrightarrow> n < m
[PROOF STEP]
apply (frule_tac monomial_mem[of c],
       frule_tac i = j and j = m and k = "(fst c)" in le_trans, assumption+,
       simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma v_gs_union: "v_gs (X \<union> Y) = v_gs X \<union> v_gs Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v_gs (X \<union> Y) = v_gs X \<union> v_gs Y
[PROOF STEP]
unfolding v_gs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v ` (X \<union> Y) = v ` X \<union> v ` Y
[PROOF STEP]
by auto


[STATEMENT]
lemma powr_less_cancel_iff [simp]: "1 < x \<Longrightarrow> x powr a < x powr b \<longleftrightarrow> a < b"
  for a b x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> (x powr a < x powr b) = (a < b)
[PROOF STEP]
by (blast intro: powr_less_cancel powr_less_mono)


[STATEMENT]
lemma ipv4addr_of_dotdecimal_bit:
    "ipv4addr_of_dotdecimal (a,b,c,d) =
      (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) +
       (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
have a: "(ipv4addr_of_nat a) << 24 = ipv4addr_of_nat (a * 16777216)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv4addr_of_nat a << 24 = ipv4addr_of_nat (a * 16777216)
[PROOF STEP]
by(simp add: ipv4addr_of_nat_def shiftl_t2n)
[PROOF STATE]
proof (state)
this:
ipv4addr_of_nat a << 24 = ipv4addr_of_nat (a * 16777216)

goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
have b: "(ipv4addr_of_nat b) << 16 = ipv4addr_of_nat (b * 65536)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv4addr_of_nat b << 16 = ipv4addr_of_nat (b * 65536)
[PROOF STEP]
by(simp add: ipv4addr_of_nat_def shiftl_t2n)
[PROOF STATE]
proof (state)
this:
ipv4addr_of_nat b << 16 = ipv4addr_of_nat (b * 65536)

goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
have c: "(ipv4addr_of_nat c) << 8 = ipv4addr_of_nat (c * 256)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv4addr_of_nat c << 8 = ipv4addr_of_nat (c * 256)
[PROOF STEP]
by(simp add: ipv4addr_of_nat_def shiftl_t2n)
[PROOF STATE]
proof (state)
this:
ipv4addr_of_nat c << 8 = ipv4addr_of_nat (c * 256)

goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
have ipv4addr_of_nat_suc: "\<And>x. ipv4addr_of_nat (Suc x) = word_succ (ipv4addr_of_nat (x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. ipv4addr_of_nat (Suc x) = word_succ (ipv4addr_of_nat x)
[PROOF STEP]
by(simp add: ipv4addr_of_nat_def, metis Abs_fnat_hom_Suc of_nat_Suc)
[PROOF STATE]
proof (state)
this:
ipv4addr_of_nat (Suc ?x) = word_succ (ipv4addr_of_nat ?x)

goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
ipv4addr_of_nat (Suc ?x) = word_succ (ipv4addr_of_nat ?x)

goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
have "ipv4addr_of_nat x + ipv4addr_of_nat y = ipv4addr_of_nat (x+y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv4addr_of_nat x + ipv4addr_of_nat y = ipv4addr_of_nat (x + y)
[PROOF STEP]
apply(induction x arbitrary: y)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. ipv4addr_of_nat 0 + ipv4addr_of_nat y = ipv4addr_of_nat (0 + y)
 2. \<And>x y. (\<And>y. ipv4addr_of_nat x + ipv4addr_of_nat y = ipv4addr_of_nat (x + y)) \<Longrightarrow> ipv4addr_of_nat (Suc x) + ipv4addr_of_nat y = ipv4addr_of_nat (Suc x + y)
[PROOF STEP]
apply(simp add: ipv4addr_of_nat_def; fail)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (\<And>y. ipv4addr_of_nat x + ipv4addr_of_nat y = ipv4addr_of_nat (x + y)) \<Longrightarrow> ipv4addr_of_nat (Suc x) + ipv4addr_of_nat y = ipv4addr_of_nat (Suc x + y)
[PROOF STEP]
by(simp add: ipv4addr_of_nat_suc word_succ_p1)
[PROOF STATE]
proof (state)
this:
ipv4addr_of_nat x + ipv4addr_of_nat y = ipv4addr_of_nat (x + y)

goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
ipv4addr_of_nat ?x2 + ipv4addr_of_nat ?y2 = ipv4addr_of_nat (?x2 + ?y2)

goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
from this a b c
[PROOF STATE]
proof (chain)
picking this:
ipv4addr_of_nat ?x2 + ipv4addr_of_nat ?y2 = ipv4addr_of_nat (?x2 + ?y2)
ipv4addr_of_nat a << 24 = ipv4addr_of_nat (a * 16777216)
ipv4addr_of_nat b << 16 = ipv4addr_of_nat (b * 65536)
ipv4addr_of_nat c << 8 = ipv4addr_of_nat (c * 256)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ipv4addr_of_nat ?x2 + ipv4addr_of_nat ?y2 = ipv4addr_of_nat (?x2 + ?y2)
ipv4addr_of_nat a << 24 = ipv4addr_of_nat (a * 16777216)
ipv4addr_of_nat b << 16 = ipv4addr_of_nat (b * 65536)
ipv4addr_of_nat c << 8 = ipv4addr_of_nat (c * 256)

goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d
[PROOF STEP]
apply(simp add: ipv4addr_of_dotdecimal.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. ipv4addr_of_nat x + ipv4addr_of_nat y = ipv4addr_of_nat (x + y); ipv4addr_of_nat a << 24 = ipv4addr_of_nat (a * 16777216); ipv4addr_of_nat b << 16 = ipv4addr_of_nat (b * 65536); ipv4addr_of_nat c << 8 = ipv4addr_of_nat (c * 256)\<rbrakk> \<Longrightarrow> ipv4addr_of_nat (d + 256 * c + 65536 * b + 16777216 * a) = ipv4addr_of_nat (a * 16777216 + b * 65536 + c * 256 + d)
[PROOF STEP]
apply(rule arg_cong[where f=ipv4addr_of_nat])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. ipv4addr_of_nat x + ipv4addr_of_nat y = ipv4addr_of_nat (x + y); ipv4addr_of_nat a << 24 = ipv4addr_of_nat (a * 16777216); ipv4addr_of_nat b << 16 = ipv4addr_of_nat (b * 65536); ipv4addr_of_nat c << 8 = ipv4addr_of_nat (c * 256)\<rbrakk> \<Longrightarrow> d + 256 * c + 65536 * b + 16777216 * a = a * 16777216 + b * 65536 + c * 256 + d
[PROOF STEP]
apply(thin_tac _)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. ipv4addr_of_nat x + ipv4addr_of_nat y = ipv4addr_of_nat (x + y)) \<Longrightarrow> d + 256 * c + 65536 * b + 16777216 * a = a * 16777216 + b * 65536 + c * 256 + d
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
ipv4addr_of_dotdecimal (a, b, c, d) = (ipv4addr_of_nat a << 24) + (ipv4addr_of_nat b << 16) + (ipv4addr_of_nat c << 8) + ipv4addr_of_nat d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cmod_Re_le_iff: "Im x = Im y \<Longrightarrow> cmod x \<le> cmod y \<longleftrightarrow> \<bar>Re x\<bar> \<le> \<bar>Re y\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im x = Im y \<Longrightarrow> (cmod x \<le> cmod y) = (\<bar>Re x\<bar> \<le> \<bar>Re y\<bar>)
[PROOF STEP]
by (metis add.commute add_le_cancel_left norm_complex_def real_sqrt_abs real_sqrt_le_iff)


[STATEMENT]
lemma list_index_fun_gt : "\<And> xs (f::'a \<Rightarrow> nat) i j .
                              (\<And> i . Suc i < length xs \<Longrightarrow> f (xs ! i) > f (xs ! (Suc i)))
                              \<Longrightarrow> j < i
                              \<Longrightarrow> i < length xs
                              \<Longrightarrow> f (xs ! j) > f (xs ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs f i j. \<lbrakk>\<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs f i j. \<lbrakk>\<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
fix xs::"'a list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs f i j. \<lbrakk>\<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
fix f::"'a \<Rightarrow> nat"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs f i j. \<lbrakk>\<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs f i j. \<lbrakk>\<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
assume "(\<And> i . Suc i < length xs \<Longrightarrow> f (xs ! i) > f (xs ! (Suc i)))"
     and "j < i"
     and "i < length xs"
[PROOF STATE]
proof (state)
this:
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs

goal (1 subgoal):
 1. \<And>xs f i j. \<lbrakk>\<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs
[PROOF STEP]
show "f (xs ! j) > f (xs ! i)"
[PROOF STATE]
proof (prove)
using this:
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs

goal (1 subgoal):
 1. f (xs ! i) < f (xs ! j)
[PROOF STEP]
proof (induction "i - j" arbitrary: i j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>0 = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
 2. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = i - j
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>0 = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
 2. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = i - j
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 = i - j
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs

goal (1 subgoal):
 1. f (xs ! i) < f (xs ! j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (xs ! i) < f (xs ! j)

goal (1 subgoal):
 1. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
case (Suc x)
[PROOF STATE]
proof (state)
this:
\<lbrakk>x = ?i - ?j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); ?j < ?i; ?i < length xs\<rbrakk> \<Longrightarrow> f (xs ! ?i) < f (xs ! ?j)
Suc x = i - j
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs

goal (1 subgoal):
 1. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>x = ?i - ?j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); ?j < ?i; ?i < length xs\<rbrakk> \<Longrightarrow> f (xs ! ?i) < f (xs ! ?j)
Suc x = i - j
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x = ?i - ?j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); ?j < ?i; ?i < length xs\<rbrakk> \<Longrightarrow> f (xs ! ?i) < f (xs ! ?j)
Suc x = i - j
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)
j < i
i < length xs

goal (1 subgoal):
 1. f (xs ! i) < f (xs ! j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
have f1: "\<forall>n. \<not> Suc n < length xs \<or> f (xs ! Suc n) < f (xs ! n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. \<not> Suc n < length xs \<or> f (xs ! Suc n) < f (xs ! n)
[PROOF STEP]
using Suc.prems(1)
[PROOF STATE]
proof (prove)
using this:
Suc ?i < length xs \<Longrightarrow> f (xs ! Suc ?i) < f (xs ! ?i)

goal (1 subgoal):
 1. \<forall>n. \<not> Suc n < length xs \<or> f (xs ! Suc n) < f (xs ! n)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<forall>n. \<not> Suc n < length xs \<or> f (xs ! Suc n) < f (xs ! n)

goal (1 subgoal):
 1. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
have f2: "\<forall>n na. \<not> n < na \<or> Suc n \<le> na"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n na. \<not> n < na \<or> Suc n \<le> na
[PROOF STEP]
using Suc_leI
[PROOF STATE]
proof (prove)
using this:
?m < ?n \<Longrightarrow> Suc ?m \<le> ?n

goal (1 subgoal):
 1. \<forall>n na. \<not> n < na \<or> Suc n \<le> na
[PROOF STEP]
by satx
[PROOF STATE]
proof (state)
this:
\<forall>n na. \<not> n < na \<or> Suc n \<le> na

goal (1 subgoal):
 1. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
have "x = i - Suc j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = i - Suc j
[PROOF STEP]
by (metis Suc.hyps(2) Suc.prems(2) Suc_diff_Suc nat.simps(1))
[PROOF STATE]
proof (state)
this:
x = i - Suc j

goal (1 subgoal):
 1. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = i - Suc j
[PROOF STEP]
have "\<not> Suc j < i \<or> f (xs ! i) < f (xs ! Suc j)"
[PROOF STATE]
proof (prove)
using this:
x = i - Suc j

goal (1 subgoal):
 1. \<not> Suc j < i \<or> f (xs ! i) < f (xs ! Suc j)
[PROOF STEP]
using f1 Suc.hyps(1) Suc.prems(3)
[PROOF STATE]
proof (prove)
using this:
x = i - Suc j
\<forall>n. \<not> Suc n < length xs \<or> f (xs ! Suc n) < f (xs ! n)
\<lbrakk>x = ?i - ?j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); ?j < ?i; ?i < length xs\<rbrakk> \<Longrightarrow> f (xs ! ?i) < f (xs ! ?j)
i < length xs

goal (1 subgoal):
 1. \<not> Suc j < i \<or> f (xs ! i) < f (xs ! Suc j)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> Suc j < i \<or> f (xs ! i) < f (xs ! Suc j)

goal (1 subgoal):
 1. \<lbrakk>\<And>i j. \<lbrakk>x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j); Suc x = i - j; \<And>i. Suc i < length xs \<Longrightarrow> f (xs ! Suc i) < f (xs ! i); j < i; i < length xs\<rbrakk> \<Longrightarrow> f (xs ! i) < f (xs ! j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> Suc j < i \<or> f (xs ! i) < f (xs ! Suc j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> Suc j < i \<or> f (xs ! i) < f (xs ! Suc j)

goal (1 subgoal):
 1. f (xs ! i) < f (xs ! j)
[PROOF STEP]
using f2 f1
[PROOF STATE]
proof (prove)
using this:
\<not> Suc j < i \<or> f (xs ! i) < f (xs ! Suc j)
\<forall>n na. \<not> n < na \<or> Suc n \<le> na
\<forall>n. \<not> Suc n < length xs \<or> f (xs ! Suc n) < f (xs ! n)

goal (1 subgoal):
 1. f (xs ! i) < f (xs ! j)
[PROOF STEP]
by (metis Suc.prems(2) Suc.prems(3) leI le_less_trans not_less_iff_gr_or_eq)
[PROOF STATE]
proof (state)
this:
f (xs ! i) < f (xs ! j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (xs ! i) < f (xs ! j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (xs ! i) < f (xs ! j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coprime_imp_mod_not_zero:
  fixes n x :: nat
  assumes "1 < n" "coprime x n"
  shows "0 < x mod n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x mod n
[PROOF STEP]
using assms coprime_0_left_iff nat_dvd_not_less
[PROOF STATE]
proof (prove)
using this:
1 < n
coprime x n
coprime (0::?'a) ?a = is_unit ?a
\<lbrakk>0 < ?m; ?m < ?n\<rbrakk> \<Longrightarrow> \<not> ?n dvd ?m

goal (1 subgoal):
 1. 0 < x mod n
[PROOF STEP]
by fastforce


[STATEMENT]
theorem inverse_equality:
  "\<lbrakk> u \<cdot> v = \<one>; v \<cdot> u = \<one>; u \<in> M; v \<in> M \<rbrakk> \<Longrightarrow> inverse u = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<cdot> v = \<one>; v \<cdot> u = \<one>; u \<in> M; v \<in> M\<rbrakk> \<Longrightarrow> inverse u = v
[PROOF STEP]
unfolding inverse_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<cdot> v = \<one>; v \<cdot> u = \<one>; u \<in> M; v \<in> M\<rbrakk> \<Longrightarrow> (\<lambda>u\<in>M. THE v. v \<in> M \<and> u \<cdot> v = \<one> \<and> v \<cdot> u = \<one>) u = v
[PROOF STEP]
using inverse_unique
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<cdot> ?v' = \<one>; ?v \<cdot> ?u = \<one>; ?u \<in> M; ?v \<in> M; ?v' \<in> M\<rbrakk> \<Longrightarrow> ?v = ?v'

goal (1 subgoal):
 1. \<lbrakk>u \<cdot> v = \<one>; v \<cdot> u = \<one>; u \<in> M; v \<in> M\<rbrakk> \<Longrightarrow> (\<lambda>u\<in>M. THE v. v \<in> M \<and> u \<cdot> v = \<one> \<and> v \<cdot> u = \<one>) u = v
[PROOF STEP]
by simp blast


[STATEMENT]
lemma inverse_matrix_inject: "\<lbrakk> inverse_matrix A X; inverse_matrix A Y \<rbrakk> \<Longrightarrow> X = Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inverse_matrix A X; inverse_matrix A Y\<rbrakk> \<Longrightarrow> X = Y
[PROOF STEP]
by (auto simp add: inverse_matrix_def left_right_inverse_matrix_unique)


[STATEMENT]
lemma landau_prop_equalsI:
  "landau_symbol L L' Lr \<Longrightarrow> (\<And>x::real. x > 1 \<Longrightarrow> f1 x = f2 x) \<Longrightarrow> (\<And>x. x > 1 \<Longrightarrow> g1 x = g2 x) \<Longrightarrow>
     f1 \<in> L at_top (g1) \<longleftrightarrow> f2 \<in> L at_top (g2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>landau_symbol L L' Lr; \<And>x. 1 < x \<Longrightarrow> f1 x = f2 x; \<And>x. 1 < x \<Longrightarrow> g1 x = g2 x\<rbrakk> \<Longrightarrow> (f1 \<in> L at_top g1) = (f2 \<in> L at_top g2)
[PROOF STEP]
apply (subst landau_gt_1_cong, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>landau_symbol L L' Lr; \<And>x. 1 < x \<Longrightarrow> f1 x = f2 x; \<And>x. 1 < x \<Longrightarrow> g1 x = g2 x\<rbrakk> \<Longrightarrow> (f1 \<in> L at_top g2) = (f2 \<in> L at_top g2)
[PROOF STEP]
apply (subst landau_gt_1_in_cong, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>landau_symbol L L' Lr; \<And>x. 1 < x \<Longrightarrow> f1 x = f2 x; \<And>x. 1 < x \<Longrightarrow> g1 x = g2 x\<rbrakk> \<Longrightarrow> (f2 \<in> L at_top g2) = (f2 \<in> L at_top g2)
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sin_cos_squared_add3 [simp]: "cos x * cos x + sin x * sin x = 1"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x * cos x + sin x * sin x = (1::'a)
[PROOF STEP]
using sin_cos_squared_add2 [unfolded power2_eq_square]
[PROOF STATE]
proof (prove)
using this:
cos ?x * cos ?x + sin ?x * sin ?x = (1::?'a)

goal (1 subgoal):
 1. cos x * cos x + sin x * sin x = (1::'a)
[PROOF STEP]
.


[STATEMENT]
lemma isometry_cblinfun_image_inf_distrib':
  fixes U::\<open>'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b::cbanach\<close> and B C::"'a ccsubspace"
  shows "U *\<^sub>S (inf B C) \<le> inf (U *\<^sub>S B) (U *\<^sub>S C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U *\<^sub>S B \<sqinter> C \<le> U *\<^sub>S B \<sqinter> (U *\<^sub>S C)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U *\<^sub>S B \<sqinter> C \<le> U *\<^sub>S B \<sqinter> (U *\<^sub>S C)
[PROOF STEP]
define V where \<open>V b = (if b then B else C)\<close> for b
[PROOF STATE]
proof (state)
this:
V ?b = (if ?b then B else C)

goal (1 subgoal):
 1. U *\<^sub>S B \<sqinter> C \<le> U *\<^sub>S B \<sqinter> (U *\<^sub>S C)
[PROOF STEP]
have \<open>U *\<^sub>S (INF i. V i) \<le> (INF i. U *\<^sub>S (V i))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U *\<^sub>S \<Sqinter> range V \<le> (\<Sqinter>i. U *\<^sub>S V i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U *\<^sub>S \<Sqinter> range V \<le> (\<Sqinter>i. U *\<^sub>S V i)

goal (1 subgoal):
 1. U *\<^sub>S B \<sqinter> C \<le> U *\<^sub>S B \<sqinter> (U *\<^sub>S C)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
U *\<^sub>S \<Sqinter> range V \<le> (\<Sqinter>i. U *\<^sub>S V i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
U *\<^sub>S \<Sqinter> range V \<le> (\<Sqinter>i. U *\<^sub>S V i)

goal (1 subgoal):
 1. U *\<^sub>S B \<sqinter> C \<le> U *\<^sub>S B \<sqinter> (U *\<^sub>S C)
[PROOF STEP]
unfolding V_def
[PROOF STATE]
proof (prove)
using this:
U *\<^sub>S (\<Sqinter>i. if i then B else C) \<le> (\<Sqinter>i. U *\<^sub>S (if i then B else C))

goal (1 subgoal):
 1. U *\<^sub>S B \<sqinter> C \<le> U *\<^sub>S B \<sqinter> (U *\<^sub>S C)
[PROOF STEP]
by (metis (mono_tags, lifting) INF_UNIV_bool_expand)
[PROOF STATE]
proof (state)
this:
U *\<^sub>S B \<sqinter> C \<le> U *\<^sub>S B \<sqinter> (U *\<^sub>S C)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lemma_NBseq_def2: "(\<exists>K > 0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real(Suc N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
have *: "\<And>N. \<forall>n. norm (X n) \<le> 1 + real N \<Longrightarrow>
         \<exists>N. \<forall>n. norm (X n) < 1 + real N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N. \<forall>n. norm (X n) \<le> 1 + real N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N
[PROOF STEP]
by (metis add.commute le_less_trans less_add_one of_nat_Suc)
[PROOF STATE]
proof (state)
this:
\<forall>n. norm (X n) \<le> 1 + real ?N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N

goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. norm (X n) \<le> 1 + real ?N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n. norm (X n) \<le> 1 + real ?N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N

goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
unfolding lemma_NBseq_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. norm (X n) \<le> 1 + real ?N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N

goal (1 subgoal):
 1. (\<exists>N. \<forall>n. norm (X n) \<le> real (Suc N)) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
by (metis less_le_not_le not_less_iff_gr_or_eq of_nat_Suc)
[PROOF STATE]
proof (state)
this:
(\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_pow_X: "coeff (X ^ i) n = (if i = n then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (X ^ i) n = (if i = n then 1::'a else (0::'a))
[PROOF STEP]
proof (induction i arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. coeff (X ^ 0) n = (if 0 = n then 1::'a else (0::'a))
 2. \<And>i n. (\<And>n. coeff (X ^ i) n = (if i = n then 1::'a else (0::'a))) \<Longrightarrow> coeff (X ^ Suc i) n = (if Suc i = n then 1::'a else (0::'a))
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
coeff (X ^ i) ?n = (if i = ?n then 1::'a else (0::'a))

goal (2 subgoals):
 1. \<And>n. coeff (X ^ 0) n = (if 0 = n then 1::'a else (0::'a))
 2. \<And>i n. (\<And>n. coeff (X ^ i) n = (if i = n then 1::'a else (0::'a))) \<Longrightarrow> coeff (X ^ Suc i) n = (if Suc i = n then 1::'a else (0::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coeff (X ^ i) ?n = (if i = ?n then 1::'a else (0::'a))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
coeff (X ^ i) ?n = (if i = ?n then 1::'a else (0::'a))

goal (1 subgoal):
 1. coeff (X ^ Suc i) n = (if Suc i = n then 1::'a else (0::'a))
[PROOF STEP]
by (cases n) simp_all
[PROOF STATE]
proof (state)
this:
coeff (X ^ Suc i) n = (if Suc i = n then 1::'a else (0::'a))

goal (1 subgoal):
 1. \<And>n. coeff (X ^ 0) n = (if 0 = n then 1::'a else (0::'a))
[PROOF STEP]
qed auto


[STATEMENT]
lemma Poly_map: "Poly (map ((*) a) p) = smult a (Poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly (map ((*) a) p) = smult a (Poly p)
[PROOF STEP]
proof (induct p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Poly (map ((*) a) []) = smult a (Poly [])
 2. \<And>aa p. Poly (map ((*) a) p) = smult a (Poly p) \<Longrightarrow> Poly (map ((*) a) (aa # p)) = smult a (Poly (aa # p))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. Poly (map ((*) a) []) = smult a (Poly [])
 2. \<And>aa p. Poly (map ((*) a) p) = smult a (Poly p) \<Longrightarrow> Poly (map ((*) a) (aa # p)) = smult a (Poly (aa # p))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly (map ((*) a) []) = smult a (Poly [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Poly (map ((*) a) []) = smult a (Poly [])

goal (1 subgoal):
 1. \<And>aa p. Poly (map ((*) a) p) = smult a (Poly p) \<Longrightarrow> Poly (map ((*) a) (aa # p)) = smult a (Poly (aa # p))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa p. Poly (map ((*) a) p) = smult a (Poly p) \<Longrightarrow> Poly (map ((*) a) (aa # p)) = smult a (Poly (aa # p))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
Poly (map ((*) a) xs) = smult a (Poly xs)

goal (1 subgoal):
 1. \<And>aa p. Poly (map ((*) a) p) = smult a (Poly p) \<Longrightarrow> Poly (map ((*) a) (aa # p)) = smult a (Poly (aa # p))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Poly (map ((*) a) xs) = smult a (Poly xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Poly (map ((*) a) xs) = smult a (Poly xs)

goal (1 subgoal):
 1. Poly (map ((*) a) (x # xs)) = smult a (Poly (x # xs))
[PROOF STEP]
by (cases "Poly xs = 0") auto
[PROOF STATE]
proof (state)
this:
Poly (map ((*) a) (x # xs)) = smult a (Poly (x # xs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fls_deriv_eq_iff:
  fixes f g :: "'a::{ring_1_no_zero_divisors,ring_char_0} fls"
  shows "fls_deriv f = fls_deriv g \<longleftrightarrow> (f = fls_const(f$$0 - g$$0) + g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fls_deriv f = fls_deriv g) = (f = fls_const (f $$ 0 - g $$ 0) + g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (fls_deriv f = fls_deriv g) = (f = fls_const (f $$ 0 - g $$ 0) + g)
[PROOF STEP]
have "fls_deriv f = fls_deriv g \<longleftrightarrow> fls_deriv (f - g) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fls_deriv f = fls_deriv g) = (fls_deriv (f - g) = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(fls_deriv f = fls_deriv g) = (fls_deriv (f - g) = 0)

goal (1 subgoal):
 1. (fls_deriv f = fls_deriv g) = (f = fls_const (f $$ 0 - g $$ 0) + g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(fls_deriv f = fls_deriv g) = (fls_deriv (f - g) = 0)

goal (1 subgoal):
 1. (fls_deriv f = fls_deriv g) = (f = fls_const (f $$ 0 - g $$ 0) + g)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> f - g = fls_const ((f - g) $$ 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fls_deriv (f - g) = 0) = (f - g = fls_const ((f - g) $$ 0))
[PROOF STEP]
unfolding fls_deriv_eq_0_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f - g = fls_const ((f - g) $$ 0)) = (f - g = fls_const ((f - g) $$ 0))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(fls_deriv (f - g) = 0) = (f - g = fls_const ((f - g) $$ 0))

goal (1 subgoal):
 1. (fls_deriv f = fls_deriv g) = (f = fls_const (f $$ 0 - g $$ 0) + g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(fls_deriv f = fls_deriv g) = (f - g = fls_const ((f - g) $$ 0))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(fls_deriv f = fls_deriv g) = (f - g = fls_const ((f - g) $$ 0))

goal (1 subgoal):
 1. (fls_deriv f = fls_deriv g) = (f = fls_const (f $$ 0 - g $$ 0) + g)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(fls_deriv f = fls_deriv g) = (f = fls_const (f $$ 0 - g $$ 0) + g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_mult_one:
  fixes f g :: "_ \<Rightarrow> 'b::topological_monoid_mult"
  shows "(f \<longlongrightarrow> 1) F \<Longrightarrow> (g \<longlongrightarrow> 1) F \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> 1) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> (1::'b)) F; (g \<longlongrightarrow> (1::'b)) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
by (drule (1) tendsto_mult) simp