[STATEMENT]
lemma int_bit_count_est_1:
  assumes "\<bar>n\<bar> \<le> r"
  shows "bit_count (I\<^sub>e n) \<le> 2 * log 2 (r+1) +3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
proof (cases "abs n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
 2. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 < \<bar>n\<bar>

goal (2 subgoals):
 1. 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
 2. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
have "real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2  \<bar>real_of_int n\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 \<bar>real_of_int n\<bar>
[PROOF STEP]
using of_int_floor_le
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>?x\<rfloor> \<le> ?x

goal (1 subgoal):
 1. real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 \<bar>real_of_int n\<bar>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 \<bar>real_of_int n\<bar>

goal (2 subgoals):
 1. 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
 2. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 \<bar>real_of_int n\<bar>

goal (2 subgoals):
 1. 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
 2. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
have "... \<le> log 2 (real_of_int r+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log 2 \<bar>real_of_int n\<bar> \<le> log 2 (real_of_int r + 1)
[PROOF STEP]
using True assms
[PROOF STATE]
proof (prove)
using this:
0 < \<bar>n\<bar>
\<bar>n\<bar> \<le> r

goal (1 subgoal):
 1. log 2 \<bar>real_of_int n\<bar> \<le> log 2 (real_of_int r + 1)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
log 2 \<bar>real_of_int n\<bar> \<le> log 2 (real_of_int r + 1)

goal (2 subgoals):
 1. 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
 2. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 (real_of_int r + 1)
[PROOF STEP]
have
    "real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 (real_of_int r + 1)"
[PROOF STATE]
proof (prove)
using this:
real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 (real_of_int r + 1)

goal (1 subgoal):
 1. real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 (real_of_int r + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 (real_of_int r + 1)

goal (2 subgoals):
 1. 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
 2. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 (real_of_int r + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 (real_of_int r + 1)

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
using True assms
[PROOF STATE]
proof (prove)
using this:
real_of_int \<lfloor>log 2 \<bar>real_of_int n\<bar>\<rfloor> \<le> log 2 (real_of_int r + 1)
0 < \<bar>n\<bar>
\<bar>n\<bar> \<le> r

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
by (simp add:int_bit_count_1)
[PROOF STATE]
proof (state)
this:
bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)

goal (1 subgoal):
 1. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 < \<bar>n\<bar>

goal (1 subgoal):
 1. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
have "r \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<bar>n\<bar> \<le> r

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

goal (1 subgoal):
 1. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> r

goal (1 subgoal):
 1. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
have "n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = 0
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < \<bar>n\<bar>

goal (1 subgoal):
 1. n = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = 0

goal (1 subgoal):
 1. \<not> 0 < \<bar>n\<bar> \<Longrightarrow> bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (r + 1)) + 3)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<le> r
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> r
n = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma landau_gt_1_cong:
  "landau_symbol L L' Lr \<Longrightarrow> (\<And>x::real. x > 1 \<Longrightarrow> f x = g x) \<Longrightarrow> L at_top (f) = L at_top (g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>landau_symbol L L' Lr; \<And>x. 1 < x \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> L at_top f = L at_top g
[PROOF STEP]
by (auto intro: eventually_mono [OF eventually_gt_at_top[of 1]] elim!: landau_symbol.cong)


[STATEMENT]
lemma nu_below_mu_nu_2_nu_below_mu_nu:
  assumes "has_least_fixpoint f"
      and "has_greatest_fixpoint f"
      and "nu_below_mu_nu_2 f"
    shows "nu_below_mu_nu f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nu_below_mu_nu f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nu_below_mu_nu f
[PROOF STEP]
have "d(L) * \<nu> f \<le> \<mu> f \<squnion> (\<nu> f \<sqinter> L) \<squnion> d((\<mu> f \<squnion> (\<nu> f \<sqinter> L)) * bot) * top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d L * \<nu> f \<le> \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d ((\<mu> f \<squnion> \<nu> f \<sqinter> L) * bot) * top
[PROOF STEP]
using assms(3) nu_below_mu_nu_2_def
[PROOF STATE]
proof (prove)
using this:
nu_below_mu_nu_2 f
nu_below_mu_nu_2 ?f \<equiv> d L * \<nu> ?f \<le> \<mu> ?f \<squnion> \<nu> ?f \<sqinter> L \<squnion> d ((\<mu> ?f \<squnion> \<nu> ?f \<sqinter> L) * bot) * top

goal (1 subgoal):
 1. d L * \<nu> f \<le> \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d ((\<mu> f \<squnion> \<nu> f \<sqinter> L) * bot) * top
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
d L * \<nu> f \<le> \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d ((\<mu> f \<squnion> \<nu> f \<sqinter> L) * bot) * top

goal (1 subgoal):
 1. nu_below_mu_nu f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d L * \<nu> f \<le> \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d ((\<mu> f \<squnion> \<nu> f \<sqinter> L) * bot) * top

goal (1 subgoal):
 1. nu_below_mu_nu f
[PROOF STEP]
have "... \<le> \<mu> f \<squnion> (\<nu> f \<sqinter> L) \<squnion> d(\<nu> f * bot) * top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d ((\<mu> f \<squnion> \<nu> f \<sqinter> L) * bot) * top \<le> \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d (\<nu> f * bot) * top
[PROOF STEP]
by (metis assms(1,2) d_isotone inf.sup_monoid.add_commute inf.sup_right_divisibility le_supI le_supI2 mu_below_nu mult_left_isotone sup_left_divisibility)
[PROOF STATE]
proof (state)
this:
\<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d ((\<mu> f \<squnion> \<nu> f \<sqinter> L) * bot) * top \<le> \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d (\<nu> f * bot) * top

goal (1 subgoal):
 1. nu_below_mu_nu f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
