[STATEMENT]
lemma upper_asymptotic_density_lim:
  assumes "(\<lambda>n. card(A \<inter> {..<n})/n) \<longlonglongrightarrow> l"
  shows "upper_asymptotic_density A = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_asymptotic_density A = l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. upper_asymptotic_density A = l
[PROOF STEP]
have "(\<lambda>n. ereal(card(A \<inter> {..<n})/n)) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ereal (real (card (A \<inter> {..<n})) / real n)) \<longlonglongrightarrow> ereal l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. real (card (A \<inter> {..<n})) / real n) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>n. ereal (real (card (A \<inter> {..<n})) / real n)) \<longlonglongrightarrow> ereal l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (real (card (A \<inter> {..<n})) / real n)) \<longlonglongrightarrow> ereal l

goal (1 subgoal):
 1. upper_asymptotic_density A = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. ereal (real (card (A \<inter> {..<n})) / real n)) \<longlonglongrightarrow> ereal l
[PROOF STEP]
have "limsup (\<lambda>n. card(A \<inter> {..<n})/n) = l"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (real (card (A \<inter> {..<n})) / real n)) \<longlonglongrightarrow> ereal l

goal (1 subgoal):
 1. limsup (\<lambda>x. ereal (real (card (A \<inter> {..<x})) / real x)) = ereal l
[PROOF STEP]
using sequentially_bot tendsto_iff_Liminf_eq_Limsup
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (real (card (A \<inter> {..<n})) / real n)) \<longlonglongrightarrow> ereal l
sequentially \<noteq> \<bottom>
?F \<noteq> \<bottom> \<Longrightarrow> (?f \<longlongrightarrow> ?f0.0) ?F = (Liminf ?F ?f = ?f0.0 \<and> Limsup ?F ?f = ?f0.0)

goal (1 subgoal):
 1. limsup (\<lambda>x. ereal (real (card (A \<inter> {..<x})) / real x)) = ereal l
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>x. ereal (real (card (A \<inter> {..<x})) / real x)) = ereal l

goal (1 subgoal):
 1. upper_asymptotic_density A = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
limsup (\<lambda>x. ereal (real (card (A \<inter> {..<x})) / real x)) = ereal l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
limsup (\<lambda>x. ereal (real (card (A \<inter> {..<x})) / real x)) = ereal l

goal (1 subgoal):
 1. upper_asymptotic_density A = l
[PROOF STEP]
unfolding upper_asymptotic_density_def
[PROOF STATE]
proof (prove)
using this:
limsup (\<lambda>x. ereal (real (card (A \<inter> {..<x})) / real x)) = ereal l

goal (1 subgoal):
 1. real_of_ereal (limsup (\<lambda>x. ereal (real (card (A \<inter> {..<x})) / real x))) = l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
upper_asymptotic_density A = l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zmod_zminus_eq_conv_pos: "
  0 < (m::int) \<Longrightarrow> (a mod - m = b mod - m) = (a mod m = b mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (a mod - m = b mod - m) = (a mod m = b mod m)
[PROOF STEP]
apply (simp only: mod_minus_right neg_equal_iff_equal)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (- a mod m = - b mod m) = (a mod m = b mod m)
[PROOF STEP]
apply (simp only: zmod_zminus1_eq_if)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> ((if a mod m = 0 then 0 else m - a mod m) = (if b mod m = 0 then 0 else m - b mod m)) = (a mod m = b mod m)
[PROOF STEP]
apply (split if_split)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (a mod m = 0 \<longrightarrow> (b mod m = 0 \<longrightarrow> (0 = 0) = (a mod m = b mod m)) \<and> (b mod m \<noteq> 0 \<longrightarrow> (0 = m - b mod m) = (a mod m = b mod m))) \<and> (a mod m \<noteq> 0 \<longrightarrow> (b mod m = 0 \<longrightarrow> (m - a mod m = 0) = (a mod m = b mod m)) \<and> (b mod m \<noteq> 0 \<longrightarrow> (m - a mod m = m - b mod m) = (a mod m = b mod m)))
[PROOF STEP]
apply (safe, simp_all)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q. \<lbrakk>0 < m; a = m * q; m = b mod m\<rbrakk> \<Longrightarrow> False
 2. \<And>q. \<lbrakk>0 < m; b = m * q; m = a mod m\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (insert pos_mod_bound[of m a] pos_mod_bound[of m b], simp_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cle_add_iff1: "a *\<^sub>C e + c \<le> b *\<^sub>C e + d \<longleftrightarrow> (a - b) *\<^sub>C e + c \<le> d"
  for c d e :: "'a::ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a *\<^sub>C e + c \<le> b *\<^sub>C e + d) = ((a - b) *\<^sub>C e + c \<le> d)
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma fds_nth_minus [simp]:
  "fds_nth (f - g) = (\<lambda>n. fds_nth f n - fds_nth g n :: 'a :: {cancel_comm_monoid_add})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (f - g) = (\<lambda>n. fds_nth f n - fds_nth g n)
[PROOF STEP]
by (simp add: minus_fds_def fds_nth_fds fun_eq_iff)


[STATEMENT]
lemma le_add_same_cancel1:
  "a + b \<ge> a \<longleftrightarrow> b \<ge> 0" if "a < \<infinity>" "-\<infinity> < a" for a b :: "int extended"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<le> a + b) = (0 \<le> b)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
a < \<infinity>
-\<infinity> < a

goal (1 subgoal):
 1. (a \<le> a + b) = (0 \<le> b)
[PROOF STEP]
by (cases a; cases b) (auto simp add: zero_extended_def)


[STATEMENT]
lemma Cauchy_vec_nth:
  "Cauchy (\<lambda>n. X n) \<Longrightarrow> Cauchy (\<lambda>n. X n $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. X n $ i)
[PROOF STEP]
unfolding Cauchy_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < e \<Longrightarrow> \<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m $ i) (X n $ i) < e
[PROOF STEP]
by (fast intro: le_less_trans [OF dist_vec_nth_le])


[STATEMENT]
lemma register_pair_apply:
  assumes \<open>compatible F G\<close>
  shows \<open>(F; G) (a \<otimes>\<^sub>u b) = (F a) *\<^sub>u (G b)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F;G) (a \<otimes>\<^sub>u b) = F a *\<^sub>u G b
[PROOF STEP]
apply (rule register_pair_apply)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. register F
 2. register G
 3. \<And>a b. F a *\<^sub>u G b = G b *\<^sub>u F a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
compatible F G

goal (3 subgoals):
 1. register F
 2. register G
 3. \<And>a b. F a *\<^sub>u G b = G b *\<^sub>u F a
[PROOF STEP]
unfolding compatible_def
[PROOF STATE]
proof (prove)
using this:
register F \<and> register G \<and> (\<forall>a b. F a *\<^sub>u G b = G b *\<^sub>u F a)

goal (3 subgoals):
 1. register F
 2. register G
 3. \<And>a b. F a *\<^sub>u G b = G b *\<^sub>u F a
[PROOF STEP]
by metis+


