[STATEMENT]
lemma residue_primroot_cong:
  assumes "[x = x'] (mod n)"
  shows   "residue_primroot n x = residue_primroot n x'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n x'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n x'
[PROOF STEP]
have "residue_primroot n x = residue_primroot n (x mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n (x mod n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
residue_primroot n x = residue_primroot n (x mod n)

goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n x'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
residue_primroot n x = residue_primroot n (x mod n)

goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n x'
[PROOF STEP]
have "x mod n = x' mod n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x mod n = x' mod n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[x = x'] (mod n)

goal (1 subgoal):
 1. x mod n = x' mod n
[PROOF STEP]
by (simp add: cong_def)
[PROOF STATE]
proof (state)
this:
x mod n = x' mod n

goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n x'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x mod n = x' mod n

goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n x'
[PROOF STEP]
have "residue_primroot n (x' mod n) = residue_primroot n x'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue_primroot n (x' mod n) = residue_primroot n x'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
residue_primroot n (x' mod n) = residue_primroot n x'

goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n x'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
residue_primroot n x = residue_primroot n x'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
residue_primroot n x = residue_primroot n x'

goal (1 subgoal):
 1. residue_primroot n x = residue_primroot n x'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
residue_primroot n x = residue_primroot n x'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma shortest_path_self:
  assumes "u \<in> V"
  shows "shortest_path u u = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shortest_path u u = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. shortest_path u u = 0
[PROOF STEP]
have "[u] \<in> connecting_paths u u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [u] \<in> connecting_paths u u
[PROOF STEP]
using connecting_paths_self
[PROOF STATE]
proof (prove)
using this:
?u \<in> V \<Longrightarrow> [?u] \<in> connecting_paths ?u ?u

goal (1 subgoal):
 1. [u] \<in> connecting_paths u u
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
[u] \<in> connecting_paths u u

goal (1 subgoal):
 1. shortest_path u u = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[u] \<in> connecting_paths u u
[PROOF STEP]
have "walk_length [u] = 0"
[PROOF STATE]
proof (prove)
using this:
[u] \<in> connecting_paths u u

goal (1 subgoal):
 1. walk_length [u] = 0
[PROOF STEP]
using walk_length_def walk_edges.simps
[PROOF STATE]
proof (prove)
using this:
[u] \<in> connecting_paths u u
walk_length ?p \<equiv> length (walk_edges ?p)
walk_edges [] = []
walk_edges [?x] = []
walk_edges (?x # ?y # ?ys) = {?x, ?y} # walk_edges (?y # ?ys)

goal (1 subgoal):
 1. walk_length [u] = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
walk_length [u] = 0

goal (1 subgoal):
 1. shortest_path u u = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
walk_length [u] = 0

goal (1 subgoal):
 1. shortest_path u u = 0
[PROOF STEP]
using shortest_path_def
[PROOF STATE]
proof (prove)
using this:
walk_length [u] = 0
shortest_path ?u ?v \<equiv> INF p\<in>connecting_paths ?u ?v. enat (walk_length p)

goal (1 subgoal):
 1. shortest_path u u = 0
[PROOF STEP]
by (metis \<open>[u] \<in> connecting_paths u u\<close> le_zero_eq shortest_path_lte zero_enat_def)
[PROOF STATE]
proof (state)
this:
shortest_path u u = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma X_has_expectation: "integrable M (X 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (X 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integrable M (X 0)
[PROOF STEP]
have "integrable (bernoulli_pmf p) (\<lambda>b. if b then 1 else 0 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (measure_pmf (bernoulli_pmf p)) (\<lambda>b. if b then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable (measure_pmf (bernoulli_pmf p)) (\<lambda>b. if b then 1 else 0)

goal (1 subgoal):
 1. integrable M (X 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integrable (measure_pmf (bernoulli_pmf p)) (\<lambda>b. if b then 1 else 0)

goal (1 subgoal):
 1. integrable M (X 0)
[PROOF STEP]
have "measure_pmf (bernoulli_pmf p) = distr M (count_space UNIV) (\<lambda>f. f 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf (bernoulli_pmf p) = distr M (count_space UNIV) (\<lambda>f. f 0)
[PROOF STEP]
by (simp add: distr_M_component)
[PROOF STATE]
proof (state)
this:
measure_pmf (bernoulli_pmf p) = distr M (count_space UNIV) (\<lambda>f. f 0)

goal (1 subgoal):
 1. integrable M (X 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf (bernoulli_pmf p) = distr M (count_space UNIV) (\<lambda>f. f 0)

goal (1 subgoal):
 1. integrable M (X 0)
[PROOF STEP]
have "integrable \<dots> (\<lambda>b. if b then 1 else 0 :: real) = integrable M (X 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (distr M (count_space UNIV) (\<lambda>f. f 0)) (\<lambda>b. if b then 1 else 0) = integrable M (X 0)
[PROOF STEP]
unfolding X_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (distr M (count_space UNIV) (\<lambda>f. f 0)) (\<lambda>b. if b then 1 else 0) = integrable M (\<lambda>f. if f 0 then 1 else 0)
[PROOF STEP]
using random_variable_component
[PROOF STATE]
proof (prove)
using this:
random_variable (count_space UNIV) (\<lambda>f. f ?i)

goal (1 subgoal):
 1. integrable (distr M (count_space UNIV) (\<lambda>f. f 0)) (\<lambda>b. if b then 1 else 0) = integrable M (\<lambda>f. if f 0 then 1 else 0)
[PROOF STEP]
by (subst integrable_distr_eq) auto
[PROOF STATE]
proof (state)
this:
integrable (distr M (count_space UNIV) (\<lambda>f. f 0)) (\<lambda>b. if b then 1 else 0) = integrable M (X 0)

goal (1 subgoal):
 1. integrable M (X 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integrable M (X 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable M (X 0)

goal (1 subgoal):
 1. integrable M (X 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integrable M (X 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_vecD: assumes "v <\<^sub>v w" and "w \<in> carrier_vec n"
  shows "i < n \<Longrightarrow> v $ i < w $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < n \<Longrightarrow> v $ i < w $ i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v <\<^sub>v w
w \<in> carrier_vec n

goal (1 subgoal):
 1. i < n \<Longrightarrow> v $ i < w $ i
[PROOF STEP]
unfolding less_vec_def
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec w \<and> (\<forall>i<dim_vec w. v $ i < w $ i)
w \<in> carrier_vec n

goal (1 subgoal):
 1. i < n \<Longrightarrow> v $ i < w $ i
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_apx_left_isotone_2:
  assumes "x \<sqsubseteq> y"
    shows "x * z \<sqsubseteq> y * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
have "x * z \<le> y * z \<squnion> L * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * z \<le> y * z \<squnion> L * z
[PROOF STEP]
by (metis assms apx_def mult_left_isotone mult_right_dist_sup)
[PROOF STATE]
proof (state)
this:
x * z \<le> y * z \<squnion> L * z

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
hence 1: "x * z \<le> y * z \<squnion> L"
[PROOF STATE]
proof (prove)
using this:
x * z \<le> y * z \<squnion> L * z

goal (1 subgoal):
 1. x * z \<le> y * z \<squnion> L
[PROOF STEP]
using n_L_below_L order_lesseq_imp semiring.add_left_mono
[PROOF STATE]
proof (prove)
using this:
x * z \<le> y * z \<squnion> L * z
L * ?x \<le> L
(\<forall>z\<ge>?x. ?y \<le> z) = (?y \<le> ?x)
?a \<le> ?b \<Longrightarrow> ?c \<squnion> ?a \<le> ?c \<squnion> ?b

goal (1 subgoal):
 1. x * z \<le> y * z \<squnion> L
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x * z \<le> y * z \<squnion> L

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
have "C (y * z) = C y * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C (y * z) = C y * z
[PROOF STEP]
by (simp add: n_L_T_meet_mult)
[PROOF STATE]
proof (state)
this:
C (y * z) = C y * z

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C (y * z) = C y * z

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
have "... \<le> x * z \<squnion> n(x) * top * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C y * z \<le> x * z \<squnion> n x * top * z
[PROOF STEP]
by (metis assms apx_def mult_left_isotone mult_right_dist_sup)
[PROOF STATE]
proof (state)
this:
C y * z \<le> x * z \<squnion> n x * top * z

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C y * z \<le> x * z \<squnion> n x * top * z

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
have "... \<le> x * z \<squnion> n(x * z) * top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * z \<squnion> n x * top * z \<le> x * z \<squnion> n (x * z) * top
[PROOF STEP]
by (simp add: n_top_split)
[PROOF STATE]
proof (state)
this:
x * z \<squnion> n x * top * z \<le> x * z \<squnion> n (x * z) * top

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
C (y * z) \<le> x * z \<squnion> n (x * z) * top
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
C (y * z) \<le> x * z \<squnion> n (x * z) * top

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
C (y * z) \<le> x * z \<squnion> n (x * z) * top
x * z \<le> y * z \<squnion> L

goal (1 subgoal):
 1. x * z \<sqsubseteq> y * z
[PROOF STEP]
by (simp add: apx_def)
[PROOF STATE]
proof (state)
this:
x * z \<sqsubseteq> y * z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enum_inj:
  assumes "i < CARD('a)" and "j < CARD('a)"
  shows "(Enum.enum ! i :: 'a::enum) = Enum.enum ! j \<longleftrightarrow> i = j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (enum_class.enum ! i = enum_class.enum ! j) = (i = j)
[PROOF STEP]
using inj_on_nth[OF enum_distinct, where I=\<open>{..<CARD('a)}\<close>]
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{..<CARD('a)}. i < length enum_class.enum \<Longrightarrow> inj_on ((!) enum_class.enum) {..<CARD('a)}

goal (1 subgoal):
 1. (enum_class.enum ! i = enum_class.enum ! j) = (i = j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{..<CARD('a)}. i < length enum_class.enum \<Longrightarrow> inj_on ((!) enum_class.enum) {..<CARD('a)}
i < CARD('a)
j < CARD('a)

goal (1 subgoal):
 1. (enum_class.enum ! i = enum_class.enum ! j) = (i = j)
[PROOF STEP]
by (auto dest: inj_onD simp flip: card_UNIV_length_enum)


[STATEMENT]
lemma card_finite_less_ex:
  assumes finite_A: "finite A"
      and finite_B: "finite B"
      and card_AB: "card A < card B"
  shows "\<exists>b \<in> B. b \<notin> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b\<in>B. b \<notin> A
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b\<in>B. b \<notin> A
[PROOF STEP]
have "card (B - A) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card (B - A)
[PROOF STEP]
using finite_A finite_B card_AB
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card A < card B

goal (1 subgoal):
 1. 0 < card (B - A)
[PROOF STEP]
by (meson Diff_eq_empty_iff card_eq_0_iff card_mono finite_Diff gr0I leD)
[PROOF STATE]
proof (state)
this:
0 < card (B - A)

goal (1 subgoal):
 1. \<exists>b\<in>B. b \<notin> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < card (B - A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < card (B - A)

goal (1 subgoal):
 1. \<exists>b\<in>B. b \<notin> A
[PROOF STEP]
using finite_B
[PROOF STATE]
proof (prove)
using this:
0 < card (B - A)
finite B

goal (1 subgoal):
 1. \<exists>b\<in>B. b \<notin> A
[PROOF STEP]
by (metis Diff_eq_empty_iff card_0_eq finite_Diff neq_iff subsetI)
[PROOF STATE]
proof (state)
this:
\<exists>b\<in>B. b \<notin> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_matrix_def_nrows[simp]: "nrows 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows 0 = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nrows 0 = 0
[PROOF STEP]
have a:"!! (x::nat). x <= 0 \<Longrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<le> 0 \<Longrightarrow> x = 0
[PROOF STEP]
by (arith)
[PROOF STATE]
proof (state)
this:
?x \<le> 0 \<Longrightarrow> ?x = 0

goal (1 subgoal):
 1. nrows 0 = 0
[PROOF STEP]
show "nrows 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows 0 = 0
[PROOF STEP]
by (rule a, subst nrows_le, simp)
[PROOF STATE]
proof (state)
this:
nrows 0 = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sturm_ext_R:
  assumes "p\<noteq>0"
  shows "proots_count p UNIV = changes_R_smods_ext p (pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
define ps where "ps\<equiv>smods_ext p (pderiv p)"
[PROOF STATE]
proof (state)
this:
ps \<equiv> smods_ext p (pderiv p)

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
have "p\<in>set ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> set ps
[PROOF STEP]
using ps_def \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
ps \<equiv> smods_ext p (pderiv p)
p \<noteq> 0

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

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
obtain lb where lb:"\<forall>p\<in>set ps. \<forall>x. poly p x=0 \<longrightarrow> x>lb"
    and lb_sgn:"\<forall>x\<le>lb. \<forall>p\<in>set ps. sgn (poly p x) = sgn_neg_inf p"
    and "lb<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>lb. \<lbrakk>\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> lb < x; \<forall>x\<le>lb. \<forall>p\<in>set ps. sgn (poly p x) = sgn_neg_inf p; lb < 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using root_list_lb[OF no_0_in_smods_ext,of p "pderiv p",folded ps_def]
[PROOF STATE]
proof (prove)
using this:
(\<And>lb. \<lbrakk>\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> lb < x; \<forall>x\<le>lb. \<forall>p\<in>set ps. sgn (poly p x) = sgn_neg_inf p; lb < ?b\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>lb. \<lbrakk>\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> lb < x; \<forall>x\<le>lb. \<forall>p\<in>set ps. sgn (poly p x) = sgn_neg_inf p; lb < 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> lb < x
\<forall>x\<le>lb. \<forall>p\<in>set ps. sgn (poly p x) = sgn_neg_inf p
lb < 0

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
obtain ub where ub:"\<forall>p\<in>set ps. \<forall>x. poly p x=0 \<longrightarrow> x<ub"
    and ub_sgn:"\<forall>x\<ge>ub. \<forall>p\<in>set ps. sgn (poly p x) = sgn_pos_inf p"
    and "ub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>ub. \<lbrakk>\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> x < ub; \<forall>x\<ge>ub. \<forall>p\<in>set ps. sgn (poly p x) = sgn_pos_inf p; 0 < ub\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using root_list_ub[OF no_0_in_smods_ext,of p "pderiv p",folded ps_def]
[PROOF STATE]
proof (prove)
using this:
(\<And>ub. \<lbrakk>\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> x < ub; \<forall>x\<ge>ub. \<forall>p\<in>set ps. sgn (poly p x) = sgn_pos_inf p; ?a < ub\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>ub. \<lbrakk>\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> x < ub; \<forall>x\<ge>ub. \<forall>p\<in>set ps. sgn (poly p x) = sgn_pos_inf p; 0 < ub\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> x < ub
\<forall>x\<ge>ub. \<forall>p\<in>set ps. sgn (poly p x) = sgn_pos_inf p
0 < ub

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
have "proots_count p UNIV = proots_count p {x. lb<x \<and> x<ub}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p UNIV = proots_count p {x. lb < x \<and> x < ub}
[PROOF STEP]
unfolding proots_count_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r\<in>proots p. order r p) = (\<Sum>r\<in>proots_within p {x. lb < x \<and> x < ub}. order r p)
[PROOF STEP]
by (rule sum.cong,insert lb ub \<open>p\<in>set ps\<close>,auto)
[PROOF STATE]
proof (state)
this:
proots_count p UNIV = proots_count p {x. lb < x \<and> x < ub}

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proots_count p UNIV = proots_count p {x. lb < x \<and> x < ub}

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
have "changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)
[PROOF STEP]
have "map (sgn \<circ> (\<lambda>p. poly p lb)) ps = map sgn_neg_inf ps"
      and "map (sgn \<circ> (\<lambda>p. poly p ub)) ps = map sgn_pos_inf ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (sgn \<circ> (\<lambda>p. poly p lb)) ps = map sgn_neg_inf ps &&& map (sgn \<circ> (\<lambda>p. poly p ub)) ps = map sgn_pos_inf ps
[PROOF STEP]
using lb_sgn[THEN spec,of lb,simplified] ub_sgn[THEN spec,of ub,simplified]
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set ps. sgn (poly p lb) = sgn_neg_inf p
\<forall>p\<in>set ps. sgn (poly p ub) = sgn_pos_inf p

goal (1 subgoal):
 1. map (sgn \<circ> (\<lambda>p. poly p lb)) ps = map sgn_neg_inf ps &&& map (sgn \<circ> (\<lambda>p. poly p ub)) ps = map sgn_pos_inf ps
[PROOF STEP]
by (metis (mono_tags, lifting) comp_def list.map_cong0)+
[PROOF STATE]
proof (state)
this:
map (sgn \<circ> (\<lambda>p. poly p lb)) ps = map sgn_neg_inf ps
map (sgn \<circ> (\<lambda>p. poly p ub)) ps = map sgn_pos_inf ps

goal (1 subgoal):
 1. changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)
[PROOF STEP]
hence "changes_poly_at ps lb=changes_poly_neg_inf ps
          \<and> changes_poly_at ps ub=changes_poly_pos_inf ps"
[PROOF STATE]
proof (prove)
using this:
map (sgn \<circ> (\<lambda>p. poly p lb)) ps = map sgn_neg_inf ps
map (sgn \<circ> (\<lambda>p. poly p ub)) ps = map sgn_pos_inf ps

goal (1 subgoal):
 1. changes_poly_at ps lb = changes_poly_neg_inf ps \<and> changes_poly_at ps ub = changes_poly_pos_inf ps
[PROOF STEP]
unfolding changes_poly_neg_inf_def changes_poly_at_def changes_poly_pos_inf_def
[PROOF STATE]
proof (prove)
using this:
map (sgn \<circ> (\<lambda>p. poly p lb)) ps = map sgn_neg_inf ps
map (sgn \<circ> (\<lambda>p. poly p ub)) ps = map sgn_pos_inf ps

goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p lb) ps) = changes (map sgn_neg_inf ps) \<and> changes (map (\<lambda>p. poly p ub) ps) = changes (map sgn_pos_inf ps)
[PROOF STEP]
by (subst (1 3)  changes_map_sgn_eq,metis map_map)
[PROOF STATE]
proof (state)
this:
changes_poly_at ps lb = changes_poly_neg_inf ps \<and> changes_poly_at ps ub = changes_poly_pos_inf ps

goal (1 subgoal):
 1. changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
changes_poly_at ps lb = changes_poly_neg_inf ps \<and> changes_poly_at ps ub = changes_poly_pos_inf ps

goal (1 subgoal):
 1. changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)
[PROOF STEP]
unfolding changes_R_smods_ext_def changes_itv_smods_ext_def ps_def
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (smods_ext p (pderiv p)) lb = changes_poly_neg_inf (smods_ext p (pderiv p)) \<and> changes_poly_at (smods_ext p (pderiv p)) ub = changes_poly_pos_inf (smods_ext p (pderiv p))

goal (1 subgoal):
 1. (let ps = smods_ext p (pderiv p) in changes_poly_neg_inf ps - changes_poly_pos_inf ps) = (let ps = smods_ext p (pderiv p) in changes_poly_at ps lb - changes_poly_at ps ub)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
have "poly p lb\<noteq>0" and "poly p ub\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p lb \<noteq> 0 &&& poly p ub \<noteq> 0
[PROOF STEP]
using lb ub \<open>p\<in>set ps\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> lb < x
\<forall>p\<in>set ps. \<forall>x. poly p x = 0 \<longrightarrow> x < ub
p \<in> set ps

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

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly p lb \<noteq> 0
poly p ub \<noteq> 0

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
have "lb<ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lb < ub
[PROOF STEP]
using \<open>lb<0\<close> \<open>0<ub\<close>
[PROOF STATE]
proof (prove)
using this:
lb < 0
0 < ub

goal (1 subgoal):
 1. lb < ub
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lb < ub

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
proots_count p UNIV = proots_count p {x. lb < x \<and> x < ub}
changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)
poly p lb \<noteq> 0
poly p ub \<noteq> 0
lb < ub
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_count p UNIV = proots_count p {x. lb < x \<and> x < ub}
changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)
poly p lb \<noteq> 0
poly p ub \<noteq> 0
lb < ub

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
using sturm_ext_interval
[PROOF STATE]
proof (prove)
using this:
proots_count p UNIV = proots_count p {x. lb < x \<and> x < ub}
changes_R_smods_ext p (pderiv p) = changes_itv_smods_ext lb ub p (pderiv p)
poly p lb \<noteq> 0
poly p ub \<noteq> 0
lb < ub
\<lbrakk>?a < ?b; poly ?p ?a \<noteq> 0; poly ?p ?b \<noteq> 0\<rbrakk> \<Longrightarrow> int (proots_count ?p {x. ?a < x \<and> x < ?b}) = changes_itv_smods_ext ?a ?b ?p (pderiv ?p)

goal (1 subgoal):
 1. int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (proots_count p UNIV) = changes_R_smods_ext p (pderiv p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldl_Gauss_condition_2:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  assumes k: "k < ncols A"
  and all_zero: "\<forall>m. is_zero_row_upt_k m k A"
  and Amk_not_zero: "A $ m $ from_nat k \<noteq> 0"
  shows "\<exists>m. \<not> is_zero_row_upt_k m (Suc k) (Gauss_Jordan_in_ij A 0 (from_nat k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m. \<not> is_zero_row_upt_k m (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>m. \<not> is_zero_row_upt_k m (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))
[PROOF STEP]
have to_nat_from_nat_k_suc: "to_nat (from_nat k::'columns) < (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat k) < Suc k
[PROOF STEP]
using to_nat_from_nat_id[OF k[unfolded ncols_def]]
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat (mod_type_class.from_nat k) = k

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

goal (1 subgoal):
 1. \<exists>m. \<not> is_zero_row_upt_k m (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))
[PROOF STEP]
have A0k_eq_1: "(Gauss_Jordan_in_ij A 0 (from_nat k)) $ 0 $ (from_nat k) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)
[PROOF STEP]
by (rule Gauss_Jordan_in_ij_1, auto intro!: Amk_not_zero least_mod_type)
[PROOF STATE]
proof (state)
this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)

goal (1 subgoal):
 1. \<exists>m. \<not> is_zero_row_upt_k m (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))
[PROOF STEP]
have "\<not> is_zero_row_upt_k 0 (Suc k) (Gauss_Jordan_in_ij A 0 (from_nat k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_zero_row_upt_k (0::'rows) (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))
[PROOF STEP]
unfolding is_zero_row_upt_k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>j. mod_type_class.to_nat j < Suc k \<longrightarrow> Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ j = (0::'a))
[PROOF STEP]
using A0k_eq_1 to_nat_from_nat_k_suc
[PROOF STATE]
proof (prove)
using this:
Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ mod_type_class.from_nat k = (1::'a)
mod_type_class.to_nat (mod_type_class.from_nat k) < Suc k

goal (1 subgoal):
 1. \<not> (\<forall>j. mod_type_class.to_nat j < Suc k \<longrightarrow> Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k) $ (0::'rows) $ j = (0::'a))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<not> is_zero_row_upt_k (0::'rows) (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))

goal (1 subgoal):
 1. \<exists>m. \<not> is_zero_row_upt_k m (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row_upt_k (0::'rows) (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))

goal (1 subgoal):
 1. \<exists>m. \<not> is_zero_row_upt_k m (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>m. \<not> is_zero_row_upt_k m (Suc k) (Gauss_Jordan_in_ij A (0::'rows) (mod_type_class.from_nat k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reflect_poly_smult: "reflect_poly (smult c p) = smult c (reflect_poly p)"
  for p :: "'a::{comm_semiring_0,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflect_poly (smult c p) = smult c (reflect_poly p)
[PROOF STEP]
using reflect_poly_mult[of "[:c:]" p]
[PROOF STATE]
proof (prove)
using this:
reflect_poly ([:c:] * p) = reflect_poly [:c:] * reflect_poly p

goal (1 subgoal):
 1. reflect_poly (smult c p) = smult c (reflect_poly p)
[PROOF STEP]
by simp


[STATEMENT]
lemma "\<exists>x::'a::linordered_field. \<bar>x\<bar> < 100 \<and> (\<forall>y > x. (\<exists>z < 2 * y - x. 5 * x - 3 * y \<le> 7 * z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. \<bar>x\<bar> < (100::'a) \<and> (\<forall>y>x. \<exists>z<(2::'a) * y - x. (5::'a) * x - (3::'a) * y \<le> (7::'a) * z)
[PROOF STEP]
by ferrack


[STATEMENT]
lemma basis_wf_many: "basis_wf (b # b' # bs) \<longleftrightarrow>
  filterlim b at_top at_top \<and> (\<lambda>x. ln (b' x)) \<in> o(\<lambda>x. ln (b x)) \<and> basis_wf (b' # bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_wf (b # b' # bs) = (filterlim b at_top at_top \<and> (\<lambda>x. ln (b' x)) \<in> o(\<lambda>x. ln (b x)) \<and> basis_wf (b' # bs))
[PROOF STEP]
unfolding basis_wf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>f\<in>set (b # b' # bs). filterlim f at_top at_top) \<and> sorted_wrt (\<lambda>f g. (\<lambda>x. ln (g x)) \<in> o(\<lambda>x. ln (f x))) (b # b' # bs)) = (filterlim b at_top at_top \<and> (\<lambda>x. ln (b' x)) \<in> o(\<lambda>x. ln (b x)) \<and> (\<forall>f\<in>set (b' # bs). filterlim f at_top at_top) \<and> sorted_wrt (\<lambda>f g. (\<lambda>x. ln (g x)) \<in> o(\<lambda>x. ln (f x))) (b' # bs))
[PROOF STEP]
by (subst sorted_wrt2[OF transp_ln_smallo_ln]) auto


[STATEMENT]
lemma xor_commute:
  fixes x y :: "'a :: {semilattice_sup,semilattice_inf,uminus}"
  shows "x \<oplus> y = y \<oplus> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<oplus> y = y \<oplus> x
[PROOF STEP]
by(simp add: xor_def sup.commute inf.commute)


[STATEMENT]
lemma (in order) mono_on_subset:
  fixes f :: "'a \<Rightarrow> 'b::order"
  shows "mono_on f X \<Longrightarrow> Y \<subseteq> X \<Longrightarrow> mono_on f Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order_class.mono_on f X; Y \<subseteq> X\<rbrakk> \<Longrightarrow> order_class.mono_on f Y
[PROOF STEP]
unfolding mono_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>X. \<forall>y\<in>X. x \<le> y \<longrightarrow> f x \<le> f y; Y \<subseteq> X\<rbrakk> \<Longrightarrow> \<forall>x\<in>Y. \<forall>y\<in>Y. x \<le> y \<longrightarrow> f x \<le> f y
[PROOF STEP]
by auto


[STATEMENT]
lemma nonzero_inverse_scaleR_distrib:
  "a \<noteq> 0 \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> inverse (scaleR a x) = scaleR (inverse a) (inverse x)"
  for x :: "'a::real_div_algebra"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> 0; x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> inverse (a *\<^sub>R x) = inverse x /\<^sub>R a
[PROOF STEP]
by (rule inverse_unique) simp


[STATEMENT]
lemma vifintersection_vsubset_iff:
  assumes "I \<noteq> 0"
  shows "A \<subseteq>\<^sub>\<circ> (\<Inter>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i) \<longleftrightarrow> (\<forall>i\<in>\<^sub>\<circ>I. A \<subseteq>\<^sub>\<circ> f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<subseteq>\<^sub>\<circ> \<Inter>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I)) = (\<forall>i\<in>elts I. A \<subseteq>\<^sub>\<circ> f i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
I \<noteq> 0

goal (1 subgoal):
 1. (A \<subseteq>\<^sub>\<circ> \<Inter>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I)) = (\<forall>i\<in>elts I. A \<subseteq>\<^sub>\<circ> f i)
[PROOF STEP]
by blast


[STATEMENT]
lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded S = (\<exists>a. \<forall>x\<in>S. norm x \<le> a)
[PROOF STEP]
unfolding bounded_any_center [where a=0]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>e. \<forall>y\<in>S. dist (0::'a) y \<le> e) = (\<exists>a. \<forall>x\<in>S. norm x \<le> a)
[PROOF STEP]
by (simp add: dist_norm)


[STATEMENT]
lemma less_vcard_VPow: "vcard A < vcard (VPow A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard A < vcard (VPow A)
[PROOF STEP]
proof (rule lesspoll_imp_Card_less)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. elts A \<prec> elts (VPow A)
[PROOF STEP]
show "elts A \<prec> elts (VPow A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts A \<prec> elts (VPow A)
[PROOF STEP]
by (simp add: elts_VPow down inj_on_def lesspoll_Pow_self)
[PROOF STATE]
proof (state)
this:
elts A \<prec> elts (VPow A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_triangle_le: "norm x + norm y \<le> e \<Longrightarrow> norm (x + y) \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x + norm y \<le> e \<Longrightarrow> norm (x + y) \<le> e
[PROOF STEP]
by (rule norm_triangle_ineq [THEN order_trans])


[STATEMENT]
lemma wf_graph_add_subset_edges: "\<lbrakk> wf_graph \<lparr> nodes = V, edges = E \<rparr>; E' \<subseteq> E \<rbrakk> \<Longrightarrow>
     wf_graph \<lparr> nodes = V, edges= E \<union> E'\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_graph \<lparr>nodes = V, edges = E\<rparr>; E' \<subseteq> E\<rbrakk> \<Longrightarrow> wf_graph \<lparr>nodes = V, edges = E \<union> E'\<rparr>
[PROOF STEP]
by(auto simp add: wf_graph_def) (metis rev_finite_subset)


[STATEMENT]
lemma (in vectorspace) fin_dim_subspace_sum:
assumes "subspace K W1 V"
assumes "subspace K W2 V"
assumes "vectorspace.fin_dim K (vs W1)" "vectorspace.fin_dim K (vs W2)"
shows "vectorspace.fin_dim K (vs (subspace_sum W1 W2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
obtain b1 where "finite b1" "b1 \<subseteq> W1" "LinearCombinations.module.gen_set K (vs W1) b1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b1. \<lbrakk>finite b1; b1 \<subseteq> W1; LinearCombinations.module.span K (vs W1) b1 = carrier (vs W1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms vectorspace.fin_dim_def subspace_is_vs
[PROOF STATE]
proof (prove)
using this:
subspace K W1 V
subspace K W2 V
vectorspace.fin_dim K (vs W1)
vectorspace.fin_dim K (vs W2)
vectorspace ?K ?V \<Longrightarrow> vectorspace.fin_dim ?K ?V = (\<exists>A. finite A \<and> A \<subseteq> carrier ?V \<and> LinearCombinations.module.span ?K ?V A = carrier ?V)
subspace K ?W V \<Longrightarrow> vectorspace K (vs ?W)

goal (1 subgoal):
 1. (\<And>b1. \<lbrakk>finite b1; b1 \<subseteq> W1; LinearCombinations.module.span K (vs W1) b1 = carrier (vs W1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite b1
b1 \<subseteq> W1
LinearCombinations.module.span K (vs W1) b1 = carrier (vs W1)

goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
obtain b2 where "finite b2" "b2 \<subseteq> W2" "LinearCombinations.module.gen_set K (vs W2) b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b2. \<lbrakk>finite b2; b2 \<subseteq> W2; LinearCombinations.module.span K (vs W2) b2 = carrier (vs W2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms vectorspace.fin_dim_def subspace_is_vs
[PROOF STATE]
proof (prove)
using this:
subspace K W1 V
subspace K W2 V
vectorspace.fin_dim K (vs W1)
vectorspace.fin_dim K (vs W2)
vectorspace ?K ?V \<Longrightarrow> vectorspace.fin_dim ?K ?V = (\<exists>A. finite A \<and> A \<subseteq> carrier ?V \<and> LinearCombinations.module.span ?K ?V A = carrier ?V)
subspace K ?W V \<Longrightarrow> vectorspace K (vs ?W)

goal (1 subgoal):
 1. (\<And>b2. \<lbrakk>finite b2; b2 \<subseteq> W2; LinearCombinations.module.span K (vs W2) b2 = carrier (vs W2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite b2
b2 \<subseteq> W2
LinearCombinations.module.span K (vs W2) b2 = carrier (vs W2)

goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
have 1:"finite (b1 \<union> b2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (b1 \<union> b2)
[PROOF STEP]
by (simp add: \<open>finite b1\<close> \<open>finite b2\<close>)
[PROOF STATE]
proof (state)
this:
finite (b1 \<union> b2)

goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
have 2:"b1 \<union> b2 \<subseteq> subspace_sum W1 W2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b1 \<union> b2 \<subseteq> subspace_sum W1 W2
[PROOF STEP]
by (metis (no_types, lifting) \<open>b1 \<subseteq> W1\<close> \<open>b2 \<subseteq> W2\<close> assms(1) assms(2)
    le_sup_iff subset_Un_eq vectorspace.in_sum_vs vectorspace.vsum_comm vectorspace_axioms)
[PROOF STATE]
proof (state)
this:
b1 \<union> b2 \<subseteq> subspace_sum W1 W2

goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
have 3:"LinearCombinations.module.gen_set K (vs (subspace_sum W1 W2)) (b1 \<union> b2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = carrier (vs (subspace_sum W1 W2))
[PROOF STEP]
proof (rule subset_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) \<subseteq> carrier (vs (subspace_sum W1 W2))
 2. carrier (vs (subspace_sum W1 W2)) \<subseteq> LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2)
[PROOF STEP]
have 0:"LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = span (b1 \<union> b2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = local.module.span (b1 \<union> b2)
[PROOF STEP]
using span_li_not_depend(1)[OF \<open>b1 \<union> b2 \<subseteq> subspace_sum W1 W2\<close>] sum_is_subspace[OF assms(1) assms(2)]
[PROOF STATE]
proof (prove)
using this:
LinearCombinations.submodule K (subspace_sum W1 W2) V \<Longrightarrow> LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = local.module.span (b1 \<union> b2)
subspace K (subspace_sum W1 W2) V

goal (1 subgoal):
 1. LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = local.module.span (b1 \<union> b2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = local.module.span (b1 \<union> b2)

goal (2 subgoals):
 1. LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) \<subseteq> carrier (vs (subspace_sum W1 W2))
 2. carrier (vs (subspace_sum W1 W2)) \<subseteq> LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = local.module.span (b1 \<union> b2)
[PROOF STEP]
show "LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) \<subseteq> carrier (vs (subspace_sum W1 W2))"
[PROOF STATE]
proof (prove)
using this:
LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = local.module.span (b1 \<union> b2)

goal (1 subgoal):
 1. LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) \<subseteq> carrier (vs (subspace_sum W1 W2))
[PROOF STEP]
using \<open>b1 \<union> b2 \<subseteq> subspace_sum W1 W2\<close> span_is_subset sum_is_subspace[OF assms(1) assms(2)]
[PROOF STATE]
proof (prove)
using this:
LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = local.module.span (b1 \<union> b2)
b1 \<union> b2 \<subseteq> subspace_sum W1 W2
\<lbrakk>?S \<subseteq> ?N; LinearCombinations.submodule K ?N V\<rbrakk> \<Longrightarrow> local.module.span ?S \<subseteq> ?N
subspace K (subspace_sum W1 W2) V

goal (1 subgoal):
 1. LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) \<subseteq> carrier (vs (subspace_sum W1 W2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) \<subseteq> carrier (vs (subspace_sum W1 W2))

goal (1 subgoal):
 1. carrier (vs (subspace_sum W1 W2)) \<subseteq> LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2)
[PROOF STEP]
show "carrier (vs (subspace_sum W1 W2)) \<subseteq> LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (vs (subspace_sum W1 W2)) \<subseteq> LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2)
[PROOF STEP]
unfolding 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (vs (subspace_sum W1 W2)) \<subseteq> local.module.span (b1 \<union> b2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (vs (subspace_sum W1 W2)) \<Longrightarrow> x \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (vs (subspace_sum W1 W2)) \<Longrightarrow> x \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
assume assumption:"x \<in> carrier (vs (subspace_sum W1 W2))"
[PROOF STATE]
proof (state)
this:
x \<in> carrier (vs (subspace_sum W1 W2))

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (vs (subspace_sum W1 W2)) \<Longrightarrow> x \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier (vs (subspace_sum W1 W2))
[PROOF STEP]
have "x\<in>subspace_sum W1 W2"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (vs (subspace_sum W1 W2))

goal (1 subgoal):
 1. x \<in> subspace_sum W1 W2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> subspace_sum W1 W2

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (vs (subspace_sum W1 W2)) \<Longrightarrow> x \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> subspace_sum W1 W2
[PROOF STEP]
obtain x1 x2 where "x = x1 \<oplus>\<^bsub>V\<^esub> x2" "x1\<in>W1" "x2\<in>W2"
[PROOF STATE]
proof (prove)
using this:
x \<in> subspace_sum W1 W2

goal (1 subgoal):
 1. (\<And>x1 x2. \<lbrakk>x = x1 \<oplus>\<^bsub>V\<^esub> x2; x1 \<in> W1; x2 \<in> W2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using imageE[OF \<open>x \<in> subspace_sum W1 W2\<close>[unfolded submodule_sum_def]]
[PROOF STATE]
proof (prove)
using this:
x \<in> subspace_sum W1 W2
(\<And>xa. \<lbrakk>x = (case xa of (x, xa) \<Rightarrow> x \<oplus>\<^bsub>V\<^esub> xa); xa \<in> {(x, y). x \<in> W1 \<and> y \<in> W2}\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>x1 x2. \<lbrakk>x = x1 \<oplus>\<^bsub>V\<^esub> x2; x1 \<in> W1; x2 \<in> W2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (no_types, lifting) BNF_Def.Collect_case_prodD split_def)
[PROOF STATE]
proof (state)
this:
x = x1 \<oplus>\<^bsub>V\<^esub> x2
x1 \<in> W1
x2 \<in> W2

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (vs (subspace_sum W1 W2)) \<Longrightarrow> x \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
have "x1\<in>span b1"  "x2\<in>span b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x1 \<in> local.module.span b1 &&& x2 \<in> local.module.span b2
[PROOF STEP]
using \<open>LinearCombinations.module.span K (vs W1) b1 = carrier (vs W1)\<close> \<open>b1 \<subseteq> W1\<close> \<open>x1 \<in> W1\<close>
              \<open>LinearCombinations.module.span K (vs W2) b2 = carrier (vs W2)\<close> \<open>b2 \<subseteq> W2\<close> \<open>x2 \<in> W2\<close>
        assms(1) assms(2) span_li_not_depend(1)
[PROOF STATE]
proof (prove)
using this:
LinearCombinations.module.span K (vs W1) b1 = carrier (vs W1)
b1 \<subseteq> W1
x1 \<in> W1
LinearCombinations.module.span K (vs W2) b2 = carrier (vs W2)
b2 \<subseteq> W2
x2 \<in> W2
subspace K W1 V
subspace K W2 V
\<lbrakk>?S \<subseteq> ?N; LinearCombinations.submodule K ?N V\<rbrakk> \<Longrightarrow> LinearCombinations.module.span K (vs ?N) ?S = local.module.span ?S

goal (1 subgoal):
 1. x1 \<in> local.module.span b1 &&& x2 \<in> local.module.span b2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x1 \<in> local.module.span b1
x2 \<in> local.module.span b2

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (vs (subspace_sum W1 W2)) \<Longrightarrow> x \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x1 \<in> local.module.span b1
x2 \<in> local.module.span b2
[PROOF STEP]
have "x1\<in>span (b1 \<union> b2)" "x2\<in>span (b1 \<union> b2)"
[PROOF STATE]
proof (prove)
using this:
x1 \<in> local.module.span b1
x2 \<in> local.module.span b2

goal (1 subgoal):
 1. x1 \<in> local.module.span (b1 \<union> b2) &&& x2 \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
by (meson le_sup_iff subsetD span_is_monotone subsetI)+
[PROOF STATE]
proof (state)
this:
x1 \<in> local.module.span (b1 \<union> b2)
x2 \<in> local.module.span (b1 \<union> b2)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (vs (subspace_sum W1 W2)) \<Longrightarrow> x \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x1 \<in> local.module.span (b1 \<union> b2)
x2 \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
show "x \<in> span (b1 \<union> b2)"
[PROOF STATE]
proof (prove)
using this:
x1 \<in> local.module.span (b1 \<union> b2)
x2 \<in> local.module.span (b1 \<union> b2)

goal (1 subgoal):
 1. x \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
unfolding \<open>x = x1 \<oplus>\<^bsub>V\<^esub> x2\<close>
[PROOF STATE]
proof (prove)
using this:
x1 \<in> local.module.span (b1 \<union> b2)
x2 \<in> local.module.span (b1 \<union> b2)

goal (1 subgoal):
 1. x1 \<oplus>\<^bsub>V\<^esub> x2 \<in> local.module.span (b1 \<union> b2)
[PROOF STEP]
by (meson \<open>b1 \<union> b2 \<subseteq> subspace_sum W1 W2\<close> assms(1) assms(2) is_module submodule.subset
        subset_trans sum_is_submodule vectorspace.span_add1 vectorspace_axioms)
[PROOF STATE]
proof (state)
this:
x \<in> local.module.span (b1 \<union> b2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
carrier (vs (subspace_sum W1 W2)) \<subseteq> LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = carrier (vs (subspace_sum W1 W2))

goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
using 1 2 3 vectorspace.fin_dim_def
[PROOF STATE]
proof (prove)
using this:
finite (b1 \<union> b2)
b1 \<union> b2 \<subseteq> subspace_sum W1 W2
LinearCombinations.module.span K (vs (subspace_sum W1 W2)) (b1 \<union> b2) = carrier (vs (subspace_sum W1 W2))
vectorspace ?K ?V \<Longrightarrow> vectorspace.fin_dim ?K ?V = (\<exists>A. finite A \<and> A \<subseteq> carrier ?V \<and> LinearCombinations.module.span ?K ?V A = carrier ?V)

goal (1 subgoal):
 1. vectorspace.fin_dim K (vs (subspace_sum W1 W2))
[PROOF STEP]
by (metis assms(1) assms(2) local.carrier_vs_is_self subspace_def sum_is_subspace vectorspace.subspace_is_vs)
[PROOF STATE]
proof (state)
this:
vectorspace.fin_dim K (vs (subspace_sum W1 W2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_nat_Sup_ennreal:
  assumes "A \<noteq> {}" "bdd_above A"
  shows "of_nat (Sup A) = (SUP a\<in>A. of_nat a :: ennreal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (Sup A) = Sup (of_nat ` A)
[PROOF STEP]
proof (intro antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. of_nat (Sup A) \<le> Sup (of_nat ` A)
 2. Sup (of_nat ` A) \<le> of_nat (Sup A)
[PROOF STEP]
show "(SUP a\<in>A. of_nat a::ennreal) \<le> of_nat (Sup A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (of_nat ` A) \<le> of_nat (Sup A)
[PROOF STEP]
by (intro SUP_least of_nat_mono) (auto intro: cSup_upper assms)
[PROOF STATE]
proof (state)
this:
Sup (of_nat ` A) \<le> of_nat (Sup A)

goal (1 subgoal):
 1. of_nat (Sup A) \<le> Sup (of_nat ` A)
[PROOF STEP]
have "Sup A \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup A \<in> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
bdd_above A

goal (1 subgoal):
 1. Sup A \<in> A
[PROOF STEP]
by (auto simp: Sup_nat_def bdd_above_nat)
[PROOF STATE]
proof (state)
this:
Sup A \<in> A

goal (1 subgoal):
 1. of_nat (Sup A) \<le> Sup (of_nat ` A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup A \<in> A
[PROOF STEP]
show "of_nat (Sup A) \<le> (SUP a\<in>A. of_nat a::ennreal)"
[PROOF STATE]
proof (prove)
using this:
Sup A \<in> A

goal (1 subgoal):
 1. of_nat (Sup A) \<le> Sup (of_nat ` A)
[PROOF STEP]
by (intro SUP_upper)
[PROOF STATE]
proof (state)
this:
of_nat (Sup A) \<le> Sup (of_nat ` A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma EM_remainder_converges_of_real:
  assumes "EM_remainder_converges n f a" "continuous_on {of_int a..} f"
  shows   "EM_remainder_converges n (\<lambda>x. of_real (f x)) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EM_remainder_converges n (\<lambda>x. of_real (f x)) a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. EM_remainder_converges n (\<lambda>x. of_real (f x)) a
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
EM_remainder_converges n f a
continuous_on {real_of_int a..} f
[PROOF STEP]
obtain L
    where L: "((\<lambda>b. EM_remainder' n f (real_of_int a) (real_of_int b)) \<longlongrightarrow> L) at_top"
[PROOF STATE]
proof (prove)
using this:
EM_remainder_converges n f a
continuous_on {real_of_int a..} f

goal (1 subgoal):
 1. (\<And>L. ((\<lambda>b. EM_remainder' n f (real_of_int a) (real_of_int b)) \<longlongrightarrow> L) at_top \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: EM_remainder_converges_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>b. EM_remainder' n f (real_of_int a) (real_of_int b)) \<longlongrightarrow> L) at_top

goal (1 subgoal):
 1. EM_remainder_converges n (\<lambda>x. of_real (f x)) a
[PROOF STEP]
have "((\<lambda>b. EM_remainder' n (\<lambda>x. of_real (f x)) (of_int a) (of_int b)) \<longlongrightarrow> of_real L) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>b. EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int b)) \<longlongrightarrow> of_real L) at_top
[PROOF STEP]
proof (rule Lim_transform_eventually)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (?f \<longlongrightarrow> of_real L) at_top
 2. \<forall>\<^sub>F x in at_top. ?f x = EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int x)
[PROOF STEP]
show "eventually (\<lambda>b. of_real (EM_remainder' n f (of_int a) (of_int b)) =
            EM_remainder' n (\<lambda>x. of_real (f x)) (of_int a) (of_int b)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F b in at_top. of_real (EM_remainder' n f (real_of_int a) (real_of_int b)) = EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int b)
[PROOF STEP]
using eventually_ge_at_top[of a]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) a) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F b in at_top. of_real (EM_remainder' n f (real_of_int a) (real_of_int b)) = EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int b)
[PROOF STEP]
by eventually_elim
         (intro EM_remainder'_bounded_linear [OF bounded_linear_of_real, symmetric]
                continuous_on_subset[OF assms(2)], auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F b in at_top. of_real (EM_remainder' n f (real_of_int a) (real_of_int b)) = EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. ((\<lambda>b. of_real (EM_remainder' n f (real_of_int a) (real_of_int b))) \<longlongrightarrow> of_real L) at_top
[PROOF STEP]
qed (intro tendsto_intros L)
[PROOF STATE]
proof (state)
this:
((\<lambda>b. EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int b)) \<longlongrightarrow> of_real L) at_top

goal (1 subgoal):
 1. EM_remainder_converges n (\<lambda>x. of_real (f x)) a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>b. EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int b)) \<longlongrightarrow> of_real L) at_top

goal (1 subgoal):
 1. EM_remainder_converges n (\<lambda>x. of_real (f x)) a
[PROOF STEP]
unfolding EM_remainder_converges_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>b. EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int b)) \<longlongrightarrow> of_real L) at_top

goal (1 subgoal):
 1. \<exists>L. ((\<lambda>x. EM_remainder' n (\<lambda>x. of_real (f x)) (real_of_int a) (real_of_int x)) \<longlongrightarrow> L) at_top
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
EM_remainder_converges n (\<lambda>x. of_real (f x)) a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rGamma_reflection_complex:
  "rGamma z * rGamma (1 - z :: complex) = sin (of_real pi * z) / of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma z * rGamma (1 - z) = sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
using Gamma_reflection_complex[of z]
[PROOF STATE]
proof (prove)
using this:
Gamma z * Gamma (1 - z) = complex_of_real pi / sin (complex_of_real pi * z)

goal (1 subgoal):
 1. rGamma z * rGamma (1 - z) = sin (complex_of_real pi * z) / complex_of_real pi
[PROOF STEP]
by (simp add: Gamma_def field_split_simps split: if_split_asm)


[STATEMENT]
lemma suminf_apply_bfun:
  fixes f :: "nat \<Rightarrow> 'c \<Rightarrow>\<^sub>b real"
  assumes "summable f"
  shows "(\<Sum>i. f i) x = (\<Sum>i. f i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_bfun (\<Sum>i. f i) x = (\<Sum>i. apply_bfun (f i) x)
[PROOF STEP]
by (auto intro!: bounded_linear.suminf assms bounded_linear_intro[where K = 1] abs_le_norm_bfun)


[STATEMENT]
lemma sum_distl_flat:
  assumes "finite (X ::'a::dioid_one_zero set)"
  and "finite Y"
  shows "\<Sum>{x \<cdot> \<Sum>Y |x. x \<in> X} = \<Sum>{x \<cdot> y|x y. x \<in> X \<and> y \<in> Y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {x \<cdot> \<Sum> Y |x. x \<in> X} = \<Sum> {x \<cdot> y |x y. x \<in> X \<and> y \<in> Y}
[PROOF STEP]
by (simp only: assms sum_distl sum_flatten1)


[STATEMENT]
lemma deriv_smult:
  assumes "a \<in> carrier R"
  assumes "b \<in> carrier R"
  assumes "g \<in> carrier P"
  shows "deriv (a \<odot>\<^bsub>P\<^esub> g) b = a \<otimes> (deriv g b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (a \<odot>\<^bsub>P\<^esub> g) b = a \<otimes> deriv g b
[PROOF STEP]
unfolding derivative_def taylor_expansion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cring_Poly.compose R (a \<odot>\<^bsub>P\<^esub> g) (X_poly_plus R b) 1 = a \<otimes> Cring_Poly.compose R g (X_poly_plus R b) 1
[PROOF STEP]
using assms sub_smult X_plus_closed cfs_smult
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
b \<in> carrier R
g \<in> carrier P
\<lbrakk>?f \<in> carrier P; ?q \<in> carrier P; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> Cring_Poly.compose R (?a \<odot>\<^bsub>P\<^esub> ?f) ?q = ?a \<odot>\<^bsub>P\<^esub> Cring_Poly.compose R ?f ?q
?a \<in> carrier R \<Longrightarrow> X_poly_plus R ?a \<in> carrier P
\<lbrakk>?a \<in> carrier R; ?p \<in> carrier P\<rbrakk> \<Longrightarrow> (?a \<odot>\<^bsub>P\<^esub> ?p) ?n = ?a \<otimes> ?p ?n

goal (1 subgoal):
 1. Cring_Poly.compose R (a \<odot>\<^bsub>P\<^esub> g) (X_poly_plus R b) 1 = a \<otimes> Cring_Poly.compose R g (X_poly_plus R b) 1
[PROOF STEP]
by (simp add: sub_closed)


[STATEMENT]
lemma to_bl_word_rev: "to_bl (word_reverse w) = rev (to_bl w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_bl (word_reverse w) = rev (to_bl w)
[PROOF STEP]
by (rule nth_equalityI) (simp_all add: nth_rev_to_bl word_reverse_def word_rep_drop flip: of_bl_eq)


[STATEMENT]
lemma vec_mset_vCons: "vec_mset (vCons x v) = add_mset x (vec_mset v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_mset (vCons x v) = add_mset x (vec_mset v)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_mset (vCons x v) = add_mset x (vec_mset v)
[PROOF STEP]
have "vec_mset (vCons x v) = mset (list_of_vec (vCons x v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_mset (vCons x v) = mset (list_of_vec (vCons x v))
[PROOF STEP]
by (simp add: mset_vec_eq_mset_list)
[PROOF STATE]
proof (state)
this:
vec_mset (vCons x v) = mset (list_of_vec (vCons x v))

goal (1 subgoal):
 1. vec_mset (vCons x v) = add_mset x (vec_mset v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vec_mset (vCons x v) = mset (list_of_vec (vCons x v))
[PROOF STEP]
have "mset (list_of_vec (vCons x v)) = add_mset x (mset (list_of_vec v))"
[PROOF STATE]
proof (prove)
using this:
vec_mset (vCons x v) = mset (list_of_vec (vCons x v))

goal (1 subgoal):
 1. mset (list_of_vec (vCons x v)) = add_mset x (mset (list_of_vec v))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mset (list_of_vec (vCons x v)) = add_mset x (mset (list_of_vec v))

goal (1 subgoal):
 1. vec_mset (vCons x v) = add_mset x (vec_mset v)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
mset (list_of_vec (vCons x v)) = add_mset x (mset (list_of_vec v))

goal (1 subgoal):
 1. vec_mset (vCons x v) = add_mset x (vec_mset v)
[PROOF STEP]
by (metis mset_vec_eq_mset_list)
[PROOF STATE]
proof (state)
this:
vec_mset (vCons x v) = add_mset x (vec_mset v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lemma_termdiff1:
  fixes z :: "'a :: {monoid_mult,comm_ring}"
  shows "(\<Sum>p<m. (((z + h) ^ (m - p)) * (z ^ p)) - (z ^ m)) =
    (\<Sum>p<m. (z ^ p) * (((z + h) ^ (m - p)) - (z ^ (m - p))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p<m. (z + h) ^ (m - p) * z ^ p - z ^ m) = (\<Sum>p<m. z ^ p * ((z + h) ^ (m - p) - z ^ (m - p)))
[PROOF STEP]
by (auto simp: algebra_simps power_add [symmetric])


[STATEMENT]
lemma exp_convex: "convex_on UNIV exp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on UNIV exp
[PROOF STEP]
by (intro f''_ge0_imp_convex derivative_eq_intros | simp)+


[STATEMENT]
lemma finprod_insert [simp]:
  assumes "finite F" "a \<notin> F" "f \<in> F \<rightarrow> carrier G" "f a \<in> carrier G"
  shows "finprod G f (insert a F) = f a \<otimes> finprod G f F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
have "finprod G f (insert a F) = foldD (carrier G) ((\<otimes>) \<circ> f) \<one> (insert a F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f (insert a F) = foldD (carrier G) ((\<otimes>) \<circ> f) \<one> (insert a F)
[PROOF STEP]
by (simp add: finprod_def assms)
[PROOF STATE]
proof (state)
this:
finprod G f (insert a F) = foldD (carrier G) ((\<otimes>) \<circ> f) \<one> (insert a F)

goal (1 subgoal):
 1. finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finprod G f (insert a F) = foldD (carrier G) ((\<otimes>) \<circ> f) \<one> (insert a F)

goal (1 subgoal):
 1. finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
have "... = ((\<otimes>) \<circ> f) a (foldD (carrier G) ((\<otimes>) \<circ> f) \<one> F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldD (carrier G) ((\<otimes>) \<circ> f) \<one> (insert a F) = ((\<otimes>) \<circ> f) a (foldD (carrier G) ((\<otimes>) \<circ> f) \<one> F)
[PROOF STEP]
by (rule LCD.foldD_insert [OF LCD.intro [of "insert a F"]])
      (use assms in \<open>auto simp: m_lcomm Pi_iff\<close>)
[PROOF STATE]
proof (state)
this:
foldD (carrier G) ((\<otimes>) \<circ> f) \<one> (insert a F) = ((\<otimes>) \<circ> f) a (foldD (carrier G) ((\<otimes>) \<circ> f) \<one> F)

goal (1 subgoal):
 1. finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
foldD (carrier G) ((\<otimes>) \<circ> f) \<one> (insert a F) = ((\<otimes>) \<circ> f) a (foldD (carrier G) ((\<otimes>) \<circ> f) \<one> F)

goal (1 subgoal):
 1. finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
have "... = f a \<otimes> finprod G f F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<otimes>) \<circ> f) a (foldD (carrier G) ((\<otimes>) \<circ> f) \<one> F) = f a \<otimes> finprod G f F
[PROOF STEP]
using \<open>finite F\<close>
[PROOF STATE]
proof (prove)
using this:
finite F

goal (1 subgoal):
 1. ((\<otimes>) \<circ> f) a (foldD (carrier G) ((\<otimes>) \<circ> f) \<one> F) = f a \<otimes> finprod G f F
[PROOF STEP]
by (auto simp add: finprod_def)
[PROOF STATE]
proof (state)
this:
((\<otimes>) \<circ> f) a (foldD (carrier G) ((\<otimes>) \<circ> f) \<one> F) = f a \<otimes> finprod G f F

goal (1 subgoal):
 1. finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finprod G f (insert a F) = f a \<otimes> finprod G f F

goal (1 subgoal):
 1. finprod G f (insert a F) = f a \<otimes> finprod G f F
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finprod G f (insert a F) = f a \<otimes> finprod G f F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permute_list_nth:
  assumes "f permutes {..<length xs}" "i < length xs"
  shows "permute_list f xs ! i = xs ! f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list f xs ! i = xs ! f i
[PROOF STEP]
using permutes_in_image[OF assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
(f ?x \<in> {..<length xs}) = (?x \<in> {..<length xs})
i < length xs

goal (1 subgoal):
 1. permute_list f xs ! i = xs ! f i
[PROOF STEP]
by (simp add: permute_list_def)


[STATEMENT]
lemma (in domain) square_eq_iff:
  assumes "x \<in> carrier R" "y \<in> carrier R"
  shows "(x \<otimes> x = y \<otimes> y) = (x = y \<or> x = \<ominus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<otimes> x = y \<otimes> y) = (x = y \<or> x = \<ominus> y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<otimes> x = y \<otimes> y \<Longrightarrow> x = y \<or> x = \<ominus> y
 2. x = y \<or> x = \<ominus> y \<Longrightarrow> x \<otimes> x = y \<otimes> y
[PROOF STEP]
assume "x \<otimes> x = y \<otimes> y"
[PROOF STATE]
proof (state)
this:
x \<otimes> x = y \<otimes> y

goal (2 subgoals):
 1. x \<otimes> x = y \<otimes> y \<Longrightarrow> x = y \<or> x = \<ominus> y
 2. x = y \<or> x = \<ominus> y \<Longrightarrow> x \<otimes> x = y \<otimes> y
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
x \<otimes> x = y \<otimes> y
[PROOF STEP]
have "(x \<ominus> y) \<otimes> (x \<oplus> y) = x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) \<oplus> (y \<otimes> y \<oplus> \<ominus> (y \<otimes> y))"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
x \<otimes> x = y \<otimes> y

goal (1 subgoal):
 1. (x \<ominus> y) \<otimes> (x \<oplus> y) = x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) \<oplus> (y \<otimes> y \<oplus> \<ominus> (y \<otimes> y))
[PROOF STEP]
by (simp add: r_distr l_distr minus_eq r_minus m_comm a_ac)
[PROOF STATE]
proof (state)
this:
(x \<ominus> y) \<otimes> (x \<oplus> y) = x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) \<oplus> (y \<otimes> y \<oplus> \<ominus> (y \<otimes> y))

goal (2 subgoals):
 1. x \<otimes> x = y \<otimes> y \<Longrightarrow> x = y \<or> x = \<ominus> y
 2. x = y \<or> x = \<ominus> y \<Longrightarrow> x \<otimes> x = y \<otimes> y
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
(x \<ominus> y) \<otimes> (x \<oplus> y) = x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) \<oplus> (y \<otimes> y \<oplus> \<ominus> (y \<otimes> y))
[PROOF STEP]
show "x = y \<or> x = \<ominus> y"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
(x \<ominus> y) \<otimes> (x \<oplus> y) = x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) \<oplus> (y \<otimes> y \<oplus> \<ominus> (y \<otimes> y))

goal (1 subgoal):
 1. x = y \<or> x = \<ominus> y
[PROOF STEP]
by (simp add: integral_iff eq_neg_iff_add_eq_0 eq_diff0 r_neg)
[PROOF STATE]
proof (state)
this:
x = y \<or> x = \<ominus> y

goal (1 subgoal):
 1. x = y \<or> x = \<ominus> y \<Longrightarrow> x \<otimes> x = y \<otimes> y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y \<or> x = \<ominus> y \<Longrightarrow> x \<otimes> x = y \<otimes> y
[PROOF STEP]
assume "x = y \<or> x = \<ominus> y"
[PROOF STATE]
proof (state)
this:
x = y \<or> x = \<ominus> y

goal (1 subgoal):
 1. x = y \<or> x = \<ominus> y \<Longrightarrow> x \<otimes> x = y \<otimes> y
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
x = y \<or> x = \<ominus> y
[PROOF STEP]
show "x \<otimes> x = y \<otimes> y"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
x = y \<or> x = \<ominus> y

goal (1 subgoal):
 1. x \<otimes> x = y \<otimes> y
[PROOF STEP]
by (auto simp add: l_minus r_minus)
[PROOF STATE]
proof (state)
this:
x \<otimes> x = y \<otimes> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccpo_fun: "class.ccpo (fun_lub Sup) (fun_ord (\<le>)) (mk_less (fun_ord (\<le>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.ccpo (fun_lub Sup) (fun_ord (\<le>)) (mk_less (fun_ord (\<le>)))
[PROOF STEP]
by standard (auto 4 3 simp add: mk_less_def fun_ord_def fun_lub_apply
    intro: order.trans order.antisym chain_imageI ccpo_Sup_upper ccpo_Sup_least)


[STATEMENT]
lemma pull_negation: "(x = \<not>? y) = (\<not>? x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = \<not>? y) = (\<not>? x = y)
[PROOF STEP]
using maybe_double_negation
[PROOF STATE]
proof (prove)
using this:
\<not>? \<not>? ?x = ?x

goal (1 subgoal):
 1. (x = \<not>? y) = (\<not>? x = y)
[PROOF STEP]
by auto


[STATEMENT]
lemma le_log2_of_power: "2 ^ n \<le> m \<Longrightarrow> n \<le> log 2 m" for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ n \<le> m \<Longrightarrow> real n \<le> log 2 (real m)
[PROOF STEP]
using le_log_of_power[of 2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>2 ^ ?n \<le> ?m; 1 < 2\<rbrakk> \<Longrightarrow> real ?n \<le> log 2 ?m

goal (1 subgoal):
 1. 2 ^ n \<le> m \<Longrightarrow> real n \<le> log 2 (real m)
[PROOF STEP]
by simp


[STATEMENT]
lemma Times_mset_single_single[simp]: "{#a#} \<times># {#b#} = {#(a, b)#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#a#} \<times># {#b#} = {#(a, b)#}
[PROOF STEP]
unfolding Sigma_mset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>#{#a#}. image_mset (Pair a) {#b#}) = {#(a, b)#}
[PROOF STEP]
by simp


[STATEMENT]
lemma basis_orthogonal2:
  fixes xs::"('a::{real_inner}^'b) list"
  shows "length (Gram_Schmidt2 xs) = length (xs)
  \<and> span (set (Gram_Schmidt2 xs)) = span (set xs)
  \<and> pairwise orthogonal (set (Gram_Schmidt2 xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Gram_Schmidt2 xs) = length xs \<and> span (set (Gram_Schmidt2 xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt2 xs))
[PROOF STEP]
by (metis Gram_Schmidt2_def basis_orthogonal' length_rev set_rev)


[STATEMENT]
lemma fv_fo_terms_set_list: "set (fv_fo_terms_list ts) = fv_fo_terms_set ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (fv_fo_terms_list ts) = fv_fo_terms_set ts
[PROOF STEP]
using fv_fo_term_set_list
[PROOF STATE]
proof (prove)
using this:
set (fv_fo_term_list ?t) = fv_fo_term_set ?t

goal (1 subgoal):
 1. set (fv_fo_terms_list ts) = fv_fo_terms_set ts
[PROOF STEP]
unfolding fv_fo_terms_list_def
[PROOF STATE]
proof (prove)
using this:
set (fv_fo_term_list ?t) = fv_fo_term_set ?t

goal (1 subgoal):
 1. set (remdups_adj (sort (fv_fo_terms_list_rec ts))) = fv_fo_terms_set ts
[PROOF STEP]
by (induction ts rule: fv_fo_terms_list_rec.induct)
     (auto simp: fv_fo_terms_set_def set_insort_key)


[STATEMENT]
lemma sub_noteq_inf:
  assumes "z \<noteq> \<infinity>\<^sub>h" and "w \<noteq> \<infinity>\<^sub>h"
  shows "z -\<^sub>h w \<noteq> \<infinity>\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z -\<^sub>h w \<noteq> \<infinity>\<^sub>h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z \<noteq> \<infinity>\<^sub>h
w \<noteq> \<infinity>\<^sub>h

goal (1 subgoal):
 1. z -\<^sub>h w \<noteq> \<infinity>\<^sub>h
[PROOF STEP]
using inf_or_of_complex[of z]
[PROOF STATE]
proof (prove)
using this:
z \<noteq> \<infinity>\<^sub>h
w \<noteq> \<infinity>\<^sub>h
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)

goal (1 subgoal):
 1. z -\<^sub>h w \<noteq> \<infinity>\<^sub>h
[PROOF STEP]
using inf_or_of_complex[of w]
[PROOF STATE]
proof (prove)
using this:
z \<noteq> \<infinity>\<^sub>h
w \<noteq> \<infinity>\<^sub>h
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)
w = \<infinity>\<^sub>h \<or> (\<exists>x. w = of_complex x)

goal (1 subgoal):
 1. z -\<^sub>h w \<noteq> \<infinity>\<^sub>h
[PROOF STEP]
using inf_or_of_complex[of "z -\<^sub>h w"]
[PROOF STATE]
proof (prove)
using this:
z \<noteq> \<infinity>\<^sub>h
w \<noteq> \<infinity>\<^sub>h
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)
w = \<infinity>\<^sub>h \<or> (\<exists>x. w = of_complex x)
z -\<^sub>h w = \<infinity>\<^sub>h \<or> (\<exists>x. z -\<^sub>h w = of_complex x)

goal (1 subgoal):
 1. z -\<^sub>h w \<noteq> \<infinity>\<^sub>h
[PROOF STEP]
using of_complex_sub_of_complex
[PROOF STATE]
proof (prove)
using this:
z \<noteq> \<infinity>\<^sub>h
w \<noteq> \<infinity>\<^sub>h
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)
w = \<infinity>\<^sub>h \<or> (\<exists>x. w = of_complex x)
z -\<^sub>h w = \<infinity>\<^sub>h \<or> (\<exists>x. z -\<^sub>h w = of_complex x)
of_complex ?x -\<^sub>h of_complex ?y = of_complex (?x - ?y)

goal (1 subgoal):
 1. z -\<^sub>h w \<noteq> \<infinity>\<^sub>h
[PROOF STEP]
by auto


[STATEMENT]
lemma ln_series':
  assumes "abs (x::real) < 1"
  shows   "(\<lambda>n. - ((-x)^n) / of_nat n) sums ln (1 + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<bar>x\<bar> < 1
[PROOF STEP]
have "(\<lambda>n. - ((-of_real x)^n) / of_nat n) sums ln (1 + complex_of_real x)"
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < 1

goal (1 subgoal):
 1. (\<lambda>n. - ((- complex_of_real x) ^ n) / of_nat n) sums Ln (1 + complex_of_real x)
[PROOF STEP]
by (intro Ln_series') simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - ((- complex_of_real x) ^ n) / of_nat n) sums Ln (1 + complex_of_real x)

goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - ((- complex_of_real x) ^ n) / of_nat n) sums Ln (1 + complex_of_real x)

goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
have "(\<lambda>n. - ((-of_real x)^n) / of_nat n) = (\<lambda>n. complex_of_real (- ((-x)^n) / of_nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - ((- complex_of_real x) ^ n) / of_nat n) = (\<lambda>n. complex_of_real (- ((- x) ^ n) / real n))
[PROOF STEP]
by (rule ext) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - ((- complex_of_real x) ^ n) / of_nat n) = (\<lambda>n. complex_of_real (- ((- x) ^ n) / real n))

goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - ((- complex_of_real x) ^ n) / of_nat n) = (\<lambda>n. complex_of_real (- ((- x) ^ n) / real n))

goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<bar>x\<bar> < 1
[PROOF STEP]
have "ln (1 + complex_of_real x) = of_real (ln (1 + x))"
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < 1

goal (1 subgoal):
 1. Ln (1 + complex_of_real x) = complex_of_real (ln (1 + x))
[PROOF STEP]
by (subst Ln_of_real [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
Ln (1 + complex_of_real x) = complex_of_real (ln (1 + x))

goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. complex_of_real (- ((- x) ^ n) / real n)) sums complex_of_real (ln (1 + x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. complex_of_real (- ((- x) ^ n) / real n)) sums complex_of_real (ln (1 + x))

goal (1 subgoal):
 1. (\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)
[PROOF STEP]
by (subst (asm) sums_of_real_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - ((- x) ^ n) / real n) sums ln (1 + x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) coset_assoc:
  assumes "x \<in> carrier G" "y \<in> carrier G" "H \<subseteq> carrier G"
  shows "x <# (H #> y) = (x <# H) #> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x <# (H #> y) = x <# H #> y
[PROOF STEP]
using set_mult_assoc[of "{x}" H "{y}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{x} \<subseteq> carrier G; H \<subseteq> carrier G; {y} \<subseteq> carrier G\<rbrakk> \<Longrightarrow> {x} <#> H <#> {y} = {x} <#> (H <#> {y})

goal (1 subgoal):
 1. x <# (H #> y) = x <# H #> y
[PROOF STEP]
by (simp add: l_coset_eq_set_mult r_coset_eq_set_mult assms)


[STATEMENT]
lemma ennreal_right_diff_distrib:
  fixes a b c :: ennreal
  assumes "a \<noteq> top"
  shows "a * (b - c) = a * b - a * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (b - c) = a * b - a * c
[PROOF STEP]
apply (cases a; cases b; cases c)
[PROOF STATE]
proof (prove)
goal (8 subgoals):
 1. \<And>r ra rb. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra; 0 \<le> rb; c = ennreal rb\<rbrakk> \<Longrightarrow> a * (b - c) = a * b - a * c
 2. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra; c = top\<rbrakk> \<Longrightarrow> a * (b - c) = a * b - a * c
 3. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; b = top; 0 \<le> ra; c = ennreal ra\<rbrakk> \<Longrightarrow> a * (b - c) = a * b - a * c
 4. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top; c = top\<rbrakk> \<Longrightarrow> a * (b - c) = a * b - a * c
 5. \<And>r ra. \<lbrakk>a = top; 0 \<le> r; b = ennreal r; 0 \<le> ra; c = ennreal ra\<rbrakk> \<Longrightarrow> a * (b - c) = a * b - a * c
 6. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r; c = top\<rbrakk> \<Longrightarrow> a * (b - c) = a * b - a * c
 7. \<And>r. \<lbrakk>a = top; b = top; 0 \<le> r; c = ennreal r\<rbrakk> \<Longrightarrow> a * (b - c) = a * b - a * c
 8. \<lbrakk>a = top; b = top; c = top\<rbrakk> \<Longrightarrow> a * (b - c) = a * b - a * c
[PROOF STEP]
apply (use assms in \<open>auto simp add: ennreal_mult_top ennreal_minus ennreal_mult' [symmetric]\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r ra rb. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra; 0 \<le> rb; c = ennreal rb\<rbrakk> \<Longrightarrow> ennreal (r * (ra - rb)) = ennreal (r * ra - r * rb)
[PROOF STEP]
apply (simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma partition_on_mset_card: assumes "partition_on_mset A P" shows " size P \<le> size A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size P \<le> size A
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> size P \<le> size A \<Longrightarrow> False
[PROOF STEP]
assume "\<not> size P \<le> size A"
[PROOF STATE]
proof (state)
this:
\<not> size P \<le> size A

goal (1 subgoal):
 1. \<not> size P \<le> size A \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> size P \<le> size A
[PROOF STEP]
have a: "size P > size A"
[PROOF STATE]
proof (prove)
using this:
\<not> size P \<le> size A

goal (1 subgoal):
 1. size A < size P
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size A < size P

goal (1 subgoal):
 1. \<not> size P \<le> size A \<Longrightarrow> False
[PROOF STEP]
have "\<And> x . x \<in># P \<Longrightarrow> size x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in># P \<Longrightarrow> 0 < size x
[PROOF STEP]
using partition_on_msetD2
[PROOF STATE]
proof (prove)
using this:
partition_on_mset ?A ?P \<Longrightarrow> {#} \<notin># ?P

goal (1 subgoal):
 1. \<And>x. x \<in># P \<Longrightarrow> 0 < size x
[PROOF STEP]
using assms nonempty_has_size
[PROOF STATE]
proof (prove)
using this:
partition_on_mset ?A ?P \<Longrightarrow> {#} \<notin># ?P
partition_on_mset A P
(?S \<noteq> {#}) = (0 < size ?S)

goal (1 subgoal):
 1. \<And>x. x \<in># P \<Longrightarrow> 0 < size x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in># P \<Longrightarrow> 0 < size ?x

goal (1 subgoal):
 1. \<not> size P \<le> size A \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in># P \<Longrightarrow> 0 < size ?x
[PROOF STEP]
have " (\<Sum>x \<in># P. size x) \<ge> size P"
[PROOF STATE]
proof (prove)
using this:
?x \<in># P \<Longrightarrow> 0 < size ?x

goal (1 subgoal):
 1. size P \<le> \<Sum>\<^sub># (image_mset size P)
[PROOF STEP]
by (metis leI less_one not_less_zero size_eq_sum_mset sum_mset_mono)
[PROOF STATE]
proof (state)
this:
size P \<le> \<Sum>\<^sub># (image_mset size P)

goal (1 subgoal):
 1. \<not> size P \<le> size A \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
size P \<le> \<Sum>\<^sub># (image_mset size P)

goal (1 subgoal):
 1. False
[PROOF STEP]
using a partition_on_mset_sum_size_eq
[PROOF STATE]
proof (prove)
using this:
size P \<le> \<Sum>\<^sub># (image_mset size P)
size A < size P
partition_on_mset ?A ?P \<Longrightarrow> \<Sum>\<^sub># (image_mset size ?P) = size ?A

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
size P \<le> \<Sum>\<^sub># (image_mset size P)
size A < size P
partition_on_mset ?A ?P \<Longrightarrow> \<Sum>\<^sub># (image_mset size ?P) = size ?A
partition_on_mset A P

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sq_norm_unit_vec[simp]: assumes i: "i < n"
  shows "\<parallel>unit_vec n i\<parallel>\<^sup>2 = (1 :: 'a :: {comm_ring_1,conjugatable_ring})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>unit_vec n i\<parallel>\<^sup>2 = (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<parallel>unit_vec n i\<parallel>\<^sup>2 = (1::'a)
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
i < n
[PROOF STEP]
have id: "[0..<n] = [0..<i] @ [i] @ [Suc i ..< n]"
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. [0..<n] = [0..<i] @ [i] @ [Suc i..<n]
[PROOF STEP]
by (metis append_Cons append_Nil diff_zero length_upt list_trisect)
[PROOF STATE]
proof (state)
this:
[0..<n] = [0..<i] @ [i] @ [Suc i..<n]

goal (1 subgoal):
 1. \<parallel>unit_vec n i\<parallel>\<^sup>2 = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>unit_vec n i\<parallel>\<^sup>2 = (1::'a)
[PROOF STEP]
unfolding sq_norm_vec_def unit_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map sq_norm (list_of_vec (vec n (\<lambda>j. if j = i then 1::'a else (0::'a))))) = (1::'a)
[PROOF STEP]
by (auto simp: o_def id, subst (1 2) sum_list_0, auto)
[PROOF STATE]
proof (state)
this:
\<parallel>unit_vec n i\<parallel>\<^sup>2 = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_neg_one: "0 < x \<Longrightarrow> x powr - 1 = 1 / x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr - 1 = 1 / x
[PROOF STEP]
using powr_int [of x "- 1"]
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> x powr real_of_int (- 1) = (if 0 \<le> - 1 then x ^ nat (- 1) else 1 / x ^ nat (- (- 1)))

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr - 1 = 1 / x
[PROOF STEP]
by simp


[STATEMENT]
lemma scaling_mono:
  fixes u::"'a::linordered_field"
  assumes "u \<le> v" "0 \<le> r" "r \<le> s"
    shows "u + r * (v - u) / s \<le> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
have "r/s \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r / s \<le> (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<le> v
(0::'a) \<le> r
r \<le> s

goal (1 subgoal):
 1. r / s \<le> (1::'a)
[PROOF STEP]
using divide_le_eq_1
[PROOF STATE]
proof (prove)
using this:
u \<le> v
(0::'a) \<le> r
r \<le> s
(?b / ?a \<le> (1::?'a)) = ((0::?'a) < ?a \<and> ?b \<le> ?a \<or> ?a < (0::?'a) \<and> ?a \<le> ?b \<or> ?a = (0::?'a))

goal (1 subgoal):
 1. r / s \<le> (1::'a)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
r / s \<le> (1::'a)

goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r / s \<le> (1::'a)
[PROOF STEP]
have "(r/s) * (v - u) \<le> 1 * (v - u)"
[PROOF STATE]
proof (prove)
using this:
r / s \<le> (1::'a)

goal (1 subgoal):
 1. r / s * (v - u) \<le> (1::'a) * (v - u)
[PROOF STEP]
by (meson diff_ge_0_iff_ge mult_right_mono \<open>u \<le> v\<close>)
[PROOF STATE]
proof (state)
this:
r / s * (v - u) \<le> (1::'a) * (v - u)

goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r / s * (v - u) \<le> (1::'a) * (v - u)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r / s * (v - u) \<le> (1::'a) * (v - u)

goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
u + r * (v - u) / s \<le> v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma winding_number_shiftpath:
  assumes \<gamma>: "path \<gamma>" "z \<notin> path_image \<gamma>"
      and "pathfinish \<gamma> = pathstart \<gamma>" "a \<in> {0..1}"
    shows "winding_number(shiftpath a \<gamma>) z = winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (shiftpath a \<gamma>) z = winding_number \<gamma> z
[PROOF STEP]
proof (rule winding_number_unique_loop)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. path (shiftpath a \<gamma>)
 2. z \<notin> path_image (shiftpath a \<gamma>)
 3. pathfinish (shiftpath a \<gamma>) = pathstart (shiftpath a \<gamma>)
 4. \<And>e. 0 < e \<Longrightarrow> \<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathfinish p = pathstart p \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - p t) < e) \<and> contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
[PROOF STEP]
show "\<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathfinish p = pathstart p \<and>
            (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - p t) < e) \<and>
            contour_integral p (\<lambda>w. 1 / (w - z)) =
            2 * pi * \<i> * winding_number \<gamma> z"
    if "e > 0" for e
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathfinish p = pathstart p \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - p t) < e) \<and> contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathfinish p = pathstart p \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - p t) < e) \<and> contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
[PROOF STEP]
obtain p where "winding_number_prop \<gamma> z e p (winding_number \<gamma> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. winding_number_prop \<gamma> z e p (winding_number \<gamma> z) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>0 < e\<close> assms winding_number
[PROOF STATE]
proof (prove)
using this:
0 < e
path \<gamma>
z \<notin> path_image \<gamma>
pathfinish \<gamma> = pathstart \<gamma>
a \<in> {0..1}
\<lbrakk>path ?\<gamma>; ?z \<notin> path_image ?\<gamma>; 0 < ?e\<rbrakk> \<Longrightarrow> \<exists>p. winding_number_prop ?\<gamma> ?z ?e p (winding_number ?\<gamma> ?z)

goal (1 subgoal):
 1. (\<And>p. winding_number_prop \<gamma> z e p (winding_number \<gamma> z) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
winding_number_prop \<gamma> z e p (winding_number \<gamma> z)

goal (1 subgoal):
 1. \<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathfinish p = pathstart p \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - p t) < e) \<and> contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
winding_number_prop \<gamma> z e p (winding_number \<gamma> z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
winding_number_prop \<gamma> z e p (winding_number \<gamma> z)

goal (1 subgoal):
 1. \<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathfinish p = pathstart p \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - p t) < e) \<and> contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
[PROOF STEP]
apply (rule_tac x="shiftpath a p" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number_prop \<gamma> z e p (winding_number \<gamma> z) \<Longrightarrow> valid_path (shiftpath a p) \<and> z \<notin> path_image (shiftpath a p) \<and> pathfinish (shiftpath a p) = pathstart (shiftpath a p) \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - shiftpath a p t) < e) \<and> contour_integral (shiftpath a p) (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
[PROOF STEP]
using assms that
[PROOF STATE]
proof (prove)
using this:
path \<gamma>
z \<notin> path_image \<gamma>
pathfinish \<gamma> = pathstart \<gamma>
a \<in> {0..1}
0 < e

goal (1 subgoal):
 1. winding_number_prop \<gamma> z e p (winding_number \<gamma> z) \<Longrightarrow> valid_path (shiftpath a p) \<and> z \<notin> path_image (shiftpath a p) \<and> pathfinish (shiftpath a p) = pathstart (shiftpath a p) \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - shiftpath a p t) < e) \<and> contour_integral (shiftpath a p) (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
[PROOF STEP]
apply (auto simp: winding_number_prop_def path_image_shiftpath pathfinish_shiftpath pathstart_shiftpath contour_integral_shiftpath)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t. \<lbrakk>path \<gamma>; z \<notin> path_image \<gamma>; pathfinish \<gamma> = pathstart \<gamma>; 0 < e; valid_path p; 0 \<le> a; a \<le> 1; z \<notin> path_image p; pathstart p = pathstart \<gamma>; pathfinish p = pathstart \<gamma>; \<forall>t\<in>{0..1}. cmod (\<gamma> t - p t) < e; contour_integral p (\<lambda>w. 1 / (w - z)) = 2 * complex_of_real pi * \<i> * winding_number \<gamma> z; 0 \<le> t; t \<le> 1\<rbrakk> \<Longrightarrow> cmod (shiftpath a \<gamma> t - shiftpath a p t) < e
[PROOF STEP]
apply (simp add: shiftpath_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathfinish p = pathstart p \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - p t) < e) \<and> contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < ?e \<Longrightarrow> \<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathfinish p = pathstart p \<and> (\<forall>t\<in>{0..1}. cmod (shiftpath a \<gamma> t - p t) < ?e) \<and> contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z

goal (3 subgoals):
 1. path (shiftpath a \<gamma>)
 2. z \<notin> path_image (shiftpath a \<gamma>)
 3. pathfinish (shiftpath a \<gamma>) = pathstart (shiftpath a \<gamma>)
[PROOF STEP]
qed (use assms in \<open>auto simp: path_shiftpath path_image_shiftpath pathfinish_shiftpath pathstart_shiftpath\<close>)


[STATEMENT]
lemma reciprocal_smult:
  fixes P :: "'a::idom poly"
  assumes h: "degree P \<le> p"
  shows "reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
[PROOF STEP]
assume "n = 0"
[PROOF STATE]
proof (state)
this:
n = (0::'a)

goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n = (0::'a)

goal (1 subgoal):
 1. reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
[PROOF STEP]
by (auto simp add: reciprocal_poly_def)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)

goal (1 subgoal):
 1. n \<noteq> (0::'a) \<Longrightarrow> reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> (0::'a) \<Longrightarrow> reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
[PROOF STEP]
assume "n \<noteq> 0"
[PROOF STATE]
proof (state)
this:
n \<noteq> (0::'a)

goal (1 subgoal):
 1. n \<noteq> (0::'a) \<Longrightarrow> reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<noteq> (0::'a)

goal (1 subgoal):
 1. reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)
[PROOF STEP]
by (auto simp add: reciprocal_poly_def smult_Poly coeffs_smult
        rev_map[symmetric])
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (smult n P) = smult n (reciprocal_poly p P)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rGamma_complex_1: "rGamma (1 :: complex) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma 1 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rGamma 1 = 1
[PROOF STEP]
have A: "eventually (\<lambda>n. rGamma_series 1 n = of_nat (Suc n) / of_nat n) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. rGamma_series (1::'a) n = of_nat (Suc n) / of_nat n
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. rGamma_series (1::'a) n = of_nat (Suc n) / of_nat n
[PROOF STEP]
by (force elim!: eventually_mono simp: rGamma_series_def exp_of_real pochhammer_fact
                    field_split_simps pochhammer_rec' dest!: pochhammer_eq_0_imp_nonpos_Int)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. rGamma_series (1::?'a1) n = of_nat (Suc n) / of_nat n

goal (1 subgoal):
 1. rGamma 1 = 1
[PROOF STEP]
have "rGamma_series 1 \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma_series (1::'a) \<longlonglongrightarrow> (1::'a)
[PROOF STEP]
by (subst tendsto_cong[OF A]) (rule LIMSEQ_Suc_n_over_n)
[PROOF STATE]
proof (state)
this:
rGamma_series (1::?'a2) \<longlonglongrightarrow> (1::?'a2)

goal (1 subgoal):
 1. rGamma 1 = 1
[PROOF STEP]
thus "rGamma 1 = (1 :: complex)"
[PROOF STATE]
proof (prove)
using this:
rGamma_series (1::?'a2) \<longlonglongrightarrow> (1::?'a2)

goal (1 subgoal):
 1. rGamma 1 = 1
[PROOF STEP]
unfolding rGamma_complex_def
[PROOF STATE]
proof (prove)
using this:
rGamma_series (1::?'a2) \<longlonglongrightarrow> (1::?'a2)

goal (1 subgoal):
 1. lim (rGamma_series 1) = 1
[PROOF STEP]
by (rule limI)
[PROOF STATE]
proof (state)
this:
rGamma 1 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_set_tree_bst: "bst t \<Longrightarrow> card (set_tree t) = size t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst t \<Longrightarrow> card (set_tree t) = size t
[PROOF STEP]
proof (induction t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bst \<langle>\<rangle> \<Longrightarrow> card (set_tree \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>bst t1 \<Longrightarrow> card (set_tree t1) = size t1; bst t2 \<Longrightarrow> card (set_tree t2) = size t2; bst \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> card (set_tree \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
case (Node l x r)
[PROOF STATE]
proof (state)
this:
bst l \<Longrightarrow> card (set_tree l) = size l
bst r \<Longrightarrow> card (set_tree r) = size r
bst \<langle>l, x, r\<rangle>

goal (2 subgoals):
 1. bst \<langle>\<rangle> \<Longrightarrow> card (set_tree \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>bst t1 \<Longrightarrow> card (set_tree t1) = size t1; bst t2 \<Longrightarrow> card (set_tree t2) = size t2; bst \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> card (set_tree \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
have "set_tree \<langle>l, x, r\<rangle> = insert x (set_tree l \<union> set_tree r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_tree \<langle>l, x, r\<rangle> = insert x (set_tree l \<union> set_tree r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_tree \<langle>l, x, r\<rangle> = insert x (set_tree l \<union> set_tree r)

goal (2 subgoals):
 1. bst \<langle>\<rangle> \<Longrightarrow> card (set_tree \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>bst t1 \<Longrightarrow> card (set_tree t1) = size t1; bst t2 \<Longrightarrow> card (set_tree t2) = size t2; bst \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> card (set_tree \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_tree \<langle>l, x, r\<rangle> = insert x (set_tree l \<union> set_tree r)

goal (2 subgoals):
 1. bst \<langle>\<rangle> \<Longrightarrow> card (set_tree \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>bst t1 \<Longrightarrow> card (set_tree t1) = size t1; bst t2 \<Longrightarrow> card (set_tree t2) = size t2; bst \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> card (set_tree \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
from Node.prems
[PROOF STATE]
proof (chain)
picking this:
bst \<langle>l, x, r\<rangle>
[PROOF STEP]
have "card \<dots> = Suc (card (set_tree l \<union> set_tree r))"
[PROOF STATE]
proof (prove)
using this:
bst \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. card (insert x (set_tree l \<union> set_tree r)) = Suc (card (set_tree l \<union> set_tree r))
[PROOF STEP]
by (intro card_insert_disjoint) auto
[PROOF STATE]
proof (state)
this:
card (insert x (set_tree l \<union> set_tree r)) = Suc (card (set_tree l \<union> set_tree r))

goal (2 subgoals):
 1. bst \<langle>\<rangle> \<Longrightarrow> card (set_tree \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>bst t1 \<Longrightarrow> card (set_tree t1) = size t1; bst t2 \<Longrightarrow> card (set_tree t2) = size t2; bst \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> card (set_tree \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (insert x (set_tree l \<union> set_tree r)) = Suc (card (set_tree l \<union> set_tree r))

goal (2 subgoals):
 1. bst \<langle>\<rangle> \<Longrightarrow> card (set_tree \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>bst t1 \<Longrightarrow> card (set_tree t1) = size t1; bst t2 \<Longrightarrow> card (set_tree t2) = size t2; bst \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> card (set_tree \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
from Node
[PROOF STATE]
proof (chain)
picking this:
bst l \<Longrightarrow> card (set_tree l) = size l
bst r \<Longrightarrow> card (set_tree r) = size r
bst \<langle>l, x, r\<rangle>
[PROOF STEP]
have "card (set_tree l \<union> set_tree r) = size l + size r"
[PROOF STATE]
proof (prove)
using this:
bst l \<Longrightarrow> card (set_tree l) = size l
bst r \<Longrightarrow> card (set_tree r) = size r
bst \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. card (set_tree l \<union> set_tree r) = size l + size r
[PROOF STEP]
by (subst card_Un_disjoint) force+
[PROOF STATE]
proof (state)
this:
card (set_tree l \<union> set_tree r) = size l + size r

goal (2 subgoals):
 1. bst \<langle>\<rangle> \<Longrightarrow> card (set_tree \<langle>\<rangle>) = size \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>bst t1 \<Longrightarrow> card (set_tree t1) = size t1; bst t2 \<Longrightarrow> card (set_tree t2) = size t2; bst \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> card (set_tree \<langle>t1, x2, t2\<rangle>) = size \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (set_tree \<langle>l, x, r\<rangle>) = Suc (size l + size r)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (set_tree \<langle>l, x, r\<rangle>) = Suc (size l + size r)

goal (1 subgoal):
 1. card (set_tree \<langle>l, x, r\<rangle>) = size \<langle>l, x, r\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (set_tree \<langle>l, x, r\<rangle>) = size \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. bst \<langle>\<rangle> \<Longrightarrow> card (set_tree \<langle>\<rangle>) = size \<langle>\<rangle>
[PROOF STEP]
qed simp_all