[STATEMENT]
lemma integral_has_vector_derivative':
  fixes f :: "real \<Rightarrow> 'a::banach"
  assumes "finite s"
    "f integrable_on {a..b}"
    "x \<in> {a..b} - s"
    "continuous (at x within {a..b} - s) f"
  shows "((\<lambda>u. integral {a .. u} f) has_vector_derivative f(x)) (at x within {a .. b} - s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>u. integral {a..u} f) has_vector_derivative f x) (at x within {a..b} - s)
[PROOF STEP]
apply (rule integral_has_vector_derivative_continuous_at')
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. finite s
 2. f integrable_on {a..b}
 3. x \<in> {a..b} - s
 4. continuous (at x within {a..b} - s) f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite s
f integrable_on {a..b}
x \<in> {a..b} - s
continuous (at x within {a..b} - s) f

goal (4 subgoals):
 1. finite s
 2. f integrable_on {a..b}
 3. x \<in> {a..b} - s
 4. continuous (at x within {a..b} - s) f
[PROOF STEP]
apply (auto simp: continuous_on_eq_continuous_within)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma l_count_app: "l_count x (ys @ zs) = l_count x ys + l_count x zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l_count x (ys @ zs) = l_count x ys + l_count x zs
[PROOF STEP]
by (simp add: l_count_def)


[STATEMENT]
lemma enat_0_less_mult_iff: "(0 < (m::enat) * n) = (0 < m \<and> 0 < n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < m * n) = (0 < m \<and> 0 < n)
[PROOF STEP]
by (simp only: zero_less_iff_neq_zero mult_eq_0_iff, simp)


[STATEMENT]
lemma mul_eq_and_mul_imp_mul: assumes "trans r" and "(M,N) \<in> mul_eq r" and "(N,P) \<in> mul r" shows "(M,P) \<in> mul r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M, P) \<in> mul r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
trans r
(M, N) \<in> mul_eq r
(N, P) \<in> mul r

goal (1 subgoal):
 1. (M, P) \<in> mul r
[PROOF STEP]
unfolding mult_is_mul[symmetric,OF assms(1)] mult_eq_is_mul_eq[symmetric,OF assms(1)] mult_def mult_eq_def
[PROOF STATE]
proof (prove)
using this:
trans r
(M, N) \<in> (mult1 r)\<^sup>*
(N, P) \<in> (mult1 r)\<^sup>+

goal (1 subgoal):
 1. (M, P) \<in> (mult1 r)\<^sup>+
[PROOF STEP]
by auto


[STATEMENT]
lemma LIMSEQ_powrat_exponent:
  "\<lbrakk> X \<longlonglongrightarrow> x; a > 0 \<rbrakk> \<Longrightarrow> (\<lambda>n. a pow\<^sub>\<rat> (X n)) \<longlonglongrightarrow> a pow\<^sub>\<rat> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow> x; 0 < a\<rbrakk> \<Longrightarrow> (\<lambda>n. a pow\<^sub>\<rat> X n) \<longlonglongrightarrow> a pow\<^sub>\<rat> x
[PROOF STEP]
by (metis isCont_tendsto_compose isCont_powrat_exponent)


[STATEMENT]
lemma convexI:
  assumes "\<And>x y u v. x \<in> s \<Longrightarrow> y \<in> s \<Longrightarrow> 0 \<le> u \<Longrightarrow> 0 \<le> v \<Longrightarrow> u + v = 1 \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s"
  shows "convex s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> s; ?y \<in> s; 0 \<le> ?u; 0 \<le> ?v; ?u + ?v = 1\<rbrakk> \<Longrightarrow> ?u *\<^sub>R ?x + ?v *\<^sub>R ?y \<in> s

goal (1 subgoal):
 1. convex s
[PROOF STEP]
unfolding convex_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> s; ?y \<in> s; 0 \<le> ?u; 0 \<le> ?v; ?u + ?v = 1\<rbrakk> \<Longrightarrow> ?u *\<^sub>R ?x + ?v *\<^sub>R ?y \<in> s

goal (1 subgoal):
 1. \<forall>x\<in>s. \<forall>y\<in>s. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s
[PROOF STEP]
by fast


[STATEMENT]
lemma fmap_rel_alt_def:
  \<open>\<langle>K, V\<rangle>fmap_rel \<equiv>
     {(m1, m2).
      (\<forall>i j. i \<in># dom_m m2 \<longrightarrow>
             (j, i) \<in> K \<longrightarrow> (the (fmlookup m1 j), the (fmlookup m2 i)) \<in> V) \<and>
      fset (fmdom m1) \<subseteq> Domain K \<and>
      fset (fmdom m2) \<subseteq> Range K \<and>
      (\<forall>i j. (i, j) \<in> K \<longrightarrow> (j \<in># dom_m m2) = (i \<in># dom_m m1))}
\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>K, V\<rangle>fmap_rel \<equiv> {(m1, m2). (\<forall>i j. i \<in># dom_m m2 \<longrightarrow> (j, i) \<in> K \<longrightarrow> (the (fmlookup m1 j), the (fmlookup m2 i)) \<in> V) \<and> fset (fmdom m1) \<subseteq> Domain K \<and> fset (fmdom m2) \<subseteq> Range K \<and> (\<forall>i j. (i, j) \<in> K \<longrightarrow> (j \<in># dom_m m2) = (i \<in># dom_m m1))}
[PROOF STEP]
unfolding fmap_rel_def dom_m_def fmember.rep_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(m1, m2). (\<forall>i j. i \<in> fset (fmdom m2) \<longrightarrow> (j, i) \<in> K \<longrightarrow> (the (fmlookup m1 j), the (fmlookup m2 i)) \<in> V) \<and> fset (fmdom m1) \<subseteq> Domain K \<and> fset (fmdom m2) \<subseteq> Range K \<and> (\<forall>i j. (i, j) \<in> K \<longrightarrow> (j \<in> fset (fmdom m2)) = (i \<in> fset (fmdom m1)))} \<equiv> {(m1, m2). (\<forall>i j. i \<in># mset_fset (fmdom m2) \<longrightarrow> (j, i) \<in> K \<longrightarrow> (the (fmlookup m1 j), the (fmlookup m2 i)) \<in> V) \<and> fset (fmdom m1) \<subseteq> Domain K \<and> fset (fmdom m2) \<subseteq> Range K \<and> (\<forall>i j. (i, j) \<in> K \<longrightarrow> (j \<in># mset_fset (fmdom m2)) = (i \<in># mset_fset (fmdom m1)))}
[PROOF STEP]
by auto


[STATEMENT]
lemma mtx2_to_mtx: "mtx
  ([a, b] #
   [c, d] # []) =
  to_mtx (\<chi> i j::2. if i=1 \<and> j=1 then a
  else (if i=1 \<and> j=2 then b
  else (if i=2 \<and> j=1 then c
  else d)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mtx [[a, b], [c, d]] = to_mtx (\<chi>i j. if i = 1 \<and> j = 1 then a else if i = 1 \<and> j = 2 then b else if i = 2 \<and> j = 1 then c else d)
[PROOF STEP]
apply(subst sq_mtx_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i j. mtx [[a, b], [c, d]] $$ i $ j = to_mtx (\<chi>i j. if i = 1 \<and> j = 1 then a else if i = 1 \<and> j = 2 then b else if i = 2 \<and> j = 1 then c else d) $$ i $ j
[PROOF STEP]
using exhaust_2
[PROOF STATE]
proof (prove)
using this:
?x = 1 \<or> ?x = 2

goal (1 subgoal):
 1. \<forall>i j. mtx [[a, b], [c, d]] $$ i $ j = to_mtx (\<chi>i j. if i = 1 \<and> j = 1 then a else if i = 1 \<and> j = 2 then b else if i = 2 \<and> j = 1 then c else d) $$ i $ j
[PROOF STEP]
by force


[STATEMENT]
lemma div_less_conv: "0 < (m::nat) \<Longrightarrow> (n div m < k) = (n < k * m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (n div m < k) = (n < k * m)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; n div m < k\<rbrakk> \<Longrightarrow> n < k * m
 2. \<lbrakk>0 < m; n < k * m\<rbrakk> \<Longrightarrow> n div m < k
[PROOF STEP]
apply (rule div_less_imp_less_mult, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; n < k * m\<rbrakk> \<Longrightarrow> n div m < k
[PROOF STEP]
apply (rule less_mult_imp_div_less, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cot_npi [simp]: "cot (real n * pi) = 0"
  for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot (real n * pi) = 0
[PROOF STEP]
by (simp add: cot_def)


[STATEMENT]
lemma sum_fun_insert:
  fixes f :: "'a \<Rightarrow> 'b::join_semilattice_zero"
  assumes "finite (A :: 'a set)"
  shows "\<Sum>(f ` (insert x A)) = f x + \<Sum>(f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> (f ` insert x A) = f x + \<Sum> (f ` A)
[PROOF STEP]
by (simp add: assms)


[STATEMENT]
lemma ratfps_dvd_code [code_unfold]:
  "x dvd y \<longleftrightarrow> y = 0 \<or> (x \<noteq> 0 \<and> ratfps_subdegree x \<le> ratfps_subdegree y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x dvd y) = (y = 0 \<or> x \<noteq> 0 \<and> ratfps_subdegree x \<le> ratfps_subdegree y)
[PROOF STEP]
using fps_dvd_code [of "fps_of_ratfps x" "fps_of_ratfps y"]
[PROOF STATE]
proof (prove)
using this:
(fps_of_ratfps x dvd fps_of_ratfps y) = (fps_of_ratfps y = 0 \<or> fps_of_ratfps x \<noteq> 0 \<and> subdegree (fps_of_ratfps x) \<le> subdegree (fps_of_ratfps y))

goal (1 subgoal):
 1. (x dvd y) = (y = 0 \<or> x \<noteq> 0 \<and> ratfps_subdegree x \<le> ratfps_subdegree y)
[PROOF STEP]
by (simp add: ratfps_subdegree_altdef)


[STATEMENT]
lemma ennreal_divide_eq_0_iff[simp]: "(a::ennreal) / b = 0 \<longleftrightarrow> (a = 0 \<or> b = top)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a / b = 0) = (a = 0 \<or> b = top)
[PROOF STEP]
by (simp add: divide_ennreal_def)


[STATEMENT]
lemma genPrefix_trans:
  "(x, y) \<in> genPrefix r \<Longrightarrow> (y, z) \<in> genPrefix r \<Longrightarrow> trans r
    \<Longrightarrow> (x, z) \<in> genPrefix r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> genPrefix r; (y, z) \<in> genPrefix r; trans r\<rbrakk> \<Longrightarrow> (x, z) \<in> genPrefix r
[PROOF STEP]
apply (rule trans_O_subset [THEN genPrefix_mono, THEN subsetD])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(x, y) \<in> genPrefix r; (y, z) \<in> genPrefix r; trans r\<rbrakk> \<Longrightarrow> trans r
 2. \<lbrakk>(x, y) \<in> genPrefix r; (y, z) \<in> genPrefix r; trans r\<rbrakk> \<Longrightarrow> (x, z) \<in> genPrefix (r O r)
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> genPrefix r; (y, z) \<in> genPrefix r; trans r\<rbrakk> \<Longrightarrow> (x, z) \<in> genPrefix (r O r)
[PROOF STEP]
apply (blast intro: genPrefix_trans_O)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma GS_rec_step_elem: "GS_rec_step d v $ s = r (s, d s) + l * ((\<Sum>s' < s. pmf (K (s, d s)) s' * GS_rec v $ s') + (\<Sum>s' \<in> {s'. s \<le> s'}. pmf (K (s, d s)) s' * v $ s'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GS_rec_step d v $ s = r (s, d s) + l * ((\<Sum>s'<s. pmf (K (s, d s)) s' * GS_rec v $ s') + (\<Sum>s' | s \<le> s'. pmf (K (s, d s)) s' * v $ s'))
[PROOF STEP]
unfolding GS_rec_step_def P_upper_def P_lower_def lessThan_def P_dec_elem matrix_vector_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r_vec d + l *\<^sub>R ((\<chi>i. \<Sum>j\<in>UNIV. (\<chi>i j. if j < i then pmf (K (i, d i)) j else 0) $ i $ j * GS_rec v $ j) + (\<chi>i. \<Sum>j\<in>UNIV. (\<chi>i j. if i \<le> j then pmf (K (i, d i)) j else 0) $ i $ j * v $ j))) $ s = r (s, d s) + l * ((\<Sum>s'\<in>{x. x < s}. pmf (K (s, d s)) s' * GS_rec v $ s') + (\<Sum>s' | s \<le> s'. pmf (K (s, d s)) s' * v $ s'))
[PROOF STEP]
by (auto simp: sum.If_cases algebra_simps if_distrib[of "\<lambda>x. _ $ _ * x"])


[STATEMENT]
lemma of_nat_stirling_Suc_n_2:
  assumes "n \<ge> Suc 0"
  shows "(of_nat (stirling (Suc n) 2)::'a::field_char_0) = fact n * (\<Sum>k=1..n. (1 / of_nat k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<le> n

goal (1 subgoal):
 1. of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc 0 \<le> 0 \<Longrightarrow> of_nat (stirling (Suc 0) 2) = fact 0 * (\<Sum>k = 1..0. (1::'a) / of_nat k)
 2. \<And>n. \<lbrakk>Suc 0 \<le> n \<Longrightarrow> of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k); Suc 0 \<le> Suc n\<rbrakk> \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
Suc 0 \<le> 0

goal (2 subgoals):
 1. Suc 0 \<le> 0 \<Longrightarrow> of_nat (stirling (Suc 0) 2) = fact 0 * (\<Sum>k = 1..0. (1::'a) / of_nat k)
 2. \<And>n. \<lbrakk>Suc 0 \<le> n \<Longrightarrow> of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k); Suc 0 \<le> Suc n\<rbrakk> \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc 0 \<le> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<le> 0

goal (1 subgoal):
 1. of_nat (stirling (Suc 0) 2) = fact 0 * (\<Sum>k = 1..0. (1::'a) / of_nat k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_nat (stirling (Suc 0) 2) = fact 0 * (\<Sum>k = 1..0. (1::'a) / of_nat k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Suc 0 \<le> n \<Longrightarrow> of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k); Suc 0 \<le> Suc n\<rbrakk> \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Suc 0 \<le> n \<Longrightarrow> of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k); Suc 0 \<le> Suc n\<rbrakk> \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
Suc 0 \<le> n \<Longrightarrow> of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)
Suc 0 \<le> Suc n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Suc 0 \<le> n \<Longrightarrow> of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k); Suc 0 \<le> Suc n\<rbrakk> \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
 2. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
 2. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
by (auto simp add: numerals(2))
[PROOF STATE]
proof (state)
this:
of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
n = Suc nat_

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = Suc nat_
[PROOF STEP]
have geq1: "Suc 0 \<le> n"
[PROOF STATE]
proof (prove)
using this:
n = Suc nat_

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

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
have "(of_nat (stirling (Suc (Suc n)) 2)::'a) =
        of_nat (Suc n * stirling (Suc n) 2 + stirling (Suc n) (Suc 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (stirling (Suc (Suc n)) 2) = of_nat (Suc n * stirling (Suc n) 2 + stirling (Suc n) (Suc 0))
[PROOF STEP]
by (simp only: stirling.simps(4)[of "Suc n"] numerals(2))
[PROOF STATE]
proof (state)
this:
of_nat (stirling (Suc (Suc n)) 2) = of_nat (Suc n * stirling (Suc n) 2 + stirling (Suc n) (Suc 0))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (stirling (Suc (Suc n)) 2) = of_nat (Suc n * stirling (Suc n) 2 + stirling (Suc n) (Suc 0))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
have "\<dots> = of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. 1 / of_nat k)) + fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (Suc n * stirling (Suc n) 2 + stirling (Suc n) (Suc 0)) = of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)) + fact n
[PROOF STEP]
using Suc.hyps[OF geq1]
[PROOF STATE]
proof (prove)
using this:
of_nat (stirling (Suc n) 2) = fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)

goal (1 subgoal):
 1. of_nat (Suc n * stirling (Suc n) 2 + stirling (Suc n) (Suc 0)) = of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)) + fact n
[PROOF STEP]
by (simp only: stirling_Suc_n_1 of_nat_fact of_nat_add of_nat_mult)
[PROOF STATE]
proof (state)
this:
of_nat (Suc n * stirling (Suc n) 2 + stirling (Suc n) (Suc 0)) = of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)) + fact n

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (Suc n * stirling (Suc n) 2 + stirling (Suc n) (Suc 0)) = of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)) + fact n

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
have "\<dots> = fact (Suc n) * (\<Sum>k = 1..n. 1 / of_nat k) + fact (Suc n) * (1 / of_nat (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)) + fact n = fact (Suc n) * (\<Sum>k = 1..n. (1::'a) / of_nat k) + fact (Suc n) * ((1::'a) / of_nat (Suc n))
[PROOF STEP]
using of_nat_neq_0
[PROOF STATE]
proof (prove)
using this:
of_nat (Suc ?n) \<noteq> (0::?'a)

goal (1 subgoal):
 1. of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)) + fact n = fact (Suc n) * (\<Sum>k = 1..n. (1::'a) / of_nat k) + fact (Suc n) * ((1::'a) / of_nat (Suc n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)) + fact n = fact (Suc n) * (\<Sum>k = 1..n. (1::'a) / of_nat k) + fact (Suc n) * ((1::'a) / of_nat (Suc n))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (Suc n) * (fact n * (\<Sum>k = 1..n. (1::'a) / of_nat k)) + fact n = fact (Suc n) * (\<Sum>k = 1..n. (1::'a) / of_nat k) + fact (Suc n) * ((1::'a) / of_nat (Suc n))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
have "\<dots> = fact (Suc n) * (\<Sum>k = 1..Suc n. 1 / of_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (Suc n) * (\<Sum>k = 1..n. (1::'a) / of_nat k) + fact (Suc n) * ((1::'a) / of_nat (Suc n)) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
by (simp add: distrib_left)
[PROOF STATE]
proof (state)
this:
fact (Suc n) * (\<Sum>k = 1..n. (1::'a) / of_nat k) + fact (Suc n) * ((1::'a) / of_nat (Suc n)) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)

goal (1 subgoal):
 1. of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_nat (stirling (Suc (Suc n)) 2) = fact (Suc n) * (\<Sum>k = 1..Suc n. (1::'a) / of_nat k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smallo_imp_le_real:
  assumes "f \<in> o[F](g)" "eventually (\<lambda>x. g x \<ge> (0::real)) F"
  shows   "eventually (\<lambda>x. f x \<le> g x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<le> g x
[PROOF STEP]
using landau_o.smallD[OF assms(1) zero_less_one] assms(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. norm (f x) \<le> 1 * norm (g x)
\<forall>\<^sub>F x in F. 0 \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<le> g x
[PROOF STEP]
by eventually_elim simp


[STATEMENT]
lemma (in dense_linorder) atLeastAtMost_subseteq_greaterThanLessThan_iff:
  "{a .. b} \<subseteq> { c <..< d } \<longleftrightarrow> (a \<le> b \<longrightarrow> c < a \<and> b < d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a..b} \<subseteq> {c<..<d}) = (a \<le> b \<longrightarrow> c < a \<and> b < d)
[PROOF STEP]
using dense[of "a" "min c b"] dense[of "max a d" "b"]
[PROOF STATE]
proof (prove)
using this:
a < min c b \<Longrightarrow> \<exists>z>a. z < min c b
max a d < b \<Longrightarrow> \<exists>z>max a d. z < b

goal (1 subgoal):
 1. ({a..b} \<subseteq> {c<..<d}) = (a \<le> b \<longrightarrow> c < a \<and> b < d)
[PROOF STEP]
by (force simp: subset_eq Ball_def not_less[symmetric])


[STATEMENT]
lemma lm046:
  assumes "X \<inter> Y  =  {}"
  shows "R``X = (R outside Y)``X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R `` X = (R outside Y) `` X
[PROOF STEP]
using assms Outside_def Image_def
[PROOF STATE]
proof (prove)
using this:
X \<inter> Y = {}
?R outside ?X = ?R - ?X \<times> Range ?R
?r `` ?s = {y. \<exists>x\<in>?s. (x, y) \<in> ?r}

goal (1 subgoal):
 1. R `` X = (R outside Y) `` X
[PROOF STEP]
by blast


[STATEMENT]
theorem nn_integral_suminf:
  assumes f: "\<And>i. f i \<in> borel_measurable M"
  shows "(\<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M) = (\<Sum>i. integral\<^sup>N M (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
have all_pos: "AE x in M. \<forall>i. 0 \<le> f i x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. \<forall>i. 0 \<le> f i x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f ?i \<in> borel_measurable M

goal (1 subgoal):
 1. AE x in M. \<forall>i. 0 \<le> f i x
[PROOF STEP]
by (auto simp: AE_all_countable)
[PROOF STATE]
proof (state)
this:
AE x in M. \<forall>i. 0 \<le> f i x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
have "(\<Sum>i. integral\<^sup>N M (f i)) = (SUP n. \<Sum>i<n. integral\<^sup>N M (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. integral\<^sup>N M (f i)) = (SUP n. \<Sum>i<n. integral\<^sup>N M (f i))
[PROOF STEP]
by (rule suminf_eq_SUP)
[PROOF STATE]
proof (state)
this:
(\<Sum>i. integral\<^sup>N M (f i)) = (SUP n. \<Sum>i<n. integral\<^sup>N M (f i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i. integral\<^sup>N M (f i)) = (SUP n. \<Sum>i<n. integral\<^sup>N M (f i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
have "\<dots> = (SUP n. \<integral>\<^sup>+x. (\<Sum>i<n. f i x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP n. \<Sum>i<n. integral\<^sup>N M (f i)) = (SUP n. \<integral>\<^sup>+ x. (\<Sum>i<n. f i x) \<partial>M)
[PROOF STEP]
unfolding nn_integral_sum[OF f]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP n. \<Sum>i<n. integral\<^sup>N M (f i)) = (SUP n. \<Sum>i<n. integral\<^sup>N M (f i))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(SUP n. \<Sum>i<n. integral\<^sup>N M (f i)) = (SUP n. \<integral>\<^sup>+ x. (\<Sum>i<n. f i x) \<partial>M)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(SUP n. \<Sum>i<n. integral\<^sup>N M (f i)) = (SUP n. \<integral>\<^sup>+ x. (\<Sum>i<n. f i x) \<partial>M)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+x. (SUP n. \<Sum>i<n. f i x) \<partial>M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP n. \<integral>\<^sup>+ x. (\<Sum>i<n. f i x) \<partial>M) = \<integral>\<^sup>+ x. (SUP n. \<Sum>i<n. f i x) \<partial>M
[PROOF STEP]
using f all_pos
[PROOF STATE]
proof (prove)
using this:
f ?i \<in> borel_measurable M
AE x in M. \<forall>i. 0 \<le> f i x

goal (1 subgoal):
 1. (SUP n. \<integral>\<^sup>+ x. (\<Sum>i<n. f i x) \<partial>M) = \<integral>\<^sup>+ x. (SUP n. \<Sum>i<n. f i x) \<partial>M
[PROOF STEP]
by (intro nn_integral_monotone_convergence_SUP_AE[symmetric])
       (elim AE_mp, auto simp: sum_nonneg simp del: sum.lessThan_Suc intro!: AE_I2 sum_mono2)
[PROOF STATE]
proof (state)
this:
(SUP n. \<integral>\<^sup>+ x. (\<Sum>i<n. f i x) \<partial>M) = \<integral>\<^sup>+ x. (SUP n. \<Sum>i<n. f i x) \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(SUP n. \<integral>\<^sup>+ x. (\<Sum>i<n. f i x) \<partial>M) = \<integral>\<^sup>+ x. (SUP n. \<Sum>i<n. f i x) \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+x. (\<Sum>i. f i x) \<partial>M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP n. \<Sum>i<n. f i x) \<partial>M = \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M
[PROOF STEP]
using all_pos
[PROOF STATE]
proof (prove)
using this:
AE x in M. \<forall>i. 0 \<le> f i x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP n. \<Sum>i<n. f i x) \<partial>M = \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M
[PROOF STEP]
by (intro nn_integral_cong_AE) (auto simp: suminf_eq_SUP)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP n. \<Sum>i<n. f i x) \<partial>M = \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i. integral\<^sup>N M (f i)) = \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. integral\<^sup>N M (f i)) = \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M = (\<Sum>i. integral\<^sup>N M (f i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_factorization_lcm_factorial:
  assumes [simp]: "a \<noteq> 0" "b \<noteq> 0"
  shows   "prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b
[PROOF STEP]
have "prime_factorization (lcm_factorial a b) =
          prime_factorization (prod_mset (prime_factorization a \<union># prime_factorization b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (lcm_factorial a b) = prime_factorization (\<Prod>\<^sub># (prime_factorization a \<union># prime_factorization b))
[PROOF STEP]
by (simp add: lcm_factorial_def)
[PROOF STATE]
proof (state)
this:
prime_factorization (lcm_factorial a b) = prime_factorization (\<Prod>\<^sub># (prime_factorization a \<union># prime_factorization b))

goal (1 subgoal):
 1. prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization (lcm_factorial a b) = prime_factorization (\<Prod>\<^sub># (prime_factorization a \<union># prime_factorization b))

goal (1 subgoal):
 1. prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b
[PROOF STEP]
have "\<dots> = prime_factorization a \<union># prime_factorization b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (\<Prod>\<^sub># (prime_factorization a \<union># prime_factorization b)) = prime_factorization a \<union># prime_factorization b
[PROOF STEP]
by (subst prime_factorization_prod_mset_primes) auto
[PROOF STATE]
proof (state)
this:
prime_factorization (\<Prod>\<^sub># (prime_factorization a \<union># prime_factorization b)) = prime_factorization a \<union># prime_factorization b

goal (1 subgoal):
 1. prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b

goal (1 subgoal):
 1. prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prime_factorization (lcm_factorial a b) = prime_factorization a \<union># prime_factorization b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interval_integral_endpoints_same [simp]: "(LBINT x=a..a. f x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integral lborel a a f = (0::'a)
[PROOF STEP]
by (simp add: interval_lebesgue_integral_def set_lebesgue_integral_def einterval_same)


[STATEMENT]
lemma null_if_pos_func_has_zero_nn_int:
  fixes f::"'a \<Rightarrow> ennreal"
  assumes [measurable]: "f \<in> borel_measurable M" "A \<in> sets M"
    and "AE x\<in>A in M. f x > 0" "(\<integral>\<^sup>+x\<in>A. f x \<partial>M) = 0"
  shows "A \<in> null_sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> null_sets M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<in> null_sets M
[PROOF STEP]
have "AE x in M. f x * indicator A x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. f x * indicator A x = 0
[PROOF STEP]
by (subst nn_integral_0_iff_AE[symmetric], auto simp add: assms(4))
[PROOF STATE]
proof (state)
this:
AE x in M. f x * indicator A x = 0

goal (1 subgoal):
 1. A \<in> null_sets M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE x in M. f x * indicator A x = 0
[PROOF STEP]
have "AE x\<in>A in M. False"
[PROOF STATE]
proof (prove)
using this:
AE x in M. f x * indicator A x = 0

goal (1 subgoal):
 1. AE x\<in>A in M. False
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
AE x in M. f x * indicator A x = 0
AE x\<in>A in M. 0 < f x

goal (1 subgoal):
 1. AE x\<in>A in M. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x\<in>A in M. False

goal (1 subgoal):
 1. A \<in> null_sets M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE x\<in>A in M. False
[PROOF STEP]
show "A \<in> null_sets M"
[PROOF STATE]
proof (prove)
using this:
AE x\<in>A in M. False

goal (1 subgoal):
 1. A \<in> null_sets M
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
AE x\<in>A in M. False
A \<in> sets M

goal (1 subgoal):
 1. A \<in> null_sets M
[PROOF STEP]
by (simp add: AE_iff_null_sets)
[PROOF STATE]
proof (state)
this:
A \<in> null_sets M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_ge_1_int: "prime p \<Longrightarrow> p \<ge> (1::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> 1 \<le> p
[PROOF STEP]
using prime_ge_2_int [of p]
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 2 \<le> p

goal (1 subgoal):
 1. prime p \<Longrightarrow> 1 \<le> p
[PROOF STEP]
by simp


[STATEMENT]
lemma card_plus_sing:
  fixes A :: "'a::ab_group_add set"
  shows "card (A + {a}) = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A + {a}) = card A
[PROOF STEP]
proof (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw ?f (A + {a}) A
[PROOF STEP]
show "bij_betw ((+) (-a)) (A + {a}) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((+) (- a)) (A + {a}) A
[PROOF STEP]
by (fastforce simp: set_plus_def bij_betw_def image_iff)
[PROOF STATE]
proof (state)
this:
bij_betw ((+) (- a)) (A + {a}) A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_distrib:
  fixes SX :: "program \<Rightarrow> nat \<Rightarrow> (nat \<Rightarrow> nat) \<Rightarrow> nat"
    and p :: program

assumes SX_simps: "\<And>h. SX p x h = (\<Sum>k = 0..length p-1. if g x k then h k else 0)"

shows "SX p x h1 + SX p x h2 = SX p x (\<lambda>k. h1 k + h2 k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SX p x h1 + SX p x h2 = SX p x (\<lambda>k. h1 k + h2 k)
[PROOF STEP]
by (subst SX_simps)+ (auto simp: sum.distrib[symmetric] intro: sum.cong)


[STATEMENT]
lemma (in comm_group) finprod_comp:
  assumes "inj_on g A" "(f \<circ> g) ` A \<subseteq> carrier G"
  shows "finprod G f (g ` A) = finprod G (f \<circ> g) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f (g ` A) = finprod G (f \<circ> g) A
[PROOF STEP]
using finprod_reindex[OF _ assms(1), of f]
[PROOF STATE]
proof (prove)
using this:
f \<in> g ` A \<rightarrow> carrier G \<Longrightarrow> finprod G f (g ` A) = (\<Otimes>x\<in>A. f (g x))

goal (1 subgoal):
 1. finprod G f (g ` A) = finprod G (f \<circ> g) A
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
f \<in> g ` A \<rightarrow> carrier G \<Longrightarrow> finprod G f (g ` A) = (\<Otimes>x\<in>A. f (g x))
(f \<circ> g) ` A \<subseteq> carrier G

goal (1 subgoal):
 1. finprod G f (g ` A) = finprod G (f \<circ> g) A
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
using this:
f \<in> g ` A \<rightarrow> carrier G \<Longrightarrow> finprod G f (g ` A) = (\<Otimes>x\<in>A. f (g x))
(\<lambda>x. f (g x)) ` A \<subseteq> carrier G

goal (1 subgoal):
 1. finprod G f (g ` A) = (\<Otimes>x\<in>A. f (g x))
[PROOF STEP]
by blast


[STATEMENT]
lemma restrict_count_space: "restrict_space (count_space B) A = count_space (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict_space (count_space B) A = count_space (A \<inter> B)
[PROOF STEP]
proof (rule measure_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sets (restrict_space (count_space B) A) = sets (count_space (A \<inter> B))
 2. \<And>Aa. Aa \<in> sets (restrict_space (count_space B) A) \<Longrightarrow> emeasure (restrict_space (count_space B) A) Aa = emeasure (count_space (A \<inter> B)) Aa
[PROOF STEP]
show "sets (restrict_space (count_space B) A) = sets (count_space (A \<inter> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (restrict_space (count_space B) A) = sets (count_space (A \<inter> B))
[PROOF STEP]
by (subst sets_restrict_space) auto
[PROOF STATE]
proof (state)
this:
sets (restrict_space (count_space B) A) = sets (count_space (A \<inter> B))

goal (1 subgoal):
 1. \<And>Aa. Aa \<in> sets (restrict_space (count_space B) A) \<Longrightarrow> emeasure (restrict_space (count_space B) A) Aa = emeasure (count_space (A \<inter> B)) Aa
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sets (restrict_space (count_space B) A) = sets (count_space (A \<inter> B))

goal (1 subgoal):
 1. \<And>Aa. Aa \<in> sets (restrict_space (count_space B) A) \<Longrightarrow> emeasure (restrict_space (count_space B) A) Aa = emeasure (count_space (A \<inter> B)) Aa
[PROOF STEP]
fix X
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Aa. Aa \<in> sets (restrict_space (count_space B) A) \<Longrightarrow> emeasure (restrict_space (count_space B) A) Aa = emeasure (count_space (A \<inter> B)) Aa
[PROOF STEP]
assume "X \<in> sets (restrict_space (count_space B) A)"
[PROOF STATE]
proof (state)
this:
X \<in> sets (restrict_space (count_space B) A)

goal (1 subgoal):
 1. \<And>Aa. Aa \<in> sets (restrict_space (count_space B) A) \<Longrightarrow> emeasure (restrict_space (count_space B) A) Aa = emeasure (count_space (A \<inter> B)) Aa
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sets (restrict_space (count_space B) A) = sets (count_space (A \<inter> B))
X \<in> sets (restrict_space (count_space B) A)
[PROOF STEP]
have "X \<subseteq> A \<inter> B"
[PROOF STATE]
proof (prove)
using this:
sets (restrict_space (count_space B) A) = sets (count_space (A \<inter> B))
X \<in> sets (restrict_space (count_space B) A)

goal (1 subgoal):
 1. X \<subseteq> A \<inter> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<subseteq> A \<inter> B

goal (1 subgoal):
 1. \<And>Aa. Aa \<in> sets (restrict_space (count_space B) A) \<Longrightarrow> emeasure (restrict_space (count_space B) A) Aa = emeasure (count_space (A \<inter> B)) Aa
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X \<subseteq> A \<inter> B
[PROOF STEP]
show "emeasure (restrict_space (count_space B) A) X = emeasure (count_space (A \<inter> B)) X"
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> A \<inter> B

goal (1 subgoal):
 1. emeasure (restrict_space (count_space B) A) X = emeasure (count_space (A \<inter> B)) X
[PROOF STEP]
by (cases "finite X") (auto simp add: emeasure_restrict_space)
[PROOF STATE]
proof (state)
this:
emeasure (restrict_space (count_space B) A) X = emeasure (count_space (A \<inter> B)) X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIM_fun_less_zero: "f \<midarrow>c\<rightarrow> l \<Longrightarrow> l < 0 \<Longrightarrow> \<exists>r. 0 < r \<and> (\<forall>x. x \<noteq> c \<and> \<bar>c - x\<bar> < r \<longrightarrow> f x < 0)"
  for f :: "real \<Rightarrow> real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<midarrow>c\<rightarrow> l; l < 0\<rbrakk> \<Longrightarrow> \<exists>r>0. \<forall>x. x \<noteq> c \<and> \<bar>c - x\<bar> < r \<longrightarrow> f x < 0
[PROOF STEP]
by (drule LIM_D [where r="-l"]) force+


[STATEMENT]
lemma order_0_monom [simp]: "c \<noteq> 0 \<Longrightarrow> order 0 (monom c n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> order (0::'a) (monom c n) = n
[PROOF STEP]
using order_power_n_n[of 0 n]
[PROOF STATE]
proof (prove)
using this:
order (0::?'b1) ([:- (0::?'b1), 1::?'b1:] ^ n) = n

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> order (0::'a) (monom c n) = n
[PROOF STEP]
by (simp add: monom_altdef order_smult)


[STATEMENT]
lemma integrable_cong:
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x = g x"
  shows   "f integrable_on A \<longleftrightarrow> g integrable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f integrable_on A) = (g integrable_on A)
[PROOF STEP]
using has_integral_cong [OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> ?s \<Longrightarrow> ?x1 x \<in> A) \<Longrightarrow> ((\<lambda>x. f (?x1 x)) has_integral ?i) ?s = ((\<lambda>x. g (?x1 x)) has_integral ?i) ?s

goal (1 subgoal):
 1. (f integrable_on A) = (g integrable_on A)
[PROOF STEP]
by fast


[STATEMENT]
lemma summable_rabs_cancel: "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> summable f"
  for f :: "nat \<Rightarrow> real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> summable f
[PROOF STEP]
by (rule summable_norm_cancel) simp


[STATEMENT]
lemma im_set_un1:"\<lbrakk>\<forall>l\<in>A. f l \<in> B; A = A1 \<union> A2\<rbrakk> \<Longrightarrow>
                                f `(A1 \<union> A2) = f `(A1) \<union> f `(A2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>l\<in>A. f l \<in> B; A = A1 \<union> A2\<rbrakk> \<Longrightarrow> f ` (A1 \<union> A2) = f ` A1 \<union> f ` A2
[PROOF STEP]
apply (rule equalityI,
       rule subsetI, simp add:image_def, erule bexE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa. \<lbrakk>\<forall>l\<in>A1 \<union> A2. f l \<in> B; A = A1 \<union> A2; xa \<in> A1 \<union> A2; x = f xa\<rbrakk> \<Longrightarrow> (\<exists>xa\<in>A1. x = f xa) \<or> (\<exists>xa\<in>A2. x = f xa)
 2. \<lbrakk>\<forall>l\<in>A. f l \<in> B; A = A1 \<union> A2\<rbrakk> \<Longrightarrow> f ` A1 \<union> f ` A2 \<subseteq> f ` (A1 \<union> A2)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>l\<in>A. f l \<in> B; A = A1 \<union> A2\<rbrakk> \<Longrightarrow> f ` A1 \<union> f ` A2 \<subseteq> f ` (A1 \<union> A2)
[PROOF STEP]
apply (rule subsetI,
       simp add:image_def, erule disjE, erule bexE, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>l\<in>A1 \<union> A2. f l \<in> B; A = A1 \<union> A2; \<exists>xa\<in>A2. x = f xa\<rbrakk> \<Longrightarrow> \<exists>xa\<in>A1 \<union> A2. x = f xa
[PROOF STEP]
apply (erule bexE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>\<forall>l\<in>A1 \<union> A2. f l \<in> B; A = A1 \<union> A2; xa \<in> A2; x = f xa\<rbrakk> \<Longrightarrow> \<exists>xa\<in>A1 \<union> A2. x = f xa
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_4_atLeast0 [simp]:"{0..<4::nat} = {0,1,2,3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<4} = {0, 1, 2, 3}
[PROOF STEP]
by auto


[STATEMENT]
lemma int_pow_val:
  assumes "a \<in> nonzero Q\<^sub>p"
  shows "val (a[^](i::int)) = i* (val a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (a [^] i) = eint i * val a
[PROOF STEP]
using int_pow_ord Qp_int_pow_nonzero assms times_eint_simps(1) val_ord
[PROOF STATE]
proof (prove)
using this:
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> ord (?a [^] ?i) = ?i * ord ?a
?x \<in> nonzero Q\<^sub>p \<Longrightarrow> ?x [^] ?n \<in> nonzero Q\<^sub>p
a \<in> nonzero Q\<^sub>p
eint ?m * eint ?n = eint (?m * ?n)
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> val ?a = eint (ord ?a)

goal (1 subgoal):
 1. val (a [^] i) = eint i * val a
[PROOF STEP]
by presburger


[STATEMENT]
lemma mult_right_bounds:
  fixes f g :: "real \<Rightarrow> real"
  shows "\<forall>x. f x \<in> {l x..u x} \<longrightarrow> g x \<ge> 0 \<longrightarrow> f x * g x \<in> {l x * g x..u x * g x}"
    and "\<forall>x. f x \<in> {l x..u x} \<longrightarrow> g x \<le> 0 \<longrightarrow> f x * g x \<in> {u x * g x..l x * g x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<in> {l x..u x} \<longrightarrow> 0 \<le> g x \<longrightarrow> f x * g x \<in> {l x * g x..u x * g x} &&& \<forall>x. f x \<in> {l x..u x} \<longrightarrow> g x \<le> 0 \<longrightarrow> f x * g x \<in> {u x * g x..l x * g x}
[PROOF STEP]
by (auto intro: mult_right_mono mult_right_mono_neg)


[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 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 product_simps[simp]:
      "alphabet\<^sub>2 (product AA) = \<Inter> (alphabet\<^sub>1 ` set AA)"
      "initial\<^sub>2 (product AA) = listset (map initial\<^sub>1 AA)"
      "transition\<^sub>2 (product AA) a ps = listset (map2 (\<lambda> A p. transition\<^sub>1 A a p) AA ps)"
      "condition\<^sub>2 (product AA) = condition (map condition\<^sub>1 AA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (alphabet\<^sub>2 (product AA) = \<Inter> (alphabet\<^sub>1 ` set AA) &&& initial\<^sub>2 (product AA) = listset (map initial\<^sub>1 AA)) &&& transition\<^sub>2 (product AA) a ps = listset (map2 (\<lambda>x. transition\<^sub>1 x a) AA ps) &&& condition\<^sub>2 (product AA) = condition (map condition\<^sub>1 AA)
[PROOF STEP]
unfolding product_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (alphabet\<^sub>2 (automaton\<^sub>2 (\<Inter> (alphabet\<^sub>1 ` set AA)) (listset (map initial\<^sub>1 AA)) (\<lambda>a ps. listset (map2 (\<lambda>x. transition\<^sub>1 x a) AA ps)) (condition (map condition\<^sub>1 AA))) = \<Inter> (alphabet\<^sub>1 ` set AA) &&& initial\<^sub>2 (automaton\<^sub>2 (\<Inter> (alphabet\<^sub>1 ` set AA)) (listset (map initial\<^sub>1 AA)) (\<lambda>a ps. listset (map2 (\<lambda>x. transition\<^sub>1 x a) AA ps)) (condition (map condition\<^sub>1 AA))) = listset (map initial\<^sub>1 AA)) &&& transition\<^sub>2 (automaton\<^sub>2 (\<Inter> (alphabet\<^sub>1 ` set AA)) (listset (map initial\<^sub>1 AA)) (\<lambda>a ps. listset (map2 (\<lambda>x. transition\<^sub>1 x a) AA ps)) (condition (map condition\<^sub>1 AA))) a ps = listset (map2 (\<lambda>x. transition\<^sub>1 x a) AA ps) &&& condition\<^sub>2 (automaton\<^sub>2 (\<Inter> (alphabet\<^sub>1 ` set AA)) (listset (map initial\<^sub>1 AA)) (\<lambda>a ps. listset (map2 (\<lambda>x. transition\<^sub>1 x a) AA ps)) (condition (map condition\<^sub>1 AA))) = condition (map condition\<^sub>1 AA)
[PROOF STEP]
by auto


[STATEMENT]
lemma fds_shift_inverse [simp]:
  "fds_shift (a :: 'a :: {field, nat_power}) (inverse f) = inverse (fds_shift a f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
proof (cases "fds_nth f 1 = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fds_nth f 1 = (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
 2. fds_nth f 1 \<noteq> (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
fds_nth f 1 \<noteq> (0::'a)

goal (2 subgoals):
 1. fds_nth f 1 = (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
 2. fds_nth f 1 \<noteq> (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
have "fds_shift a f * fds_shift a (inverse f) = fds_shift a (f * inverse f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_shift a f * fds_shift a (inverse f) = fds_shift a (f * inverse f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fds_shift a f * fds_shift a (inverse f) = fds_shift a (f * inverse f)

goal (2 subgoals):
 1. fds_nth f 1 = (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
 2. fds_nth f 1 \<noteq> (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds_shift a f * fds_shift a (inverse f) = fds_shift a (f * inverse f)

goal (2 subgoals):
 1. fds_nth f 1 = (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
 2. fds_nth f 1 \<noteq> (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
fds_nth f 1 \<noteq> (0::'a)
[PROOF STEP]
have "f * inverse f = 1"
[PROOF STATE]
proof (prove)
using this:
fds_nth f 1 \<noteq> (0::'a)

goal (1 subgoal):
 1. f * inverse f = 1
[PROOF STEP]
by (intro fds_right_inverse)
[PROOF STATE]
proof (state)
this:
f * inverse f = 1

goal (2 subgoals):
 1. fds_nth f 1 = (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
 2. fds_nth f 1 \<noteq> (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fds_shift a f * fds_shift a (inverse f) = fds_shift a 1
[PROOF STEP]
have "fds_shift a f * fds_shift a (inverse f) = 1"
[PROOF STATE]
proof (prove)
using this:
fds_shift a f * fds_shift a (inverse f) = fds_shift a 1

goal (1 subgoal):
 1. fds_shift a f * fds_shift a (inverse f) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fds_shift a f * fds_shift a (inverse f) = 1

goal (2 subgoals):
 1. fds_nth f 1 = (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
 2. fds_nth f 1 \<noteq> (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fds_shift a f * fds_shift a (inverse f) = 1

goal (1 subgoal):
 1. fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
by (rule fds_right_inverse_unique)
[PROOF STATE]
proof (state)
this:
fds_shift a (inverse f) = inverse (fds_shift a f)

goal (1 subgoal):
 1. fds_nth f 1 = (0::'a) \<Longrightarrow> fds_shift a (inverse f) = inverse (fds_shift a f)
[PROOF STEP]
qed (auto simp: inverse_fds_nonunit)


[STATEMENT]
lemma (in padic_integers) p_residue_ring_car_memI:
  assumes "(m::int) \<ge>0"
  assumes "m < p^k"
  shows "m \<in> carrier (Zp_res_ring k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<in> carrier (residue_ring (p ^ k))
[PROOF STEP]
using residue_ring_def[of "p^k"]  assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
residue_ring (p ^ k) = \<lparr>carrier = {0..p ^ k - 1}, monoid.mult = \<lambda>x y. x * y mod p ^ k, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod p ^ k\<rparr>
0 \<le> m
m < p ^ k

goal (1 subgoal):
 1. m \<in> carrier (residue_ring (p ^ k))
[PROOF STEP]
by auto


[STATEMENT]
lemma update_minus_monomial: "Poly_Mapping.update k i (m - monomial i k) = Poly_Mapping.update k i m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly_Mapping.update k i (m - monomial i k) = Poly_Mapping.update k i m
[PROOF STEP]
by (auto simp: poly_mapping_eq_iff lookup_update update.rep_eq fun_eq_iff lookup_minus
      lookup_single)


[STATEMENT]
lemma between_midpoint:
  fixes a :: "'a::euclidean_space"
  shows "between (a,b) (midpoint a b)" (is ?t1)
    and "between (b,a) (midpoint a b)" (is ?t2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. between (a, b) (midpoint a b) &&& between (b, a) (midpoint a b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. between (a, b) (midpoint a b)
 2. between (b, a) (midpoint a b)
[PROOF STEP]
have *: "\<And>x y z. x = (1/2::real) *\<^sub>R z \<Longrightarrow> y = (1/2) *\<^sub>R z \<Longrightarrow> norm z = norm x + norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x = (1 / 2) *\<^sub>R z; y = (1 / 2) *\<^sub>R z\<rbrakk> \<Longrightarrow> norm z = norm x + norm y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x = (1 / 2) *\<^sub>R ?z; ?y = (1 / 2) *\<^sub>R ?z\<rbrakk> \<Longrightarrow> norm ?z = norm ?x + norm ?y

goal (2 subgoals):
 1. between (a, b) (midpoint a b)
 2. between (b, a) (midpoint a b)
[PROOF STEP]
show ?t1 ?t2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. between (a, b) (midpoint a b) &&& between (b, a) (midpoint a b)
[PROOF STEP]
unfolding between midpoint_def dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a - b) = norm (a - (a + b) /\<^sub>R 2) + norm ((a + b) /\<^sub>R 2 - b) &&& norm (b - a) = norm (b - (a + b) /\<^sub>R 2) + norm ((a + b) /\<^sub>R 2 - a)
[PROOF STEP]
by (auto simp add: field_simps inner_simps euclidean_eq_iff[where 'a='a] intro!: *)
[PROOF STATE]
proof (state)
this:
between (a, b) (midpoint a b)
between (b, a) (midpoint a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma natUnion_upperbound:
  "(\<And> n. f n \<subseteq> G) \<Longrightarrow> (natUnion f) \<subseteq> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. f n \<subseteq> G) \<Longrightarrow> natUnion f \<subseteq> G
[PROOF STEP]
by (auto simp add: natUnion_def)


[STATEMENT]
lemma fps_XDp_commute: "fps_XDp b \<circ> fps_XDp (c::'a::comm_ring_1) = fps_XDp c \<circ> fps_XDp b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_XDp b \<circ> fps_XDp c = fps_XDp c \<circ> fps_XDp b
[PROOF STEP]
by (simp add: fps_XDp_def fun_eq_iff fps_eq_iff algebra_simps)


[STATEMENT]
lemma bin_split_num: "bin_split n b = (b div 2 ^ n, b mod 2 ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_split n b = (b div 2 ^ n, b mod 2 ^ n)
[PROOF STEP]
by (simp add: drop_bit_eq_div take_bit_eq_mod)


[STATEMENT]
lemma changes_smods_congr:
  fixes p q:: "real poly"
  assumes "a\<noteq>a'" "poly p a\<noteq>0"
  assumes "\<forall>p\<in>set (smods p q). \<forall>x. ((a<x\<and>x\<le>a') \<or> (a'\<le>x \<and> x<a)) \<longrightarrow> poly p x \<noteq>0"
  shows "changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
using assms(2-3)
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0
\<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
proof (induct "smods p q" arbitrary:p q rule:length_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a')
poly p a \<noteq> 0
\<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
using \<open>poly p a \<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0

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

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
define r1 where "r1\<equiv>- (p mod q)"
[PROOF STATE]
proof (state)
this:
r1 \<equiv> - (p mod q)

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have a_a'_rel:"\<forall>pp\<in>set (smods p q). poly pp a * poly pp a' \<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a'
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a') \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a')"
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a')

goal (1 subgoal):
 1. \<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a') \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a')
[PROOF STEP]
obtain pp where pp:"pp\<in>set (smods p q)" " poly pp a * poly pp a'<0"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a')

goal (1 subgoal):
 1. (\<And>pp. \<lbrakk>pp \<in> set (smods p q); poly pp a * poly pp a' < 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a')
p \<noteq> 0

goal (1 subgoal):
 1. (\<And>pp. \<lbrakk>pp \<in> set (smods p q); poly pp a * poly pp a' < 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis less_eq_real_def linorder_neqE_linordered_idom)
[PROOF STATE]
proof (state)
this:
pp \<in> set (smods p q)
poly pp a * poly pp a' < 0

goal (1 subgoal):
 1. \<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a') \<Longrightarrow> False
[PROOF STEP]
hence "a<a' \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
using this:
pp \<in> set (smods p q)
poly pp a * poly pp a' < 0

goal (1 subgoal):
 1. a < a' \<Longrightarrow> False
[PROOF STEP]
using "1.prems"(2) poly_IVT[of a a' pp]
[PROOF STATE]
proof (prove)
using this:
pp \<in> set (smods p q)
poly pp a * poly pp a' < 0
\<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
\<lbrakk>a < a'; poly pp a * poly pp a' < 0\<rbrakk> \<Longrightarrow> \<exists>x>a. x < a' \<and> poly pp x = 0

goal (1 subgoal):
 1. a < a' \<Longrightarrow> False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a < a' \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a') \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a < a' \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a') \<Longrightarrow> False
[PROOF STEP]
have "a'<a\<Longrightarrow>False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a' < a \<Longrightarrow> False
[PROOF STEP]
using pp[unfolded mult.commute[of "poly pp a"]] "1.prems"(2) poly_IVT[of a' a pp]
[PROOF STATE]
proof (prove)
using this:
pp \<in> set (smods p q)
poly pp a' * poly pp a < 0
\<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
\<lbrakk>a' < a; poly pp a' * poly pp a < 0\<rbrakk> \<Longrightarrow> \<exists>x>a'. x < a \<and> poly pp x = 0

goal (1 subgoal):
 1. a' < a \<Longrightarrow> False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a' < a \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> (\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a') \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a < a' \<Longrightarrow> False
a' < a \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
a < a' \<Longrightarrow> False
a' < a \<Longrightarrow> False

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>a\<noteq>a'\<close>
[PROOF STATE]
proof (prove)
using this:
a < a' \<Longrightarrow> False
a' < a \<Longrightarrow> False
a \<noteq> a'

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a'

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "q=0 \<Longrightarrow> ?case"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q = 0 \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q = 0 \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
q = 0 \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "\<lbrakk>q\<noteq>0;poly q a=0\<rbrakk> \<Longrightarrow> ?case"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
assume "q\<noteq>0" "poly q a=0"
[PROOF STATE]
proof (state)
this:
q \<noteq> 0
poly q a = 0

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
define r2 where "r2\<equiv>- (q mod r1)"
[PROOF STATE]
proof (state)
this:
r2 \<equiv> - (q mod r1)

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "- poly r1 a = poly p a "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - poly r1 a = poly p a
[PROOF STEP]
by (metis \<open>poly q a = 0\<close> add.inverse_inverse add.left_neutral div_mult_mod_eq
            mult_zero_right poly_add poly_minus poly_mult r1_def)
[PROOF STATE]
proof (state)
this:
- poly r1 a = poly p a

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
hence "r1\<noteq>0" and "poly r1 a\<noteq>0" and "poly p a*poly r1 a<0"
[PROOF STATE]
proof (prove)
using this:
- poly r1 a = poly p a

goal (1 subgoal):
 1. r1 \<noteq> 0 &&& poly r1 a \<noteq> 0 &&& poly p a * poly r1 a < 0
[PROOF STEP]
using \<open>poly p a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
- poly r1 a = poly p a
poly p a \<noteq> 0

goal (1 subgoal):
 1. r1 \<noteq> 0 &&& poly r1 a \<noteq> 0 &&& poly p a * poly r1 a < 0
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- poly r1 a = poly p a; poly p a \<noteq> 0\<rbrakk> \<Longrightarrow> poly p a * poly r1 a < 0
[PROOF STEP]
using mult_less_0_iff
[PROOF STATE]
proof (prove)
using this:
(?a * ?b < (0::?'a)) = ((0::?'a) < ?a \<and> ?b < (0::?'a) \<or> ?a < (0::?'a) \<and> (0::?'a) < ?b)

goal (1 subgoal):
 1. \<lbrakk>- poly r1 a = poly p a; poly p a \<noteq> 0\<rbrakk> \<Longrightarrow> poly p a * poly r1 a < 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
r1 \<noteq> 0
poly r1 a \<noteq> 0
poly p a * poly r1 a < 0

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r1 \<noteq> 0
poly r1 a \<noteq> 0
poly p a * poly r1 a < 0
[PROOF STEP]
obtain ps where ps:"smods p q=p#q#r1#ps" "smods r1 r2=r1#ps"
[PROOF STATE]
proof (prove)
using this:
r1 \<noteq> 0
poly r1 a \<noteq> 0
poly p a * poly r1 a < 0

goal (1 subgoal):
 1. (\<And>ps. \<lbrakk>smods p q = p # q # r1 # ps; smods r1 r2 = r1 # ps\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis \<open>p\<noteq>0\<close> \<open>q \<noteq> 0\<close> r1_def r2_def smods.simps)
[PROOF STATE]
proof (state)
this:
smods p q = p # q # r1 # ps
smods r1 r2 = r1 # ps

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
hence "length (smods r1 r2)<length (smods p q)"
[PROOF STATE]
proof (prove)
using this:
smods p q = p # q # r1 # ps
smods r1 r2 = r1 # ps

goal (1 subgoal):
 1. length (smods r1 r2) < length (smods p q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (smods r1 r2) < length (smods p q)

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (smods r1 r2) < length (smods p q)

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "(\<forall>p\<in>set (smods r1 r2). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>set (smods r1 r2). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
using "1.prems"(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. \<forall>p\<in>set (smods r1 r2). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
unfolding ps
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set (p # q # r1 # ps). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. \<forall>p\<in>set (r1 # ps). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>set (smods r1 r2). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (smods r1 r2) < length (smods p q)
\<forall>p\<in>set (smods r1 r2). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
have "changes_poly_at (smods r1 r2) a = changes_poly_at (smods r1 r2) a'"
[PROOF STATE]
proof (prove)
using this:
length (smods r1 r2) < length (smods p q)
\<forall>p\<in>set (smods r1 r2). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. changes_poly_at (smods r1 r2) a = changes_poly_at (smods r1 r2) a'
[PROOF STEP]
using "1.hyps" \<open>r1\<noteq>0\<close> \<open>poly r1 a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
length (smods r1 r2) < length (smods p q)
\<forall>p\<in>set (smods r1 r2). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a')
r1 \<noteq> 0
poly r1 a \<noteq> 0

goal (1 subgoal):
 1. changes_poly_at (smods r1 r2) a = changes_poly_at (smods r1 r2) a'
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods r1 r2) a = changes_poly_at (smods r1 r2) a'

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods r1 r2) a = changes_poly_at (smods r1 r2) a'

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "changes_poly_at (smods p q) a = 1+changes_poly_at (smods r1 r2) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (smods p q) a = 1 + changes_poly_at (smods r1 r2) a
[PROOF STEP]
unfolding ps changes_poly_at_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p a) (p # q # r1 # ps)) = 1 + changes (map (\<lambda>p. poly p a) (r1 # ps))
[PROOF STEP]
using \<open>poly q a=0\<close> \<open>poly p a*poly r1 a<0\<close>
[PROOF STATE]
proof (prove)
using this:
poly q a = 0
poly p a * poly r1 a < 0

goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p a) (p # q # r1 # ps)) = 1 + changes (map (\<lambda>p. poly p a) (r1 # ps))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a = 1 + changes_poly_at (smods r1 r2) a

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a = 1 + changes_poly_at (smods r1 r2) a

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "changes_poly_at (smods p q) a' = 1+changes_poly_at (smods r1 r2) a'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'
[PROOF STEP]
have "poly p a * poly p a' \<ge>0" and "poly r1 a*poly r1 a'\<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> poly p a * poly p a' &&& 0 \<le> poly r1 a * poly r1 a'
[PROOF STEP]
using a_a'_rel
[PROOF STATE]
proof (prove)
using this:
\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a'

goal (1 subgoal):
 1. 0 \<le> poly p a * poly p a' &&& 0 \<le> poly r1 a * poly r1 a'
[PROOF STEP]
unfolding ps
[PROOF STATE]
proof (prove)
using this:
\<forall>pp\<in>set (p # q # r1 # ps). 0 \<le> poly pp a * poly pp a'

goal (1 subgoal):
 1. 0 \<le> poly p a * poly p a' &&& 0 \<le> poly r1 a * poly r1 a'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> poly p a * poly p a'
0 \<le> poly r1 a * poly r1 a'

goal (1 subgoal):
 1. changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> poly p a * poly p a'
0 \<le> poly r1 a * poly r1 a'

goal (1 subgoal):
 1. changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'
[PROOF STEP]
have "poly p a'\<noteq>0" and "poly q a'\<noteq>0" and "poly r1 a'\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p a' \<noteq> 0 &&& poly q a' \<noteq> 0 &&& poly r1 a' \<noteq> 0
[PROOF STEP]
using "1.prems"(2)[unfolded ps] \<open>a\<noteq>a'\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set (p # q # r1 # ps). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
a \<noteq> a'

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

goal (1 subgoal):
 1. changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<le> poly p a * poly p a'
0 \<le> poly r1 a * poly r1 a'
poly p a' \<noteq> 0
poly q a' \<noteq> 0
poly r1 a' \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> poly p a * poly p a'
0 \<le> poly r1 a * poly r1 a'
poly p a' \<noteq> 0
poly q a' \<noteq> 0
poly r1 a' \<noteq> 0

goal (1 subgoal):
 1. changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'
[PROOF STEP]
using \<open>poly p a*poly r1 a<0\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> poly p a * poly p a'
0 \<le> poly r1 a * poly r1 a'
poly p a' \<noteq> 0
poly q a' \<noteq> 0
poly r1 a' \<noteq> 0
poly p a * poly r1 a < 0

goal (1 subgoal):
 1. changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'
[PROOF STEP]
unfolding ps changes_poly_at_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> poly p a * poly p a'
0 \<le> poly r1 a * poly r1 a'
poly p a' \<noteq> 0
poly q a' \<noteq> 0
poly r1 a' \<noteq> 0
poly p a * poly r1 a < 0

goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p a') (p # q # r1 # ps)) = 1 + changes (map (\<lambda>p. poly p a') (r1 # ps))
[PROOF STEP]
by (auto simp add: zero_le_mult_iff, auto simp add: mult_less_0_iff)
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
changes_poly_at (smods r1 r2) a = changes_poly_at (smods r1 r2) a'
changes_poly_at (smods p q) a = 1 + changes_poly_at (smods r1 r2) a
changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (smods r1 r2) a = changes_poly_at (smods r1 r2) a'
changes_poly_at (smods p q) a = 1 + changes_poly_at (smods r1 r2) a
changes_poly_at (smods p q) a' = 1 + changes_poly_at (smods r1 r2) a'

goal (1 subgoal):
 1. changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "\<lbrakk>q\<noteq>0;poly q a\<noteq>0\<rbrakk> \<Longrightarrow> ?case"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
assume "q\<noteq>0" "poly q a\<noteq>0"
[PROOF STATE]
proof (state)
this:
q \<noteq> 0
poly q a \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<noteq> 0
poly q a \<noteq> 0
[PROOF STEP]
obtain ps where ps:"smods p q=p#q#ps" "smods q r1=q#ps"
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0
poly q a \<noteq> 0

goal (1 subgoal):
 1. (\<And>ps. \<lbrakk>smods p q = p # q # ps; smods q r1 = q # ps\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis \<open>p\<noteq>0\<close> r1_def smods.simps)
[PROOF STATE]
proof (state)
this:
smods p q = p # q # ps
smods q r1 = q # ps

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
hence "length (smods q r1) < length (smods p q)"
[PROOF STATE]
proof (prove)
using this:
smods p q = p # q # ps
smods q r1 = q # ps

goal (1 subgoal):
 1. length (smods q r1) < length (smods p q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (smods q r1) < length (smods p q)

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (smods q r1) < length (smods p q)

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "(\<forall>p\<in>set (smods q r1). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>set (smods q r1). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
using "1.prems"(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. \<forall>p\<in>set (smods q r1). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
unfolding ps
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set (p # q # ps). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. \<forall>p\<in>set (q # ps). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>set (smods q r1). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (smods q r1) < length (smods p q)
\<forall>p\<in>set (smods q r1). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
have "changes_poly_at (smods q r1) a = changes_poly_at (smods q r1) a'"
[PROOF STATE]
proof (prove)
using this:
length (smods q r1) < length (smods p q)
\<forall>p\<in>set (smods q r1). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0

goal (1 subgoal):
 1. changes_poly_at (smods q r1) a = changes_poly_at (smods q r1) a'
[PROOF STEP]
using "1.hyps" \<open>q\<noteq>0\<close> \<open>poly q a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
length (smods q r1) < length (smods p q)
\<forall>p\<in>set (smods q r1). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a')
q \<noteq> 0
poly q a \<noteq> 0

goal (1 subgoal):
 1. changes_poly_at (smods q r1) a = changes_poly_at (smods q r1) a'
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods q r1) a = changes_poly_at (smods q r1) a'

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods q r1) a = changes_poly_at (smods q r1) a'

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "poly p a'\<noteq>0" and "poly q a'\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p a' \<noteq> 0 &&& poly q a' \<noteq> 0
[PROOF STEP]
using "1.prems"(2)[unfolded ps] \<open>a\<noteq>a'\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set (p # q # ps). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
a \<noteq> a'

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

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly p a' \<noteq> 0
poly q a' \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
have "poly p a * poly p a' \<ge>0" and "poly q a*poly q a'\<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> poly p a * poly p a' &&& 0 \<le> poly q a * poly q a'
[PROOF STEP]
using a_a'_rel
[PROOF STATE]
proof (prove)
using this:
\<forall>pp\<in>set (smods p q). 0 \<le> poly pp a * poly pp a'

goal (1 subgoal):
 1. 0 \<le> poly p a * poly p a' &&& 0 \<le> poly q a * poly q a'
[PROOF STEP]
unfolding ps
[PROOF STATE]
proof (prove)
using this:
\<forall>pp\<in>set (p # q # ps). 0 \<le> poly pp a * poly pp a'

goal (1 subgoal):
 1. 0 \<le> poly p a * poly p a' &&& 0 \<le> poly q a * poly q a'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> poly p a * poly p a'
0 \<le> poly q a * poly q a'

goal (1 subgoal):
 1. \<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
changes_poly_at (smods q r1) a = changes_poly_at (smods q r1) a'
poly p a' \<noteq> 0
poly q a' \<noteq> 0
0 \<le> poly p a * poly p a'
0 \<le> poly q a * poly q a'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (smods q r1) a = changes_poly_at (smods q r1) a'
poly p a' \<noteq> 0
poly q a' \<noteq> 0
0 \<le> poly p a * poly p a'
0 \<le> poly q a * poly q a'

goal (1 subgoal):
 1. changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
unfolding ps changes_poly_at_def
[PROOF STATE]
proof (prove)
using this:
changes (map (\<lambda>p. poly p a) (q # ps)) = changes (map (\<lambda>p. poly p a') (q # ps))
poly p a' \<noteq> 0
poly q a' \<noteq> 0
0 \<le> poly p a * poly p a'
0 \<le> poly q a * poly q a'

goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p a) (p # q # ps)) = changes (map (\<lambda>p. poly p a') (p # q # ps))
[PROOF STEP]
using  \<open>poly q a\<noteq>0\<close> \<open>poly p a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
changes (map (\<lambda>p. poly p a) (q # ps)) = changes (map (\<lambda>p. poly p a') (q # ps))
poly p a' \<noteq> 0
poly q a' \<noteq> 0
0 \<le> poly p a * poly p a'
0 \<le> poly q a * poly q a'
poly q a \<noteq> 0
poly p a \<noteq> 0

goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p a) (p # q # ps)) = changes (map (\<lambda>p. poly p a') (p # q # ps))
[PROOF STEP]
by (auto simp add: zero_le_mult_iff,auto simp add: mult_less_0_iff)
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<forall>ys. length ys < length (smods p q) \<longrightarrow> (\<forall>x xa. ys = smods x xa \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> (\<forall>p\<in>set (smods x xa). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0) \<longrightarrow> changes_poly_at (smods x xa) a = changes_poly_at (smods x xa) a'); poly p a \<noteq> 0; \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
q = 0 \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
\<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
\<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
q = 0 \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
\<lbrakk>q \<noteq> 0; poly q a = 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
\<lbrakk>q \<noteq> 0; poly q a \<noteq> 0\<rbrakk> \<Longrightarrow> changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal (1 subgoal):
 1. changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_nat_le_hmset[simp]: "(of_nat M :: hmultiset) \<le> of_nat N \<longleftrightarrow> M \<le> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat M \<le> of_nat N) = (M \<le> N)
[PROOF STEP]
unfolding of_nat_hmset order_le_less less_multiset_ext\<^sub>D\<^sub>M_less
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (HMSet (replicate_mset M 0) < HMSet (replicate_mset N 0) \<or> HMSet (replicate_mset M 0) = HMSet (replicate_mset N 0)) = (M < N \<or> M = N)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in group) ord_le_group_order:
  assumes finite: "finite (carrier G)" and a: "a \<in> carrier G"
  shows "ord a \<le> order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord a \<le> order G
[PROOF STEP]
by (simp add: a dvd_imp_le local.finite ord_dvd_group_order order_gt_0_iff_finite)


[STATEMENT]
lemma has_derivative_split_at:
  "(g has_derivative g') (at x)"
  if
    "(g has_derivative g') (at_left x)"
    "(g has_derivative g') (at_right x)"
  for x::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_derivative g') (at x)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
(g has_derivative g') (at_left x)
(g has_derivative g') (at_right x)

goal (1 subgoal):
 1. (g has_derivative g') (at x)
[PROOF STEP]
unfolding has_derivative_def netlimit_at netlimit_at_right netlimit_at_left
[PROOF STATE]
proof (prove)
using this:
bounded_linear g' \<and> ((\<lambda>y. (g y - g x - g' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'a)) (at_left x)
bounded_linear g' \<and> ((\<lambda>y. (g y - g x - g' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'a)) (at_right x)

goal (1 subgoal):
 1. bounded_linear g' \<and> (\<lambda>y. (g y - g x - g' (y - x)) /\<^sub>R norm (y - x)) \<midarrow>x\<rightarrow> (0::'a)
[PROOF STEP]
by (auto intro: filterlim_split_at)


[STATEMENT]
lemma span_subset_cspan: "span A \<subseteq> cspan A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span A \<subseteq> cspan A
[PROOF STEP]
unfolding span_def complex_vector.span_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace hull A \<subseteq> csubspace hull A
[PROOF STEP]
by (simp add: csubspace_is_subspace hull_antimono)


[STATEMENT]
lemma cosh_real_nonpos_le_iff: "x \<le> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> cosh x \<le> cosh y \<longleftrightarrow> x \<ge> (y::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> 0; y \<le> 0\<rbrakk> \<Longrightarrow> (cosh x \<le> cosh y) = (y \<le> x)
[PROOF STEP]
using cosh_real_nonneg_le_iff[of "-x" "-y"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> - x; 0 \<le> - y\<rbrakk> \<Longrightarrow> (cosh (- x) \<le> cosh (- y)) = (- x \<le> - y)

goal (1 subgoal):
 1. \<lbrakk>x \<le> 0; y \<le> 0\<rbrakk> \<Longrightarrow> (cosh x \<le> cosh y) = (y \<le> x)
[PROOF STEP]
by simp


[STATEMENT]
lemma leadsTo_UN:
    "(!!i. i \<in> I ==> F \<in> (A i) leadsTo B) ==> F \<in> (\<Union>i \<in> I. A i) leadsTo B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> F \<in> A i \<longmapsto> B) \<Longrightarrow> F \<in> \<Union> (A ` I) \<longmapsto> B
[PROOF STEP]
apply (blast intro: leadsTo_Union)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in filtrated_prob_space) borel_adapt_stoch_proc_borel_measurable:
  assumes "borel_adapt_stoch_proc F X"
  shows "\<forall>n. (X n) \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. random_variable borel (X n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. random_variable borel (X n)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. random_variable borel (X n)
[PROOF STEP]
have "X n \<in> borel_measurable (F n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X n \<in> borel_measurable (F n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
borel_adapt_stoch_proc F X

goal (1 subgoal):
 1. X n \<in> borel_measurable (F n)
[PROOF STEP]
unfolding  adapt_stoch_proc_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t. X t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. X n \<in> borel_measurable (F n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X n \<in> borel_measurable (F n)

goal (1 subgoal):
 1. \<And>n. random_variable borel (X n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
X n \<in> borel_measurable (F n)

goal (1 subgoal):
 1. \<And>n. random_variable borel (X n)
[PROOF STEP]
have "subalgebra M (F n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subalgebra M (F n)
[PROOF STEP]
using filtration
[PROOF STATE]
proof (prove)
using this:
Filtration.filtration M F

goal (1 subgoal):
 1. subalgebra M (F n)
[PROOF STEP]
unfolding filtration_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>t. subalgebra M (F t)) \<and> (\<forall>s t. s \<le> t \<longrightarrow> subalgebra (F t) (F s))

goal (1 subgoal):
 1. subalgebra M (F n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
subalgebra M (F n)

goal (1 subgoal):
 1. \<And>n. random_variable borel (X n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
X n \<in> borel_measurable (F n)
subalgebra M (F n)
[PROOF STEP]
show "X n \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
using this:
X n \<in> borel_measurable (F n)
subalgebra M (F n)

goal (1 subgoal):
 1. random_variable borel (X n)
[PROOF STEP]
by (simp add:measurable_from_subalg)
[PROOF STATE]
proof (state)
this:
random_variable borel (X n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree0_neighborhood_empt_iff:
  assumes "finite E"
  shows "degree v = 0 \<longleftrightarrow> neighborhood v = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (degree v = 0) = (neighborhood v = {})
[PROOF STEP]
using degree0_inc_edges_empt_iff incident_edges_neighbors_img
[PROOF STATE]
proof (prove)
using this:
finite E \<Longrightarrow> (degree ?v = 0) = (incident_edges ?v = {})
incident_edges ?v = (\<lambda>u. {?v, u}) ` neighborhood ?v

goal (1 subgoal):
 1. (degree v = 0) = (neighborhood v = {})
[PROOF STEP]
by (simp add: assms)


[STATEMENT]
lemma reparam_weak_eq_refl:
  shows "reparam_weak \<gamma>1 \<gamma>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reparam_weak \<gamma>1 \<gamma>1
[PROOF STEP]
unfolding reparam_weak_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<phi>. (\<forall>x\<in>{0..1}. \<gamma>1 x = (\<gamma>1 \<circ> \<phi>) x) \<and> \<phi> piecewise_C1_differentiable_on {0..1} \<and> \<phi> 0 = 0 \<and> \<phi> 1 = 1 \<and> \<phi> ` {0..1} = {0..1}
[PROOF STEP]
apply (rule_tac x="id" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>{0..1}. \<gamma>1 x = (\<gamma>1 \<circ> id) x) \<and> id piecewise_C1_differentiable_on {0..1} \<and> id 0 = 0 \<and> id 1 = 1 \<and> id ` {0..1} = {0..1}
[PROOF STEP]
by (auto simp add: id_def piecewise_C1_differentiable_on_def C1_differentiable_on_def continuous_on_id)


[STATEMENT]
lemma divide_right_mono_ennreal:
  fixes a b c :: ennreal
  shows "a \<le> b \<Longrightarrow> a / c \<le> b / c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> a / c \<le> b / c
[PROOF STEP]
unfolding divide_ennreal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> a * inverse c \<le> b * inverse c
[PROOF STEP]
by (intro mult_mono) auto