[STATEMENT]
lemma expands_to_root:
  assumes  "n > 0" "trimmed_pos F" "basis_wf basis" "(f expands_to F) basis"
  shows   "((\<lambda>x. root n (f x)) expands_to powr_expansion False F (inverse (real n))) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. root n (f x)) expands_to powr_expansion False F (inverse (real n))) basis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. root n (f x)) expands_to powr_expansion False F (inverse (real n))) basis
[PROOF STEP]
have "((\<lambda>x. f x powr (inverse (real n))) expands_to
          powr_expansion False F (inverse (real n))) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x powr inverse (real n)) expands_to powr_expansion False F (inverse (real n))) basis
[PROOF STEP]
using assms(2-)
[PROOF STATE]
proof (prove)
using this:
trimmed_pos F
basis_wf basis
(f expands_to F) basis

goal (1 subgoal):
 1. ((\<lambda>x. f x powr inverse (real n)) expands_to powr_expansion False F (inverse (real n))) basis
[PROOF STEP]
by (rule expands_to_powr_const)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x powr inverse (real n)) expands_to powr_expansion False F (inverse (real n))) basis

goal (1 subgoal):
 1. ((\<lambda>x. root n (f x)) expands_to powr_expansion False F (inverse (real n))) basis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x powr inverse (real n)) expands_to powr_expansion False F (inverse (real n))) basis

goal (1 subgoal):
 1. ((\<lambda>x. root n (f x)) expands_to powr_expansion False F (inverse (real n))) basis
[PROOF STEP]
have "eventually (\<lambda>x. f x powr (inverse (real n)) = root n (f x)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x powr inverse (real n) = root n (f x)
[PROOF STEP]
using eval_pos_if_dominant_term_pos[of basis F] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>basis_wf basis; is_expansion F basis; trimmed F; 0 < fst (dominant_term F)\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. 0 < eval F x
0 < n
trimmed_pos F
basis_wf basis
(f expands_to F) basis

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x powr inverse (real n) = root n (f x)
[PROOF STEP]
by (auto simp: trimmed_pos_def expands_to.simps root_powr_inverse field_simps
             elim: eventually_elim2)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. f x powr inverse (real n) = root n (f x)

goal (1 subgoal):
 1. ((\<lambda>x. root n (f x)) expands_to powr_expansion False F (inverse (real n))) basis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. f x powr inverse (real n)) expands_to powr_expansion False F (inverse (real n))) basis
\<forall>\<^sub>F x in at_top. f x powr inverse (real n) = root n (f x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f x powr inverse (real n)) expands_to powr_expansion False F (inverse (real n))) basis
\<forall>\<^sub>F x in at_top. f x powr inverse (real n) = root n (f x)

goal (1 subgoal):
 1. ((\<lambda>x. root n (f x)) expands_to powr_expansion False F (inverse (real n))) basis
[PROOF STEP]
by (rule expands_to_cong)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. root n (f x)) expands_to powr_expansion False F (inverse (real n))) basis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_ANR_iff_ANR:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  shows "S homeomorphic T \<Longrightarrow> ANR S \<longleftrightarrow> ANR T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T \<Longrightarrow> ANR S = ANR T
[PROOF STEP]
by (metis ANR_homeomorphic_ANR homeomorphic_sym)


