[STATEMENT]
lemma p_minus_one_l: "(int p - 1) div 2 < p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int p - 1) div 2 < int p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (int p - 1) div 2 < int p
[PROOF STEP]
have "(p - 1) div 2 \<le> (p - 1) div 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p - 1) div 2 \<le> (p - 1) div 1
[PROOF STEP]
by (metis div_by_1 div_le_dividend)
[PROOF STATE]
proof (state)
this:
(p - 1) div 2 \<le> (p - 1) div 1

goal (1 subgoal):
 1. (int p - 1) div 2 < int p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p - 1) div 2 \<le> (p - 1) div 1

goal (1 subgoal):
 1. (int p - 1) div 2 < int p
[PROOF STEP]
have "\<dots> = p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p - 1) div 1 = p - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(p - 1) div 1 = p - 1

goal (1 subgoal):
 1. (int p - 1) div 2 < int p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(p - 1) div 2 \<le> p - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(p - 1) div 2 \<le> p - 1

goal (1 subgoal):
 1. (int p - 1) div 2 < int p
[PROOF STEP]
using p_ge_2
[PROOF STATE]
proof (prove)
using this:
(p - 1) div 2 \<le> p - 1
2 < p

goal (1 subgoal):
 1. (int p - 1) div 2 < int p
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
(int p - 1) div 2 < int p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_buffon_set'_short: "emeasure lborel Buffon_set' = ennreal l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
have "emeasure lborel Buffon_set' =
          ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))" (is "_ = ennreal ?I")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
by (rule emeasure_buffon_set')
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
have *: "sin \<phi> * l \<le> d" if "\<phi> \<ge> 0" "\<phi> \<le> pi" for \<phi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin \<phi> * l \<le> d
[PROOF STEP]
using mult_mono[OF l_le_d sin_le_one _ sin_ge_zero] that d
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> d; 0 \<le> ?x1; ?x1 \<le> pi\<rbrakk> \<Longrightarrow> l * sin ?x1 \<le> d * 1
0 \<le> \<phi>
\<phi> \<le> pi
0 < d

goal (1 subgoal):
 1. sin \<phi> * l \<le> d
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?\<phi>1; ?\<phi>1 \<le> pi\<rbrakk> \<Longrightarrow> sin ?\<phi>1 * l \<le> d

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
have "?I = integral {0..pi} (\<lambda>x. (l / 2) * sin x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..pi} (\<lambda>x. l / 2 * sin x)
[PROOF STEP]
using l d l_le_d
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < d
l \<le> d

goal (1 subgoal):
 1. integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..pi} (\<lambda>x. l / 2 * sin x)
[PROOF STEP]
by (intro integral_cong) (auto dest: * simp: min_def sin_ge_zero)
[PROOF STATE]
proof (state)
this:
integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..pi} (\<lambda>x. l / 2 * sin x)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)) = integral {0..pi} (\<lambda>x. l / 2 * sin x)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
have "\<dots> = l / 2 * integral {0..pi} sin"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..pi} (\<lambda>x. l / 2 * sin x) = l / 2 * integral {0..pi} sin
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral {0..pi} (\<lambda>x. l / 2 * sin x) = l / 2 * integral {0..pi} sin

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {0..pi} (\<lambda>x. l / 2 * sin x) = l / 2 * integral {0..pi} sin

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
have "(sin has_integral (-cos pi - (- cos 0))) {0..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin has_integral - cos pi - - cos 0) {0..pi}
[PROOF STEP]
by (intro fundamental_theorem_of_calculus)
       (auto intro!: derivative_eq_intros simp: has_real_derivative_iff_has_vector_derivative [symmetric])
[PROOF STATE]
proof (state)
this:
(sin has_integral - cos pi - - cos 0) {0..pi}

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
hence "integral {0..pi} sin = -cos pi - (-cos 0)"
[PROOF STATE]
proof (prove)
using this:
(sin has_integral - cos pi - - cos 0) {0..pi}

goal (1 subgoal):
 1. integral {0..pi} sin = - cos pi - - cos 0
[PROOF STEP]
by (simp add: has_integral_iff)
[PROOF STATE]
proof (state)
this:
integral {0..pi} sin = - cos pi - - cos 0

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure lborel Buffon_set' = ennreal (l / 2 * (- cos pi - - cos 0))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure lborel Buffon_set' = ennreal (l / 2 * (- cos pi - - cos 0))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal l
[PROOF STEP]
by (simp add: lborel_prod)
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = ennreal l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_within_open: "a \<in> S \<Longrightarrow> open S \<Longrightarrow> (f \<longlongrightarrow> l) (at a within S) \<longleftrightarrow> (f \<midarrow>a\<rightarrow> l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> S; open S\<rbrakk> \<Longrightarrow> (f \<longlongrightarrow> l) (at a within S) = f \<midarrow>a\<rightarrow> l
[PROOF STEP]
by (simp add: tendsto_def at_within_open[where S = S])


[STATEMENT]
lemma evens_infinite:
  shows "infinite evens"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite evens
[PROOF STEP]
proof(rule iffD2[OF infinite_iff_countable_subset], rule exI, rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj ?f3
 2. range ?f3 \<subseteq> evens
[PROOF STEP]
let ?f = "\<lambda>n::nat. cofinite (2*n)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj ?f3
 2. range ?f3 \<subseteq> evens
[PROOF STEP]
show "inj ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>n. cofinite.cofinite (2 * n))
[PROOF STEP]
by (auto intro: inj_onI)
[PROOF STATE]
proof (state)
this:
inj (\<lambda>n. cofinite.cofinite (2 * n))

goal (1 subgoal):
 1. range (\<lambda>n. cofinite.cofinite (2 * n)) \<subseteq> evens
[PROOF STEP]
show "range ?f \<subseteq> evens"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (\<lambda>n. cofinite.cofinite (2 * n)) \<subseteq> evens
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range (\<lambda>n. cofinite.cofinite (2 * n)) \<subseteq> evens

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma star_irreflexive_part_eq:
  "x\<^sup>\<star> - 1 = (x - 1)\<^sup>+ - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> - (1::'a) = (x - (1::'a))\<^sup>+ - (1::'a)
[PROOF STEP]
by (metis reachable_without_loops star_plus_without_loops)


[STATEMENT]
lemma card_UNIV_union:
  "card {x. x < dim_vec a \<and> vec_index (a::bool vec) x = True}
  + card {x. x < dim_vec a \<and> vec_index (a::bool vec) x = False}
  = card {x. x < dim_vec a}"
  (is "card ?true + card ?false = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}
[PROOF STEP]
have "card ?true + card ?false = card (?true \<union> ?false) + card (?true \<inter> ?false)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card ({x. x < dim_vec a \<and> a $ x = True} \<union> {x. x < dim_vec a \<and> a $ x = False}) + card ({x. x < dim_vec a \<and> a $ x = True} \<inter> {x. x < dim_vec a \<and> a $ x = False})
[PROOF STEP]
using card_Un_Int [OF finite_True [of a] finite_False [of a]]
[PROOF STATE]
proof (prove)
using this:
card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card ({x. x < dim_vec a \<and> a $ x = True} \<union> {x. x < dim_vec a \<and> a $ x = False}) + card ({x. x < dim_vec a \<and> a $ x = True} \<inter> {x. x < dim_vec a \<and> a $ x = False})

goal (1 subgoal):
 1. card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card ({x. x < dim_vec a \<and> a $ x = True} \<union> {x. x < dim_vec a \<and> a $ x = False}) + card ({x. x < dim_vec a \<and> a $ x = True} \<inter> {x. x < dim_vec a \<and> a $ x = False})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card ({x. x < dim_vec a \<and> a $ x = True} \<union> {x. x < dim_vec a \<and> a $ x = False}) + card ({x. x < dim_vec a \<and> a $ x = True} \<inter> {x. x < dim_vec a \<and> a $ x = False})

goal (1 subgoal):
 1. card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card ({x. x < dim_vec a \<and> a $ x = True} \<union> {x. x < dim_vec a \<and> a $ x = False}) + card ({x. x < dim_vec a \<and> a $ x = True} \<inter> {x. x < dim_vec a \<and> a $ x = False})

goal (1 subgoal):
 1. card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}
[PROOF STEP]
have "... = card {x. x < dim_vec a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({x. x < dim_vec a \<and> a $ x = True} \<union> {x. x < dim_vec a \<and> a $ x = False}) + card ({x. x < dim_vec a \<and> a $ x = True} \<inter> {x. x < dim_vec a \<and> a $ x = False}) = card {x. x < dim_vec a}
[PROOF STEP]
unfolding UNIV_union UNIV_disjoint
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. x < dim_vec a} + card {} = card {x. x < dim_vec a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card ({x. x < dim_vec a \<and> a $ x = True} \<union> {x. x < dim_vec a \<and> a $ x = False}) + card ({x. x < dim_vec a \<and> a $ x = True} \<inter> {x. x < dim_vec a \<and> a $ x = False}) = card {x. x < dim_vec a}

goal (1 subgoal):
 1. card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}