d L * \<nu> f \<le> \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d (\<nu> f * bot) * top
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
d L * \<nu> f \<le> \<mu> f \<squnion> \<nu> f \<sqinter> L \<squnion> d (\<nu> f * bot) * top

goal (1 subgoal):
 1. nu_below_mu_nu f
[PROOF STEP]
by (simp add: nu_below_mu_nu_def)
[PROOF STATE]
proof (state)
this:
nu_below_mu_nu f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reduced_run_length_1:
      assumes "reduced_run q v\<^sub>1 v\<^sub>2 l w w\<^sub>1 w\<^sub>2 u"
      shows "length v\<^sub>1 \<le> length w\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v\<^sub>1 \<le> length w\<^sub>1
[PROOF STEP]
using reduced_run_invar_1 assms
[PROOF STATE]
proof (prove)
using this:
reduced_run ?q ?v\<^sub>1 ?v\<^sub>2 ?l ?w ?w\<^sub>1 ?w\<^sub>2 ?u \<Longrightarrow> ?v\<^sub>1 @ ?l =\<^sub>F ?w\<^sub>1
reduced_run q v\<^sub>1 v\<^sub>2 l w w\<^sub>1 w\<^sub>2 u

goal (1 subgoal):
 1. length v\<^sub>1 \<le> length w\<^sub>1
[PROOF STEP]
by force


[STATEMENT]
lemma (in abelian_subgroup) a_rcos_module:
  assumes "x \<in> carrier G" "x' \<in> carrier G"
  shows "(x' \<in> H +> x) = (x' \<oplus> \<ominus>x \<in> H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x' \<in> H +> x) = (x' \<oplus> \<ominus> x \<in> H)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
x' \<in> carrier G

goal (1 subgoal):
 1. (x' \<in> H +> x) = (x' \<oplus> \<ominus> x \<in> H)
[PROOF STEP]
by (rule subgroup.rcos_module [OF a_subgroup a_group,
    folded a_r_coset_def a_inv_def, simplified monoid_record_simps])

\<comment> \<open>variant\<close>


[STATEMENT]
lemma equalityI'':
  assumes "\<And>x. A x \<Longrightarrow> B x"
  assumes "\<And>x. B x \<Longrightarrow> A x"
  shows "{x. A x} = {x. B x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. A x} = {x. B x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A ?x3 \<Longrightarrow> B ?x3
B ?x3 \<Longrightarrow> A ?x3

goal (1 subgoal):
 1. {x. A x} = {x. B x}
[PROOF STEP]
by blast


[STATEMENT]
lemma ok_commute: "(F ok G) = (G ok F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F ok G = G ok F
[PROOF STEP]
by (auto simp add: ok_def)


[STATEMENT]
lemma multiply_by_add_time: "VARS m s a b t
  {a=A \<and> b=B \<and> t=0}
  m := 0; t := t+1; s := 0; t := t+1;
  WHILE m\<noteq>a
  INV {s=m*b \<and> a=A \<and> b=B \<and> t = 2*m + 2}
  DO s := s+b; t := t+1; m := m+(1::nat); t := t+1 OD
  {s = A*B \<and> t = 2*A + 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a = A \<and> b = B \<and> t = 0}
m := 0; t := t + 1; s := 0; t := t + 1; WHILE m \<noteq> a INV {s = m * b \<and> a = A \<and> b = B \<and> t = 2 * m + 2}  VAR {0}
DO s := s + b; t := t + 1; m := m + 1; t := t + 1 OD
{s = A * B \<and> t = 2 * A + 2}
[PROOF STEP]
by vcg_simp