[STATEMENT]
lemma rev_bl_order_bl_to_bin:
  "length xs = length ys \<Longrightarrow>
    rev_bl_order True xs ys = (bl_to_bin (rev xs) \<le> bl_to_bin (rev ys)) \<and>
    rev_bl_order False xs ys = (bl_to_bin (rev xs) < bl_to_bin (rev ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys \<Longrightarrow> rev_bl_order True xs ys = (bl_to_bin (rev xs) \<le> bl_to_bin (rev ys)) \<and> rev_bl_order False xs ys = (bl_to_bin (rev xs) < bl_to_bin (rev ys))
[PROOF STEP]
apply (induct xs ys rule: list_induct2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. rev_bl_order True [] [] = (bl_to_bin (rev []) \<le> bl_to_bin (rev [])) \<and> rev_bl_order False [] [] = (bl_to_bin (rev []) < bl_to_bin (rev []))
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; rev_bl_order True xs ys = (bl_to_bin (rev xs) \<le> bl_to_bin (rev ys)) \<and> rev_bl_order False xs ys = (bl_to_bin (rev xs) < bl_to_bin (rev ys))\<rbrakk> \<Longrightarrow> rev_bl_order True (x # xs) (y # ys) = (bl_to_bin (rev (x # xs)) \<le> bl_to_bin (rev (y # ys))) \<and> rev_bl_order False (x # xs) (y # ys) = (bl_to_bin (rev (x # xs)) < bl_to_bin (rev (y # ys)))
[PROOF STEP]
apply (simp_all add: rev_bl_order_simps bl_to_bin_app_cat concat_bit_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; rev_bl_order True xs ys = (bl_to_bin (rev xs) \<le> bl_to_bin (rev ys)) \<and> rev_bl_order False xs ys = (bl_to_bin (rev xs) < bl_to_bin (rev ys))\<rbrakk> \<Longrightarrow> rev_bl_order (y \<and> \<not> x \<or> y \<or> \<not> x) xs ys = (bl_to_bin [x] mod 2 + 2 * bl_to_bin (rev xs) \<le> bl_to_bin [y] mod 2 + 2 * bl_to_bin (rev ys)) \<and> rev_bl_order (y \<and> \<not> x) xs ys = (bl_to_bin [x] mod 2 + 2 * bl_to_bin (rev xs) < bl_to_bin [y] mod 2 + 2 * bl_to_bin (rev ys))
[PROOF STEP]
apply (auto simp add: bl_to_bin_def add1_zle_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma up_filter_dist_inf:
  "up_filter ((x::'a::lattice) \<sqinter> y) = up_filter x \<squnion> up_filter y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. up_filter (x \<sqinter> y) = up_filter x \<squnion> up_filter y
[PROOF STEP]
by (simp add: eq_onp_def sup_filter.abs_eq up_dist_inf)


[STATEMENT]
lemma bit_not_spark_eq:
  "Bit_Operations.not (word_of_int x :: ('a::len) word) =
  word_of_int (2 ^ LENGTH('a) - 1 - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. not (word_of_int x) = word_of_int (2 ^ LENGTH('a) - 1 - x)
[PROOF STEP]
by (simp flip: mask_eq_exp_minus_1 add: of_int_mask_eq not_eq_complement)


[STATEMENT]
lemma proots_rect_border_eq_lines:
  fixes p::"complex poly" and lb ub::complex
  assumes ab_le:"Re lb < Re ub" "Im lb < Im ub"
    and not_van:"not_rect_vanishing p lb ub"
  shows "proots_rect_border p lb ub =
                  proots_line p lb (Complex (Re ub) (Im lb))
                      +  proots_line p (Complex (Re ub) (Im lb)) ub
                      +  proots_line p ub (Complex (Re lb) (Im ub))
                      +  proots_line p (Complex (Re lb) (Im ub)) lb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have "p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
using not_rect_vanishing_def not_van order_root
[PROOF STATE]
proof (prove)
using this:
not_rect_vanishing ?p ?a ?b = (poly ?p ?a \<noteq> 0 \<and> poly ?p (Complex (Re ?b) (Im ?a)) \<noteq> 0 \<and> poly ?p ?b \<noteq> 0 \<and> poly ?p (Complex (Re ?a) (Im ?b)) \<noteq> 0)
not_rect_vanishing p lb ub
(poly ?p ?a = (0::?'a)) = (?p = 0 \<or> order ?a ?p \<noteq> 0)

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

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
define l1 l2 l3 l4 where  "l1 = open_segment lb (Complex (Re ub) (Im lb))"
                        and "l2 = open_segment (Complex (Re ub) (Im lb)) ub"
                        and "l3 = open_segment ub (Complex (Re lb) (Im ub))"
                        and "l4 = open_segment (Complex (Re lb) (Im ub)) lb"
[PROOF STATE]
proof (state)
this:
l1 = open_segment lb (Complex (Re ub) (Im lb))
l2 = open_segment (Complex (Re ub) (Im lb)) ub
l3 = open_segment ub (Complex (Re lb) (Im ub))
l4 = open_segment (Complex (Re lb) (Im ub)) lb

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have ll_eq:
    "l1 = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}}"
    "l2 = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}"
    "l3 = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}"
    "l4 = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l1 = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}} &&& l2 = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}) &&& l3 = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} &&& l4 = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l1 = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
unfolding l1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment lb (Complex (Re ub) (Im lb)) = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
apply (subst open_segment_Im_equal)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Re lb \<noteq> Re (Complex (Re ub) (Im lb))
 2. Im lb = Im (Complex (Re ub) (Im lb))
 3. {z. Im z = Im lb \<and> Re z \<in> open_segment (Re lb) (Re (Complex (Re ub) (Im lb)))} = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (3 subgoals):
 1. Re lb \<noteq> Re (Complex (Re ub) (Im lb))
 2. Im lb = Im (Complex (Re ub) (Im lb))
 3. {z. Im z = Im lb \<and> Re z \<in> open_segment (Re lb) (Re (Complex (Re ub) (Im lb)))} = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
unfolding open_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (3 subgoals):
 1. Re lb \<noteq> Re (Complex (Re ub) (Im lb))
 2. Im lb = Im (Complex (Re ub) (Im lb))
 3. {z. Im z = Im lb \<and> Re z \<in> (if Re lb \<le> Re (Complex (Re ub) (Im lb)) then {Re lb<..<Re (Complex (Re ub) (Im lb))} else {Re (Complex (Re ub) (Im lb))<..<Re lb})} = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. l2 = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}
 2. l3 = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
 3. l4 = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2 = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
unfolding l2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment (Complex (Re ub) (Im lb)) ub = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
apply (subst open_segment_Re_equal)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Re (Complex (Re ub) (Im lb)) = Re ub
 2. Im (Complex (Re ub) (Im lb)) \<noteq> Im ub
 3. {z. Re z = Re (Complex (Re ub) (Im lb)) \<and> Im z \<in> open_segment (Im (Complex (Re ub) (Im lb))) (Im ub)} = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (3 subgoals):
 1. Re (Complex (Re ub) (Im lb)) = Re ub
 2. Im (Complex (Re ub) (Im lb)) \<noteq> Im ub
 3. {z. Re z = Re (Complex (Re ub) (Im lb)) \<and> Im z \<in> open_segment (Im (Complex (Re ub) (Im lb))) (Im ub)} = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
unfolding open_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (3 subgoals):
 1. Re (Complex (Re ub) (Im lb)) = Re ub
 2. Im (Complex (Re ub) (Im lb)) \<noteq> Im ub
 3. {z. Re z = Re (Complex (Re ub) (Im lb)) \<and> Im z \<in> (if Im (Complex (Re ub) (Im lb)) \<le> Im ub then {Im (Complex (Re ub) (Im lb))<..<Im ub} else {Im ub<..<Im (Complex (Re ub) (Im lb))})} = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. l3 = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
 2. l4 = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l3 = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
unfolding l3_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment ub (Complex (Re lb) (Im ub)) = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
apply (subst open_segment_Im_equal)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Re ub \<noteq> Re (Complex (Re lb) (Im ub))
 2. Im ub = Im (Complex (Re lb) (Im ub))
 3. {z. Im z = Im ub \<and> Re z \<in> open_segment (Re ub) (Re (Complex (Re lb) (Im ub)))} = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (3 subgoals):
 1. Re ub \<noteq> Re (Complex (Re lb) (Im ub))
 2. Im ub = Im (Complex (Re lb) (Im ub))
 3. {z. Im z = Im ub \<and> Re z \<in> open_segment (Re ub) (Re (Complex (Re lb) (Im ub)))} = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
unfolding open_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (3 subgoals):
 1. Re ub \<noteq> Re (Complex (Re lb) (Im ub))
 2. Im ub = Im (Complex (Re lb) (Im ub))
 3. {z. Im z = Im ub \<and> Re z \<in> (if Re ub \<le> Re (Complex (Re lb) (Im ub)) then {Re ub<..<Re (Complex (Re lb) (Im ub))} else {Re (Complex (Re lb) (Im ub))<..<Re ub})} = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l4 = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l4 = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
unfolding l4_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment (Complex (Re lb) (Im ub)) lb = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
apply (subst open_segment_Re_equal)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Re (Complex (Re lb) (Im ub)) = Re lb
 2. Im (Complex (Re lb) (Im ub)) \<noteq> Im lb
 3. {z. Re z = Re (Complex (Re lb) (Im ub)) \<and> Im z \<in> open_segment (Im (Complex (Re lb) (Im ub))) (Im lb)} = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (3 subgoals):
 1. Re (Complex (Re lb) (Im ub)) = Re lb
 2. Im (Complex (Re lb) (Im ub)) \<noteq> Im lb
 3. {z. Re z = Re (Complex (Re lb) (Im ub)) \<and> Im z \<in> open_segment (Im (Complex (Re lb) (Im ub))) (Im lb)} = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
unfolding open_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (3 subgoals):
 1. Re (Complex (Re lb) (Im ub)) = Re lb
 2. Im (Complex (Re lb) (Im ub)) \<noteq> Im lb
 3. {z. Re z = Re (Complex (Re lb) (Im ub)) \<and> Im z \<in> (if Im (Complex (Re lb) (Im ub)) \<le> Im lb then {Im (Complex (Re lb) (Im ub))<..<Im lb} else {Im lb<..<Im (Complex (Re lb) (Im ub))})} = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
l1 = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}}
l2 = {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}}
l3 = {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
l4 = {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have ll_disj: "l1 \<inter> l2 = {}" "l1 \<inter> l3 = {}" "l1 \<inter> l4 = {}"
       "l2 \<inter> l3 = {}" "l2 \<inter> l4 = {}" "l3 \<inter> l4 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l1 \<inter> l2 = {} &&& l1 \<inter> l3 = {} &&& l1 \<inter> l4 = {}) &&& l2 \<inter> l3 = {} &&& l2 \<inter> l4 = {} &&& l3 \<inter> l4 = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (1 subgoal):
 1. (l1 \<inter> l2 = {} &&& l1 \<inter> l3 = {} &&& l1 \<inter> l4 = {}) &&& l2 \<inter> l3 = {} &&& l2 \<inter> l4 = {} &&& l3 \<inter> l4 = {}
[PROOF STEP]
unfolding ll_eq
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
not_rect_vanishing p lb ub

goal (1 subgoal):
 1. ({z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}} \<inter> {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} = {} &&& {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}} \<inter> {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} = {} &&& {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}} \<inter> {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}} = {}) &&& {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<inter> {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} = {} &&& {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<inter> {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}} = {} &&& {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<inter> {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l1 \<inter> l2 = {}
l1 \<inter> l3 = {}
l1 \<inter> l4 = {}
l2 \<inter> l3 = {}
l2 \<inter> l4 = {}
l3 \<inter> l4 = {}

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have "proots_rect_border p lb ub = proots_count p
           ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union>
            {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}})
[PROOF STEP]
unfolding proots_rect_border_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p (path_image (rectpath lb ub)) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}})
[PROOF STEP]
apply (subst path_image_rectpath)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Re lb \<le> Re ub
 2. Im lb \<le> Im ub
 3. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}}) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}})
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub

goal (3 subgoals):
 1. Re lb \<le> Re ub
 2. Im lb \<le> Im ub
 3. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}}) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_rect_border p lb ub = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}})

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_rect_border p lb ub = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}})

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have "... = proots_count p
           ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union>
            {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}
            \<union> {lb,Complex (Re ub) (Im lb), ub,Complex (Re lb) (Im ub)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}}) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)})
[PROOF STEP]
apply (rule arg_cong2[where f=proots_count])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. p = p
 2. {z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}} = {z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}
[PROOF STEP]
unfolding not_rect_vanishing_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. p = p
 2. {z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}} = {z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}
[PROOF STEP]
using assms(1,2) complex.exhaust_sel
[PROOF STATE]
proof (prove)
using this:
Re lb < Re ub
Im lb < Im ub
(?complex = Complex (Re ?complex) (Im ?complex) \<Longrightarrow> ?P) \<Longrightarrow> ?P

goal (2 subgoals):
 1. p = p
 2. {z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}} = {z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}
[PROOF STEP]
by (auto simp add:order.order_iff_strict intro:complex_eqI)
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}}) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)})

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb..Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb..Re ub}}) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)})

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have "... = proots_count p
           ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union>
            {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})
            + proots_count p
            ({lb,Complex (Re ub) (Im lb), ub,Complex (Re lb) (Im ub)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}
[PROOF STEP]
apply (subst proots_count_union_disjoint)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) \<inter> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = {}
 2. p \<noteq> 0
 3. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}
[PROOF STEP]
using \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (3 subgoals):
 1. ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) \<inter> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = {}
 2. p \<noteq> 0
 3. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}) = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)}

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have "... = proots_count p
           ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union>
            {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})
[PROOF STEP]
have "proots_count p
            ({lb,Complex (Re ub) (Im lb), ub,Complex (Re lb) (Im ub)}) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = 0
[PROOF STEP]
apply (rule proots_count_nzero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} \<Longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
using not_van
[PROOF STATE]
proof (prove)
using this:
not_rect_vanishing p lb ub

goal (1 subgoal):
 1. \<And>x. x \<in> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} \<Longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
unfolding not_rect_vanishing_def
[PROOF STATE]
proof (prove)
using this:
poly p lb \<noteq> 0 \<and> poly p (Complex (Re ub) (Im lb)) \<noteq> 0 \<and> poly p ub \<noteq> 0 \<and> poly p (Complex (Re lb) (Im ub)) \<noteq> 0

goal (1 subgoal):
 1. \<And>x. x \<in> {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} \<Longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = 0

goal (1 subgoal):
 1. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = 0