[STATEMENT]
lemma count_image_mset:
  \<open>count (image_mset f A) x = (\<Sum>y\<in>f -` {x} \<inter> set_mset A. count A y)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A)
[PROOF STEP]
proof (induction A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. count (image_mset f {#}) x = sum (count {#}) (f -` {x} \<inter> set_mset {#})
 2. \<And>xa A. count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A) \<Longrightarrow> count (image_mset f (add_mset xa A)) x = sum (count (add_mset xa A)) (f -` {x} \<inter> set_mset (add_mset xa A))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. count (image_mset f {#}) x = sum (count {#}) (f -` {x} \<inter> set_mset {#})
 2. \<And>xa A. count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A) \<Longrightarrow> count (image_mset f (add_mset xa A)) x = sum (count (add_mset xa A)) (f -` {x} \<inter> set_mset (add_mset xa A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (image_mset f {#}) x = sum (count {#}) (f -` {x} \<inter> set_mset {#})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count (image_mset f {#}) x = sum (count {#}) (f -` {x} \<inter> set_mset {#})

goal (1 subgoal):
 1. \<And>xa A. count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A) \<Longrightarrow> count (image_mset f (add_mset xa A)) x = sum (count (add_mset xa A)) (f -` {x} \<inter> set_mset (add_mset xa A))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa A. count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A) \<Longrightarrow> count (image_mset f (add_mset xa A)) x = sum (count (add_mset xa A)) (f -` {x} \<inter> set_mset (add_mset xa A))
[PROOF STEP]
case (add x A)
[PROOF STATE]
proof (state)
this:
count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A)

goal (1 subgoal):
 1. \<And>xa A. count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A) \<Longrightarrow> count (image_mset f (add_mset xa A)) x = sum (count (add_mset xa A)) (f -` {x} \<inter> set_mset (add_mset xa A))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A)

goal (1 subgoal):
 1. \<And>xa A. count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A) \<Longrightarrow> count (image_mset f (add_mset xa A)) x = sum (count (add_mset xa A)) (f -` {x} \<inter> set_mset (add_mset xa A))
[PROOF STEP]
have *: "(if x = y then Suc n else n) = n + (if x = y then 1 else 0)" for n y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x = y then Suc n else n) = n + (if x = y then 1 else 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if x = ?y then Suc ?n else ?n) = ?n + (if x = ?y then 1 else 0)

goal (1 subgoal):
 1. \<And>xa A. count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A) \<Longrightarrow> count (image_mset f (add_mset xa A)) x = sum (count (add_mset xa A)) (f -` {x} \<inter> set_mset (add_mset xa A))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A)
(if x = ?y then Suc ?n else ?n) = ?n + (if x = ?y then 1 else 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
count (image_mset f A) x = sum (count A) (f -` {x} \<inter> set_mset A)
(if x = ?y then Suc ?n else ?n) = ?n + (if x = ?y then 1 else 0)