goal (1 subgoal):
 1. card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {x. x < dim_vec a \<and> a $ x = True} + card {x. x < dim_vec a \<and> a $ x = False} = card {x. x < dim_vec a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma E_inf_mono:
  "(\<And>\<omega>. f \<omega> \<le> g \<omega>) \<Longrightarrow> E_inf s f \<le> E_inf s g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<omega>. f \<omega> \<le> g \<omega>) \<Longrightarrow> E_inf s f \<le> E_inf s g
[PROOF STEP]
unfolding E_inf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<omega>. f \<omega> \<le> g \<omega>) \<Longrightarrow> (\<Sqinter>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f) \<le> (\<Sqinter>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) g)
[PROOF STEP]
by (intro INF_superset_mono order_refl nn_integral_mono)


[STATEMENT]
lemma fps_of_poly_sum_list: "fps_of_poly (sum_list xs) = sum_list (map fps_of_poly xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_poly (sum_list xs) = sum_list (map fps_of_poly xs)
[PROOF STEP]
by (induction xs) (simp_all add: fps_of_poly_add)


[STATEMENT]
lemma upclosed_set_iff: "upclosed_set X = (\<forall>x \<in> X. \<forall>y. x \<le> y \<longrightarrow> y \<in> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upclosed_set X = (\<forall>x\<in>X. \<forall>y\<ge>x. y \<in> X)
[PROOF STEP]
unfolding upclosed_set_def upsets_def Fix_def upset_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<in> {x. {y. \<exists>x\<in>x. x \<le> y} = x}) = (\<forall>x\<in>X. \<forall>y\<ge>x. y \<in> X)
[PROOF STEP]
by auto


[STATEMENT]
lemma cos_lt_zero_pi: "pi/2 < x \<Longrightarrow> x < 3*pi/2 \<Longrightarrow> cos x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pi / 2 < x; x < 3 * pi / 2\<rbrakk> \<Longrightarrow> cos x < 0
[PROOF STEP]
using cos_minus_pi cos_gt_zero_pi [of "x-pi"]
[PROOF STATE]
proof (prove)
using this:
cos (?x - pi) = - cos ?x
\<lbrakk>- (pi / 2) < x - pi; x - pi < pi / 2\<rbrakk> \<Longrightarrow> 0 < cos (x - pi)

goal (1 subgoal):
 1. \<lbrakk>pi / 2 < x; x < 3 * pi / 2\<rbrakk> \<Longrightarrow> cos x < 0
[PROOF STEP]
by simp


[STATEMENT]
lemma floor_le_zero [simp]: "\<lfloor>x\<rfloor> \<le> 0 \<longleftrightarrow> x < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> \<le> 0) = (x < (1::'a))
[PROOF STEP]
by (simp add: floor_le_iff)