goal (1 subgoal):
 1. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) + proots_count p {lb, Complex (Re ub) (Im lb), ub, Complex (Re lb) (Im ub)} = proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}})

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have "... = proots_count p (l1 \<union> l2 \<union> l3 \<union> l4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) = proots_count p (l1 \<union> l2 \<union> l3 \<union> l4)
[PROOF STEP]
apply (rule arg_cong2[where f=proots_count])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. p = p
 2. {z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} = l1 \<union> l2 \<union> l3 \<union> l4
[PROOF STEP]
unfolding ll_eq
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. p = p
 2. {z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} = {z. Im z \<in> {Im lb} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {z. Re z \<in> {Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im ub} \<and> Re z \<in> {Re lb<..<Re ub}} \<union> {z. Re z \<in> {Re lb} \<and> Im z \<in> {Im lb<..<Im ub}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) = proots_count p (l1 \<union> l2 \<union> l3 \<union> l4)

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_count p ({z. Re z \<in> {Re lb, Re ub} \<and> Im z \<in> {Im lb<..<Im ub}} \<union> {z. Im z \<in> {Im lb, Im ub} \<and> Re z \<in> {Re lb<..<Re ub}}) = proots_count p (l1 \<union> l2 \<union> l3 \<union> l4)

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have "... = proots_count p l1
                      + proots_count p l2
                      + proots_count p l3
                      + proots_count p l4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p (l1 \<union> l2 \<union> l3 \<union> l4) = proots_count p l1 + proots_count p l2 + proots_count p l3 + proots_count p l4
[PROOF STEP]
using ll_disj \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
l1 \<inter> l2 = {}
l1 \<inter> l3 = {}
l1 \<inter> l4 = {}
l2 \<inter> l3 = {}
l2 \<inter> l4 = {}
l3 \<inter> l4 = {}
p \<noteq> 0

goal (1 subgoal):
 1. proots_count p (l1 \<union> l2 \<union> l3 \<union> l4) = proots_count p l1 + proots_count p l2 + proots_count p l3 + proots_count p l4
[PROOF STEP]
by (subst proots_count_union_disjoint;
        (simp add:Int_Un_distrib Int_Un_distrib2 )?)+
[PROOF STATE]
proof (state)
this:
proots_count p (l1 \<union> l2 \<union> l3 \<union> l4) = proots_count p l1 + proots_count p l2 + proots_count p l3 + proots_count p l4

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_count p (l1 \<union> l2 \<union> l3 \<union> l4) = proots_count p l1 + proots_count p l2 + proots_count p l3 + proots_count p l4

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
have "...  = proots_line p lb (Complex (Re ub) (Im lb))
                      +  proots_line p (Complex (Re ub) (Im lb)) ub
                      +  proots_line p ub (Complex (Re lb) (Im ub))
                      +  proots_line p (Complex (Re lb) (Im ub)) lb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p l1 + proots_count p l2 + proots_count p l3 + proots_count p l4 = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
unfolding proots_line_def l1_def l2_def l3_def l4_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p (open_segment lb (Complex (Re ub) (Im lb))) + proots_count p (open_segment (Complex (Re ub) (Im lb)) ub) + proots_count p (open_segment ub (Complex (Re lb) (Im ub))) + proots_count p (open_segment (Complex (Re lb) (Im ub)) lb) = proots_count p (open_segment lb (Complex (Re ub) (Im lb))) + proots_count p (open_segment (Complex (Re ub) (Im lb)) ub) + proots_count p (open_segment ub (Complex (Re lb) (Im ub))) + proots_count p (open_segment (Complex (Re lb) (Im ub)) lb)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
proots_count p l1 + proots_count p l2 + proots_count p l3 + proots_count p l4 = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb

goal (1 subgoal):
 1. proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
proots_rect_border p lb ub = proots_line p lb (Complex (Re ub) (Im lb)) + proots_line p (Complex (Re ub) (Im lb)) ub + proots_line p ub (Complex (Re lb) (Im ub)) + proots_line p (Complex (Re lb) (Im ub)) lb

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiplicity_gauss_cnj: "multiplicity (gauss_cnj a) (gauss_cnj b) = multiplicity a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (gauss_cnj a) (gauss_cnj b) = multiplicity a b
[PROOF STEP]
unfolding multiplicity_def gauss_cnj_power [symmetric] gauss_cnj_dvd_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if finite {n. a ^ n dvd b} then Max {n. a ^ n dvd b} else 0) = (if finite {n. a ^ n dvd b} then Max {n. a ^ n dvd b} else 0)
[PROOF STEP]
..


[STATEMENT]
lemma image_add_integer_atLeastLessThan:
    "(%x. x + (l::integer)) ` {0..<u-l} = {l..<u}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x + l) ` {0..<u - l} = {l..<u}