goal (1 subgoal):
 1. count (image_mset f (add_mset x A)) x = sum (count (add_mset x A)) (f -` {x} \<inter> set_mset (add_mset x A))
[PROOF STEP]
by (auto simp: sum.distrib intro!: sum.mono_neutral_left)
[PROOF STATE]
proof (state)
this:
count (image_mset f (add_mset x A)) x = sum (count (add_mset x A)) (f -` {x} \<inter> set_mset (add_mset x A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_cn_cov_comp_ObjMap_vrange:
  assumes "\<GG> : \<BB> \<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret L: is_functor \<alpha> \<open>op_cat \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_cat \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret R: is_functor \<alpha> \<AA> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
by
      (
        rule smcf_cn_cov_comp_ObjMap_vrange
          [
            OF
              L.cf_is_semifunctor[unfolded slicing_commute[symmetric]]
              R.cf_is_semifunctor,
            unfolded slicing_commute slicing_simps
          ]
      )
[PROOF STATE]
proof (state)
this:
\<R>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isOK_forallM_index_aux [simp]:
  "isOK (forallM_index_aux P n xs) = (\<forall>i < length xs. isOK (P (xs ! i) (i + n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isOK (forallM_index_aux P n xs) = (\<forall>i<length xs. isOK (P (xs ! i) (i + n)))
[PROOF STEP]
proof (induct xs arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. isOK (forallM_index_aux P n []) = (\<forall>i<length []. isOK (P ([] ! i) (i + n)))
 2. \<And>a xs n. (\<And>n. isOK (forallM_index_aux P n xs) = (\<forall>i<length xs. isOK (P (xs ! i) (i + n)))) \<Longrightarrow> isOK (forallM_index_aux P n (a # xs)) = (\<forall>i<length (a # xs). isOK (P ((a # xs) ! i) (i + n)))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
isOK (forallM_index_aux P ?n xs) = (\<forall>i<length xs. isOK (P (xs ! i) (i + ?n)))

goal (2 subgoals):
 1. \<And>n. isOK (forallM_index_aux P n []) = (\<forall>i<length []. isOK (P ([] ! i) (i + n)))
 2. \<And>a xs n. (\<And>n. isOK (forallM_index_aux P n xs) = (\<forall>i<length xs. isOK (P (xs ! i) (i + n)))) \<Longrightarrow> isOK (forallM_index_aux P n (a # xs)) = (\<forall>i<length (a # xs). isOK (P ((a # xs) ! i) (i + n)))
[PROOF STEP]
have "(\<forall>i < length (x # xs). isOK (P ((x # xs) ! i) (i + n))) \<longleftrightarrow>
    (isOK (P x n) \<and> (\<forall>i < length xs. isOK (P (xs ! i) (i + Suc n))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<length (x # xs). isOK (P ((x # xs) ! i) (i + n))) = (isOK (P x n) \<and> (\<forall>i<length xs. isOK (P (xs ! i) (i + Suc n))))
[PROOF STEP]
by (auto, case_tac i) (simp_all)
[PROOF STATE]
proof (state)
this:
(\<forall>i<length (x # xs). isOK (P ((x # xs) ! i) (i + n))) = (isOK (P x n) \<and> (\<forall>i<length xs. isOK (P (xs ! i) (i + Suc n))))

goal (2 subgoals):
 1. \<And>n. isOK (forallM_index_aux P n []) = (\<forall>i<length []. isOK (P ([] ! i) (i + n)))
 2. \<And>a xs n. (\<And>n. isOK (forallM_index_aux P n xs) = (\<forall>i<length xs. isOK (P (xs ! i) (i + n)))) \<Longrightarrow> isOK (forallM_index_aux P n (a # xs)) = (\<forall>i<length (a # xs). isOK (P ((a # xs) ! i) (i + n)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>i<length (x # xs). isOK (P ((x # xs) ! i) (i + n))) = (isOK (P x n) \<and> (\<forall>i<length xs. isOK (P (xs ! i) (i + Suc n))))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<forall>i<length (x # xs). isOK (P ((x # xs) ! i) (i + n))) = (isOK (P x n) \<and> (\<forall>i<length xs. isOK (P (xs ! i) (i + Suc n))))

goal (1 subgoal):
 1. isOK (forallM_index_aux P n (x # xs)) = (\<forall>i<length (x # xs). isOK (P ((x # xs) ! i) (i + n)))
[PROOF STEP]
unfolding Cons [of "Suc n", symmetric]
[PROOF STATE]
proof (prove)
using this:
(\<forall>i<length (x # xs). isOK (P ((x # xs) ! i) (i + n))) = (isOK (P x n) \<and> isOK (forallM_index_aux P (Suc n) xs))

goal (1 subgoal):
 1. isOK (forallM_index_aux P n (x # xs)) = (\<forall>i<length (x # xs). isOK (P ((x # xs) ! i) (i + n)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
isOK (forallM_index_aux P n (x # xs)) = (\<forall>i<length (x # xs). isOK (P ((x # xs) ! i) (i + n)))

goal (1 subgoal):
 1. \<And>n. isOK (forallM_index_aux P n []) = (\<forall>i<length []. isOK (P ([] ! i) (i + n)))
[PROOF STEP]
qed auto


[STATEMENT]
lemma perfect_injective_eq_homeomorphic_map:
   "perfect_map X Y f \<and> inj_on f (topspace X) \<longleftrightarrow> homeomorphic_map X Y f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (perfect_map X Y f \<and> inj_on f (topspace X)) = homeomorphic_map X Y f
[PROOF STEP]
by (simp add: homeomorphic_eq_injective_perfect_map)


[STATEMENT]
lemma degree_monom_eq: "a \<noteq> 0 \<Longrightarrow> degree (monom a n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> degree (monom a n) = n
[PROOF STEP]
by (metis coeff_monom leading_coeff_0_iff)


[STATEMENT]
lemma same_floor:
assumes "real_of_int a \<le> x" "real_of_int a \<le> y"
  "x < a+1" "y < a+1"
shows "floor x = floor y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x\<rfloor> = \<lfloor>y\<rfloor>
[PROOF STEP]
using assms floor_unique
[PROOF STATE]
proof (prove)
using this:
real_of_int a \<le> x
real_of_int a \<le> y
x < real_of_int (a + 1)
y < real_of_int (a + 1)
\<lbrakk>real_of_int ?a \<le> ?x; ?x < real_of_int (?a + 1)\<rbrakk> \<Longrightarrow> \<lfloor>?x\<rfloor> = ?a

goal (1 subgoal):
 1. \<lfloor>x\<rfloor> = \<lfloor>y\<rfloor>
[PROOF STEP]
by presburger


[STATEMENT]
lemma fps_const_add_right: "f + fps_const (c::'a::monoid_add) =
    Abs_fps (\<lambda>n. if n = 0 then f$0 + c else f$n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f + fps_const c = Abs_fps (\<lambda>n. if n = 0 then f $ 0 + c else f $ n)
[PROOF STEP]
by (simp add: fps_ext)


[STATEMENT]
lemma cross7_minus_left [simp]: "(-x) \<times>\<^sub>7 y = - (x \<times>\<^sub>7 y)"
and cross7_minus_right [simp]: "x \<times>\<^sub>7 -y = - (x \<times>\<^sub>7 y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- x) \<times>\<^sub>7 y = - (x \<times>\<^sub>7 y) &&& x \<times>\<^sub>7 - y = - (x \<times>\<^sub>7 y)
[PROOF STEP]
by (simp_all add: cross7_simps)


[STATEMENT]
lemma poly_mult_coeff:
  assumes "set p1 \<subseteq> carrier R" "set p2 \<subseteq> carrier R"
  shows "coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus> k \<in> {..i}. (coeff p1) k \<otimes> (coeff p2) (i - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
set p1 \<subseteq> carrier R

goal (1 subgoal):
 1. local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
proof (induction p1)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set [] \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult [] p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff [] k \<otimes> local.coeff p2 (i - k))
 2. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
set [] \<subseteq> carrier R

goal (2 subgoals):
 1. set [] \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult [] p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff [] k \<otimes> local.coeff p2 (i - k))
 2. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set [] \<subseteq> carrier R

goal (1 subgoal):
 1. local.coeff (poly_mult [] p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff [] k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
set [] \<subseteq> carrier R
set p2 \<subseteq> carrier R

goal (1 subgoal):
 1. local.coeff (poly_mult [] p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff [] k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult [] p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff [] k \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
case (Cons a p1)
[PROOF STATE]
proof (state)
this:
set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))
set (a # p1) \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
hence in_carrier:
    "a \<in> carrier R" "\<And>i. (coeff p1) i \<in> carrier R" "\<And>i. (coeff p2) i \<in> carrier R"
[PROOF STATE]
proof (prove)
using this:
set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))
set (a # p1) \<subseteq> carrier R

goal (1 subgoal):
 1. a \<in> carrier R &&& (\<And>i. local.coeff p1 i \<in> carrier R) &&& (\<And>i. local.coeff p2 i \<in> carrier R)
[PROOF STEP]
using coeff_in_carrier assms(2)
[PROOF STATE]
proof (prove)
using this:
set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))
set (a # p1) \<subseteq> carrier R
set ?p \<subseteq> carrier R \<Longrightarrow> local.coeff ?p ?i \<in> carrier R
set p2 \<subseteq> carrier R

goal (1 subgoal):
 1. a \<in> carrier R &&& (\<And>i. local.coeff p1 i \<in> carrier R) &&& (\<And>i. local.coeff p2 i \<in> carrier R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
let ?a_p2 = "(map (\<lambda>b. a \<otimes> b) p2) @ (replicate (degree (a # p1)) \<zero>)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have "coeff  (replicate (degree (a # p1)) \<zero>) = (\<lambda>_. \<zero>)"
   and "length (replicate (degree (a # p1)) \<zero>) = length p1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (replicate (degree (a # p1)) \<zero>) = (\<lambda>_. \<zero>) &&& length (replicate (degree (a # p1)) \<zero>) = length p1
[PROOF STEP]
using prefix_replicate_zero_coeff[of "[]" "length p1"]
[PROOF STATE]
proof (prove)
using this:
local.coeff [] = local.coeff (replicate (length p1) \<zero> @ [])

goal (1 subgoal):
 1. local.coeff (replicate (degree (a # p1)) \<zero>) = (\<lambda>_. \<zero>) &&& length (replicate (degree (a # p1)) \<zero>) = length p1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.coeff (replicate (degree (a # p1)) \<zero>) = (\<lambda>_. \<zero>)
length (replicate (degree (a # p1)) \<zero>) = length p1

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
hence "coeff ?a_p2 = (\<lambda>i. if i < length p1 then \<zero> else (coeff (map (\<lambda>b. a \<otimes> b) p2)) (i - length p1))"
[PROOF STATE]
proof (prove)
using this:
local.coeff (replicate (degree (a # p1)) \<zero>) = (\<lambda>_. \<zero>)
length (replicate (degree (a # p1)) \<zero>) = length p1

goal (1 subgoal):
 1. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1))
[PROOF STEP]
using append_coeff[of "map (\<lambda>b. a \<otimes> b) p2" "replicate (length p1) \<zero>"]
[PROOF STATE]
proof (prove)
using this:
local.coeff (replicate (degree (a # p1)) \<zero>) = (\<lambda>_. \<zero>)
length (replicate (degree (a # p1)) \<zero>) = length p1
local.coeff (map ((\<otimes>) a) p2 @ replicate (length p1) \<zero>) = (\<lambda>i. if i < length (replicate (length p1) \<zero>) then local.coeff (replicate (length p1) \<zero>) i else local.coeff (map ((\<otimes>) a) p2) (i - length (replicate (length p1) \<zero>)))

goal (1 subgoal):
 1. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have " ... = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> ((coeff p2) (i - length p1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))
[PROOF STEP]
have "\<And>i. i < length p2 \<Longrightarrow> (coeff (map (\<lambda>b. a \<otimes> b) p2)) i = a \<otimes> ((coeff p2) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
assume i_lt: "i < length p2"
[PROOF STATE]
proof (state)
this:
i < length p2

goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
hence "(coeff (map (\<lambda>b. a \<otimes> b) p2)) i = (map (\<lambda>b. a \<otimes> b) p2) ! (length p2 - 1 - i)"
[PROOF STATE]
proof (prove)
using this:
i < length p2

goal (1 subgoal):
 1. local.coeff (map ((\<otimes>) a) p2) i = map ((\<otimes>) a) p2 ! (degree p2 - i)
[PROOF STEP]
using coeff_nth[of i "map (\<lambda>b. a \<otimes> b) p2"]
[PROOF STATE]
proof (prove)
using this:
i < length p2
i < length (map ((\<otimes>) a) p2) \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = map ((\<otimes>) a) p2 ! (degree (map ((\<otimes>) a) p2) - i)

goal (1 subgoal):
 1. local.coeff (map ((\<otimes>) a) p2) i = map ((\<otimes>) a) p2 ! (degree p2 - i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.coeff (map ((\<otimes>) a) p2) i = map ((\<otimes>) a) p2 ! (degree p2 - i)

goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.coeff (map ((\<otimes>) a) p2) i = map ((\<otimes>) a) p2 ! (degree p2 - i)

goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
have " ... = a \<otimes> (p2 ! (length p2 - 1 - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((\<otimes>) a) p2 ! (degree p2 - i) = a \<otimes> p2 ! (degree p2 - i)
[PROOF STEP]
using i_lt
[PROOF STATE]
proof (prove)
using this:
i < length p2

goal (1 subgoal):
 1. map ((\<otimes>) a) p2 ! (degree p2 - i) = a \<otimes> p2 ! (degree p2 - i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map ((\<otimes>) a) p2 ! (degree p2 - i) = a \<otimes> p2 ! (degree p2 - i)

goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map ((\<otimes>) a) p2 ! (degree p2 - i) = a \<otimes> p2 ! (degree p2 - i)

goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
have " ... = a \<otimes> ((coeff p2) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes> p2 ! (degree p2 - i) = a \<otimes> local.coeff p2 i
[PROOF STEP]
using coeff_nth[OF i_lt]
[PROOF STATE]
proof (prove)
using this:
local.coeff p2 i = p2 ! (degree p2 - i)

goal (1 subgoal):
 1. a \<otimes> p2 ! (degree p2 - i) = a \<otimes> local.coeff p2 i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<otimes> p2 ! (degree p2 - i) = a \<otimes> local.coeff p2 i

goal (1 subgoal):
 1. \<And>i. i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
show "(coeff (map (\<lambda>b. a \<otimes> b) p2)) i = a \<otimes> ((coeff p2) i)"
[PROOF STATE]
proof (prove)
using this:
local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i

goal (1 subgoal):
 1. local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) ?i = a \<otimes> local.coeff p2 ?i

goal (1 subgoal):
 1. (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) ?i = a \<otimes> local.coeff p2 ?i

goal (1 subgoal):
 1. (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))
[PROOF STEP]
have "\<And>i. i \<ge> length p2 \<Longrightarrow> (coeff (map (\<lambda>b. a \<otimes> b) p2)) i = a \<otimes> ((coeff p2) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. length p2 \<le> i \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
using coeff_length[of p2] coeff_length[of "map (\<lambda>b. a \<otimes> b) p2"] in_carrier
[PROOF STATE]
proof (prove)
using this:
length p2 \<le> ?i \<Longrightarrow> local.coeff p2 ?i = \<zero>
length (map ((\<otimes>) a) p2) \<le> ?i \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) ?i = \<zero>
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R

goal (1 subgoal):
 1. \<And>i. length p2 \<le> i \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) i = a \<otimes> local.coeff p2 i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length p2 \<le> ?i \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) ?i = a \<otimes> local.coeff p2 ?i

goal (1 subgoal):
 1. (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) ?i = a \<otimes> local.coeff p2 ?i
length p2 \<le> ?i \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) ?i = a \<otimes> local.coeff p2 ?i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i < length p2 \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) ?i = a \<otimes> local.coeff p2 ?i
length p2 \<le> ?i \<Longrightarrow> local.coeff (map ((\<otimes>) a) p2) ?i = a \<otimes> local.coeff p2 ?i

goal (1 subgoal):
 1. (\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))
[PROOF STEP]
by (meson not_le)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. if i < length p1 then \<zero> else local.coeff (map ((\<otimes>) a) p2) (i - length p1)) = (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have " ... = (\<lambda>i. \<Oplus> k \<in> {..i}. (if k = length p1 then a else \<zero>) \<otimes> (coeff p2) (i - k))"
  (is "?f1 = (\<lambda>i. (\<Oplus> k \<in> {..i}. ?f2 k \<otimes> ?f3 (i - k)))")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have "\<And>k. k \<in> {..i} \<Longrightarrow> ?f2 k \<otimes> ?f3 (i - k) = \<zero>" if "i < length p1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k \<in> {..i} \<Longrightarrow> (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) = \<zero>
[PROOF STEP]
using in_carrier that
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
i < length p1

goal (1 subgoal):
 1. \<And>k. k \<in> {..i} \<Longrightarrow> (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) = \<zero>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>i < length p1; ?k \<in> {..i}\<rbrakk> \<Longrightarrow> (if ?k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ?k) = \<zero>

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
hence "(\<Oplus> k \<in> {..i}. ?f2 k \<otimes> ?f3 (i - k)) = \<zero>" if "i < length p1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < length p1; ?k \<in> {..i}\<rbrakk> \<Longrightarrow> (if ?k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ?k) = \<zero>

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = \<zero>
[PROOF STEP]
using that in_carrier
            add.finprod_cong'[of "{..i}" "{..i}" "\<lambda>k. ?f2 k \<otimes> ?f3 (i - k)" "\<lambda>i. \<zero>"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < length p1; ?k \<in> {..i}\<rbrakk> \<Longrightarrow> (if ?k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ?k) = \<zero>
i < length p1
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
\<lbrakk>{..i} = {..i}; (\<lambda>k. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<in> {..i} \<rightarrow> carrier R; \<And>ia. ia \<in> {..i} \<Longrightarrow> \<zero> = (if ia = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ia)\<rbrakk> \<Longrightarrow> (\<Oplus>i\<in>{..i}. \<zero>) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = \<zero>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length p1 \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = \<zero>

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
hence eq_lt: "?f1 i = (\<lambda>i. (\<Oplus> k \<in> {..i}. ?f2 k \<otimes> ?f3 (i - k))) i" if "i < length p1"
[PROOF STATE]
proof (prove)
using this:
i < length p1 \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = \<zero>

goal (1 subgoal):
 1. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i < length p1 \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = \<zero>
i < length p1

goal (1 subgoal):
 1. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length p1 \<Longrightarrow> (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have "\<And>k. k \<in> {..i} \<Longrightarrow>
              ?f2 k \<otimes>\<^bsub>R\<^esub> ?f3 (i - k) = (if length p1 = k then a \<otimes> coeff p2 (i - k) else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k \<in> {..i} \<Longrightarrow> (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) = (if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>)
[PROOF STEP]
using in_carrier
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R

goal (1 subgoal):
 1. \<And>k. k \<in> {..i} \<Longrightarrow> (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) = (if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k \<in> {..i} \<Longrightarrow> (if ?k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ?k) = (if length p1 = ?k then a \<otimes> local.coeff p2 (i - ?k) else \<zero>)

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
hence "(\<Oplus> k \<in> {..i}. ?f2 k \<otimes> ?f3 (i - k)) =
           (\<Oplus> k \<in> {..i}. (if length p1 = k then a \<otimes> coeff p2 (i - k) else \<zero>))"
[PROOF STATE]
proof (prove)
using this:
?k \<in> {..i} \<Longrightarrow> (if ?k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ?k) = (if length p1 = ?k then a \<otimes> local.coeff p2 (i - ?k) else \<zero>)

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>)
[PROOF STEP]
using in_carrier
            add.finprod_cong'[of "{..i}" "{..i}" "\<lambda>k. ?f2 k \<otimes> ?f3 (i - k)"
                             "\<lambda>k. (if length p1 = k then a \<otimes> coeff p2 (i - k) else \<zero>)"]
[PROOF STATE]
proof (prove)
using this:
?k \<in> {..i} \<Longrightarrow> (if ?k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ?k) = (if length p1 = ?k then a \<otimes> local.coeff p2 (i - ?k) else \<zero>)
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
\<lbrakk>{..i} = {..i}; (\<lambda>k. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<in> {..i} \<rightarrow> carrier R; \<And>ia. ia \<in> {..i} \<Longrightarrow> (if length p1 = ia then a \<otimes> local.coeff p2 (i - ia) else \<zero>) = (if ia = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ia)\<rbrakk> \<Longrightarrow> (\<Oplus>k\<in>{..i}. if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>)

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>)

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have " ... = a \<otimes> (coeff p2) (i - length p1)" if "i \<ge> length p1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>) = a \<otimes> local.coeff p2 (i - length p1)
[PROOF STEP]
using add.finprod_singleton[of "length p1" "{..i}" "\<lambda>j. a \<otimes> (coeff p2) (i - j)"]
            in_carrier that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length p1 \<in> {..i}; finite {..i}; (\<lambda>j. a \<otimes> local.coeff p2 (i - j)) \<in> {..i} \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<Oplus>j\<in>{..i}. if length p1 = j then a \<otimes> local.coeff p2 (i - j) else \<zero>) = a \<otimes> local.coeff p2 (i - length p1)
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
length p1 \<le> i

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>) = a \<otimes> local.coeff p2 (i - length p1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length p1 \<le> i \<Longrightarrow> (\<Oplus>k\<in>{..i}. if length p1 = k then a \<otimes> local.coeff p2 (i - k) else \<zero>) = a \<otimes> local.coeff p2 (i - length p1)

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length p1 \<le> i \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = a \<otimes> local.coeff p2 (i - length p1)
[PROOF STEP]
have "(\<Oplus> k \<in> {..i}. ?f2 k \<otimes> ?f3 (i - k)) =  a \<otimes> (coeff p2) (i - length p1)" if "i \<ge> length p1"
[PROOF STATE]
proof (prove)
using this:
length p1 \<le> i \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = a \<otimes> local.coeff p2 (i - length p1)

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = a \<otimes> local.coeff p2 (i - length p1)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
length p1 \<le> i \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = a \<otimes> local.coeff p2 (i - length p1)
length p1 \<le> i

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = a \<otimes> local.coeff p2 (i - length p1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length p1 \<le> i \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = a \<otimes> local.coeff p2 (i - length p1)

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
hence eq_ge: "?f1 i = (\<lambda>i. (\<Oplus> k \<in> {..i}. ?f2 k \<otimes> ?f3 (i - k))) i" if "i \<ge> length p1"
[PROOF STATE]
proof (prove)
using this:
length p1 \<le> i \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = a \<otimes> local.coeff p2 (i - length p1)

goal (1 subgoal):
 1. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
length p1 \<le> i \<Longrightarrow> (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) = a \<otimes> local.coeff p2 (i - length p1)
length p1 \<le> i

goal (1 subgoal):
 1. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length p1 \<le> i \<Longrightarrow> (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. \<And>i. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
from eq_lt eq_ge
[PROOF STATE]
proof (chain)
picking this:
i < length p1 \<Longrightarrow> (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
length p1 \<le> i \<Longrightarrow> (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
show "?f1 i = (\<lambda>i. (\<Oplus> k \<in> {..i}. ?f2 k \<otimes> ?f3 (i - k))) i"
[PROOF STATE]
proof (prove)
using this:
i < length p1 \<Longrightarrow> (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
length p1 \<le> i \<Longrightarrow> (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. (if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>i. if i < length p1 then \<zero> else a \<otimes> local.coeff p2 (i - length p1)) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have coeff_a_p2:
    "coeff ?a_p2 = (\<lambda>i. \<Oplus> k \<in> {..i}. (if k = length p1 then a else \<zero>) \<otimes> (coeff p2) (i - k))"
[PROOF STATE]
proof (prove)
using this:
local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have "set ?a_p2 \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> carrier R
[PROOF STEP]
using in_carrier(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
set p2 \<subseteq> carrier R

goal (1 subgoal):
 1. set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have "set (poly_mult p1 p2) \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (poly_mult p1 p2) \<subseteq> carrier R
[PROOF STEP]
using poly_mult_in_carrier[OF _ assms(2)] Cons(2)
[PROOF STATE]
proof (prove)
using this:
set ?p1.0 \<subseteq> carrier R \<Longrightarrow> set (poly_mult ?p1.0 p2) \<subseteq> carrier R
set (a # p1) \<subseteq> carrier R

goal (1 subgoal):
 1. set (poly_mult p1 p2) \<subseteq> carrier R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (poly_mult p1 p2) \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> carrier R
set (poly_mult p1 p2) \<subseteq> carrier R
[PROOF STEP]
have "coeff (poly_mult (a # p1) p2) = (\<lambda>i. ((coeff ?a_p2) i) \<oplus> ((coeff (poly_mult p1 p2)) i))"
[PROOF STATE]
proof (prove)
using this:
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> carrier R
set (poly_mult p1 p2) \<subseteq> carrier R

goal (1 subgoal):
 1. local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i)
[PROOF STEP]
using poly_add_coeff[of ?a_p2 "poly_mult p1 p2"]
[PROOF STATE]
proof (prove)
using this:
set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> carrier R
set (poly_mult p1 p2) \<subseteq> carrier R
\<lbrakk>set (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) \<subseteq> carrier R; set (poly_mult p1 p2) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_add (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) (poly_mult p1 p2)) = (\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i)

goal (1 subgoal):
 1. local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i)

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i)

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have " ... = (\<lambda>i. (\<Oplus> k \<in> {..i}. (if k = length p1 then a else \<zero>) \<otimes> (coeff p2) (i - k)) \<oplus>
                         (\<Oplus> k \<in> {..i}. (coeff p1) k \<otimes> (coeff p2) (i - k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i) = (\<lambda>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<oplus> (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)))
[PROOF STEP]
using Cons  coeff_a_p2
[PROOF STATE]
proof (prove)
using this:
set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))
set (a # p1) \<subseteq> carrier R
local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. (\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i) = (\<lambda>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<oplus> (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i) = (\<lambda>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<oplus> (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. local.coeff (map ((\<otimes>) a) p2 @ replicate (degree (a # p1)) \<zero>) i \<oplus> local.coeff (poly_mult p1 p2) i) = (\<lambda>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<oplus> (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have " ... = (\<lambda>i. (\<Oplus> k \<in> {..i}. ((if k = length p1 then a else \<zero>) \<otimes> (coeff p2) (i - k)) \<oplus>
                                                            ((coeff p1) k \<otimes> (coeff p2) (i - k))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<oplus> (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
using add.finprod_multf in_carrier
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> ?A \<rightarrow> carrier R; ?g \<in> ?A \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<Oplus>x\<in>?A. ?f x \<oplus> ?g x) = finsum R ?f ?A \<oplus> finsum R ?g ?A
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R

goal (1 subgoal):
 1. (\<lambda>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<oplus> (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<oplus> (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k)) \<oplus> (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))) = (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have " ... = (\<lambda>i. (\<Oplus> k \<in> {..i}. (coeff (a # p1) k) \<otimes> (coeff p2) (i - k)))"
   (is "(\<lambda>i. (\<Oplus> k \<in> {..i}. ?f i k)) = (\<lambda>i. (\<Oplus> k \<in> {..i}. ?g i k))")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
have "\<And>k. ?f i k = ?g i k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k) = local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k)
[PROOF STEP]
using in_carrier coeff_length[of p1]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
length p1 \<le> ?i \<Longrightarrow> local.coeff p1 ?i = \<zero>

goal (1 subgoal):
 1. \<And>k. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k) = local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if ?k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ?k) \<oplus> local.coeff p1 ?k \<otimes> local.coeff p2 (i - ?k) = local.coeff (a # p1) ?k \<otimes> local.coeff p2 (i - ?k)

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
thus "(\<Oplus> k \<in> {..i}. ?f i k) = (\<Oplus> k \<in> {..i}. ?g i k)"
[PROOF STATE]
proof (prove)
using this:
(if ?k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - ?k) \<oplus> local.coeff p1 ?k \<otimes> local.coeff p2 (i - ?k) = local.coeff (a # p1) ?k \<otimes> local.coeff p2 (i - ?k)

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>i. \<Oplus>k\<in>{..i}. (if k = length p1 then a else \<zero>) \<otimes> local.coeff p2 (i - k) \<oplus> local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. \<And>a p1. \<lbrakk>set p1 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)); set (a # p1) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))

goal (1 subgoal):
 1. local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult (a # p1) p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (a # p1) k \<otimes> local.coeff p2 (i - k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_implies_block_nempty: "j < dim_col M \<Longrightarrow> 1 \<in>$ (col M j) \<Longrightarrow> map_col_to_block (col M j) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < dim_col M; (1::'b) \<in>$ col M j\<rbrakk> \<Longrightarrow> map_col_to_block (col M j) \<noteq> {}
[PROOF STEP]
unfolding map_col_to_block_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < dim_col M; (1::'b) \<in>$ col M j\<rbrakk> \<Longrightarrow> {i \<in> {..<dim_vec (col M j)}. col M j $ i = (1::'b)} \<noteq> {}
[PROOF STEP]
using vec_setE
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in>$ ?v; \<And>i. \<lbrakk>?v $ i = ?a; i < dim_vec ?v\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<lbrakk>j < dim_col M; (1::'b) \<in>$ col M j\<rbrakk> \<Longrightarrow> {i \<in> {..<dim_vec (col M j)}. col M j $ i = (1::'b)} \<noteq> {}
[PROOF STEP]
by force


[STATEMENT]
lemma all_edges_between_Union2:
  "all_edges_between X (Union \<Y>) = (\<Union>Y\<in>\<Y>. all_edges_between X Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_edges_between X (\<Union> \<Y>) = \<Union> (all_edges_between X ` \<Y>)
[PROOF STEP]
by (auto simp: all_edges_between_def)


[STATEMENT]
lemma fst_snd_id_lens: "fst\<^sub>L +\<^sub>L snd\<^sub>L = 1\<^sub>L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst\<^sub>L +\<^sub>L snd\<^sub>L = 1\<^sub>L
[PROOF STEP]
by (auto simp add: lens_plus_def fst_lens_def snd_lens_def id_lens_def)


[STATEMENT]
lemma [code abstract]:
  "integer_of_natural (m div n) = integer_of_natural m div integer_of_natural n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integer_of_natural (m div n) = integer_of_natural m div integer_of_natural n
[PROOF STEP]
by transfer (simp add: zdiv_int)


[STATEMENT]
lemma acc_bacc_eq:
  fixes A :: "('a :: finite \<times> 'a) set"
  assumes "finite A"
  shows "Wellfounded.acc A = bacc A (card (UNIV :: 'a set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Wellfounded.acc A = bacc A (card UNIV)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. Wellfounded.acc A = bacc A (card UNIV)
[PROOF STEP]
by (metis acc_subseteq_bacc bacc_subseteq_acc bacc_upper_bound order_eq_iff)


[STATEMENT]
lemma cf_lcomp_Hom_ArrMap_vdomain[cat_cs_simps]:
  assumes "category \<alpha> \<CC>" and "\<FF> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  shows "\<D>\<^sub>\<circ> (Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,-)\<lparr>ArrMap\<rparr>) = (op_cat \<BB> \<times>\<^sub>C \<CC>)\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,-)\<lparr>ArrMap\<rparr>) = (op_cat \<BB> \<times>\<^sub>C \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
\<FF> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,-)\<lparr>ArrMap\<rparr>) = (op_cat \<BB> \<times>\<^sub>C \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
unfolding cf_lcomp_Hom_def
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
\<FF> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_cn_cov_lcomp \<CC> Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-) \<FF>\<lparr>ArrMap\<rparr>) = (op_cat \<BB> \<times>\<^sub>C \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)


[STATEMENT]
lemma [mono]:
  shows "A <= B \<Longrightarrow> C <= D ==> prod_alpha A C <= prod_alpha B D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<le> B; C \<le> D\<rbrakk> \<Longrightarrow> prod_alpha A C \<le> prod_alpha B D
[PROOF STEP]
unfolding prod_alpha_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<le> B; C \<le> D\<rbrakk> \<Longrightarrow> rel_prod A C \<le> rel_prod B D
[PROOF STEP]
by auto


[STATEMENT]
lemma obtuse_out2__obtuse:
  assumes "B Out A' A" and
    "B Out C' C" and
    "Obtuse A B C"
  shows "Obtuse A' B C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Obtuse A' B C'
[PROOF STEP]
by (meson Tarski_neutral_dimensionless.out2__conga Tarski_neutral_dimensionless_axioms assms(1) assms(2) assms(3) conga_obtuse__obtuse)


[STATEMENT]
lemma normal_polyI:
  assumes "(p \<noteq> 0)"
      and "(\<And> i. 0 \<le> coeff p i)"
      and "(\<And> i. coeff p i * coeff p (i+2) \<le> (coeff p (i+1))^2)"
      and "(\<And> i j k. i \<le> j \<Longrightarrow> j \<le> k \<Longrightarrow> 0 < coeff p i \<Longrightarrow> 0 < coeff p k \<Longrightarrow> 0 < coeff p j)"
    shows "normal_poly p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normal_poly p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
(0::'a) \<le> coeff p ?i
coeff p ?i * coeff p (?i + 2) \<le> (coeff p (?i + 1))\<^sup>2
\<lbrakk>?i \<le> ?j; ?j \<le> ?k; (0::'a) < coeff p ?i; (0::'a) < coeff p ?k\<rbrakk> \<Longrightarrow> (0::'a) < coeff p ?j

goal (1 subgoal):
 1. normal_poly p
[PROOF STEP]
by (force simp: normal_poly_def)


[STATEMENT]
lemma sum_disjoint:
  assumes "x \<sqinter> y = bot"
    shows "sum ((x \<squnion> y) \<sqinter> z) = sum (x \<sqinter> z) + sum (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_class.sum ((x \<squnion> y) \<sqinter> z) = sum_class.sum (x \<sqinter> z) + sum_class.sum (y \<sqinter> z)
[PROOF STEP]
by (subst sum_plus) (metis assms inf.sup_monoid.add_assoc inf.sup_monoid.add_commute inf_bot_left inf_sup_distrib2 sum_bot)


[STATEMENT]
lemma coprime_cong_mult:
  "[a = b] (mod m) \<Longrightarrow> [a = b] (mod n) \<Longrightarrow> coprime m n \<Longrightarrow> [a = b] (mod m * n)"
  for a b :: "'a :: {unique_euclidean_ring, semiring_gcd}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>[a = b] (mod m); [a = b] (mod n); coprime m n\<rbrakk> \<Longrightarrow> [a = b] (mod m * n)
[PROOF STEP]
by (simp add: cong_iff_dvd_diff divides_mult)


[STATEMENT]
lemma  iffb_sup_dual: "fb\<^sup>-\<^sub>\<F> (\<phi> \<squnion> \<psi>) = fb\<^sup>-\<^sub>\<F> \<phi> \<sqinter> fb\<^sup>-\<^sub>\<F> \<psi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fb\<^sup>-\<^sub>\<F> (\<phi> \<squnion> \<psi>) = fb\<^sup>-\<^sub>\<F> \<phi> \<sqinter> fb\<^sup>-\<^sub>\<F> \<psi>
[PROOF STEP]
unfolding iffb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<Inter> {X. s2p ((\<phi> \<squnion> \<psi>) X) x}) = (\<lambda>x. \<Inter> {X. s2p (\<phi> X) x}) \<sqinter> (\<lambda>x. \<Inter> {X. s2p (\<psi> X) x})
[PROOF STEP]
by fastforce


[STATEMENT]
lemma has_field_derivative_erfc_aux:
    "(erfc_aux has_field_derivative (2 * x * erfc_aux x - 2)) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (erfc_aux has_real_derivative 2 * x * erfc_aux x - 2) (at x)
[PROOF STEP]
by (auto simp: erfc_aux_def [abs_def] exp_minus field_simps intro!: derivative_eq_intros)


[STATEMENT]
lemma nn_intergal_power_times_exp_Icc:
  assumes [arith]: "0 \<le> a"
  shows "(\<integral>\<^sup>+x. ennreal (x^k * exp (-x)) * indicator {0 .. a} x \<partial>lborel) =
    (1 - (\<Sum>n\<le>k. (a^n * exp (-a)) / fact n)) * fact k" (is "?I = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
let ?f = "\<lambda>k x. x^k * exp (-x) / fact k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
let ?F = "\<lambda>k x. - (\<Sum>n\<le>k. (x^n * exp (-x)) / fact n)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
have "?I * (inverse (real_of_nat (fact k))) =
      (\<integral>\<^sup>+x. ennreal (x^k * exp (-x)) * indicator {0 .. a} x * (inverse (real_of_nat (fact k))) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel) * ennreal (inverse (real (fact k))) = \<integral>\<^sup>+ x. ennreal (x ^ k * exp (- x)) * indicator {0..a} x * ennreal (inverse (real (fact k))) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_multc[symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel) * ennreal (inverse (real (fact k))) = \<integral>\<^sup>+ x. ennreal (x ^ k * exp (- x)) * indicator {0..a} x * ennreal (inverse (real (fact k))) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel) * ennreal (inverse (real (fact k))) = \<integral>\<^sup>+ x. ennreal (x ^ k * exp (- x)) * indicator {0..a} x * ennreal (inverse (real (fact k))) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+x. ennreal (?f k x) * indicator {0 .. a} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (x ^ k * exp (- x)) * indicator {0..a} x * ennreal (inverse (real (fact k))) \<partial>lborel = \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x) / fact k)\<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong)
       (simp add: field_simps ennreal_mult'[symmetric] indicator_mult_ennreal)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (x ^ k * exp (- x)) * indicator {0..a} x * ennreal (inverse (real (fact k))) \<partial>lborel = \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x) / fact k)\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (x ^ k * exp (- x)) * indicator {0..a} x * ennreal (inverse (real (fact k))) \<partial>lborel = \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x) / fact k)\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
have "\<dots> = ennreal (?F k a - ?F k 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x) / fact k)\<partial>lborel = ennreal (- (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n) - - (\<Sum>n\<le>k. 0 ^ n * exp (- 0) / fact n))
[PROOF STEP]
proof (rule nn_integral_FTC_Icc)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<lambda>x. x ^ k * exp (- x) / fact k) \<in> borel_measurable borel
 2. \<And>x. x \<in> {0..a} \<Longrightarrow> ((\<lambda>a. - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x)
 3. \<And>x. x \<in> {0..a} \<Longrightarrow> 0 \<le> x ^ k * exp (- x) / fact k
 4. 0 \<le> a
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<lambda>x. x ^ k * exp (- x) / fact k) \<in> borel_measurable borel
 2. \<And>x. x \<in> {0..a} \<Longrightarrow> ((\<lambda>a. - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x)
 3. \<And>x. x \<in> {0..a} \<Longrightarrow> 0 \<le> x ^ k * exp (- x) / fact k
 4. 0 \<le> a
[PROOF STEP]
assume "x \<in> {0..a}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..a}

goal (4 subgoals):
 1. (\<lambda>x. x ^ k * exp (- x) / fact k) \<in> borel_measurable borel
 2. \<And>x. x \<in> {0..a} \<Longrightarrow> ((\<lambda>a. - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x)
 3. \<And>x. x \<in> {0..a} \<Longrightarrow> 0 \<le> x ^ k * exp (- x) / fact k
 4. 0 \<le> a
[PROOF STEP]
show "DERIV (?F k) x :> ?f k x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x)
[PROOF STEP]
proof(induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>x. - (\<Sum>n\<le>0. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ 0 * exp (- x) / fact 0) (at x)
 2. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. ((\<lambda>x. - (\<Sum>n\<le>0. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ 0 * exp (- x) / fact 0) (at x)
 2. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - (\<Sum>n\<le>0. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ 0 * exp (- x) / fact 0) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - (\<Sum>n\<le>0. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ 0 * exp (- x) / fact 0) (at x)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
have "DERIV (\<lambda>x. ?F k x - (x^Suc k * exp (-x)) / fact (Suc k)) x :>
        ?f k x - ((real (Suc k) - x) * x ^ k * exp (- x)) / (fact (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n) - x ^ Suc k * exp (- x) / fact (Suc k)) has_real_derivative x ^ k * exp (- x) / fact k - (real (Suc k) - x) * x ^ k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
by (intro DERIV_diff Suc)
           (auto intro!: derivative_eq_intros simp del: fact_Suc power_Suc
                 simp add: field_simps power_Suc[symmetric])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n) - x ^ Suc k * exp (- x) / fact (Suc k)) has_real_derivative x ^ k * exp (- x) / fact k - (real (Suc k) - x) * x ^ k * exp (- x) / fact (Suc k)) (at x)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n) - x ^ Suc k * exp (- x) / fact (Suc k)) has_real_derivative x ^ k * exp (- x) / fact k - (real (Suc k) - x) * x ^ k * exp (- x) / fact (Suc k)) (at x)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
have "(\<lambda>x. ?F k x - (x^Suc k * exp (-x)) / fact (Suc k)) = ?F (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n) - x ^ Suc k * exp (- x) / fact (Suc k)) = (\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n) - x ^ Suc k * exp (- x) / fact (Suc k)) = (\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n))

goal (1 subgoal):
 1. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n) - x ^ Suc k * exp (- x) / fact (Suc k)) = (\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n))

goal (1 subgoal):
 1. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
have "?f k x - ((real (Suc k) - x) * x ^ k * exp (- x)) / (fact (Suc k)) = ?f (Suc k) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ k * exp (- x) / fact k - (real (Suc k) - x) * x ^ k * exp (- x) / fact (Suc k) = x ^ Suc k * exp (- x) / fact (Suc k)
[PROOF STEP]
by (auto simp: field_simps simp del: fact_Suc)
           (simp_all add: of_nat_Suc field_simps)
[PROOF STATE]
proof (state)
this:
x ^ k * exp (- x) / fact k - (real (Suc k) - x) * x ^ k * exp (- x) / fact (Suc k) = x ^ Suc k * exp (- x) / fact (Suc k)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x) \<Longrightarrow> ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - (\<Sum>n\<le>Suc k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ Suc k * exp (- x) / fact (Suc k)) (at x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - (\<Sum>n\<le>k. x ^ n * exp (- x) / fact n)) has_real_derivative x ^ k * exp (- x) / fact k) (at x)

goal (3 subgoals):
 1. (\<lambda>x. x ^ k * exp (- x) / fact k) \<in> borel_measurable borel
 2. \<And>x. x \<in> {0..a} \<Longrightarrow> 0 \<le> x ^ k * exp (- x) / fact k
 3. 0 \<le> a
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x) / fact k)\<partial>lborel = ennreal (- (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n) - - (\<Sum>n\<le>k. 0 ^ n * exp (- 0) / fact n))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x) / fact k)\<partial>lborel = ennreal (- (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n) - - (\<Sum>n\<le>k. 0 ^ n * exp (- 0) / fact n))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
have "\<dots> = ennreal (1 - (\<Sum>n\<le>k. (a^n * exp (-a)) / fact n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (- (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n) - - (\<Sum>n\<le>k. 0 ^ n * exp (- 0) / fact n)) = ennreal (1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n))
[PROOF STEP]
by (auto simp: power_0_left if_distrib[where f="\<lambda>x. x / a" for a] sum.If_cases)
[PROOF STATE]
proof (state)
this:
ennreal (- (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n) - - (\<Sum>n\<le>k. 0 ^ n * exp (- 0) / fact n)) = ennreal (1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (- (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n) - - (\<Sum>n\<le>k. 0 ^ n * exp (- 0) / fact n)) = ennreal (1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
have "\<dots> = ennreal ((1 - (\<Sum>n\<le>k. (a^n * exp (-a)) / fact n)) * fact k) * ennreal (inverse (fact k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k) * ennreal (inverse (fact k))
[PROOF STEP]
by (subst ennreal_mult''[symmetric]) (auto intro!: arg_cong[where f=ennreal])
[PROOF STATE]
proof (state)
this:
ennreal (1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k) * ennreal (inverse (fact k))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel) * ennreal (inverse (real (fact k))) = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k) * ennreal (inverse (fact k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel) * ennreal (inverse (real (fact k))) = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k) * ennreal (inverse (fact k))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)
[PROOF STEP]
by (auto simp add: mult_right_ennreal_cancel le_less)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..a}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal ((1 - (\<Sum>n\<le>k. a ^ n * exp (- a) / fact n)) * fact k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma to_univ_poly_add:
  assumes "i \<le> n"
  assumes "p \<in> carrier (R[\<X>\<^bsub>Suc n\<^esub>])"
  assumes "Q \<in> carrier (R[\<X>\<^bsub>Suc n\<^esub>])"
  shows "to_univ_poly (Suc n) i (p \<oplus>\<^bsub>R[\<X>\<^bsub>Suc n\<^esub>]\<^esub>Q) =
        to_univ_poly (Suc n) i p \<oplus>\<^bsub>UP (R[\<X>\<^bsub>n\<^esub>])\<^esub> to_univ_poly (Suc n) i Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_univ_poly (Suc n) i (p \<oplus>\<^bsub>R [\<X>\<^bsub>Suc n\<^esub>]\<^esub> Q) = to_univ_poly (Suc n) i p \<oplus>\<^bsub>UP (R [\<X>\<^bsub>n\<^esub>])\<^esub> to_univ_poly (Suc n) i Q
[PROOF STEP]
using to_univ_poly_is_hom ring_hom_add
[PROOF STATE]
proof (prove)
using this:
?i \<le> ?n \<Longrightarrow> to_univ_poly (Suc ?n) ?i \<in> ring_hom (R [\<X>\<^bsub>Suc ?n\<^esub>]) (UP (R [\<X>\<^bsub>?n\<^esub>]))
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<oplus>\<^bsub>?R\<^esub> ?y) = ?h ?x \<oplus>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. to_univ_poly (Suc n) i (p \<oplus>\<^bsub>R [\<X>\<^bsub>Suc n\<^esub>]\<^esub> Q) = to_univ_poly (Suc n) i p \<oplus>\<^bsub>UP (R [\<X>\<^bsub>n\<^esub>])\<^esub> to_univ_poly (Suc n) i Q
[PROOF STEP]
by (metis assms(1) assms(2) assms(3))


[STATEMENT]
lemma dec_seqn1:"\<lbrakk>a \<in> A; A \<subseteq> Zset;\<not> (\<exists>m. m\<in>A \<and> (\<forall>x\<in>A. m \<le> x))\<rbrakk> \<Longrightarrow>
                       (dec_seq A a (Suc n)) \<le> (dec_seq A a n) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; A \<subseteq> Zset; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. m \<le> x)\<rbrakk> \<Longrightarrow> dec_seq A a (Suc n) \<le> dec_seq A a n - 1
[PROOF STEP]
apply (frule dec_seqn [of "a" "A" "n"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; A \<subseteq> Zset; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. m \<le> x); dec_seq A a (Suc n) < dec_seq A a n\<rbrakk> \<Longrightarrow> dec_seq A a (Suc n) \<le> dec_seq A a n - 1
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma aux1:"(A - rat_poly_times (rat_poly_times B B) B)
         = A - (B^3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - rat_poly_times (rat_poly_times B B) B = A - B ^ 3
[PROOF STEP]
using power3_eq_cube
[PROOF STATE]
proof (prove)
using this:
?a ^ 3 = ?a * ?a * ?a

goal (1 subgoal):
 1. A - rat_poly_times (rat_poly_times B B) B = A - B ^ 3
[PROOF STEP]
by (metis)


[STATEMENT]
lemma raw_match_extend_map_preserve':
  assumes "raw_match_term t u subs = Some subs'" "map_le subs' subs''"
  shows "tsubst t (convert_subs subs')
    = tsubst t (convert_subs subs'')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tsubst t (convert_subs subs') = tsubst t (convert_subs subs'')
[PROOF STEP]
apply (rule map_eq_on_tvs_imp_map_eq_on_term)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. p \<in> tvs t \<Longrightarrow> subs' p = subs'' p
[PROOF STEP]
using raw_match_term_extend_map_preserve assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>raw_match_term ?t ?u ?subs = Some ?subs'; ?subs' \<subseteq>\<^sub>m ?subs''; ?p \<in> tvs ?t\<rbrakk> \<Longrightarrow> ?subs'' ?p = ?subs' ?p
raw_match_term t u subs = Some subs'
subs' \<subseteq>\<^sub>m subs''

goal (1 subgoal):
 1. \<And>p. p \<in> tvs t \<Longrightarrow> subs' p = subs'' p
[PROOF STEP]
by fastforce


[STATEMENT]
lemma permutation_lift_signed_lconjperm_eq_signed_list_lconjaction:
  "x \<in> FreeGroup S \<Longrightarrow>
    permutation (lift_signed_lconjperm x) =
      signed_list_lconjaction (map fst (freeword x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> FreeGroup S \<Longrightarrow> (\<rightarrow>) (freeword_funlift signed_lconjpermutation x) = signed_list_lconjaction (map fst (freeword x))
[PROOF STEP]
using freeword FreeGroup_def[of S] freeword_inverse[of x]
        permutation_lift_signed_lconjperm_eq_signed_list_lconjaction'
[PROOF STATE]
proof (prove)
using this:
freeword ?x \<in> {as. proper_signed_list as}
FreeGroup S \<equiv> {x. fst ` set (freeword x) \<subseteq> S}
Abs_freeword (freeword x) = x
\<lbrakk>proper_signed_list ?xs; fst ` set ?xs \<subseteq> S\<rbrakk> \<Longrightarrow> (\<rightarrow>) (freeword_funlift signed_lconjpermutation (Abs_freeword ?xs)) = signed_list_lconjaction (map fst ?xs)

goal (1 subgoal):
 1. x \<in> FreeGroup S \<Longrightarrow> (\<rightarrow>) (freeword_funlift signed_lconjpermutation x) = signed_list_lconjaction (map fst (freeword x))
[PROOF STEP]
by    force