[STATEMENT]
lemma rel_\<I>_conversep [simp]: "rel_\<I> C\<inverse>\<inverse> R\<inverse>\<inverse> = (rel_\<I> C R)\<inverse>\<inverse>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_\<I> C\<inverse>\<inverse> R\<inverse>\<inverse> = (rel_\<I> C R)\<inverse>\<inverse>
[PROOF STEP]
unfolding fun_eq_iff conversep_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x xa. rel_\<I> (\<lambda>a b. C b a) (\<lambda>a b. R b a) x xa = rel_\<I> C R xa x
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C R. \<forall>x xa. (rel_set (\<lambda>a b. C b a) {out. x out \<noteq> {}} {out. xa out \<noteq> {}} \<and> rel_fun (\<lambda>a b. C b a) (rel_set (\<lambda>a b. R b a)) x xa) = (rel_set C {out. xa out \<noteq> {}} {out. x out \<noteq> {}} \<and> rel_fun C (rel_set R) xa x)
[PROOF STEP]
apply(rewrite in "rel_fun \<hole>" conversep_iff[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C R. \<forall>x xa. (rel_set (\<lambda>a b. C b a) {out. x out \<noteq> {}} {out. xa out \<noteq> {}} \<and> rel_fun C\<inverse>\<inverse> (rel_set (\<lambda>a b. R b a)) x xa) = (rel_set C {out. xa out \<noteq> {}} {out. x out \<noteq> {}} \<and> rel_fun C (rel_set R) xa x)
[PROOF STEP]
apply(rewrite in "rel_set \<hole>" conversep_iff[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C R. \<forall>x xa. (rel_set C\<inverse>\<inverse> {out. x out \<noteq> {}} {out. xa out \<noteq> {}} \<and> rel_fun C\<inverse>\<inverse> (rel_set (\<lambda>a b. R b a)) x xa) = (rel_set C {out. xa out \<noteq> {}} {out. x out \<noteq> {}} \<and> rel_fun C (rel_set R) xa x)
[PROOF STEP]
apply(rewrite in "rel_fun _ \<hole>" conversep_iff[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C R. \<forall>x xa. (rel_set C\<inverse>\<inverse> {out. x out \<noteq> {}} {out. xa out \<noteq> {}} \<and> rel_fun C\<inverse>\<inverse> (rel_set R\<inverse>\<inverse>) x xa) = (rel_set C {out. xa out \<noteq> {}} {out. x out \<noteq> {}} \<and> rel_fun C (rel_set R) xa x)
[PROOF STEP]
apply(simp del: conversep_iff add: rel_fun_conversep)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C R. \<forall>x xa. ((rel_set C)\<inverse>\<inverse> {out. x out \<noteq> {}} {out. xa out \<noteq> {}} \<and> (rel_fun C (rel_set R))\<inverse>\<inverse> x xa) = (rel_set C {out. xa out \<noteq> {}} {out. x out \<noteq> {}} \<and> rel_fun C (rel_set R) xa x)
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lm071:
  "injectionsUniverse  =  runiqs \<inter> converse`runiqs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. injectionsUniverse = runiqs \<inter> converse ` runiqs
[PROOF STEP]
unfolding runiqs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. injectionsUniverse = Collect runiq \<inter> converse ` Collect runiq
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_imp_compact: "finite s \<Longrightarrow> compact s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite s \<Longrightarrow> compact s
[PROOF STEP]
by (induct set: finite) simp_all


[STATEMENT]
lemma fcard_mono:
  "A |\<subseteq>| B \<Longrightarrow> fcard A \<le> fcard B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A |\<subseteq>| B \<Longrightarrow> fcard A \<le> fcard B
[PROOF STEP]
by transfer (rule card_mono)


[STATEMENT]
lemma symmetric_mpoly_uminus_iff [simp]: "symmetric_mpoly A (-p) \<longleftrightarrow> symmetric_mpoly A p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symmetric_mpoly A (- p) = symmetric_mpoly A p
[PROOF STEP]
unfolding symmetric_mpoly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<pi>. \<pi> permutes A \<longrightarrow> mpoly_map_vars \<pi> (- p) = - p) = (\<forall>\<pi>. \<pi> permutes A \<longrightarrow> mpoly_map_vars \<pi> p = p)
[PROOF STEP]
by simp


[STATEMENT]
lemma divided_differences_main: assumes "k \<le> n" "i < k"
  shows "sum_list (map (\<lambda> j. xij_f i (i + j) * pprod k i (i + j)) [0..<Suc k - i]) =
  sum_list (map (\<lambda> j. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j)) [0..<Suc k - Suc i])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
let ?exp = "\<lambda> i j. xij_f i (i + j) * pprod k i (i + j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
define ei where "ei = ?exp i"
[PROOF STATE]
proof (state)
this:
ei = (\<lambda>j. xij_f i (i + j) * pprod k i (i + j))

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
define esi where "esi = ?exp (Suc i)"
[PROOF STATE]
proof (state)
this:
esi = (\<lambda>j. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
let ?ki = "k - i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
let ?sumi = "\<lambda> xs. sum_list (map ei xs)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
let ?sumsi = "\<lambda> xs. sum_list (map esi xs)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
let ?mid = "\<lambda> j. xij_f i (k - j) * pprod k (Suc i) (k - j) * xd (k - j) i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
let ?sum = "\<lambda> j. ?sumi [0 ..< ?ki - j] + ?sumsi [?ki - j ..< ?ki] + ?mid j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
define fin where "fin = ?ki - 1"
[PROOF STATE]
proof (state)
this:
fin = k - i - 1

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have fin: "fin < ?ki"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fin < k - i
[PROOF STEP]
unfolding fin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k - i - 1 < k - i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n
i < k

goal (1 subgoal):
 1. k - i - 1 < k - i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fin < k - i

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have id: "[ 0 ..< Suc k - i] = [0 ..< ?ki] @ [?ki]" and
    id2: "[i..<k] = i # [Suc i ..< k]" and
    id3: "k - (i + (k - Suc i)) = 1" "k - (?ki - 1) = Suc i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<Suc k - i] = [0..<k - i] @ [k - i] &&& [i..<k] = i # [Suc i..<k] &&& k - (i + (k - Suc i)) = 1 &&& k - (k - i - 1) = Suc i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n
i < k

goal (1 subgoal):
 1. [0..<Suc k - i] = [0..<k - i] @ [k - i] &&& [i..<k] = i # [Suc i..<k] &&& k - (i + (k - Suc i)) = 1 &&& k - (k - i - 1) = Suc i
[PROOF STEP]
by (auto simp: Suc_diff_le upt_conv_Cons)
[PROOF STATE]
proof (state)
this:
[0..<Suc k - i] = [0..<k - i] @ [k - i]
[i..<k] = i # [Suc i..<k]
k - (i + (k - Suc i)) = 1
k - (k - i - 1) = Suc i

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have neq: "xd (Suc i) i \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xd (Suc i) i \<noteq> (0::'a)
[PROOF STEP]
using xd_diff[of i "Suc i"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < Suc i; Suc i \<le> n\<rbrakk> \<Longrightarrow> xd i (Suc i) \<noteq> (0::'a)
\<lbrakk>i < Suc i; Suc i \<le> n\<rbrakk> \<Longrightarrow> xd (Suc i) i \<noteq> (0::'a)
k \<le> n
i < k

goal (1 subgoal):
 1. xd (Suc i) i \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xd (Suc i) i \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "sum_list (map (\<lambda> j. xij_f i (i + j) * pprod k i (i + j)) [0..<Suc k - i])
    = ?sumi [0 ..< Suc k - i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = sum_list (map ei [0..<Suc k - i])
[PROOF STEP]
unfolding ei_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = sum_list (map ei [0..<Suc k - i])

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = sum_list (map ei [0..<Suc k - i])

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "\<dots> = ?sumi [0 ..< ?ki] + ?sumsi [?ki ..< ?ki] + ei ?ki"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei [0..<Suc k - i]) = sum_list (map ei [0..<k - i]) + sum_list (map esi [k - i..<k - i]) + ei (k - i)
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei ([0..<k - i] @ [k - i])) = sum_list (map ei [0..<k - i]) + sum_list (map esi [k - i..<k - i]) + ei (k - i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<Suc k - i]) = sum_list (map ei [0..<k - i]) + sum_list (map esi [k - i..<k - i]) + ei (k - i)

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<Suc k - i]) = sum_list (map ei [0..<k - i]) + sum_list (map esi [k - i..<k - i]) + ei (k - i)

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "\<dots> = ?sum 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei [0..<k - i]) + sum_list (map esi [k - i..<k - i]) + ei (k - i) = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
[PROOF STEP]
unfolding ei_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<k - i]. xij_f i (i + j) * pprod k i (i + j)) + sum_list (map esi [k - i..<k - i]) + xij_f i (i + (k - i)) * pprod k i (i + (k - i)) = (\<Sum>j\<leftarrow>[0..<k - i - 0]. xij_f i (i + j) * pprod k i (i + j)) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n
i < k

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<k - i]. xij_f i (i + j) * pprod k i (i + j)) + sum_list (map esi [k - i..<k - i]) + xij_f i (i + (k - i)) * pprod k i (i + (k - i)) = (\<Sum>j\<leftarrow>[0..<k - i - 0]. xij_f i (i + j) * pprod k i (i + j)) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
[PROOF STEP]
by (simp add: pprod_def id2)
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i]) + sum_list (map esi [k - i..<k - i]) + ei (k - i) = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i]) + sum_list (map esi [k - i..<k - i]) + ei (k - i) = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "?sum 0 = ?sum fin"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
fin < k - i

goal (1 subgoal):
 1. sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i
[PROOF STEP]
proof (induct fin)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
case (Suc fin)
[PROOF STATE]
proof (state)
this:
fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i
Suc fin < k - i

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
from Suc(2) assms
[PROOF STATE]
proof (chain)
picking this:
Suc fin < k - i
k \<le> n
i < k
[PROOF STEP]
have fki: "fin < ?ki" and ikf: "i < k - Suc fin" "i < k - fin" and kfn: "k - fin \<le> n"
[PROOF STATE]
proof (prove)
using this:
Suc fin < k - i
k \<le> n
i < k

goal (1 subgoal):
 1. fin < k - i &&& (i < k - Suc fin &&& i < k - fin) &&& k - fin \<le> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fin < k - i
i < k - Suc fin
i < k - fin
k - fin \<le> n

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
from xd_diff[OF ikf(2) kfn]
[PROOF STATE]
proof (chain)
picking this:
xd i (k - fin) \<noteq> (0::'a)
xd (k - fin) i \<noteq> (0::'a)
[PROOF STEP]
have nz: "xd (k - fin) i \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
xd i (k - fin) \<noteq> (0::'a)
xd (k - fin) i \<noteq> (0::'a)

goal (1 subgoal):
 1. xd (k - fin) i \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xd (k - fin) i \<noteq> (0::'a)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
note IH = Suc(1)[OF fki]
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have id4: "[0 ..< ?ki - fin] = [0 ..< ?ki - Suc fin] @ [?ki - Suc fin]"
      "i + (k - i - Suc fin) = k - Suc fin"
      "Suc (k - Suc fin) = k - fin"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<k - i - fin] = [0..<k - i - Suc fin] @ [k - i - Suc fin] &&& i + (k - i - Suc fin) = k - Suc fin &&& Suc (k - Suc fin) = k - fin
[PROOF STEP]
using Suc(2) assms  \<open>fin < ?ki\<close>
[PROOF STATE]
proof (prove)
using this:
Suc fin < k - i
k \<le> n
i < k
fin < k - i

goal (1 subgoal):
 1. [0..<k - i - fin] = [0..<k - i - Suc fin] @ [k - i - Suc fin] &&& i + (k - i - Suc fin) = k - Suc fin &&& Suc (k - Suc fin) = k - fin
[PROOF STEP]
by (metis Suc_diff_Suc le0 upt_Suc) (insert Suc(2), auto)
[PROOF STATE]
proof (state)
this:
[0..<k - i - fin] = [0..<k - i - Suc fin] @ [k - i - Suc fin]
i + (k - i - Suc fin) = k - Suc fin
Suc (k - Suc fin) = k - fin

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
from Suc(2) assms
[PROOF STATE]
proof (chain)
picking this:
Suc fin < k - i
k \<le> n
i < k
[PROOF STEP]
have id5: "[i..<k - Suc fin] = i # [Suc i ..< k - Suc fin]"
      "[Suc i..<k - fin] = [Suc i..<k - Suc fin] @ [k - Suc fin]"
[PROOF STATE]
proof (prove)
using this:
Suc fin < k - i
k \<le> n
i < k

goal (1 subgoal):
 1. [i..<k - Suc fin] = i # [Suc i..<k - Suc fin] &&& [Suc i..<k - fin] = [Suc i..<k - Suc fin] @ [k - Suc fin]
[PROOF STEP]
by (force simp: upt_rec) (metis Suc_leI id4(3) ikf(1) upt_Suc)
[PROOF STATE]
proof (state)
this:
[i..<k - Suc fin] = i # [Suc i..<k - Suc fin]
[Suc i..<k - fin] = [Suc i..<k - Suc fin] @ [k - Suc fin]

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "?sum 0 = ?sum fin"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i
[PROOF STEP]
by (rule IH)
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "\<dots> = ?sumi [0 ..< ?ki - Suc fin] + ?sumsi [?ki - fin ..< ?ki] +
      (ei (?ki - Suc fin) + ?mid fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - fin..<k - i]) + (ei (k - i - Suc fin) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i)
[PROOF STEP]
unfolding id4
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei ([0..<k - i - Suc fin] @ [k - i - Suc fin])) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - fin..<k - i]) + (ei (k - i - Suc fin) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - fin..<k - i]) + (ei (k - i - Suc fin) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - fin..<k - i]) + (ei (k - i - Suc fin) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "?mid fin = (xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin))
      * pprod k (Suc i) (k - fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = (xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin)) * pprod k (Suc i) (k - fin)
[PROOF STEP]
unfolding xij_f.simps[of i "k - fin"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i < k - fin then (xij_f (i + 1) (k - fin) - xij_f i (k - fin - 1)) / xd (k - fin) i else f i) * pprod k (Suc i) (k - fin) * xd (k - fin) i = (xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin)) * pprod k (Suc i) (k - fin)
[PROOF STEP]
using ikf nz
[PROOF STATE]
proof (prove)
using this:
i < k - Suc fin
i < k - fin
xd (k - fin) i \<noteq> (0::'a)

goal (1 subgoal):
 1. (if i < k - fin then (xij_f (i + 1) (k - fin) - xij_f i (k - fin - 1)) / xd (k - fin) i else f i) * pprod k (Suc i) (k - fin) * xd (k - fin) i = (xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin)) * pprod k (Suc i) (k - fin)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = (xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin)) * pprod k (Suc i) (k - fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = (xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin)) * pprod k (Suc i) (k - fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "\<dots> = xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) -
      xij_f i (k - Suc fin) * pprod k (Suc i) (k - fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin)) * pprod k (Suc i) (k - fin) = xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) - xij_f i (k - Suc fin) * pprod k (Suc i) (k - fin)
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
(xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin)) * pprod k (Suc i) (k - fin) = xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) - xij_f i (k - Suc fin) * pprod k (Suc i) (k - fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(xij_f (Suc i) (k - fin) - xij_f i (k - Suc fin)) * pprod k (Suc i) (k - fin) = xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) - xij_f i (k - Suc fin) * pprod k (Suc i) (k - fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) = esi (?ki - Suc fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) = esi (k - i - Suc fin)
[PROOF STEP]
unfolding esi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) = xij_f (Suc i) (Suc i + (k - i - Suc fin)) * pprod k (Suc i) (Suc i + (k - i - Suc fin))
[PROOF STEP]
using ikf
[PROOF STATE]
proof (prove)
using this:
i < k - Suc fin
i < k - fin

goal (1 subgoal):
 1. xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) = xij_f (Suc i) (Suc i + (k - i - Suc fin)) * pprod k (Suc i) (Suc i + (k - i - Suc fin))
[PROOF STEP]
by (simp add: id4)
[PROOF STATE]
proof (state)
this:
xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) = esi (k - i - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
xij_f (Suc i) (k - fin) * pprod k (Suc i) (k - fin) = esi (k - i - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "ei (?ki - Suc fin) = xij_f i (k - Suc fin) * pprod k i (k - Suc fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ei (k - i - Suc fin) = xij_f i (k - Suc fin) * pprod k i (k - Suc fin)
[PROOF STEP]
unfolding ei_def id4
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xij_f i (k - Suc fin) * pprod k i (k - Suc fin) = xij_f i (k - Suc fin) * pprod k i (k - Suc fin)
[PROOF STEP]
using ikf
[PROOF STATE]
proof (prove)
using this:
i < k - Suc fin
i < k - fin

goal (1 subgoal):
 1. xij_f i (k - Suc fin) * pprod k i (k - Suc fin) = xij_f i (k - Suc fin) * pprod k i (k - Suc fin)
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
ei (k - i - Suc fin) = xij_f i (k - Suc fin) * pprod k i (k - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - fin..<k - i]) + (xij_f i (k - Suc fin) * pprod k i (k - Suc fin) + (esi (k - i - Suc fin) - xij_f i (k - Suc fin) * pprod k (Suc i) (k - fin)))
[PROOF STEP]
have "?sum 0 = ?sumi [0 ..< ?ki - Suc fin]
      + (esi (?ki - Suc fin) + ?sumsi [?ki - fin ..< ?ki])
      + (xij_f i (k - Suc fin) * (pprod k i (k - Suc fin) - pprod k (Suc i) (k - fin)))"
[PROOF STATE]
proof (prove)
using this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - fin..<k - i]) + (xij_f i (k - Suc fin) * pprod k i (k - Suc fin) + (esi (k - i - Suc fin) - xij_f i (k - Suc fin) * pprod k (Suc i) (k - fin)))

goal (1 subgoal):
 1. sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + (esi (k - i - Suc fin) + sum_list (map esi [k - i - fin..<k - i])) + xij_f i (k - Suc fin) * (pprod k i (k - Suc fin) - pprod k (Suc i) (k - fin))
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + (esi (k - i - Suc fin) + sum_list (map esi [k - i - fin..<k - i])) + xij_f i (k - Suc fin) * (pprod k i (k - Suc fin) - pprod k (Suc i) (k - fin))

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + (esi (k - i - Suc fin) + sum_list (map esi [k - i - fin..<k - i])) + xij_f i (k - Suc fin) * (pprod k i (k - Suc fin) - pprod k (Suc i) (k - fin))

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "esi (?ki - Suc fin) + ?sumsi [?ki - fin ..< ?ki]
      = ?sumsi ((?ki - Suc fin) # [?ki - fin ..< ?ki])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. esi (k - i - Suc fin) + sum_list (map esi [k - i - fin..<k - i]) = sum_list (map esi ((k - i - Suc fin) # [k - i - fin..<k - i]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
esi (k - i - Suc fin) + sum_list (map esi [k - i - fin..<k - i]) = sum_list (map esi ((k - i - Suc fin) # [k - i - fin..<k - i]))

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
esi (k - i - Suc fin) + sum_list (map esi [k - i - fin..<k - i]) = sum_list (map esi ((k - i - Suc fin) # [k - i - fin..<k - i]))

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "(?ki - Suc fin) # [?ki - fin ..< ?ki] = [?ki - Suc fin ..< ?ki]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k - i - Suc fin) # [k - i - fin..<k - i] = [k - i - Suc fin..<k - i]
[PROOF STEP]
using Suc(2)
[PROOF STATE]
proof (prove)
using this:
Suc fin < k - i

goal (1 subgoal):
 1. (k - i - Suc fin) # [k - i - fin..<k - i] = [k - i - Suc fin..<k - i]
[PROOF STEP]
by (simp add: Suc_diff_Suc upt_rec)
[PROOF STATE]
proof (state)
this:
(k - i - Suc fin) # [k - i - fin..<k - i] = [k - i - Suc fin..<k - i]

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(k - i - Suc fin) # [k - i - fin..<k - i] = [k - i - Suc fin..<k - i]

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "pprod k i (k - Suc fin) - pprod k (Suc i) (k - fin)
      = (xd k i) * pprod k (Suc i) (k - Suc fin) - (xd k (k - Suc fin)) * pprod k (Suc i) (k - Suc fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pprod k i (k - Suc fin) - pprod k (Suc i) (k - fin) = xd k i * pprod k (Suc i) (k - Suc fin) - xd k (k - Suc fin) * pprod k (Suc i) (k - Suc fin)
[PROOF STEP]
unfolding pprod_def id5
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map (xd k) (i # [Suc i..<k - Suc fin])) - prod_list (map (xd k) ([Suc i..<k - Suc fin] @ [k - Suc fin])) = xd k i * prod_list (map (xd k) [Suc i..<k - Suc fin]) - xd k (k - Suc fin) * prod_list (map (xd k) [Suc i..<k - Suc fin])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pprod k i (k - Suc fin) - pprod k (Suc i) (k - fin) = xd k i * pprod k (Suc i) (k - Suc fin) - xd k (k - Suc fin) * pprod k (Suc i) (k - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pprod k i (k - Suc fin) - pprod k (Suc i) (k - fin) = xd k i * pprod k (Suc i) (k - Suc fin) - xd k (k - Suc fin) * pprod k (Suc i) (k - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "\<dots> = (xd k i - xd k (k - Suc fin)) * pprod k (Suc i) (k - Suc fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xd k i * pprod k (Suc i) (k - Suc fin) - xd k (k - Suc fin) * pprod k (Suc i) (k - Suc fin) = (xd k i - xd k (k - Suc fin)) * pprod k (Suc i) (k - Suc fin)
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
xd k i * pprod k (Suc i) (k - Suc fin) - xd k (k - Suc fin) * pprod k (Suc i) (k - Suc fin) = (xd k i - xd k (k - Suc fin)) * pprod k (Suc i) (k - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
xd k i * pprod k (Suc i) (k - Suc fin) - xd k (k - Suc fin) * pprod k (Suc i) (k - Suc fin) = (xd k i - xd k (k - Suc fin)) * pprod k (Suc i) (k - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "\<dots> = (xd (k - Suc fin) i) * pprod k (Suc i) (k - Suc fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xd k i - xd k (k - Suc fin)) * pprod k (Suc i) (k - Suc fin) = xd (k - Suc fin) i * pprod k (Suc i) (k - Suc fin)
[PROOF STEP]
unfolding xd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x k - x i - (x k - x (k - Suc fin))) * pprod k (Suc i) (k - Suc fin) = (x (k - Suc fin) - x i) * pprod k (Suc i) (k - Suc fin)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(xd k i - xd k (k - Suc fin)) * pprod k (Suc i) (k - Suc fin) = xd (k - Suc fin) i * pprod k (Suc i) (k - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(xd k i - xd k (k - Suc fin)) * pprod k (Suc i) (k - Suc fin) = xd (k - Suc fin) i * pprod k (Suc i) (k - Suc fin)

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
have "xij_f i (k - Suc fin) * \<dots> = ?mid (Suc fin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xij_f i (k - Suc fin) * (xd (k - Suc fin) i * pprod k (Suc i) (k - Suc fin)) = xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
xij_f i (k - Suc fin) * (xd (k - Suc fin) i * pprod k (Suc i) (k - Suc fin)) = xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i

goal (2 subgoals):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
 2. \<And>fin. \<lbrakk>fin < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i; Suc fin < k - i\<rbrakk> \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i

goal (1 subgoal):
 1. sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - Suc fin]) + sum_list (map esi [k - i - Suc fin..<k - i]) + xij_f i (k - Suc fin) * pprod k (Suc i) (k - Suc fin) * xd (k - Suc fin) i

goal (1 subgoal):
 1. 0 < k - i \<Longrightarrow> sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - 0]) + sum_list (map esi [k - i - 0..<k - i]) + xij_f i (k - 0) * pprod k (Suc i) (k - 0) * xd (k - 0) i = sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "\<dots> = (ei 0 + ?mid (k - i - 1)) + ?sumsi [1 ..< k - i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = ei 0 + xij_f i (k - (k - i - 1)) * pprod k (Suc i) (k - (k - i - 1)) * xd (k - (k - i - 1)) i + sum_list (map esi [1..<k - i])
[PROOF STEP]
unfolding fin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ei [0..<k - i - (k - i - 1)]) + sum_list (map esi [k - i - (k - i - 1)..<k - i]) + xij_f i (k - (k - i - 1)) * pprod k (Suc i) (k - (k - i - 1)) * xd (k - (k - i - 1)) i = ei 0 + xij_f i (k - (k - i - 1)) * pprod k (Suc i) (k - (k - i - 1)) * xd (k - (k - i - 1)) i + sum_list (map esi [1..<k - i])
[PROOF STEP]
by (simp add: id3)
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = ei 0 + xij_f i (k - (k - i - 1)) * pprod k (Suc i) (k - (k - i - 1)) * xd (k - (k - i - 1)) i + sum_list (map esi [1..<k - i])

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map ei [0..<k - i - fin]) + sum_list (map esi [k - i - fin..<k - i]) + xij_f i (k - fin) * pprod k (Suc i) (k - fin) * xd (k - fin) i = ei 0 + xij_f i (k - (k - i - 1)) * pprod k (Suc i) (k - (k - i - 1)) * xd (k - (k - i - 1)) i + sum_list (map esi [1..<k - i])

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "ei 0 + ?mid (k - i - 1) = esi 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ei 0 + xij_f i (k - (k - i - 1)) * pprod k (Suc i) (k - (k - i - 1)) * xd (k - (k - i - 1)) i = esi 0
[PROOF STEP]
unfolding id3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ei 0 + xij_f i (Suc i) * pprod k (Suc i) (Suc i) * xd (Suc i) i = esi 0
[PROOF STEP]
unfolding ei_def esi_def xij_f.simps[of i i]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xij_f i (i + 0) * pprod k i (i + 0) + xij_f i (Suc i) * pprod k (Suc i) (Suc i) * xd (Suc i) i = xij_f (Suc i) (Suc i + 0) * pprod k (Suc i) (Suc i + 0)
[PROOF STEP]
using neq assms
[PROOF STATE]
proof (prove)
using this:
xd (Suc i) i \<noteq> (0::'a)
k \<le> n
i < k

goal (1 subgoal):
 1. xij_f i (i + 0) * pprod k i (i + 0) + xij_f i (Suc i) * pprod k (Suc i) (Suc i) * xd (Suc i) i = xij_f (Suc i) (Suc i + 0) * pprod k (Suc i) (Suc i + 0)
[PROOF STEP]
by (simp add: field_simps xij_f.simps pprod_def)
[PROOF STATE]
proof (state)
this:
ei 0 + xij_f i (k - (k - i - 1)) * pprod k (Suc i) (k - (k - i - 1)) * xd (k - (k - i - 1)) i = esi 0

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ei 0 + xij_f i (k - (k - i - 1)) * pprod k (Suc i) (k - (k - i - 1)) * xd (k - (k - i - 1)) i = esi 0

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "esi 0 + ?sumsi [1 ..< k - i] = ?sumsi (0 # [1 ..< k - i])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. esi 0 + sum_list (map esi [1..<k - i]) = sum_list (map esi (0 # [1..<k - i]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
esi 0 + sum_list (map esi [1..<k - i]) = sum_list (map esi (0 # [1..<k - i]))

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
esi 0 + sum_list (map esi [1..<k - i]) = sum_list (map esi (0 # [1..<k - i]))

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "0 # [1 ..< k - i] = [0 ..< Suc k - Suc i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 # [1..<k - i] = [0..<Suc k - Suc i]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n
i < k

goal (1 subgoal):
 1. 0 # [1..<k - i] = [0..<Suc k - Suc i]
[PROOF STEP]
by (simp add: upt_rec)
[PROOF STATE]
proof (state)
this:
0 # [1..<k - i] = [0..<Suc k - Suc i]

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 # [1..<k - i] = [0..<Suc k - Suc i]

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
have "?sumsi \<dots> = sum_list (map (\<lambda> j. xij_f (Suc i) (Suc i + j) *
    pprod k (Suc i) (Suc i + j)) [0..<Suc k - Suc i])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map esi [0..<Suc k - Suc i]) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
unfolding esi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n
i < k

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map esi [0..<Suc k - Suc i]) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))

goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<leftarrow>[0..<Suc k - i]. xij_f i (i + j) * pprod k i (i + j)) = (\<Sum>j\<leftarrow>[0..<Suc k - Suc i]. xij_f (Suc i) (Suc i + j) * pprod k (Suc i) (Suc i + j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ipt_iprange_compress: "(\<Union> ip \<in> set (ipt_iprange_compress l). ipt_iprange_to_set ip) =
      (\<Inter> ip \<in> set (getPos l). ipt_iprange_to_set ip) - (\<Union> ip \<in> set (getNeg l). ipt_iprange_to_set ip)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (ipt_iprange_to_set ` set (ipt_iprange_compress l)) = \<Inter> (ipt_iprange_to_set ` set (getPos l)) - \<Union> (ipt_iprange_to_set ` set (getNeg l))
[PROOF STEP]
by (metis wi_2_cidr_ipt_iprange_list comp_apply ipt_iprange_compress_def ipt_iprange_negation_type_to_br_intersect)


[STATEMENT]
lemma (in Module) mQmpTr1:"\<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N;
 m \<in> carrier M; n \<in> carrier M; m \<uplus>\<^bsub>M\<^esub> H = n \<uplus>\<^bsub>M\<^esub> H\<rbrakk> \<Longrightarrow>  m \<uplus>\<^bsub>M\<^esub> N = n \<uplus>\<^bsub>M\<^esub> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; m \<in> carrier M; n \<in> carrier M; m \<uplus>\<^bsub>M\<^esub> H = n \<uplus>\<^bsub>M\<^esub> H\<rbrakk> \<Longrightarrow> m \<uplus>\<^bsub>M\<^esub> N = n \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply (frule_tac m_in_mr_coset [of H m], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; m \<in> carrier M; n \<in> carrier M; m \<uplus>\<^bsub>M\<^esub> H = n \<uplus>\<^bsub>M\<^esub> H; m \<in> m \<uplus>\<^bsub>M\<^esub> H\<rbrakk> \<Longrightarrow> m \<uplus>\<^bsub>M\<^esub> N = n \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; m \<in> carrier M; n \<in> carrier M; m \<uplus>\<^bsub>M\<^esub> H = n \<uplus>\<^bsub>M\<^esub> H; m \<in> n \<uplus>\<^bsub>M\<^esub> H\<rbrakk> \<Longrightarrow> m \<uplus>\<^bsub>M\<^esub> N = n \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply (frule_tac x_in_mr_coset [of H n m], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; m \<in> carrier M; n \<in> carrier M; m \<uplus>\<^bsub>M\<^esub> H = n \<uplus>\<^bsub>M\<^esub> H; m \<in> n \<uplus>\<^bsub>M\<^esub> H; \<exists>h\<in>H. n \<plusminus> h = m\<rbrakk> \<Longrightarrow> m \<uplus>\<^bsub>M\<^esub> N = n \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply (erule bexE, rotate_tac -1, frule sym, thin_tac "n \<plusminus> h = m", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>h. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; n \<plusminus> h \<in> carrier M; n \<in> carrier M; (n \<plusminus> h) \<uplus>\<^bsub>M\<^esub> H = n \<uplus>\<^bsub>M\<^esub> H; n \<plusminus> h \<in> n \<uplus>\<^bsub>M\<^esub> H; h \<in> H; m = n \<plusminus> h\<rbrakk> \<Longrightarrow> (n \<plusminus> h) \<uplus>\<^bsub>M\<^esub> N = n \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply (frule_tac c = h in subsetD [of "H" "N"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>h. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; n \<plusminus> h \<in> carrier M; n \<in> carrier M; (n \<plusminus> h) \<uplus>\<^bsub>M\<^esub> H = n \<uplus>\<^bsub>M\<^esub> H; n \<plusminus> h \<in> n \<uplus>\<^bsub>M\<^esub> H; h \<in> H; m = n \<plusminus> h; h \<in> N\<rbrakk> \<Longrightarrow> (n \<plusminus> h) \<uplus>\<^bsub>M\<^esub> N = n \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply (rule mr_cos_h_stable1[of N n], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma divisor_add_diff_mod_if: "
  (m + b mod m - a mod m) mod (m::nat)= (
  if a mod m \<le> b mod m
  then (b mod m - a mod m)
  else (m + b mod m - a mod m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m + b mod m - a mod m) mod m = (if a mod m \<le> b mod m then b mod m - a mod m else m + b mod m - a mod m)
[PROOF STEP]
apply (case_tac "m = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> (m + b mod m - a mod m) mod m = (if a mod m \<le> b mod m then b mod m - a mod m else m + b mod m - a mod m)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; a mod m \<le> b mod m\<rbrakk> \<Longrightarrow> (m + b mod m - a mod m) mod m = b mod m - a mod m
[PROOF STEP]
apply (subst diff_add_assoc, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; a mod m \<le> b mod m\<rbrakk> \<Longrightarrow> (m + (b mod m - a mod m)) mod m = b mod m - a mod m
[PROOF STEP]
apply (simp only: mod_add_self1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; a mod m \<le> b mod m\<rbrakk> \<Longrightarrow> (b mod m - a mod m) mod m = b mod m - a mod m
[PROOF STEP]
apply (rule mod_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; a mod m \<le> b mod m\<rbrakk> \<Longrightarrow> b mod m - a mod m < m
[PROOF STEP]
apply (simp add: less_imp_diff_less)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma rel_fun_comp1:
  assumes "(R1 ===> S1) f g" "(R2 ===> S2) g h" "R' = R1 OO R2"
  shows "(R' ===> S1 OO S2) f h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (R' ===> S1 OO S2) f h
[PROOF STEP]
using assms rel_fun_comp
[PROOF STATE]
proof (prove)
using this:
(R1 ===> S1) f g
(R2 ===> S2) g h
R' = R1 OO R2
\<lbrakk>(?R1.0 ===> ?S1.0) ?f ?g; (?R2.0 ===> ?S2.0) ?g ?h\<rbrakk> \<Longrightarrow> (?R1.0 OO ?R2.0 ===> ?S1.0 OO ?S2.0) ?f ?h

goal (1 subgoal):
 1. (R' ===> S1 OO S2) f h
[PROOF STEP]
by metis


[STATEMENT]
lemma append_simpl3:
 assumes "i > (length y)"
 shows " (i <((length (z#zs))*(length y)))
                  \<longrightarrow> (i - (length y))< (length zs)*(length y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
have "length (z#zs) = (length zs)+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (z # zs) = length zs + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (z # zs) = length zs + 1

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (z # zs) = length zs + 1
[PROOF STEP]
have "i <((length (z#zs))*(length y))
                   \<longrightarrow> i <((length zs)+1)*(length y)"
[PROOF STATE]
proof (prove)
using this:
length (z # zs) = length zs + 1

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i < (length zs + 1) * length y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length (z # zs) * length y \<longrightarrow> i < (length zs + 1) * length y

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length (z # zs) * length y \<longrightarrow> i < (length zs + 1) * length y
[PROOF STEP]
have 1: "i <((length (z#zs))*(length y))
                  \<longrightarrow> (i <((length zs)*(length y)+ (length y)))"
[PROOF STATE]
proof (prove)
using this:
i < length (z # zs) * length y \<longrightarrow> i < (length zs + 1) * length y

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i < length zs * length y + length y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length (z # zs) * length y \<longrightarrow> i < length zs * length y + length y

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
have "i <((length zs)*(length y)+ (length y))
                   = ((i - (length y)) <((length zs)*(length y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < length zs * length y + length y) = (i - length y < length zs * length y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length y < i

goal (1 subgoal):
 1. (i < length zs * length y + length y) = (i - length y < length zs * length y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(i < length zs * length y + length y) = (i - length y < length zs * length y)

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(i < length zs * length y + length y) = (i - length y < length zs * length y)
[PROOF STEP]
have "(i <((length (z#zs))*(length y)))
                  \<longrightarrow> ((i - (length y)) <((length zs)*(length y)))"
[PROOF STATE]
proof (prove)
using this:
(i < length zs * length y + length y) = (i - length y < length zs * length y)

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y

goal (1 subgoal):
 1. i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length (z # zs) * length y \<longrightarrow> i - length y < length zs * length y

goal:
No subgoals!
[PROOF STEP]
qed