[PROOF STEP]
apply (auto simp add: image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>l \<le> x; x < u\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..<u - l}. x = xa + l
[PROOF STEP]
apply (rule_tac x = "x - l" in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>l \<le> x; x < u\<rbrakk> \<Longrightarrow> x = x - l + l
 2. \<And>x. \<lbrakk>l \<le> x; x < u\<rbrakk> \<Longrightarrow> x - l \<in> {0..<u - l}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prodinf_nonzero:
  fixes f :: "nat \<Rightarrow> 'a :: {idom,topological_semigroup_mult,t2_space}"
  assumes "convergent_prod f" "\<And>i. f i \<noteq> 0"
  shows "prodinf f \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prodinf f \<noteq> (0::'a)
[PROOF STEP]
by (metis assms convergent_prod_offset_0 has_prod_unique raw_has_prod_def has_prod_def)


[STATEMENT]
lemma (in group) int_pow_inv:
  "x \<in> carrier G \<Longrightarrow> (inv x) [^] (i :: int) = inv (x [^] i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> inv x [^] i = inv (x [^] i)
[PROOF STEP]
by (metis int_pow_def2 nat_pow_inv)


[STATEMENT]
lemma closedin_t1_singleton:
   "\<lbrakk>t1_space X; a \<in> topspace X\<rbrakk> \<Longrightarrow> closedin X {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t1_space X; a \<in> topspace X\<rbrakk> \<Longrightarrow> closedin X {a}
[PROOF STEP]
by (simp add: t1_space_closedin_singleton)


[STATEMENT]
lemma single_valued_lfp:
fixes f :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set"
assumes "cont f" "\<And>r. single_valued r \<Longrightarrow> single_valued (f r)"
shows "single_valued(lfp f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. single_valued (lfp f)
[PROOF STEP]
unfolding lfp_if_cont[OF assms(1)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. single_valued (\<Union>n. (f ^^ n) {})
[PROOF STEP]
proof(rule single_valued_UN_chain[OF chain_iterates[OF mono_if_cont[OF assms(1)]]])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. single_valued ((f ^^ n) {})
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. single_valued ((f ^^ n) {})
[PROOF STEP]
show "single_valued ((f ^^ n) {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. single_valued ((f ^^ n) {})
[PROOF STEP]
by(induction n)(auto simp: assms(2))
[PROOF STATE]
proof (state)
this:
single_valued ((f ^^ n) {})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lim_component_le:
  fixes f :: "'a \<Rightarrow> 'b::euclidean_space"
  assumes "(f \<longlongrightarrow> l) net"
    and "\<not> (trivial_limit net)"
    and "eventually (\<lambda>x. f(x)\<bullet>i \<le> b) net"
  shows "l\<bullet>i \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<bullet> i \<le> b
[PROOF STEP]
by (rule tendsto_le[OF assms(2) tendsto_const tendsto_inner[OF assms(1) tendsto_const] assms(3)])


[STATEMENT]
lemma abs_conv_abscissa_add_le:
  "abs_conv_abscissa (f + g :: 'a :: dirichlet_series fds) \<le> max (abs_conv_abscissa f) (abs_conv_abscissa g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_conv_abscissa (f + g) \<le> max (abs_conv_abscissa f) (abs_conv_abscissa g)
[PROOF STEP]
by (rule abs_conv_abscissa_leI_weak) (auto intro!: fds_abs_converges_add intro: fds_abs_converges)


[STATEMENT]
lemma int_bit_count: "bit_count (I\<^sub>e n) = 2 * \<lfloor>log 2 (2*\<bar>n\<bar>+1)\<rfloor> +1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_count (I\<^sub>e n) = ereal (real_of_int (2 * \<lfloor>log 2 (real_of_int (2 * \<bar>n\<bar> + 1))\<rfloor> + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bit_count (I\<^sub>e n) = ereal (real_of_int (2 * \<lfloor>log 2 (real_of_int (2 * \<bar>n\<bar> + 1))\<rfloor> + 1))
[PROOF STEP]
have a:"m > 0 \<Longrightarrow>
    \<lfloor>log (real 2) (real (2 * m))\<rfloor> = \<lfloor>log (real 2) (real (2 * m + 1))\<rfloor>"
    for m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<lfloor>log (real 2) (real (2 * m))\<rfloor> = \<lfloor>log (real 2) (real (2 * m + 1))\<rfloor>
[PROOF STEP]
by (rule  floor_log_eq_if, auto)
[PROOF STATE]
proof (state)
this:
0 < ?m \<Longrightarrow> \<lfloor>log (real 2) (real (2 * ?m))\<rfloor> = \<lfloor>log (real 2) (real (2 * ?m + 1))\<rfloor>

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) = ereal (real_of_int (2 * \<lfloor>log 2 (real_of_int (2 * \<bar>n\<bar> + 1))\<rfloor> + 1))
[PROOF STEP]
have "n > 0 \<Longrightarrow>
    \<lfloor>log 2 (2 * real_of_int n)\<rfloor> = \<lfloor>log 2 (2 * real_of_int n + 1)\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<lfloor>log 2 (2 * real_of_int n)\<rfloor> = \<lfloor>log 2 (2 * real_of_int n + 1)\<rfloor>
[PROOF STEP]
using  a[where m="nat n"]
[PROOF STATE]
proof (prove)
using this:
0 < nat n \<Longrightarrow> \<lfloor>log (real 2) (real (2 * nat n))\<rfloor> = \<lfloor>log (real 2) (real (2 * nat n + 1))\<rfloor>

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<lfloor>log 2 (2 * real_of_int n)\<rfloor> = \<lfloor>log 2 (2 * real_of_int n + 1)\<rfloor>
[PROOF STEP]
by (simp add:add.commute)
[PROOF STATE]
proof (state)
this:
0 < n \<Longrightarrow> \<lfloor>log 2 (2 * real_of_int n)\<rfloor> = \<lfloor>log 2 (2 * real_of_int n + 1)\<rfloor>

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) = ereal (real_of_int (2 * \<lfloor>log 2 (real_of_int (2 * \<bar>n\<bar> + 1))\<rfloor> + 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> \<lfloor>log 2 (2 * real_of_int n)\<rfloor> = \<lfloor>log 2 (2 * real_of_int n + 1)\<rfloor>

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) = ereal (real_of_int (2 * \<lfloor>log 2 (real_of_int (2 * \<bar>n\<bar> + 1))\<rfloor> + 1))
[PROOF STEP]
by (simp add:I\<^sub>e_def exp_golomb_bit_count_exact floorlog_def)
[PROOF STATE]
proof (state)
this:
bit_count (I\<^sub>e n) = ereal (real_of_int (2 * \<lfloor>log 2 (real_of_int (2 * \<bar>n\<bar> + 1))\<rfloor> + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Corps) field_frac_mul:"\<lbrakk>x \<in> carrier K; y \<in> carrier K; y \<noteq> \<zero>\<rbrakk>
        \<Longrightarrow>   x = (x \<cdot>\<^sub>r  (y\<^bsup>\<hyphen>K\<^esup>)) \<cdot>\<^sub>r y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier K; y \<in> carrier K; y \<noteq> \<zero>\<rbrakk> \<Longrightarrow> x = x \<cdot>\<^sub>r y\<^bsup>\<hyphen> K\<^esup> \<cdot>\<^sub>r y
[PROOF STEP]
apply (cut_tac invf_closed[of y],
       cut_tac field_is_ring,
       simp add:Ring.ring_tOp_assoc,
       subst linvf[of y], simp, simp add:Ring.ring_r_one[of K], simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma aux1_digit_gen_sum_repr:
assumes "n < b^c" "r<c" and "b>1"
shows "nth_digit (\<Sum>k<c.((nth_digit n k b)*b^k)) r b = nth_digit n r b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
define a where "a \<equiv> (\<Sum>k=0..<Suc(r).((nth_digit n k b)*b^k))"
[PROOF STATE]
proof (state)
this:
a \<equiv> \<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
define d where "d \<equiv> (\<Sum>k=Suc(r)..<c.((nth_digit n k b)*b^k))"
[PROOF STATE]
proof (state)
this:
d \<equiv> \<Sum>k = Suc r..<c. nth_digit n k b * b ^ k

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
define e where "e \<equiv> (\<Sum>k=Suc r..<c.((nth_digit n k b)*b^(k-Suc(r))))"
[PROOF STATE]
proof (state)
this:
e \<equiv> \<Sum>k = Suc r..<c. nth_digit n k b * b ^ (k - Suc r)

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
define f where "f \<equiv> (\<Sum>k=0..<r.((nth_digit n k b)*b^k))"
[PROOF STATE]
proof (state)
this:
f \<equiv> \<Sum>k = 0..<r. nth_digit n k b * b ^ k

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
have ad: "(\<Sum>k=0..<c.((nth_digit n k b)*b^k)) = a + d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<c. nth_digit n k b * b ^ k) = a + d
[PROOF STEP]
using a_def d_def assms
[PROOF STATE]
proof (prove)
using this:
a \<equiv> \<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k
d \<equiv> \<Sum>k = Suc r..<c. nth_digit n k b * b ^ k
n < b ^ c
r < c
1 < b

goal (1 subgoal):
 1. (\<Sum>k = 0..<c. nth_digit n k b * b ^ k) = a + d
[PROOF STEP]
by (metis (no_types, lifting) Suc_leI a_def assms(2) d_def sum.atLeastLessThan_concat zero_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<c. nth_digit n k b * b ^ k) = a + d

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
have "d = (\<Sum>k=Suc(r)..<c.(b^(Suc r) * (nth_digit n k b * b^(k - Suc r))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d = (\<Sum>k = Suc r..<c. b ^ Suc r * (nth_digit n k b * b ^ (k - Suc r)))
[PROOF STEP]
using d_def
[PROOF STATE]
proof (prove)
using this:
d \<equiv> \<Sum>k = Suc r..<c. nth_digit n k b * b ^ k

goal (1 subgoal):
 1. d = (\<Sum>k = Suc r..<c. b ^ Suc r * (nth_digit n k b * b ^ (k - Suc r)))
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<equiv> \<Sum>k = Suc r..<c. nth_digit n k b * b ^ k \<Longrightarrow> (\<Sum>k = Suc r..<c. nth_digit n k b * b ^ k) = (\<Sum>k = Suc r..<c. b * b ^ r * (nth_digit n k b * b ^ (k - Suc r)))
[PROOF STEP]
apply (rule sum.cong; auto simp: algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>d \<equiv> \<Sum>k = Suc r..<c. b ^ k * nth_digit n k b; Suc r \<le> x; x < c; b ^ x \<noteq> b * (b ^ r * b ^ (x - Suc r))\<rbrakk> \<Longrightarrow> nth_digit n x b = 0
[PROOF STEP]
by (metis add_Suc le_add_diff_inverse power_Suc power_add)
[PROOF STATE]
proof (state)
this:
d = (\<Sum>k = Suc r..<c. b ^ Suc r * (nth_digit n k b * b ^ (k - Suc r)))

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
hence d2r: "d = b^Suc(r)*e"
[PROOF STATE]
proof (prove)
using this:
d = (\<Sum>k = Suc r..<c. b ^ Suc r * (nth_digit n k b * b ^ (k - Suc r)))

goal (1 subgoal):
 1. d = b ^ Suc r * e
[PROOF STEP]
using d_def e_def sum_distrib_left[of "b^(Suc r)"
                          "\<lambda>k. (nth_digit n k b) *  b^(k - Suc r)" "{Suc r..<c}"]
[PROOF STATE]
proof (prove)
using this:
d = (\<Sum>k = Suc r..<c. b ^ Suc r * (nth_digit n k b * b ^ (k - Suc r)))
d \<equiv> \<Sum>k = Suc r..<c. nth_digit n k b * b ^ k
e \<equiv> \<Sum>k = Suc r..<c. nth_digit n k b * b ^ (k - Suc r)
b ^ Suc r * (\<Sum>k = Suc r..<c. nth_digit n k b * b ^ (k - Suc r)) = (\<Sum>na = Suc r..<c. b ^ Suc r * (nth_digit n na b * b ^ (na - Suc r)))

goal (1 subgoal):
 1. d = b ^ Suc r * e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d = b ^ Suc r * e

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
have "(\<Sum>k<c.((nth_digit n k b)*b^k)) = a +b^Suc(r)*e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<c. nth_digit n k b * b ^ k) = a + b ^ Suc r * e
[PROOF STEP]
by (simp add: d2r ad lessThan_atLeast0)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<c. nth_digit n k b * b ^ k) = a + b ^ Suc r * e

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>k<c. nth_digit n k b * b ^ k) = a + b ^ Suc r * e

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
have "(\<Sum>k=0..<Suc(r).((nth_digit n k b)*b^k)) < b ^ Suc(r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < b ^ c
r < c
1 < b

goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
proof(induct r)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>n < b ^ c; 0 < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc 0. nth_digit n k b * b ^ k) < b ^ Suc 0
 2. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n < b ^ c
0 < c
1 < b

goal (2 subgoals):
 1. \<lbrakk>n < b ^ c; 0 < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc 0. nth_digit n k b * b ^ k) < b ^ Suc 0
 2. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n < b ^ c
0 < c
1 < b
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
n < b ^ c
0 < c
1 < b

goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc 0. nth_digit n k b * b ^ k) < b ^ Suc 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>n < b ^ c; 0 < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc 0. nth_digit n k b * b ^ k) < b ^ Suc 0
[PROOF STEP]
have "nth_digit n 0 b < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit n 0 b < b
[PROOF STEP]
using nth_digit_bounded[of "b" "n" "0"] \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < b \<Longrightarrow> nth_digit n 0 b \<le> b - 1
1 < b

goal (1 subgoal):
 1. nth_digit n 0 b < b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nth_digit n 0 b < b

goal (1 subgoal):
 1. \<lbrakk>n < b ^ c; 0 < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc 0. nth_digit n k b * b ^ k) < b ^ Suc 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nth_digit n 0 b < b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nth_digit n 0 b < b

goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc 0. nth_digit n k b * b ^ k) < b ^ Suc 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<Suc 0. nth_digit n k b * b ^ k) < b ^ Suc 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<Suc 0. nth_digit n k b * b ^ k) < b ^ Suc 0

goal (1 subgoal):
 1. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
case (Suc r)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
n < b ^ c
Suc r < c
1 < b

goal (1 subgoal):
 1. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
have r2: "(nth_digit n (Suc r) b) * b ^ Suc(r) \<le> (b-1) * b ^ Suc(r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit n (Suc r) b * b ^ Suc r \<le> (b - 1) * b ^ Suc r
[PROOF STEP]
using nth_digit_bounded[of "b" "n" "Suc r"] \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < b \<Longrightarrow> nth_digit n (Suc r) b \<le> b - 1
1 < b

goal (1 subgoal):
 1. nth_digit n (Suc r) b * b ^ Suc r \<le> (b - 1) * b ^ Suc r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nth_digit n (Suc r) b * b ^ Suc r \<le> (b - 1) * b ^ Suc r

goal (1 subgoal):
 1. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
nth_digit n (Suc r) b * b ^ Suc r \<le> (b - 1) * b ^ Suc r

goal (1 subgoal):
 1. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
have "(\<Sum>k=0..<Suc(r).((nth_digit n k b)*b^k)) < b ^ Suc(r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
using Suc.hyps
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r

goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
using Suc.prems(2) Suc_lessD assms(1) \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
Suc r < c
Suc ?m < ?n \<Longrightarrow> ?m < ?n
n < b ^ c
1 < b

goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r

goal (1 subgoal):
 1. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