[STATEMENT]
lemma "rec_bexp number ite equal (Equal x y) = equal x y (rec_aexp number ite equal x) (rec_aexp number ite equal y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_bexp number ite equal (Equal x y) = equal x y (rec_aexp number ite equal x) (rec_aexp number ite equal y)
[PROOF STEP]
nitpick [card = 1-3, expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_bexp number ite equal (Equal x y) = equal x y (rec_aexp number ite equal x) (rec_aexp number ite equal y)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma isCont_LIM_compose2:
  fixes a :: "'a::real_normed_vector"
  assumes f [unfolded isCont_def]: "isCont f a"
    and g: "g \<midarrow>f a\<rightarrow> l"
    and inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < d \<longrightarrow> f x \<noteq> f a"
  shows "(\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> l
[PROOF STEP]
by (rule LIM_compose2 [OF f g inj])


[STATEMENT]
lemma return_time:
  assumes ret: "returns_to P x"
  assumes "closed P"
  shows "return_time P x > 0"
    and return_time_exivl: "return_time P x \<in> existence_ivl0 x"
    and return_time_returns: "flow0 x (return_time P x) \<in> P"
    and return_time_least: "\<And>s. 0 < s \<Longrightarrow> s < return_time P x \<Longrightarrow> flow0 x s \<notin> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < return_time P x &&& return_time P x \<in> existence_ivl0 x) &&& flow0 x (return_time P x) \<in> P &&& (\<And>s. \<lbrakk>0 < s; s < return_time P x\<rbrakk> \<Longrightarrow> flow0 x s \<notin> P)
[PROOF STEP]
using someI_ex[OF return_time_ex1[OF assms, THEN ex1_implies_ex]]
[PROOF STATE]
proof (prove)
using this:
0 < (SOME xa. 0 < xa \<and> xa \<in> existence_ivl0 x \<and> flow0 x xa \<in> P \<and> (\<forall>s\<in>{0<..<xa}. flow0 x s \<notin> P)) \<and> (SOME xa. 0 < xa \<and> xa \<in> existence_ivl0 x \<and> flow0 x xa \<in> P \<and> (\<forall>s\<in>{0<..<xa}. flow0 x s \<notin> P)) \<in> existence_ivl0 x \<and> flow0 x (SOME xa. 0 < xa \<and> xa \<in> existence_ivl0 x \<and> flow0 x xa \<in> P \<and> (\<forall>s\<in>{0<..<xa}. flow0 x s \<notin> P)) \<in> P \<and> (\<forall>s\<in>{0<..<SOME xa. 0 < xa \<and> xa \<in> existence_ivl0 x \<and> flow0 x xa \<in> P \<and> (\<forall>s\<in>{0<..<xa}. flow0 x s \<notin> P)}. flow0 x s \<notin> P)

goal (1 subgoal):
 1. (0 < return_time P x &&& return_time P x \<in> existence_ivl0 x) &&& flow0 x (return_time P x) \<in> P &&& (\<And>s. \<lbrakk>0 < s; s < return_time P x\<rbrakk> \<Longrightarrow> flow0 x s \<notin> P)
[PROOF STEP]
unfolding return_time_some[OF ret, symmetric]
[PROOF STATE]
proof (prove)
using this:
0 < return_time P x \<and> return_time P x \<in> existence_ivl0 x \<and> flow0 x (return_time P x) \<in> P \<and> (\<forall>s\<in>{0<..<return_time P x}. flow0 x s \<notin> P)

goal (1 subgoal):
 1. (0 < return_time P x &&& return_time P x \<in> existence_ivl0 x) &&& flow0 x (return_time P x) \<in> P &&& (\<And>s. \<lbrakk>0 < s; s < return_time P x\<rbrakk> \<Longrightarrow> flow0 x s \<notin> P)
[PROOF STEP]
by auto


[STATEMENT]
lemma bounded_scaling:
  fixes S :: "'a::real_normed_vector set"
  shows "bounded S \<Longrightarrow> bounded ((\<lambda>x. c *\<^sub>R x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded S \<Longrightarrow> bounded ((*\<^sub>R) c ` S)
[PROOF STEP]
by (simp add: bounded_linear_image bounded_linear_scaleR_right)


[STATEMENT]
lemma iIN_subset_conv: "([n'\<dots>,d'] \<subseteq> [n\<dots>,d]) = (n \<le> n' \<and> n'+d' \<le> n+d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([n'\<dots>,d'] \<subseteq> [n\<dots>,d]) = (n \<le> n' \<and> n' + d' \<le> n + d)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. [n'\<dots>,d'] \<subseteq> [n\<dots>,d] \<Longrightarrow> n \<le> n' \<and> n' + d' \<le> n + d
 2. n \<le> n' \<and> n' + d' \<le> n + d \<Longrightarrow> [n'\<dots>,d'] \<subseteq> [n\<dots>,d]
[PROOF STEP]
apply (frule iMin_subset[OF iIN_not_empty])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>[n'\<dots>,d'] \<subseteq> [n\<dots>,d]; iMin [n\<dots>,d] \<le> iMin [n'\<dots>,d']\<rbrakk> \<Longrightarrow> n \<le> n' \<and> n' + d' \<le> n + d
 2. n \<le> n' \<and> n' + d' \<le> n + d \<Longrightarrow> [n'\<dots>,d'] \<subseteq> [n\<dots>,d]
[PROOF STEP]
apply (drule Max_subset[OF iIN_not_empty _ iIN_finite])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>iMin [n\<dots>,d] \<le> iMin [n'\<dots>,d']; Max [n'\<dots>,d'] \<le> Max [n\<dots>,d]\<rbrakk> \<Longrightarrow> n \<le> n' \<and> n' + d' \<le> n + d
 2. n \<le> n' \<and> n' + d' \<le> n + d \<Longrightarrow> [n'\<dots>,d'] \<subseteq> [n\<dots>,d]
[PROOF STEP]
apply (simp add: iIN_Min iIN_Max)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> n' \<and> n' + d' \<le> n + d \<Longrightarrow> [n'\<dots>,d'] \<subseteq> [n\<dots>,d]
[PROOF STEP]
apply (simp add: subset_iff iIN_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma length_take_left: "length (take ((length ts + 1) div 2) ts) = (length ts + 1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (take ((length ts + 1) div 2) ts) = (length ts + 1) div 2
[PROOF STEP]
apply (cases ts)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ts = [] \<Longrightarrow> length (take ((length ts + 1) div 2) ts) = (length ts + 1) div 2
 2. \<And>a list. ts = a # list \<Longrightarrow> length (take ((length ts + 1) div 2) ts) = (length ts + 1) div 2
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nth_least_strict_mono_inverse:
    fixes A :: "nat set"
    assumes "enat k < esize A" "enat l < esize A" "nth_least A k < nth_least A l"
    shows "k < l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
enat k < esize A
enat l < esize A
nth_least A k < nth_least A l

goal (1 subgoal):
 1. k < l
[PROOF STEP]
by (metis not_less_iff_gr_or_eq nth_least_strict_mono)


[STATEMENT]
lemma fundamental_theorem_of_calculus_real:
  "a \<le> b \<Longrightarrow> \<forall>x\<in>{a..b}. (f has_real_derivative f' x) (at x within {a..b}) \<Longrightarrow>
      (f' has_integral (f b - f a)) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; \<forall>x\<in>{a..b}. (f has_real_derivative f' x) (at x within {a..b})\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
by (intro fundamental_theorem_of_calculus ballI)
     (simp_all add: has_real_derivative_iff_has_vector_derivative[symmetric])


[STATEMENT]
lemma pac_ideal_mono:
  \<open>A \<subseteq> B \<Longrightarrow> pac_ideal A \<subseteq> pac_ideal B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> pac_ideal A \<subseteq> pac_ideal B
[PROOF STEP]
using ideal.span_mono[of \<open>A \<union> _\<close> \<open>B \<union> _\<close>]
[PROOF STATE]
proof (prove)
using this:
A \<union> ?uu3 \<subseteq> B \<union> ?uua3 \<Longrightarrow> More_Modules.ideal (A \<union> ?uu3) \<subseteq> More_Modules.ideal (B \<union> ?uua3)

goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> pac_ideal A \<subseteq> pac_ideal B
[PROOF STEP]
by (auto simp: pac_ideal_def intro: ideal.span_mono)


[STATEMENT]
lemma elements_0_mat [simp]: "elements_mat (0\<^sub>m nr nc) \<subseteq> {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elements_mat (0\<^sub>m nr nc) \<subseteq> {0::'a}
[PROOF STEP]
unfolding elements_mat_def zero_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (concat (map (\<lambda>i. map (\<lambda>j. mat nr nc (\<lambda>ij. 0::'a) $$ (i, j)) [0..<dim_col (mat nr nc (\<lambda>ij. 0::'a))]) [0..<dim_row (mat nr nc (\<lambda>ij. 0::'a))])) \<subseteq> {0::'a}
[PROOF STEP]
by auto


[STATEMENT]
lemma has_integral_combine_tagged_division:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes "p tagged_division_of S"
    and "\<And>x k. (x,k) \<in> p \<Longrightarrow> (f has_integral (i k)) k"
  shows "(f has_integral (\<Sum>(x,k)\<in>p. i k)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral (\<Sum>(x, k)\<in>p. i k)) S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral (\<Sum>(x, k)\<in>p. i k)) S
[PROOF STEP]
have *: "(f has_integral (\<Sum>k\<in>snd`p. integral k f)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral (\<Sum>k\<in>snd ` p. integral k f)) S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral (\<Sum>k\<in>snd ` p. integral k f)) S
[PROOF STEP]
have "snd ` p division_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ` p division_of S
[PROOF STEP]
by (simp add: assms(1) division_of_tagged_division)
[PROOF STATE]
proof (state)
this:
snd ` p division_of S

goal (1 subgoal):
 1. (f has_integral (\<Sum>k\<in>snd ` p. integral k f)) S
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
p tagged_division_of S
(?x, ?k) \<in> p \<Longrightarrow> (f has_integral i ?k) ?k
snd ` p division_of S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p tagged_division_of S
(?x, ?k) \<in> p \<Longrightarrow> (f has_integral i ?k) ?k
snd ` p division_of S

goal (1 subgoal):
 1. (f has_integral (\<Sum>k\<in>snd ` p. integral k f)) S
[PROOF STEP]
by (metis (mono_tags, lifting) has_integral_combine_division has_integral_integrable_integral imageE prod.collapse)
[PROOF STATE]
proof (state)
this:
(f has_integral (\<Sum>k\<in>snd ` p. integral k f)) S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f has_integral (\<Sum>k\<in>snd ` p. integral k f)) S

goal (1 subgoal):
 1. (f has_integral (\<Sum>(x, k)\<in>p. i k)) S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f has_integral (\<Sum>k\<in>snd ` p. integral k f)) S

goal (1 subgoal):
 1. (f has_integral (\<Sum>(x, k)\<in>p. i k)) S
[PROOF STEP]
have "(\<Sum>k\<in>snd`p. integral k f) = (\<Sum>(x, k)\<in>p. integral k f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>snd ` p. integral k f) = (\<Sum>(x, k)\<in>p. integral k f)
[PROOF STEP]
by (intro sum.over_tagged_division_lemma[OF assms(1), symmetric] integral_null)
       (simp add: content_eq_0_interior)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>snd ` p. integral k f) = (\<Sum>(x, k)\<in>p. integral k f)

goal (1 subgoal):
 1. (f has_integral (\<Sum>(x, k)\<in>p. i k)) S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f has_integral (\<Sum>(x, k)\<in>p. integral k f)) S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f has_integral (\<Sum>(x, k)\<in>p. integral k f)) S

goal (1 subgoal):
 1. (f has_integral (\<Sum>(x, k)\<in>p. i k)) S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f has_integral (\<Sum>(x, k)\<in>p. integral k f)) S
p tagged_division_of S
(?x, ?k) \<in> p \<Longrightarrow> (f has_integral i ?k) ?k

goal (1 subgoal):
 1. (f has_integral (\<Sum>(x, k)\<in>p. i k)) S
[PROOF STEP]
by (auto simp add: has_integral_iff intro!: sum.cong)
[PROOF STATE]
proof (state)
this:
(f has_integral (\<Sum>(x, k)\<in>p. i k)) S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) cyclic_order_is_ord:
 assumes "g \<in> carrier G"
 shows "ord g = order (subgroup_generated G {g})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord g = order (subgroup_generated G {g})
[PROOF STEP]
unfolding order_def subgroup_generated_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord g = card (carrier (G\<lparr>carrier := generate G (carrier G \<inter> {g})\<rparr>))
[PROOF STEP]
using assms generate_pow_card
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
?a \<in> carrier G \<Longrightarrow> ord ?a = card (generate G {?a})

goal (1 subgoal):
 1. ord g = card (carrier (G\<lparr>carrier := generate G (carrier G \<inter> {g})\<rparr>))
[PROOF STEP]
by simp


[STATEMENT]
lemma invertible_means_mult_id:
  fixes A:: "'a::field mat"
  assumes assm: "invertible_mat A"
  shows "matr_option (dim_row A)
     (mat_inverse (A))*A = 1\<^sub>m (dim_row A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
proof (cases "mat_inverse(A)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mat_inverse A = None \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
 2. \<And>a. mat_inverse A = Some a \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
obtain n where n: "A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. A \<in> carrier_mat n n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms invertible_mat_def square_mat.simps
[PROOF STATE]
proof (prove)
using this:
invertible_mat A
invertible_mat ?A \<equiv> square_mat ?A \<and> (\<exists>B. inverts_mat ?A B \<and> inverts_mat B ?A)
square_mat ?A = (dim_col ?A = dim_row ?A)

goal (1 subgoal):
 1. (\<And>n. A \<in> carrier_mat n n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n

goal (2 subgoals):
 1. mat_inverse A = None \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
 2. \<And>a. mat_inverse A = Some a \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
case None
[PROOF STATE]
proof (state)
this:
mat_inverse A = None

goal (2 subgoals):
 1. mat_inverse A = None \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
 2. \<And>a. mat_inverse A = Some a \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat_inverse A = None
[PROOF STEP]
have "A \<notin> Units (ring_mat TYPE('a) n n)"
[PROOF STATE]
proof (prove)
using this:
mat_inverse A = None

goal (1 subgoal):
 1. A \<notin> Units (ring_mat TYPE('a) n n)
[PROOF STEP]
by (simp add: mat_inverse(1) n)
[PROOF STATE]
proof (state)
this:
A \<notin> Units (ring_mat TYPE('a) n n)

goal (2 subgoals):
 1. mat_inverse A = None \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
 2. \<And>a. mat_inverse A = Some a \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<notin> Units (ring_mat TYPE('a) n n)

goal (1 subgoal):
 1. matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
by (meson assms det_non_zero_imp_unit invertible_Units n unit_imp_det_non_zero)
[PROOF STATE]
proof (state)
this:
matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)

goal (1 subgoal):
 1. \<And>a. mat_inverse A = Some a \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. mat_inverse A = Some a \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
case (Some a)
[PROOF STATE]
proof (state)
this:
mat_inverse A = Some a

goal (1 subgoal):
 1. \<And>a. mat_inverse A = Some a \<Longrightarrow> matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat_inverse A = Some a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_inverse A = Some a

goal (1 subgoal):
 1. matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)
[PROOF STEP]
by (metis assms carrier_matI invertible_mat_def mat_inverse(2) matr_option.simps(2) square_mat.elims(2))
[PROOF STATE]
proof (state)
this:
matr_option (dim_row A) (mat_inverse A) * A = 1\<^sub>m (dim_row A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_of_zip_map_Some:
     "v < length xs
        \<Longrightarrow> (map_of (zip [0..<length xs] (map f xs)) v) = Some (f (xs ! v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v < length xs \<Longrightarrow> map_of (zip [0..<length xs] (map f xs)) v = Some (f (xs ! v))
[PROOF STEP]
by (induction xs rule: rev_induct) (auto simp add: nth_append map_add_Some_iff)


[STATEMENT]
lemma sat_Conjs: "sat (Conjs Q xys) I \<sigma> \<longleftrightarrow> sat Q I \<sigma> \<and> (\<forall>(x, y) \<in> set xys. sat (x \<approx> y) I \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sat (Conjs Q xys) I \<sigma> = (sat Q I \<sigma> \<and> (\<forall>(x, y)\<in>set xys. sat (x \<approx> y) I \<sigma>))
[PROOF STEP]
by (induct Q xys rule: Conjs.induct) auto


[STATEMENT]
lemma fSup_subdistl:
  assumes "mono (f::'a::complete_lattice \<Rightarrow> 'b::complete_lattice)"
  shows "Sup \<circ> (`) ((\<circ>) f) \<le> (\<circ>) f \<circ> Sup"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup \<circ> (`) ((\<circ>) f) \<le> (\<circ>) f \<circ> Sup
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mono f

goal (1 subgoal):
 1. Sup \<circ> (`) ((\<circ>) f) \<le> (\<circ>) f \<circ> Sup
[PROOF STEP]
by (simp add: fun_isol supdistl_iso)


[STATEMENT]
lemma bij_betw_Diff:
  assumes "bij_betw f A B" "bij_betw f A' B'" "A' \<subseteq> A" "B' \<subseteq> B"
  shows   "bij_betw f (A - A') (B - B')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f (A - A') (B - B')
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (A - A') \<and> f ` (A - A') = B - B'
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on f (A - A')
 2. f ` (A - A') = B - B'
[PROOF STEP]
have "inj_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f A
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B

goal (1 subgoal):
 1. inj_on f A
[PROOF STEP]
by (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
inj_on f A

goal (2 subgoals):
 1. inj_on f (A - A')
 2. f ` (A - A') = B - B'
[PROOF STEP]
thus "inj_on f (A - A')"
[PROOF STATE]
proof (prove)
using this:
inj_on f A

goal (1 subgoal):
 1. inj_on f (A - A')
[PROOF STEP]
by (rule inj_on_subset) auto
[PROOF STATE]
proof (state)
this:
inj_on f (A - A')

goal (1 subgoal):
 1. f ` (A - A') = B - B'
[PROOF STEP]
have "f ` (A - A') = f ` A - f ` A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (A - A') = f ` A - f ` A'
[PROOF STEP]
by (intro inj_on_image_set_diff[OF \<open>inj_on f A\<close>]) (use \<open>A' \<subseteq> A\<close> in auto)
[PROOF STATE]
proof (state)
this:
f ` (A - A') = f ` A - f ` A'

goal (1 subgoal):
 1. f ` (A - A') = B - B'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f ` (A - A') = f ` A - f ` A'

goal (1 subgoal):
 1. f ` (A - A') = B - B'
[PROOF STEP]
have "\<dots> = B - B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` A - f ` A' = B - B'
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B
bij_betw f A' B'

goal (1 subgoal):
 1. f ` A - f ` A' = B - B'
[PROOF STEP]
by (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
f ` A - f ` A' = B - B'

goal (1 subgoal):
 1. f ` (A - A') = B - B'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f ` (A - A') = B - B'
[PROOF STEP]
show "f` (A - A') = B - B'"
[PROOF STATE]
proof (prove)
using this:
f ` (A - A') = B - B'

goal (1 subgoal):
 1. f ` (A - A') = B - B'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f ` (A - A') = B - B'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vi_policy_opt:
  assumes "0 < eps"
  shows "dist (\<nu>\<^sub>b (mk_stationary_det (vi_policy eps v))) \<nu>\<^sub>b_opt < eps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (\<nu>\<^sub>b (mk_stationary_det (vi_policy eps v))) \<nu>\<^sub>b_opt < eps
[PROOF STEP]
unfolding vi_policy_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration eps v)))) \<nu>\<^sub>b_opt < eps
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < eps

goal (1 subgoal):
 1. dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration eps v)))) \<nu>\<^sub>b_opt < eps
[PROOF STEP]
proof (induction eps v rule: value_iteration.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>eps v. \<lbrakk>\<lbrakk>\<not> (2 * l * dist v (\<L>\<^sub>b v) < eps * (1 - l) \<or> eps \<le> 0); 0 < eps\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration eps (\<L>\<^sub>b v))))) \<nu>\<^sub>b_opt < eps; 0 < eps\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration eps v)))) \<nu>\<^sub>b_opt < eps
[PROOF STEP]
case (1 v)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> (2 * l * dist v_ (\<L>\<^sub>b v_) < v * (1 - l) \<or> v \<le> 0); 0 < v\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration v (\<L>\<^sub>b v_))))) \<nu>\<^sub>b_opt < v
0 < v

goal (1 subgoal):
 1. \<And>eps v. \<lbrakk>\<lbrakk>\<not> (2 * l * dist v (\<L>\<^sub>b v) < eps * (1 - l) \<or> eps \<le> 0); 0 < eps\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration eps (\<L>\<^sub>b v))))) \<nu>\<^sub>b_opt < eps; 0 < eps\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration eps v)))) \<nu>\<^sub>b_opt < eps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<not> (2 * l * dist v_ (\<L>\<^sub>b v_) < v * (1 - l) \<or> v \<le> 0); 0 < v\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration v (\<L>\<^sub>b v_))))) \<nu>\<^sub>b_opt < v
0 < v
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> (2 * l * dist v_ (\<L>\<^sub>b v_) < v * (1 - l) \<or> v \<le> 0); 0 < v\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration v (\<L>\<^sub>b v_))))) \<nu>\<^sub>b_opt < v
0 < v

goal (1 subgoal):
 1. dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration v v_)))) \<nu>\<^sub>b_opt < v
[PROOF STEP]
using find_policy_error_bound
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> (2 * l * dist v_ (\<L>\<^sub>b v_) < v * (1 - l) \<or> v \<le> 0); 0 < v\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration v (\<L>\<^sub>b v_))))) \<nu>\<^sub>b_opt < v
0 < v
\<lbrakk>0 < ?eps; 2 * l * dist ?v (\<L>\<^sub>b ?v) < ?eps * (1 - l)\<rbrakk> \<Longrightarrow> dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (\<L>\<^sub>b ?v)))) \<nu>\<^sub>b_opt < ?eps

goal (1 subgoal):
 1. dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration v v_)))) \<nu>\<^sub>b_opt < v
[PROOF STEP]
by (subst value_iteration.simps) auto
[PROOF STATE]
proof (state)
this:
dist (\<nu>\<^sub>b (mk_stationary_det (find_policy (value_iteration v v_)))) \<nu>\<^sub>b_opt < v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsetsum_reindex_bij_betw:
  assumes "bij_betw g A B"
  shows   "infsetsum (\<lambda>x. f (g x)) A = infsetsum f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f (g x)) = infsetsum f B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f (g x)) = infsetsum f B
[PROOF STEP]
have *: "count_space B = distr (count_space A) (count_space B) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_space B = distr (count_space A) (count_space B) g
[PROOF STEP]
by (rule distr_bij_count_space [symmetric]) fact
[PROOF STATE]
proof (state)
this:
count_space B = distr (count_space A) (count_space B) g

goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f (g x)) = infsetsum f B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f (g x)) = infsetsum f B
[PROOF STEP]
unfolding infsetsum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|count_space A. f (g x) = integral\<^sup>L (count_space B) f
[PROOF STEP]
by (subst *, subst integral_distr[of _ _ "count_space B"])
       (insert assms, auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>ax\<in>A. f (g x)) = infsetsum f B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem build_ip_partition_complete: "(\<Union>x\<in>set (build_ip_partition c rs). wordinterval_to_set x) = (UNIV :: 'i::len word set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (wordinterval_to_set ` set (build_ip_partition c rs)) = UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> (wordinterval_to_set ` set (build_ip_partition c rs)) = UNIV
[PROOF STEP]
have "wordinterval_to_set (foldr wordinterval_union x Empty_WordInterval) = \<Union>(set (map wordinterval_to_set x))"
    for x::"'i wordinterval list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (foldr wordinterval_union x Empty_WordInterval) = \<Union> (set (map wordinterval_to_set x))
[PROOF STEP]
by(induction x) simp_all
[PROOF STATE]
proof (state)
this:
wordinterval_to_set (foldr wordinterval_union ?x Empty_WordInterval) = \<Union> (set (map wordinterval_to_set ?x))

goal (1 subgoal):
 1. \<Union> (wordinterval_to_set ` set (build_ip_partition c rs)) = UNIV
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
wordinterval_to_set (foldr wordinterval_union ?x Empty_WordInterval) = \<Union> (set (map wordinterval_to_set ?x))

goal (1 subgoal):
 1. \<Union> (wordinterval_to_set ` set (build_ip_partition c rs)) = UNIV
[PROOF STEP]
apply(simp add: build_ip_partition_def groupWIs3 wordinterval_compress wordinterval_sort)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. wordinterval_to_set (foldr wordinterval_union x Empty_WordInterval) = \<Union> (wordinterval_to_set ` set x)) \<Longrightarrow> (\<Union>x\<in>set (groupWIs c rs). \<Union> (wordinterval_to_set ` set x)) = UNIV
[PROOF STEP]
using groupWIs_complete[simplified wordinterval_list_to_set_def]
[PROOF STATE]
proof (prove)
using this:
(\<Union>x\<in>set (groupWIs ?c ?rs). \<Union> (set (map wordinterval_to_set x))) = UNIV

goal (1 subgoal):
 1. (\<And>x. wordinterval_to_set (foldr wordinterval_union x Empty_WordInterval) = \<Union> (wordinterval_to_set ` set x)) \<Longrightarrow> (\<Union>x\<in>set (groupWIs c rs). \<Union> (wordinterval_to_set ` set x)) = UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Union> (wordinterval_to_set ` set (build_ip_partition c rs)) = UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gauss_i_times_gauss_i_times [simp]: "\<i>\<^sub>\<int> * (\<i>\<^sub>\<int> * x) = (-x :: gauss_int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i>\<^sub>\<int> * (\<i>\<^sub>\<int> * x) = - x
[PROOF STEP]
by (subst mult.assoc [symmetric], subst gauss_i_times_i) auto


[STATEMENT]
lemma bigthetaI_tendsto:
  assumes c_not_0: "(c::real) \<noteq> 0"
  assumes lim:     "((\<lambda>x. f x / g x) \<longlongrightarrow> c) F"
  shows   "f \<in> \<Theta>[F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> \<Theta>[F](g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
((\<lambda>x. f x / g x) \<longlongrightarrow> c) F

goal (1 subgoal):
 1. f \<in> \<Theta>[F](g)
[PROOF STEP]
by (intro bigthetaI_tendsto_norm[OF _ tendsto_norm, of "c"]) simp_all


[STATEMENT]
lemma padic_set_memI:
  fixes f :: "padic_int"
  assumes "\<And>m. (f m) \<in> (carrier (residue_ring (p^m)))"
  assumes "(\<And>(m::nat) n. (n > m \<Longrightarrow> (residue (p^m) (f n) = (f m))))"
  shows "f \<in> padic_set (p::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> padic_set p
[PROOF STEP]
by (simp add: assms(1) assms(2) padic_set_def)


[STATEMENT]
lemma closure_of_alt: "X closure_of S = topspace X \<inter> S \<union> X derived_set_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X closure_of S = topspace X \<inter> S \<union> X derived_set_of S
[PROOF STEP]
using derived_set_of_subset_topspace [of X S]
[PROOF STATE]
proof (prove)
using this:
X derived_set_of S \<subseteq> topspace X

goal (1 subgoal):
 1. X closure_of S = topspace X \<inter> S \<union> X derived_set_of S
[PROOF STEP]
unfolding closure_of_def in_derived_set_of
[PROOF STATE]
proof (prove)
using this:
X derived_set_of S \<subseteq> topspace X

goal (1 subgoal):
 1. {x \<in> topspace X. \<forall>T. x \<in> T \<and> openin X T \<longrightarrow> (\<exists>y\<in>S. y \<in> T)} = topspace X \<inter> S \<union> X derived_set_of S
[PROOF STEP]
by safe (auto simp: in_derived_set_of)


[STATEMENT]
lemma det_swap_cols: assumes A: "A \<in> carrier_mat (k + n) (k + n)"
  shows "det A = (-1)^(k * n) * det (mat (k + n) (k + n) (\<lambda> (i,j).
   A $$ (i,(if j < k then j + n else j - k))))" (is "_ = _ * det ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat (k + n) (k + n) (\<lambda>(i, j). A $$ (i, if j < k then j + n else j - k)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat (k + n) (k + n) (\<lambda>(i, j). A $$ (i, if j < k then j + n else j - k)))
[PROOF STEP]
have le: "n + k \<le> k + n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n + k \<le> k + n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n + k \<le> k + n

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat (k + n) (k + n) (\<lambda>(i, j). A $$ (i, if j < k then j + n else j - k)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat (k + n) (k + n) (\<lambda>(i, j). A $$ (i, if j < k then j + n else j - k)))
[PROOF STEP]
unfolding det_swap_initial_cols[OF A le]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ (n * k) * det (mat (k + n) (k + n) (\<lambda>(i, j). A $$ (i, if j < k then j + n else if j < n + k then j - k else j))) = (- (1::'a)) ^ (k * n) * det (mat (k + n) (k + n) (\<lambda>(i, j). A $$ (i, if j < k then j + n else j - k)))
[PROOF STEP]
by (intro arg_cong2[of _ _ _ _ "\<lambda> x y. ((-1)^x * det y)"], force, intro eq_matI, auto)
[PROOF STATE]
proof (state)
this:
det A = (- (1::'a)) ^ (k * n) * det (mat (k + n) (k + n) (\<lambda>(i, j). A $$ (i, if j < k then j + n else j - k)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma moebius_pt_moebius_id [simp]:
  shows "moebius_pt id_moebius = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt id_moebius = id
[PROOF STEP]
unfolding id_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt id_moebius = (\<lambda>x. x)
[PROOF STEP]
apply (rule ext, transfer, transfer)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<noteq> vec_zero \<Longrightarrow> moebius_pt_cmat_cvec id_moebius_cmat x \<approx>\<^sub>v x
[PROOF STEP]
using eye_mv_l
[PROOF STATE]
proof (prove)
using this:
eye *\<^sub>m\<^sub>v ?v = ?v

goal (1 subgoal):
 1. \<And>x. x \<noteq> vec_zero \<Longrightarrow> moebius_pt_cmat_cvec id_moebius_cmat x \<approx>\<^sub>v x
[PROOF STEP]
by simp


[STATEMENT]
lemma convex_hull_carrier[intro]: "Vs \<subseteq> carrier_vec n \<Longrightarrow> convex_hull Vs \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Vs \<subseteq> carrier_vec n \<Longrightarrow> convex_hull Vs \<subseteq> carrier_vec n
[PROOF STEP]
unfolding convex_hull_def convex_lincomb_def nonneg_lincomb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Vs \<subseteq> carrier_vec n \<Longrightarrow> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> Vs \<and> (lincomb c Ws = x \<and> c ` Ws \<subseteq> Collect ((\<le>) (0::'a))) \<and> sum c Ws = (1::'a)} \<subseteq> carrier_vec n
[PROOF STEP]
by auto


[STATEMENT]
lemma (in vec_space) rank_0I: "rank (0\<^sub>m n nc) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (0\<^sub>m n nc) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank (0\<^sub>m n nc) = 0
[PROOF STEP]
have "set (cols (0\<^sub>m n nc)) \<subseteq> {0\<^sub>v n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (cols (0\<^sub>m n nc)) \<subseteq> {0\<^sub>v n}
[PROOF STEP]
by (metis col_zero cols_length cols_nth in_set_conv_nth insertCI index_zero_mat(3) subsetI)
[PROOF STATE]
proof (state)
this:
set (cols (0\<^sub>m n nc)) \<subseteq> {0\<^sub>v n}

goal (1 subgoal):
 1. rank (0\<^sub>m n nc) = 0
[PROOF STEP]
have "set (cols (0\<^sub>m n nc::'a mat)) = {} \<or> set (cols (0\<^sub>m n nc)) = {0\<^sub>v n::'a vec}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (cols (0\<^sub>m n nc)) = {} \<or> set (cols (0\<^sub>m n nc)) = {0\<^sub>v n}
[PROOF STEP]
by (meson \<open>set (cols (0\<^sub>m n nc)) \<subseteq> {0\<^sub>v n}\<close> subset_singletonD)
[PROOF STATE]
proof (state)
this:
set (cols (0\<^sub>m n nc)) = {} \<or> set (cols (0\<^sub>m n nc)) = {0\<^sub>v n}

goal (1 subgoal):
 1. rank (0\<^sub>m n nc) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (cols (0\<^sub>m n nc)) = {} \<or> set (cols (0\<^sub>m n nc)) = {0\<^sub>v n}
[PROOF STEP]
have "span (set (cols (0\<^sub>m n nc))) = {0\<^sub>v n}"
[PROOF STATE]
proof (prove)
using this:
set (cols (0\<^sub>m n nc)) = {} \<or> set (cols (0\<^sub>m n nc)) = {0\<^sub>v n}

goal (1 subgoal):
 1. local.span (set (cols (0\<^sub>m n nc))) = {0\<^sub>v n}
[PROOF STEP]
by (metis (no_types) span_empty span_zero vectorspace.span_empty vectorspace_axioms)
[PROOF STATE]
proof (state)
this:
local.span (set (cols (0\<^sub>m n nc))) = {0\<^sub>v n}

goal (1 subgoal):
 1. rank (0\<^sub>m n nc) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
local.span (set (cols (0\<^sub>m n nc))) = {0\<^sub>v n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.span (set (cols (0\<^sub>m n nc))) = {0\<^sub>v n}

goal (1 subgoal):
 1. rank (0\<^sub>m n nc) = 0
[PROOF STEP]
unfolding rank_def \<open>span (set (cols (0\<^sub>m n nc))) = {0\<^sub>v n}\<close>
[PROOF STATE]
proof (prove)
using this:
{0\<^sub>v n} = {0\<^sub>v n}

goal (1 subgoal):
 1. vectorspace.dim class_ring (vs {0\<^sub>v n}) = 0
[PROOF STEP]
using span_empty dim_zero_vs
[PROOF STATE]
proof (prove)
using this:
{0\<^sub>v n} = {0\<^sub>v n}
local.span {} = {0\<^sub>v n}
vectorspace.dim class_ring (vs (local.span {})) = 0

goal (1 subgoal):
 1. vectorspace.dim class_ring (vs {0\<^sub>v n}) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rank (0\<^sub>m n nc) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ereal_m1_less_0[simp]: "-(1::ereal) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 < 0
[PROOF STEP]
by (simp add: zero_ereal_def one_ereal_def)


[STATEMENT]
lemma dim_span[simp]: "dim (span S) = dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim (span S) = dim S
[PROOF STEP]
by (auto simp add: dim_def span_span)


[STATEMENT]
lemma nth_default_take_eq:
  "nth_default dflt (take m xs) n =
    (if n < m then nth_default dflt xs n else dflt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_default dflt (take m xs) n = (if n < m then nth_default dflt xs n else dflt)
[PROOF STEP]
by (simp add: nth_default_def)


[STATEMENT]
lemma similar_matD: assumes "similar_mat A B"
  shows "\<exists> n P Q. {A,B,P,Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> A = P * B * Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n P Q. {A, B, P, Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> A = P * B * Q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
similar_mat A B

goal (1 subgoal):
 1. \<exists>n P Q. {A, B, P, Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> A = P * B * Q
[PROOF STEP]
unfolding similar_mat_def similar_mat_wit_def[abs_def] Let_def
[PROOF STATE]
proof (prove)
using this:
\<exists>P Q. {A, B, P, Q} \<subseteq> carrier_mat (dim_row A) (dim_row A) \<and> P * Q = 1\<^sub>m (dim_row A) \<and> Q * P = 1\<^sub>m (dim_row A) \<and> A = P * B * Q

goal (1 subgoal):
 1. \<exists>n P Q. {A, B, P, Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> A = P * B * Q
[PROOF STEP]
by blast


[STATEMENT]
lemma hnorm_zero [simp]: "hnorm (0::'a::real_normed_vector star) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hnorm 0 = 0
[PROOF STEP]
by transfer (rule norm_zero)


[STATEMENT]
lemma Nleast:"(A::nat set) \<noteq> {} \<Longrightarrow> Nleast A \<in> A \<and> (\<forall>x\<in>A. (Nleast A) \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> Nleast A \<in> A \<and> (\<forall>x\<in>A. Nleast A \<le> x)
[PROOF STEP]
apply (frule ex_Nleast [of "A"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; \<exists>!m. m \<in> A \<and> (\<forall>x\<in>A. m \<le> x)\<rbrakk> \<Longrightarrow> Nleast A \<in> A \<and> (\<forall>x\<in>A. Nleast A \<le> x)
[PROOF STEP]
apply (simp add:Nleast_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; \<exists>!m. m \<in> A \<and> (\<forall>x\<in>A. m \<le> x)\<rbrakk> \<Longrightarrow> (THE a. a \<in> A \<and> (\<forall>x\<in>A. a \<le> x)) \<in> A \<and> (\<forall>x\<in>A. (THE a. a \<in> A \<and> (\<forall>x\<in>A. a \<le> x)) \<le> x)
[PROOF STEP]
apply (rule theI')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; \<exists>!m. m \<in> A \<and> (\<forall>x\<in>A. m \<le> x)\<rbrakk> \<Longrightarrow> \<exists>!x. x \<in> A \<and> (\<forall>xa\<in>A. x \<le> xa)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_image_mset_mono_mem:
  "n \<in># M \<Longrightarrow> f n \<le> (\<Sum>m \<in># M. f m)" for f :: "'a \<Rightarrow> 'b::canonically_ordered_monoid_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<in># M \<Longrightarrow> f n \<le> \<Sum>\<^sub># (image_mset f M)
[PROOF STEP]
using le_iff_add multi_member_split
[PROOF STATE]
proof (prove)
using this:
(?a \<le> ?b) = (\<exists>c. ?b = ?a + c)
?x \<in># ?M \<Longrightarrow> \<exists>A. ?M = add_mset ?x A

goal (1 subgoal):
 1. n \<in># M \<Longrightarrow> f n \<le> \<Sum>\<^sub># (image_mset f M)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma vars_lift_add : "vars(liftPoly a b (p+q)) \<subseteq> vars(liftPoly a b (p))\<union> vars(liftPoly a b (q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (liftPoly a b (p + q)) \<subseteq> vars (liftPoly a b p) \<union> vars (liftPoly a b q)
[PROOF STEP]
using liftPoly_add[of a b p q]
[PROOF STATE]
proof (prove)
using this:
liftPoly a b (p + q) = liftPoly a b p + liftPoly a b q

goal (1 subgoal):
 1. vars (liftPoly a b (p + q)) \<subseteq> vars (liftPoly a b p) \<union> vars (liftPoly a b q)
[PROOF STEP]
using vars_add[of "liftPoly a b p" "liftPoly a b q"]
[PROOF STATE]
proof (prove)
using this:
liftPoly a b (p + q) = liftPoly a b p + liftPoly a b q
vars (liftPoly a b p + liftPoly a b q) \<subseteq> vars (liftPoly a b p) \<union> vars (liftPoly a b q)

goal (1 subgoal):
 1. vars (liftPoly a b (p + q)) \<subseteq> vars (liftPoly a b p) \<union> vars (liftPoly a b q)
[PROOF STEP]
by auto


[STATEMENT]
lemma "(4::nat) + 4 = 3 + 5"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 + 4 = 3 + 5
[PROOF STEP]
by algebra


[STATEMENT]
lemma main_nat: "(a + b) * valid_countings a b = (a - b) * all_countings a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b) * valid_countings a b = (a - b) * all_countings a b
[PROOF STEP]
unfolding valid_countings all_countings
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b) * (a + b choose a) = (a - b) * (a + b choose a)
[PROOF STEP]
..


[STATEMENT]
lemma has_derivative_power_int':
  fixes x :: "'a::real_normed_field"
  assumes x: "x \<noteq> 0"
  shows "((\<lambda>x. power_int x n) has_derivative (\<lambda>y. y * (of_int n * power_int x (n - 1)))) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
proof (cases n rule: int_cases4)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>na. n = int na \<Longrightarrow> ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
 2. \<And>na. \<lbrakk>0 < na; n = - int na\<rbrakk> \<Longrightarrow> ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
case (nonneg n)
[PROOF STATE]
proof (state)
this:
n = int n

goal (2 subgoals):
 1. \<And>na. n = int na \<Longrightarrow> ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
 2. \<And>na. \<lbrakk>0 < na; n = - int na\<rbrakk> \<Longrightarrow> ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n = int n

goal (1 subgoal):
 1. ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
n = int n
x \<noteq> (0::'a)

goal (1 subgoal):
 1. ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
by (cases "n = 0") (auto intro!: derivative_eq_intros simp: field_simps power_int_diff fun_eq_iff
                             simp flip: power_Suc)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)

goal (1 subgoal):
 1. \<And>na. \<lbrakk>0 < na; n = - int na\<rbrakk> \<Longrightarrow> ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>0 < na; n = - int na\<rbrakk> \<Longrightarrow> ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
case (neg n)
[PROOF STATE]
proof (state)
this:
0 < n
n = - int n

goal (1 subgoal):
 1. \<And>na. \<lbrakk>0 < na; n = - int na\<rbrakk> \<Longrightarrow> ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n
n = - int n

goal (1 subgoal):
 1. ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
0 < n
n = - int n
x \<noteq> (0::'a)

goal (1 subgoal):
 1. ((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: field_simps power_int_diff power_int_minus
             simp flip: power_Suc power_Suc2 power_add)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powi n) has_derivative (\<lambda>y. y * (of_int n * x powi (n - 1)))) (at x within S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stirling_integral_1_unfold:
  assumes "m > 0"
  shows   "stirling_integral 1 s = stirling_integral m s / of_nat m -
             (\<Sum>k=1..<m. of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
have "stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) -
          (\<Sum>k=1..<Suc m. of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))" for m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
proof (induction m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
let ?C = "(\<Sum>k = 1..<Suc m. of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
note Suc.IH
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
have "stirling_integral (Suc m) s / of_nat (Suc m) =
                 stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) -
                 of_real (bernoulli (Suc (Suc m))) /
                   (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m)"
      (is "_ = ?A - ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stirling_integral (Suc m) s / of_nat (Suc m) = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m)
[PROOF STEP]
by (subst stirling_integral_conv_stirling_integral_Suc)
                            (simp_all del: of_nat_Suc power_Suc add: divide_simps)
[PROOF STATE]
proof (state)
this:
stirling_integral (Suc m) s / of_nat (Suc m) = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m)

goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
stirling_integral (Suc m) s / of_nat (Suc m) = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m)

goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
have "?A - ?B - ?C = ?A - (?B + ?C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) + (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)))
[PROOF STEP]
by (rule diff_diff_eq)
[PROOF STATE]
proof (state)
this:
stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) + (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)))

goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) + (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)))

goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
have "?B + ?C = (\<Sum>k = 1..<Suc (Suc m). of_real (bernoulli (Suc k)) /
                             (of_nat k * of_nat (Suc k) * s ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) + (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) = (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
using s
[PROOF STATE]
proof (prove)
using this:
s \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) + (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) = (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
by (simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
complex_of_real (bernoulli (Suc (Suc m))) / (of_nat (Suc m) * of_nat (Suc (Suc m)) * s ^ Suc m) + (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) = (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (2 subgoals):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
 2. \<And>m. stirling_integral 1 s = stirling_integral (Suc m) s / of_nat (Suc m) - (\<Sum>k = 1..<Suc m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k)) \<Longrightarrow> stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral (Suc (Suc m)) s / of_nat (Suc (Suc m)) - (\<Sum>k = 1..<Suc (Suc m). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral (Suc 0) s / of_nat (Suc 0) - (\<Sum>k = 1..<Suc 0. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral (Suc ?m) s / of_nat (Suc ?m) - (\<Sum>k = 1..<Suc ?m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
note this[of "m - 1"]
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral (Suc (m - 1)) s / of_nat (Suc (m - 1)) - (\<Sum>k = 1..<Suc (m - 1). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral (Suc (m - 1)) s / of_nat (Suc (m - 1)) - (\<Sum>k = 1..<Suc (m - 1). complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < m
[PROOF STEP]
have "Suc (m - 1) = m"
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (1 subgoal):
 1. Suc (m - 1) = m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc (m - 1) = m

goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal (1 subgoal):
 1. stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
stirling_integral 1 s = stirling_integral m s / of_nat m - (\<Sum>k = 1..<m. complex_of_real (bernoulli (Suc k)) / (of_nat k * of_nat (Suc k) * s ^ k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ring) canonical_proj_ext_is_hom:
  assumes "\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R"
  shows "(canonical_proj_ext I n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot (I i)) [0..< Suc n]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n]))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i \<le> n \<Longrightarrow> ideal (I ?i) R

goal (1 subgoal):
 1. canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n]))
[PROOF STEP]
proof (induct n arbitrary: I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>I. (\<And>i. i \<le> 0 \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I 0 \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc 0]))
 2. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?i \<le> 0 \<Longrightarrow> ideal (I ?i) R

goal (2 subgoals):
 1. \<And>I. (\<And>i. i \<le> 0 \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I 0 \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc 0]))
 2. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
?i \<le> 0 \<Longrightarrow> ideal (I ?i) R

goal (1 subgoal):
 1. canonical_proj_ext I 0 \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc 0]))
[PROOF STEP]
using RDirProd_list_hom2[OF ideal.rcos_ring_hom[of _ R]]
[PROOF STATE]
proof (prove)
using this:
?i \<le> 0 \<Longrightarrow> ideal (I ?i) R
ideal ?I1 R \<Longrightarrow> (\<lambda>a. [?I1 +> a]) \<in> ring_hom R (RDirProd_list [R Quot ?I1])

goal (1 subgoal):
 1. canonical_proj_ext I 0 \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc 0]))
[PROOF STEP]
by (simp add: canonical_proj_ext_def)
[PROOF STATE]
proof (state)
this:
canonical_proj_ext I 0 \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc 0]))

goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
let ?DirProd = "\<lambda>I n. RDirProd_list (map (\<lambda>i. R Quot (I i)) [0..<Suc n])"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
let ?proj = "\<lambda>I n. canonical_proj_ext I n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<And>i. i \<le> n \<Longrightarrow> ideal (?I i) R) \<Longrightarrow> canonical_proj_ext ?I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot ?I i) [0..<Suc n]))
?i \<le> Suc n \<Longrightarrow> ideal (I ?i) R

goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
hence I: "ideal (I 0) R"
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<le> n \<Longrightarrow> ideal (?I i) R) \<Longrightarrow> canonical_proj_ext ?I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot ?I i) [0..<Suc n]))
?i \<le> Suc n \<Longrightarrow> ideal (I ?i) R

goal (1 subgoal):
 1. ideal (I 0) R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ideal (I 0) R

goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
have hom: "(?proj (\<lambda>i. I (Suc i)) n) \<in> ring_hom R (?DirProd (\<lambda>i. I (Suc i)) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canonical_proj_ext (\<lambda>i. I (Suc i)) n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I (Suc i)) [0..<Suc n]))
[PROOF STEP]
using Suc(1)[of "\<lambda>i. I (Suc i)"] Suc(2)
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<le> n \<Longrightarrow> ideal (I (Suc i)) R) \<Longrightarrow> canonical_proj_ext (\<lambda>a. I (Suc a)) n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I (Suc i)) [0..<Suc n]))
?i \<le> Suc n \<Longrightarrow> ideal (I ?i) R

goal (1 subgoal):
 1. canonical_proj_ext (\<lambda>i. I (Suc i)) n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I (Suc i)) [0..<Suc n]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
canonical_proj_ext (\<lambda>i. I (Suc i)) n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I (Suc i)) [0..<Suc n]))

goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
have [simp]:
    "(\<lambda>(a, as). a # as) \<circ> ((\<lambda>(r, s). (I 0 +> r, ?proj (\<lambda>i. I (Suc i)) n s)) \<circ> (\<lambda>a. (a, a))) = ?proj I (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(a, as). a # as) \<circ> ((\<lambda>(r, s). (I 0 +> r, canonical_proj_ext (\<lambda>i. I (Suc i)) n s)) \<circ> (\<lambda>a. (a, a))) = canonical_proj_ext I (Suc n)
[PROOF STEP]
unfolding canonical_proj_ext_tl
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(a, as). a # as) \<circ> ((\<lambda>(r, s). (I 0 +> r, canonical_proj_ext (\<lambda>i. I (Suc i)) n s)) \<circ> (\<lambda>a. (a, a))) = (\<lambda>a. (I 0 +> a) # canonical_proj_ext (\<lambda>i. I (Suc i)) n a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>(a, as). a # as) \<circ> ((\<lambda>(r, s). (I 0 +> r, canonical_proj_ext (\<lambda>i. I (Suc i)) n s)) \<circ> (\<lambda>a. (a, a))) = canonical_proj_ext I (Suc n)

goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>(a, as). a # as) \<circ> ((\<lambda>(r, s). (I 0 +> r, canonical_proj_ext (\<lambda>i. I (Suc i)) n s)) \<circ> (\<lambda>a. (a, a))) = canonical_proj_ext I (Suc n)

goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
have
    "(R Quot I 0) # (map (\<lambda>i. R Quot I (Suc i)) [0..< Suc n]) = map (\<lambda>i. R Quot (I i)) [0..< Suc (Suc n)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (R Quot I 0) # map (\<lambda>i. R Quot I (Suc i)) [0..<Suc n] = map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]
[PROOF STEP]
by (induct n) (auto)
[PROOF STATE]
proof (state)
this:
(R Quot I 0) # map (\<lambda>i. R Quot I (Suc i)) [0..<Suc n] = map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]

goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(R Quot I 0) # map (\<lambda>i. R Quot I (Suc i)) [0..<Suc n] = map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]

goal (1 subgoal):
 1. \<And>n I. \<lbrakk>\<And>I. (\<And>i. i \<le> n \<Longrightarrow> ideal (I i) R) \<Longrightarrow> canonical_proj_ext I n \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc n])); \<And>i. i \<le> Suc n \<Longrightarrow> ideal (I i) R\<rbrakk> \<Longrightarrow> canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
using ring_hom_trans[OF ring_hom_trans[OF RDirProd_hom1
          RDirProd_hom3[OF ideal.rcos_ring_hom[OF I] hom]] RDirProd_list_hom1]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(a, as). a # as) \<circ> ((\<lambda>(r, s). (I 0 +> r, canonical_proj_ext (\<lambda>i. I (Suc i)) n s)) \<circ> (\<lambda>a. (a, a))) \<in> ring_hom R (RDirProd_list ((R Quot I 0) # map (\<lambda>i. R Quot I (Suc i)) [0..<Suc n]))

goal (1 subgoal):
 1. canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
unfolding calculation(2)
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(a, as). a # as) \<circ> ((\<lambda>(r, s). (I 0 +> r, canonical_proj_ext (\<lambda>i. I (Suc i)) n s)) \<circ> (\<lambda>a. (a, a))) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))

goal (1 subgoal):
 1. canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
canonical_proj_ext I (Suc n) \<in> ring_hom R (RDirProd_list (map (\<lambda>i. R Quot I i) [0..<Suc (Suc n)]))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma erf_real_less_1 [intro]: "erf (x::real) < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf x < 1
[PROOF STEP]
using erfc_real_gt_0[of x]
[PROOF STATE]
proof (prove)
using this:
0 < erfc x

goal (1 subgoal):
 1. erf x < 1
[PROOF STEP]
unfolding erfc_def
[PROOF STATE]
proof (prove)
using this:
0 < 1 - erf x

goal (1 subgoal):
 1. erf x < 1
[PROOF STEP]
by simp


[STATEMENT]
lemma poly_no_roots_less_less:
  "(\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) \<longleftrightarrow>
   ((a \<ge> b \<or> p \<noteq> 0 \<and> count_roots_between p a b =
       (if poly p b = 0 then 1 else 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0) = (b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0))
[PROOF STEP]
proof (standard, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0 \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
 2. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
case A: 1
[PROOF STATE]
proof (state)
this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0

goal (2 subgoals):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0 \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
 2. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
proof (cases "a \<ge> b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
 2. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b \<le> a

goal (2 subgoals):
 1. b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
 2. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
b \<le> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
b \<le> a

goal (1 subgoal):
 1. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)

goal (1 subgoal):
 1. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> b \<le> a

goal (1 subgoal):
 1. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
\<not> b \<le> a
[PROOF STEP]
have [simp]: "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
\<not> b \<le> a

goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
using dense[of a b]
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
\<not> b \<le> a
a < b \<Longrightarrow> \<exists>z>a. z < b

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

goal (1 subgoal):
 1. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
have B: "{x. a < x \<and> x \<le> b \<and> poly p x = 0} =
                {x. a < x \<and> x < b \<and> poly p x = 0} \<union>
                (if poly p b = 0 then {b} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. a < x \<and> x \<le> b \<and> poly p x = 0} = {x. a < x \<and> x < b \<and> poly p x = 0} \<union> (if poly p b = 0 then {b} else {})
[PROOF STEP]
using A False
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
\<not> b \<le> a

goal (1 subgoal):
 1. {x. a < x \<and> x \<le> b \<and> poly p x = 0} = {x. a < x \<and> x < b \<and> poly p x = 0} \<union> (if poly p b = 0 then {b} else {})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. a < x \<and> x \<le> b \<and> poly p x = 0} = {x. a < x \<and> x < b \<and> poly p x = 0} \<union> (if poly p b = 0 then {b} else {})

goal (1 subgoal):
 1. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
have "count_roots_between p a b =
                 card {x. a < x \<and> x < b \<and> poly p x = 0} +
                (if poly p b = 0 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_roots_between p a b = card {x. a < x \<and> x < b \<and> poly p x = 0} + (if poly p b = 0 then 1 else 0)
[PROOF STEP]
by (subst count_roots_between_correct, subst B, subst card_Un_disjoint,
             rule finite_subset[OF _ poly_roots_finite], blast, simp_all)
[PROOF STATE]
proof (state)
this:
count_roots_between p a b = card {x. a < x \<and> x < b \<and> poly p x = 0} + (if poly p b = 0 then 1 else 0)

goal (1 subgoal):
 1. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_roots_between p a b = card {x. a < x \<and> x < b \<and> poly p x = 0} + (if poly p b = 0 then 1 else 0)

goal (1 subgoal):
 1. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
have "{x. a < x \<and> x < b \<and> poly p x = 0} = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. {x. a < x \<and> x < b \<and> poly p x = 0} = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{x. a < x \<and> x < b \<and> poly p x = 0} = {}

goal (1 subgoal):
 1. \<not> b \<le> a \<Longrightarrow> b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count_roots_between p a b = card {} + (if poly p b = 0 then 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count_roots_between p a b = card {} + (if poly p b = 0 then 1 else 0)

goal (1 subgoal):
 1. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)

goal (1 subgoal):
 1. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
case prems: 2
[PROOF STATE]
proof (state)
this:
b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)

goal (1 subgoal):
 1. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
hence "card {x. a < x \<and> x < b \<and> poly p x = 0} = 0"
[PROOF STATE]
proof (prove)
using this:
b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)

goal (1 subgoal):
 1. card {x. a < x \<and> x < b \<and> poly p x = 0} = 0
[PROOF STEP]
by (subst poly_card_roots_less_less, auto simp: count_roots_between_def)
[PROOF STATE]
proof (state)
this:
card {x. a < x \<and> x < b \<and> poly p x = 0} = 0

goal (1 subgoal):
 1. b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0) \<Longrightarrow> \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
card {x. a < x \<and> x < b \<and> poly p x = 0} = 0

goal (1 subgoal):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
using prems
[PROOF STATE]
proof (prove)
using this:
card {x. a < x \<and> x < b \<and> poly p x = 0} = 0
b \<le> a \<or> p \<noteq> 0 \<and> count_roots_between p a b = (if poly p b = 0 then 1 else 0)

goal (1 subgoal):
 1. \<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by (cases "p = 0", simp, subst (asm) card_eq_0_iff,
            auto dest: poly_roots_finite)
[PROOF STATE]
proof (state)
this:
\<forall>x. a < x \<and> x < b \<longrightarrow> poly p x \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floorlog_leD:
  "floorlog b x \<le> w \<Longrightarrow> b > 1 \<Longrightarrow> x < b ^ w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>floorlog b x \<le> w; 1 < b\<rbrakk> \<Longrightarrow> x < b ^ w
[PROOF STEP]
by (metis floorlog_bounds leD linorder_neqE_nat order.strict_trans power_strict_increasing_iff
      zero_less_one zero_less_power)


[STATEMENT]
lemma (in finite_comm_group) is_iso_Characters_FactGroup:
  assumes H: "subgroup H G"
  shows "Characters (G Mod H) \<cong> (Characters G)\<lparr>carrier := {\<chi>\<in>characters G. \<forall>x\<in>H. \<chi> x = 1}\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Characters (G Mod H) \<cong> Characters G\<lparr>carrier := {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1}\<rparr>
[PROOF STEP]
using iso_Characters_FactGroup[OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>\<chi> x. if x \<in> carrier G then \<chi> (H #> x) else 0) \<in> Group.iso (Characters (G Mod H)) (Characters G\<lparr>carrier := {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1}\<rparr>)

goal (1 subgoal):
 1. Characters (G Mod H) \<cong> Characters G\<lparr>carrier := {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1}\<rparr>
[PROOF STEP]
unfolding is_iso_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>\<chi> x. if x \<in> carrier G then \<chi> (H #> x) else 0) \<in> Group.iso (Characters (G Mod H)) (Characters G\<lparr>carrier := {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1}\<rparr>)

goal (1 subgoal):
 1. Group.iso (Characters (G Mod H)) (Characters G\<lparr>carrier := {\<chi> \<in> characters G. \<forall>x\<in>H. \<chi> x = 1}\<rparr>) \<noteq> {}
[PROOF STEP]
by blast


[STATEMENT]
lemma open_uminus_iff:
  fixes S :: "ereal set"
  shows "open (uminus ` S) \<longleftrightarrow> open S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (uminus ` S) = open S
[PROOF STEP]
using ereal_open_uminus[of S] ereal_open_uminus[of "uminus ` S"]
[PROOF STATE]
proof (prove)
using this:
open S \<Longrightarrow> open (uminus ` S)
open (uminus ` S) \<Longrightarrow> open (uminus ` uminus ` S)

goal (1 subgoal):
 1. open (uminus ` S) = open S
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_scalar_nth_axis: "sum (\<lambda>i. (x $ i) *s \<e> i) UNIV = x" for x :: "('a::semiring_1)^'n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. x $ i *s \<e> i) = x
[PROOF STEP]
unfolding vec_eq_iff axis_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. (\<Sum>i\<in>UNIV. x $ i *s (\<chi>ia. if ia = i then 1::'a else (0::'a))) $ i = x $ i
[PROOF STEP]
by simp


[STATEMENT]
lemma (in complete_lattice) Sup_sup_pred: "x \<squnion> \<Squnion>{y. P y} = \<Squnion>{y. y = x \<or> P y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> \<Squnion>{y. P y} = \<Squnion>{y. y = x \<or> P y}
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<squnion> \<Squnion>{y. P y} \<le> \<Squnion>{y. y = x \<or> P y}
 2. \<Squnion>{y. y = x \<or> P y} \<le> x \<squnion> \<Squnion>{y. P y}
[PROOF STEP]
apply (simp add: Collect_mono Sup_subset_mono Sup_upper)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>{y. y = x \<or> P y} \<le> x \<squnion> \<Squnion>{y. P y}
[PROOF STEP]
using Sup_least Sup_upper sup.coboundedI2
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> ?A \<Longrightarrow> x \<le> ?z) \<Longrightarrow> \<Squnion>?A \<le> ?z
?x \<in> ?A \<Longrightarrow> ?x \<le> \<Squnion>?A
?c \<le> ?b \<Longrightarrow> ?c \<le> ?a \<squnion> ?b

goal (1 subgoal):
 1. \<Squnion>{y. y = x \<or> P y} \<le> x \<squnion> \<Squnion>{y. P y}
[PROOF STEP]
by force