nth_digit n (Suc r) b * b ^ Suc r \<le> (b - 1) * b ^ Suc r
(\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
have "(nth_digit n (Suc r) b) * b ^ Suc(r)
                     + (\<Sum>k=0..<Suc(r).((nth_digit n k b)*b^k)) < b ^ Suc (Suc r)"
[PROOF STATE]
proof (prove)
using this:
nth_digit n (Suc r) b * b ^ Suc r \<le> (b - 1) * b ^ Suc r
(\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r

goal (1 subgoal):
 1. nth_digit n (Suc r) b * b ^ Suc r + (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
using assms(3) mult_eq_if
[PROOF STATE]
proof (prove)
using this:
nth_digit n (Suc r) b * b ^ Suc r \<le> (b - 1) * b ^ Suc r
(\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
1 < b
?m * ?n = (if ?m = 0 then 0 else ?n + (?m - 1) * ?n)

goal (1 subgoal):
 1. nth_digit n (Suc r) b * b ^ Suc r + (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nth_digit n (Suc r) b * b ^ Suc r + (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc (Suc r)

goal (1 subgoal):
 1. \<And>r. \<lbrakk>\<lbrakk>n < b ^ c; r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r; n < b ^ c; Suc r < c; 1 < b\<rbrakk> \<Longrightarrow> (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nth_digit n (Suc r) b * b ^ Suc r + (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
nth_digit n (Suc r) b * b ^ Suc r + (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc (Suc r)

goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<Suc (Suc r). nth_digit n k b * b ^ k) < b ^ Suc (Suc r)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
hence "a < b^Suc(r)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r

goal (1 subgoal):
 1. a < b ^ Suc r
[PROOF STEP]
using a_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
a \<equiv> \<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k

goal (1 subgoal):
 1. a < b ^ Suc r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a < b ^ Suc r

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k<c. nth_digit n k b * b ^ k) = a + b ^ Suc r * e
a < b ^ Suc r
[PROOF STEP]
have ar:"nth_digit (a+d) r b = nth_digit a r b"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<c. nth_digit n k b * b ^ k) = a + b ^ Suc r * e
a < b ^ Suc r

goal (1 subgoal):
 1. nth_digit (a + d) r b = nth_digit a r b
[PROOF STEP]
using d2r
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<c. nth_digit n k b * b ^ k) = a + b ^ Suc r * e
a < b ^ Suc r
d = b ^ Suc r * e

goal (1 subgoal):
 1. nth_digit (a + d) r b = nth_digit a r b
[PROOF STEP]
by (metis (no_types, lifting) aux2_digit_gen_sum_repr lessI semiring_normalization_rules(24)
              semiring_normalization_rules(7))
[PROOF STATE]
proof (state)
this:
nth_digit (a + d) r b = nth_digit a r b

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
(* Second part of proof *)
[PROOF STATE]
proof (state)
this:
nth_digit (a + d) r b = nth_digit a r b

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
have ab: "a =(nth_digit n r b)*b^r + f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = nth_digit n r b * b ^ r + f
[PROOF STEP]
using a_def f_def d_def
[PROOF STATE]
proof (prove)
using this:
a \<equiv> \<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k
f \<equiv> \<Sum>k = 0..<r. nth_digit n k b * b ^ k
d \<equiv> \<Sum>k = Suc r..<c. nth_digit n k b * b ^ k

goal (1 subgoal):
 1. a = nth_digit n r b * b ^ r + f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a = nth_digit n r b * b ^ r + f

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
have "(\<Sum>k=0..<r.((nth_digit n k b)*b^k)) < b^r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r
[PROOF STEP]
proof(induct r)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>k = 0..<0. nth_digit n k b * b ^ k) < b ^ 0
 2. \<And>r. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<Sum>k = 0..<0. nth_digit n k b * b ^ k) < b ^ 0
 2. \<And>r. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<0. nth_digit n k b * b ^ k) < b ^ 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<0. nth_digit n k b * b ^ k) < b ^ 0

goal (1 subgoal):
 1. \<And>r. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
case (Suc r)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r

goal (1 subgoal):
 1. \<And>r. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
have r2: "nth_digit n r b * b ^ r \<le> (b-1) * b ^ r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit n r b * b ^ r \<le> (b - 1) * b ^ r
[PROOF STEP]
using nth_digit_bounded[of "b"] \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < b \<Longrightarrow> nth_digit ?a ?k b \<le> b - 1
1 < b

goal (1 subgoal):
 1. nth_digit n r b * b ^ r \<le> (b - 1) * b ^ r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nth_digit n r b * b ^ r \<le> (b - 1) * b ^ r

goal (1 subgoal):
 1. \<And>r. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
have "(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b^r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r
[PROOF STEP]
using Suc.hyps
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r

goal (1 subgoal):
 1. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r

goal (1 subgoal):
 1. \<And>r. (\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r \<Longrightarrow> (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r

goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
using "r2" assms(3) mult_eq_if
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r
nth_digit n r b * b ^ r \<le> (b - 1) * b ^ r
1 < b
?m * ?n = (if ?m = 0 then 0 else ?n + (?m - 1) * ?n)

goal (1 subgoal):
 1. (\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k) < b ^ Suc r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
hence f: "f < b^r"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r

goal (1 subgoal):
 1. f < b ^ r
[PROOF STEP]
using f_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<r. nth_digit n k b * b ^ k) < b ^ r
f \<equiv> \<Sum>k = 0..<r. nth_digit n k b * b ^ k

goal (1 subgoal):
 1. f < b ^ r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f < b ^ r

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
hence "nth_digit a r b = (nth_digit (nth_digit n r b * b^r) r b)"
[PROOF STATE]
proof (prove)
using this:
f < b ^ r

goal (1 subgoal):
 1. nth_digit a r b = nth_digit (nth_digit n r b * b ^ r) r b
[PROOF STEP]
using ab aux3_digit_gen_sum_repr \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
f < b ^ r
a = nth_digit n r b * b ^ r + f
\<lbrakk>?d < ?b ^ ?r; 1 < ?b\<rbrakk> \<Longrightarrow> nth_digit (?a * ?b ^ ?r + ?d) ?r ?b = nth_digit (?a * ?b ^ ?r) ?r ?b
1 < b

goal (1 subgoal):
 1. nth_digit a r b = nth_digit (nth_digit n r b * b ^ r) r b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nth_digit a r b = nth_digit (nth_digit n r b * b ^ r) r b

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
hence "nth_digit a r b = nth_digit n r b"
[PROOF STATE]
proof (prove)
using this:
nth_digit a r b = nth_digit (nth_digit n r b * b ^ r) r b

goal (1 subgoal):
 1. nth_digit a r b = nth_digit n r b
[PROOF STEP]
using nth_digit_def \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
nth_digit a r b = nth_digit (nth_digit n r b * b ^ r) r b
nth_digit ?num ?k ?base = ?num div ?base ^ ?k mod ?base
1 < b

goal (1 subgoal):
 1. nth_digit a r b = nth_digit n r b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nth_digit a r b = nth_digit n r b

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nth_digit a r b = nth_digit n r b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nth_digit a r b = nth_digit n r b

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
using ar a_def
[PROOF STATE]
proof (prove)
using this:
nth_digit a r b = nth_digit n r b
nth_digit (a + d) r b = nth_digit a r b
a \<equiv> \<Sum>k = 0..<Suc r. nth_digit n k b * b ^ k

goal (1 subgoal):
 1. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
by (simp add: ad lessThan_atLeast0)
[PROOF STATE]
proof (state)
this:
nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_ipv6_addr_number: "max_ipv6_addr = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_ipv6_addr = 340282366920938463463374607431768211455
[PROOF STEP]
unfolding max_ipv6_addr_def ipv6addr_of_nat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_of_nat (2 ^ 128 - 1) = 340282366920938463463374607431768211455
[PROOF STEP]
by(simp)


[STATEMENT]
lemma take_bit_Suc_from_most:
  \<open>take_bit (Suc n) k = 2 ^ n * of_bool (bit k n) + take_bit n k\<close> for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) k = 2 ^ n * of_bool (bit k n) + take_bit n k
[PROOF STEP]
by (simp only: take_bit_eq_mod power_Suc2) (simp_all add: bit_iff_odd odd_iff_mod_2_eq_one zmod_zmult2_eq)


[STATEMENT]
lemma content_box_cases:
  "content (box a b) = (if \<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i then prod (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (box a b) = (if \<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i then \<Prod>i\<in>Basis. b \<bullet> i - a \<bullet> i else 0)
[PROOF STEP]
by (simp add: measure_lborel_box_eq inner_diff)


[STATEMENT]
lemma continuous_map_paired:
   "continuous_map Z (prod_topology X Y) (\<lambda>x. (f x,g x)) \<longleftrightarrow> continuous_map Z X f \<and> continuous_map Z Y g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map Z (prod_topology X Y) (\<lambda>x. (f x, g x)) = (continuous_map Z X f \<and> continuous_map Z Y g)
[PROOF STEP]
by (simp add: continuous_map_pairwise o_def)


[STATEMENT]
lemma binop_plus:
  fixes b::"(nat * 'a::euclidean_space) list"
  shows
    "(\<Sum>(i, y)\<leftarrow>binop (+) 0 0 b ba. e i *\<^sub>R y) = (\<Sum>(i, y)\<leftarrow>b. e i *\<^sub>R y) + (\<Sum>(i, y)\<leftarrow>ba. e i *\<^sub>R y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(i, y)\<leftarrow>binop (+) (0::'a) (0::'a) b ba. e i *\<^sub>R y) = (\<Sum>(i, y)\<leftarrow>b. e i *\<^sub>R y) + (\<Sum>(i, y)\<leftarrow>ba. e i *\<^sub>R y)
[PROOF STEP]
by (induct "(+) ::'a\<Rightarrow>_" "0::'a" "0::'a" b ba rule: binop.induct)
    (auto simp: algebra_simps)


[STATEMENT]
lemma polymul_eq0_iff:
  fixes p::"'a::field poly"
  shows "isnpolyh p n0 \<Longrightarrow> isnpolyh q n1 \<Longrightarrow> p *\<^sub>p q = 0\<^sub>p \<longleftrightarrow> p = 0\<^sub>p \<or> q = 0\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isnpolyh p n0; isnpolyh q n1\<rbrakk> \<Longrightarrow> (p *\<^sub>p q = 0\<^sub>p) = (p = 0\<^sub>p \<or> q = 0\<^sub>p)
[PROOF STEP]
using polymul_properties(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>isnpolyh ?p ?n0.0; isnpolyh ?q ?n1.0; ?m \<le> min ?n0.0 ?n1.0\<rbrakk> \<Longrightarrow> (?p *\<^sub>p ?q = 0\<^sub>p) = (?p = 0\<^sub>p \<or> ?q = 0\<^sub>p)

goal (1 subgoal):
 1. \<lbrakk>isnpolyh p n0; isnpolyh q n1\<rbrakk> \<Longrightarrow> (p *\<^sub>p q = 0\<^sub>p) = (p = 0\<^sub>p \<or> q = 0\<^sub>p)
[PROOF STEP]
by blast


[STATEMENT]
lemma continuous_infdist[continuous_intros]:
  assumes "continuous F f"
  shows "continuous F (\<lambda>x. infdist (f x) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. infdist (f x) A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous F f

goal (1 subgoal):
 1. continuous F (\<lambda>x. infdist (f x) A)
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f (netlimit F)) F

goal (1 subgoal):
 1. ((\<lambda>x. infdist (f x) A) \<longlongrightarrow> infdist (f (netlimit F)) A) F
[PROOF STEP]
by (rule tendsto_infdist)


[STATEMENT]
lemma iprev_mono2_if_neq_iMin: "\<lbrakk> n \<in> I; iMin I \<noteq> n\<rbrakk> \<Longrightarrow> iprev n I < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<in> I; iMin I \<noteq> n\<rbrakk> \<Longrightarrow> iprev n I < n
[PROOF STEP]
by (blast intro: iMinI iprev_mono2)


[STATEMENT]
lemma set_insert_list: "set (insert_list x xs) = insert x (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (insert_list x xs) = insert x (set xs)
[PROOF STEP]
by (auto simp add: insert_list_def)


[STATEMENT]
lemma l9_19:
  assumes "Col X Y P" and
    "Col A B P"
  shows "X Y OS A B \<longleftrightarrow> (P Out A B \<and> \<not> Col X Y A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X Y OS A B) = (P Out A B \<and> \<not> Col X Y A)
[PROOF STEP]
using l9_19_R1 l9_19_R2 assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Col ?X ?Y ?P; Col ?A ?B ?P; ?X ?Y OS ?A ?B\<rbrakk> \<Longrightarrow> ?P Out ?A ?B \<and> \<not> Col ?X ?Y ?A
\<lbrakk>Col ?X ?Y ?P; ?P Out ?A ?B; \<not> Col ?X ?Y ?A\<rbrakk> \<Longrightarrow> ?X ?Y OS ?A ?B
Col X Y P
Col A B P

goal (1 subgoal):
 1. (X Y OS A B) = (P Out A B \<and> \<not> Col X Y A)
[PROOF STEP]
by blast


[STATEMENT]
lemma div_mult_twopow_eq: "a div ((2::nat) ^ n) div b = a div (b * 2 ^ n)" for a b :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a div 2 ^ n div b = a div (b * 2 ^ n)
[PROOF STEP]
by (cases "b = 0") (simp_all add: div_mult2_eq[symmetric] ac_simps)


[STATEMENT]
lemma biquadratic_solution: fixes p q :: "'a :: field_char_0"
  shows "y^4 + p * y^2 + q = 0 \<longleftrightarrow> (\<exists> z. z^2 + p * z + q = 0 \<and> z = y^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y ^ 4 + p * y\<^sup>2 + q = (0::'a)) = (\<exists>z. z\<^sup>2 + p * z + q = (0::'a) \<and> z = y\<^sup>2)
[PROOF STEP]
by (auto simp: field_simps power4_eq_xxxx power2_eq_square)


[STATEMENT]
lemma zero_less_ceiling [simp]: "0 < \<lceil>x\<rceil> \<longleftrightarrow> 0 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < \<lceil>x\<rceil>) = ((0::'a) < x)
[PROOF STEP]
by (simp add: less_ceiling_iff)


[STATEMENT]
lemma invariance_of_domain_sphere_affine_set:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes contf: "continuous_on S f" and injf: "inj_on f S" and fim: "f ` S \<subseteq> T"
      and "r \<noteq> 0" "affine T" and affTU: "aff_dim T < DIM('a)"
      and ope: "openin (top_of_set (sphere a r)) S"
   shows "openin (top_of_set T) (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set T) (f ` S)
[PROOF STEP]
proof (cases "sphere a r = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sphere a r = {} \<Longrightarrow> openin (top_of_set T) (f ` S)
 2. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
sphere a r = {}

goal (2 subgoals):
 1. sphere a r = {} \<Longrightarrow> openin (top_of_set T) (f ` S)
 2. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sphere a r = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sphere a r = {}

goal (1 subgoal):
 1. openin (top_of_set T) (f ` S)
[PROOF STEP]
using ope openin_subset
[PROOF STATE]
proof (prove)
using this:
sphere a r = {}
openin (top_of_set (sphere a r)) S
openin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

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

goal (1 subgoal):
 1. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
sphere a r \<noteq> {}

goal (1 subgoal):
 1. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set T) (f ` S)
[PROOF STEP]
proof (rule invariance_of_domain_sphere_affine_set_gen [OF contf injf fim bounded_cball convex_cball \<open>affine T\<close>])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. aff_dim T < aff_dim (cball ?x1 ?e1)
 2. openin (top_of_set (rel_frontier (cball ?x1 ?e1))) S
[PROOF STEP]
show "aff_dim T < aff_dim (cball a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim T < aff_dim (cball a r)
[PROOF STEP]
by (metis False affTU aff_dim_cball assms(4) linorder_cases sphere_empty)
[PROOF STATE]
proof (state)
this:
aff_dim T < aff_dim (cball a r)

goal (1 subgoal):
 1. openin (top_of_set (rel_frontier (cball a r))) S
[PROOF STEP]
show "openin (top_of_set (rel_frontier (cball a r))) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set (rel_frontier (cball a r))) S
[PROOF STEP]
by (simp add: \<open>r \<noteq> 0\<close> ope)
[PROOF STATE]
proof (state)
this:
openin (top_of_set (rel_frontier (cball a r))) S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
openin (top_of_set T) (f ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_Pair [simp]: "inner (a, b) (c, d) = inner a c + inner b d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner (a, b) (c, d) = inner a c + inner b d
[PROOF STEP]
unfolding inner_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner (fst (a, b)) (fst (c, d)) + inner (snd (a, b)) (snd (c, d)) = inner a c + inner b d
[PROOF STEP]
by simp


[STATEMENT]
lemma closed_Int_compactin: "\<lbrakk>closedin X S; compactin X T\<rbrakk> \<Longrightarrow> compactin X (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closedin X S; compactin X T\<rbrakk> \<Longrightarrow> compactin X (S \<inter> T)
[PROOF STEP]
by (metis compact_Int_closedin inf_commute)


[STATEMENT]
lemma majorities_intersect:
  assumes crd: "card (UNIV::('a::finite) set) < card (S::'a set) + card T"
  shows "S \<inter> T \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> T \<noteq> {}
[PROOF STEP]
by (rule abs_majorities_intersect[OF crd]) auto


[STATEMENT]
lemma cf_cn_cov_lcomp_ObjMap_app[cat_cs_simps]:
  assumes "category \<alpha> \<CC>"
    and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
    and "a \<in>\<^sub>\<circ> op_cat \<AA>\<lparr>Obj\<rparr>"
    and "c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
  shows "cf_cn_cov_lcomp \<CC> \<SS> \<FF>\<lparr>ObjMap\<rparr>\<lparr>a, c\<rparr>\<^sub>\<bullet> = \<SS>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>, c\<rparr>\<^sub>\<bullet>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_cn_cov_lcomp \<CC> \<SS> \<FF>\<^esub> c = \<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
a \<in>\<^sub>\<circ> op_cat \<AA>\<lparr>Obj\<rparr>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_cn_cov_lcomp \<CC> \<SS> \<FF>\<^esub> c = \<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> c
[PROOF STEP]
unfolding cf_cn_cov_lcomp_def cat_op_simps
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_cn_cov_bcomp \<SS> \<FF> (dghm_id \<CC>)\<^esub> c = \<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> c
[PROOF STEP]
by
    (
      cs_concl
        cs_simp: cat_cs_simps cat_op_simps
        cs_intro: cat_cs_intros cat_prod_cs_intros
    )


[STATEMENT]
lemma trees_cyl_map_in_sets:
  "(\<And>x. x \<in> set_tree t \<Longrightarrow> f x \<in> sets M) \<Longrightarrow> trees_cyl (map_tree f t) \<in> sets (tree_sigma M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set_tree t \<Longrightarrow> f x \<in> sets M) \<Longrightarrow> trees_cyl (map_tree f t) \<in> sets (tree_sigma M)
[PROOF STEP]
by (subst sets_tree_sigma_eq) auto


[STATEMENT]
lemma finite_tree_MPT[code] :
  "finite_tree (MPT m) = (finite (Mapping.keys m) \<and> (\<forall> x \<in> Mapping.keys m . finite_tree (the (Mapping.lookup m x))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_tree (MPT m) = (finite (Mapping.keys m) \<and> (\<forall>x\<in>Mapping.keys m. finite_tree (the (Mapping.lookup m x))))
[PROOF STEP]
unfolding MPT_def finite_tree.simps keys_dom_lookup ran_dom_the_eq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite (dom (Mapping.lookup m)) \<and> Ball ((\<lambda>k. the (Mapping.lookup m k)) ` dom (Mapping.lookup m)) finite_tree) = (finite (dom (Mapping.lookup m)) \<and> (\<forall>x\<in>dom (Mapping.lookup m). finite_tree (the (Mapping.lookup m x))))
[PROOF STEP]
by blast


[STATEMENT]
lemma product_Set [code]:
  "Product_Type.product (Set t1) (Set t2) =
    fold_keys (\<lambda>x A. fold_keys (\<lambda>y. Set.insert (x, y)) t2 A) t1 {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Product_Type.product (Set t1) (Set t2) = fold_keys (\<lambda>x. fold_keys (\<lambda>y. insert (x, y)) t2) t1 {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Product_Type.product (Set t1) (Set t2) = fold_keys (\<lambda>x. fold_keys (\<lambda>y. insert (x, y)) t2) t1 {}
[PROOF STEP]
have *: "comp_fun_commute (\<lambda>y. Set.insert (x, y))" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>y. insert (x, y))
[PROOF STEP]
by standard auto
[PROOF STATE]
proof (state)
this:
comp_fun_commute (\<lambda>y. insert (?x1, y))

goal (1 subgoal):
 1. Product_Type.product (Set t1) (Set t2) = fold_keys (\<lambda>x. fold_keys (\<lambda>y. insert (x, y)) t2) t1 {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Product_Type.product (Set t1) (Set t2) = fold_keys (\<lambda>x. fold_keys (\<lambda>y. insert (x, y)) t2) t1 {}
[PROOF STEP]
using finite_fold_fold_keys[OF comp_fun_commute_product_fold, of "Set t2" "{}" "t1"]
[PROOF STATE]
proof (prove)
using this:
finite (Set t2) \<Longrightarrow> Finite_Set.fold (\<lambda>x z. Finite_Set.fold (\<lambda>y. insert (x, y)) z (Set t2)) {} (Set t1) = fold_keys (\<lambda>x z. Finite_Set.fold (\<lambda>y. insert (x, y)) z (Set t2)) t1 {}

goal (1 subgoal):
 1. Product_Type.product (Set t1) (Set t2) = fold_keys (\<lambda>x. fold_keys (\<lambda>y. insert (x, y)) t2) t1 {}
[PROOF STEP]
by (simp add: product_fold Product_Type.product_def finite_fold_fold_keys[OF *])
[PROOF STATE]
proof (state)
this:
Product_Type.product (Set t1) (Set t2) = fold_keys (\<lambda>x. fold_keys (\<lambda>y. insert (x, y)) t2) t1 {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma DERIV_pos_inc_left:
  fixes f :: "real \<Rightarrow> real"
  shows "DERIV f x :> l \<Longrightarrow> 0 < l \<Longrightarrow> \<exists>d > 0. \<forall>h > 0. h < d \<longrightarrow> f (x - h) < f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_real_derivative l) (at x); 0 < l\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>h>0. h < d \<longrightarrow> f (x - h) < f x
[PROOF STEP]
using has_real_derivative_pos_inc_left
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f has_real_derivative ?l) (at ?x within ?S); 0 < ?l\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>h>0. ?x - h \<in> ?S \<longrightarrow> h < d \<longrightarrow> ?f (?x - h) < ?f ?x

goal (1 subgoal):
 1. \<lbrakk>(f has_real_derivative l) (at x); 0 < l\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>h>0. h < d \<longrightarrow> f (x - h) < f x
[PROOF STEP]
by blast


[STATEMENT]
lemma transpos_hom:"\<lbrakk>i \<le> n; j \<le> n; i \<noteq> j\<rbrakk> \<Longrightarrow>
                          (transpos i j)  \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> n; j \<le> n; i \<noteq> j\<rbrakk> \<Longrightarrow> transpos i j \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}
[PROOF STEP]
apply (simp add:Pi_def, rule allI, rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>i \<le> n; j \<le> n; i \<noteq> j; x \<le> n\<rbrakk> \<Longrightarrow> transpos i j x \<le> n
[PROOF STEP]
apply (case_tac "x = i", simp add:transpos_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>i \<le> n; j \<le> n; i \<noteq> j; x \<le> n; x \<noteq> i\<rbrakk> \<Longrightarrow> transpos i j x \<le> n
[PROOF STEP]
apply (case_tac "x = j", simp add:transpos_def,
        subst transpos_id, assumption+, simp, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma smallo_powr_iff:
  assumes "0 < p" "eventually (\<lambda>x. f x \<ge> 0) F" "eventually (\<lambda>x. g x \<ge> 0) F"
  shows "(\<lambda>x. (f x :: real) powr p) \<in> o[F](\<lambda>x. g x powr p) \<longleftrightarrow> f \<in> o[F](g)" (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p)) = (f \<in> o[F](g))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p) \<Longrightarrow> f \<in> o[F](g)
 2. f \<in> o[F](g) \<Longrightarrow> (\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p)
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p)

goal (2 subgoals):
 1. (\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p) \<Longrightarrow> f \<in> o[F](g)
 2. f \<in> o[F](g) \<Longrightarrow> (\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p)
[PROOF STEP]
with assms smallo_powr[OF this, of "inverse p"]
[PROOF STATE]
proof (chain)
picking this:
0 < p
\<forall>\<^sub>F x in F. 0 \<le> f x
\<forall>\<^sub>F x in F. 0 \<le> g x
0 < inverse p \<Longrightarrow> (\<lambda>x. \<bar>f x powr p\<bar> powr inverse p) \<in> o[F](\<lambda>x. \<bar>g x powr p\<bar> powr inverse p)
(\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p)
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
0 < p
\<forall>\<^sub>F x in F. 0 \<le> f x
\<forall>\<^sub>F x in F. 0 \<le> g x
0 < inverse p \<Longrightarrow> (\<lambda>x. \<bar>f x powr p\<bar> powr inverse p) \<in> o[F](\<lambda>x. \<bar>g x powr p\<bar> powr inverse p)
(\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p)

goal (1 subgoal):
 1. f \<in> o[F](g)
[PROOF STEP]
by (simp add: powr_powr landau_simps)
[PROOF STATE]
proof (state)
this:
f \<in> o[F](g)

goal (1 subgoal):
 1. f \<in> o[F](g) \<Longrightarrow> (\<lambda>x. f x powr p) \<in> o[F](\<lambda>x. g x powr p)
[PROOF STEP]
qed (insert assms, simp_all add: smallo_powr_nonneg)


[STATEMENT]
lemma vec_count_MV_Rel_direct:
  assumes "MV_Rel v1 v2"
  shows "count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
have eq_vecs: "to_int_vec v2 = vec_mod v1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_int_vec v2 = vec_mod v1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
MV_Rel v1 v2

goal (1 subgoal):
 1. to_int_vec v2 = vec_mod v1
[PROOF STEP]
unfolding MV_Rel_def
[PROOF STATE]
proof (prove)
using this:
vec_mod v1 = to_int_vec v2

goal (1 subgoal):
 1. to_int_vec v2 = vec_mod v1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
to_int_vec v2 = vec_mod v1

goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
have "count_vec v2 i = count (vec_mset v2) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_vec v2 i = count_vec v2 i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count_vec v2 i = count_vec v2 i

goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_vec v2 i = count_vec v2 i

goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
have 1: "... = count (image_mset to_int_mod_ring (vec_mset v2)) (to_int_mod_ring i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_vec v2 i = count (image_mset to_int_mod_ring (vec_mset v2)) (to_int_mod_ring i)
[PROOF STEP]
using count_image_mset_inj
[PROOF STATE]
proof (prove)
using this:
inj ?f \<Longrightarrow> count (image_mset ?f ?M) (?f ?x) = count ?M ?x

goal (1 subgoal):
 1. count_vec v2 i = count (image_mset to_int_mod_ring (vec_mset v2)) (to_int_mod_ring i)
[PROOF STEP]
by (metis to_int_mod_ring_hom.inj_f)
[PROOF STATE]
proof (state)
this:
count_vec v2 i = count (image_mset to_int_mod_ring (vec_mset v2)) (to_int_mod_ring i)

goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_vec v2 i = count (image_mset to_int_mod_ring (vec_mset v2)) (to_int_mod_ring i)

goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
have 2: "... = count (vec_mset (vec_mod v1)) (to_int_mod_ring i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (image_mset to_int_mod_ring (vec_mset v2)) (to_int_mod_ring i) = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
MV_Rel v1 v2

goal (1 subgoal):
 1. count (image_mset to_int_mod_ring (vec_mset v2)) (to_int_mod_ring i) = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
by (simp add: eq_vecs inj_zero_hom.vec_hom_mset to_int_mod_ring_hom.inj_zero_hom_axioms)
[PROOF STATE]
proof (state)
this:
count (image_mset to_int_mod_ring (vec_mset v2)) (to_int_mod_ring i) = count_vec (vec_mod v1) (to_int_mod_ring i)

goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count_vec (vec_mod v1) (to_int_mod_ring i) = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
show "count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)"
[PROOF STATE]
proof (prove)
using this:
count_vec (vec_mod v1) (to_int_mod_ring i) = count_vec (vec_mod v1) (to_int_mod_ring i)

goal (1 subgoal):
 1. count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)
[PROOF STEP]
by (simp add: 1 2 )
[PROOF STATE]
proof (state)
this:
count_vec v2 i = count_vec (vec_mod v1) (to_int_mod_ring i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma openin_Int_derived_set_of_eq:
  assumes "openin X S"
  shows "S \<inter> X derived_set_of T = S \<inter> X derived_set_of (S \<inter> T)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> X derived_set_of T = S \<inter> X derived_set_of (S \<inter> T)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S \<inter> X derived_set_of T \<subseteq> S \<inter> X derived_set_of (S \<inter> T)
 2. S \<inter> X derived_set_of (S \<inter> T) \<subseteq> S \<inter> X derived_set_of T
[PROOF STEP]
show "?lhs \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> X derived_set_of T \<subseteq> S \<inter> X derived_set_of (S \<inter> T)
[PROOF STEP]
by (simp add: assms openin_Int_derived_set_of_subset)
[PROOF STATE]
proof (state)
this:
S \<inter> X derived_set_of T \<subseteq> S \<inter> X derived_set_of (S \<inter> T)

goal (1 subgoal):
 1. S \<inter> X derived_set_of (S \<inter> T) \<subseteq> S \<inter> X derived_set_of T
[PROOF STEP]
show "?rhs \<subseteq> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> X derived_set_of (S \<inter> T) \<subseteq> S \<inter> X derived_set_of T
[PROOF STEP]
by (metis derived_set_of_mono inf_commute inf_le1 inf_mono order_refl)
[PROOF STATE]
proof (state)
this:
S \<inter> X derived_set_of (S \<inter> T) \<subseteq> S \<inter> X derived_set_of T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uminus_ms_aux_MSLCons: "uminus_ms_aux (MSLCons x xs) = MSLCons (-fst x, snd x) (uminus_ms_aux xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uminus_ms_aux (MSLCons x xs) = MSLCons (- fst x, snd x) (uminus_ms_aux xs)
[PROOF STEP]
by (simp add: uminus_ms_aux_def map_prod_def split: prod.splits)


[STATEMENT]
lemma (in linorder_topology) tendsto_max[tendsto_intros]:
  assumes X: "(X \<longlongrightarrow> x) net"
    and Y: "(Y \<longlongrightarrow> y) net"
  shows "((\<lambda>x. max (X x) (Y x)) \<longlongrightarrow> max x y) net"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. max (X x) (Y x)) \<longlongrightarrow> max x y) net
[PROOF STEP]
proof (rule order_tendstoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < max x y \<Longrightarrow> \<forall>\<^sub>F x in net. a < max (X x) (Y x)
 2. \<And>a. max x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < max x y \<Longrightarrow> \<forall>\<^sub>F x in net. a < max (X x) (Y x)
 2. \<And>a. max x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
assume "a < max x y"
[PROOF STATE]
proof (state)
this:
a < max x y

goal (2 subgoals):
 1. \<And>a. a < max x y \<Longrightarrow> \<forall>\<^sub>F x in net. a < max (X x) (Y x)
 2. \<And>a. max x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < max x y
[PROOF STEP]
show "eventually (\<lambda>x. a < max (X x) (Y x)) net"
[PROOF STATE]
proof (prove)
using this:
a < max x y

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. a < max (X x) (Y x)
[PROOF STEP]
using order_tendstoD(1)[OF X, of a] order_tendstoD(1)[OF Y, of a]
[PROOF STATE]
proof (prove)
using this:
a < max x y
a < x \<Longrightarrow> \<forall>\<^sub>F x in net. a < X x
a < y \<Longrightarrow> \<forall>\<^sub>F x in net. a < Y x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. a < max (X x) (Y x)
[PROOF STEP]
by (auto simp: less_max_iff_disj elim: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in net. a < max (X x) (Y x)

goal (1 subgoal):
 1. \<And>a. max x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. max x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. max x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
assume "max x y < a"
[PROOF STATE]
proof (state)
this:
max x y < a

goal (1 subgoal):
 1. \<And>a. max x y < a \<Longrightarrow> \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
max x y < a
[PROOF STEP]
show "eventually (\<lambda>x. max (X x) (Y x) < a) net"
[PROOF STATE]
proof (prove)
using this:
max x y < a

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
using order_tendstoD(2)[OF X, of a] order_tendstoD(2)[OF Y, of a]
[PROOF STATE]
proof (prove)
using this:
max x y < a
x < a \<Longrightarrow> \<forall>\<^sub>F x in net. X x < a
y < a \<Longrightarrow> \<forall>\<^sub>F x in net. Y x < a

goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. max (X x) (Y x) < a
[PROOF STEP]
by (auto simp: eventually_conj_iff)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in net. max (X x) (Y x) < a

goal:
No subgoals!
[PROOF STEP]
qed