[STATEMENT]
lemma has_vector_derivative_cong_ev:
  assumes *: "eventually (\<lambda>x. x \<in> S \<longrightarrow> f x = g x) (nhds x)" "f x = g x"
  shows "(f has_vector_derivative f') (at x within S) = (g has_vector_derivative f') (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_vector_derivative f') (at x within S) = (g has_vector_derivative f') (at x within S)
[PROOF STEP]
unfolding has_vector_derivative_def has_derivative_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (f y - f (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S)) = (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (g y - g (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x
f x = g x

goal (1 subgoal):
 1. (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (f y - f (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S)) = (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (g y - g (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S))
[PROOF STEP]
apply (cases "at x within S \<noteq> bot")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x; f x = g x; at x within S \<noteq> bot\<rbrakk> \<Longrightarrow> (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (f y - f (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S)) = (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (g y - g (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S))
 2. \<lbrakk>\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x; f x = g x; \<not> at x within S \<noteq> bot\<rbrakk> \<Longrightarrow> (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (f y - f (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S)) = (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (g y - g (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S))
[PROOF STEP]
apply (intro refl conj_cong filterlim_cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x; f x = g x; at x within S \<noteq> bot; bounded_linear (\<lambda>x. x *\<^sub>R f')\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F xa in at x within S. (f xa - f (netlimit (at x within S)) - (xa - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (xa - netlimit (at x within S)) = (g xa - g (netlimit (at x within S)) - (xa - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (xa - netlimit (at x within S))
 2. \<lbrakk>\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x; f x = g x; \<not> at x within S \<noteq> bot\<rbrakk> \<Longrightarrow> (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (f y - f (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S)) = (bounded_linear (\<lambda>x. x *\<^sub>R f') \<and> ((\<lambda>y. (g y - g (netlimit (at x within S)) - (y - netlimit (at x within S)) *\<^sub>R f') /\<^sub>R norm (y - netlimit (at x within S))) \<longlongrightarrow> (0::'a)) (at x within S))
[PROOF STEP]
apply (auto simp: Lim_ident_at eventually_at_filter elim: eventually_mono)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Cd_single:
  assumes "x \<in> X"
  assumes "inj_on Xd X"
  assumes "x \<in> Field (Pd d)"
  shows "x \<in> Cd d X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> Cd d X
[PROOF STEP]
using assms Pd_linear
[PROOF STATE]
proof (prove)
using this:
x \<in> X
inj_on Xd X
x \<in> Field (Pd d)
\<forall>d. Linear_order (Pd d)

goal (1 subgoal):
 1. x \<in> Cd d X
[PROOF STEP]
unfolding Cd_greatest greatest_def
[PROOF STATE]
proof (prove)
using this:
x \<in> X
inj_on Xd X
x \<in> Field (Pd d)
\<forall>d. Linear_order (Pd d)

goal (1 subgoal):
 1. x \<in> {x \<in> X \<inter> Field (Pd d). \<forall>y\<in>X \<inter> Field (Pd d). (y, x) \<in> Pd d}
[PROOF STEP]
by clarsimp (metis Pd_Xd inj_on_eq_iff subset_refl underS_incl_iff)


[STATEMENT]
lemma (in topology) core_iff:
  "a open = (core a = a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a open) = (core a = a)
[PROOF STEP]
by (auto intro: core_eq_open)


[STATEMENT]
lemma eliminate_aux_vars: fixes p :: "complex mpoly"
  assumes "distinct is"
  and "vars p \<subseteq> insert 0 (Suc ` set is)"
  and "finite {\<alpha>. mpoly_polys_zero_solution p qs (set is) \<alpha>}"
  and "0 \<notin> qs ` set is"
  and "mpoly_polys_solution p qs (set is) \<alpha>"
shows "poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct is
vars p \<subseteq> insert 0 (Suc ` set is)
finite {\<alpha>. mpoly_polys_zero_solution p qs (set is) \<alpha>}
0 \<notin> qs ` set is
mpoly_polys_solution p qs (set is) \<alpha>

goal (1 subgoal):
 1. poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0
[PROOF STEP]
proof (induct "is" arbitrary: p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p. \<lbrakk>distinct []; vars p \<subseteq> insert 0 (Suc ` set []); finite (Collect (mpoly_polys_zero_solution p qs (set []))); 0 \<notin> qs ` set []; mpoly_polys_solution p qs (set []) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
 2. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
case (Nil p)
[PROOF STATE]
proof (state)
this:
distinct []
vars p \<subseteq> insert 0 (Suc ` set [])
finite {a. mpoly_polys_zero_solution p qs (set []) a}
0 \<notin> qs ` set []
mpoly_polys_solution p qs (set []) \<alpha>

goal (2 subgoals):
 1. \<And>p. \<lbrakk>distinct []; vars p \<subseteq> insert 0 (Suc ` set []); finite (Collect (mpoly_polys_zero_solution p qs (set []))); 0 \<notin> qs ` set []; mpoly_polys_solution p qs (set []) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
 2. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
from Nil(3) finite_resultant_mpoly_polys_empty[of p]
[PROOF STATE]
proof (chain)
picking this:
finite {a. mpoly_polys_zero_solution p qs (set []) a}
finite {\<alpha>. mpoly_polys_zero_solution p ?qs {} \<alpha>} \<Longrightarrow> p \<noteq> 0
[PROOF STEP]
have p0: "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
finite {a. mpoly_polys_zero_solution p qs (set []) a}
finite {\<alpha>. mpoly_polys_zero_solution p ?qs {} \<alpha>} \<Longrightarrow> p \<noteq> 0

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

goal (2 subgoals):
 1. \<And>p. \<lbrakk>distinct []; vars p \<subseteq> insert 0 (Suc ` set []); finite (Collect (mpoly_polys_zero_solution p qs (set []))); 0 \<notin> qs ` set []; mpoly_polys_solution p qs (set []) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
 2. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
from Nil(2)
[PROOF STATE]
proof (chain)
picking this:
vars p \<subseteq> insert 0 (Suc ` set [])
[PROOF STEP]
have vars: "vars p \<subseteq> {0}"
[PROOF STATE]
proof (prove)
using this:
vars p \<subseteq> insert 0 (Suc ` set [])

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

goal (2 subgoals):
 1. \<And>p. \<lbrakk>distinct []; vars p \<subseteq> insert 0 (Suc ` set []); finite (Collect (mpoly_polys_zero_solution p qs (set []))); 0 \<notin> qs ` set []; mpoly_polys_solution p qs (set []) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
 2. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
note [simp] = poly_eq_insertion[OF this]
[PROOF STATE]
proof (state)
this:
poly (mpoly_to_poly 0 p) ?x = insertion (\<lambda>v. ?x) p

goal (2 subgoals):
 1. \<And>p. \<lbrakk>distinct []; vars p \<subseteq> insert 0 (Suc ` set []); finite (Collect (mpoly_polys_zero_solution p qs (set []))); 0 \<notin> qs ` set []; mpoly_polys_solution p qs (set []) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
 2. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
from Nil(5)[unfolded mpoly_polys_solution_def]
[PROOF STATE]
proof (chain)
picking this:
insertion \<alpha> p = 0 \<and> (\<forall>i\<in>set []. poly (qs i) (\<alpha> (Suc i)) = 0)
[PROOF STEP]
have "insertion \<alpha> p = 0"
[PROOF STATE]
proof (prove)
using this:
insertion \<alpha> p = 0 \<and> (\<forall>i\<in>set []. poly (qs i) (\<alpha> (Suc i)) = 0)

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

goal (2 subgoals):
 1. \<And>p. \<lbrakk>distinct []; vars p \<subseteq> insert 0 (Suc ` set []); finite (Collect (mpoly_polys_zero_solution p qs (set []))); 0 \<notin> qs ` set []; mpoly_polys_solution p qs (set []) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
 2. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
insertion \<alpha> p = 0

goal (2 subgoals):
 1. \<And>p. \<lbrakk>distinct []; vars p \<subseteq> insert 0 (Suc ` set []); finite (Collect (mpoly_polys_zero_solution p qs (set []))); 0 \<notin> qs ` set []; mpoly_polys_solution p qs (set []) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
 2. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
have "insertion \<alpha> p = insertion (\<lambda>v. \<alpha> 0) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion \<alpha> p = insertion (\<lambda>v. \<alpha> 0) p
[PROOF STEP]
by (rule insertion_irrelevant_vars, insert vars, auto)
[PROOF STATE]
proof (state)
this:
insertion \<alpha> p = insertion (\<lambda>v. \<alpha> 0) p

goal (2 subgoals):
 1. \<And>p. \<lbrakk>distinct []; vars p \<subseteq> insert 0 (Suc ` set []); finite (Collect (mpoly_polys_zero_solution p qs (set []))); 0 \<notin> qs ` set []; mpoly_polys_solution p qs (set []) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
 2. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
insertion (\<lambda>v. \<alpha> 0) p = 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
insertion (\<lambda>v. \<alpha> 0) p = 0

goal (1 subgoal):
 1. poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
[PROOF STEP]
using p0 mpoly_to_poly_inverse[OF vars]
[PROOF STATE]
proof (prove)
using this:
insertion (\<lambda>v. \<alpha> 0) p = 0
p \<noteq> 0
poly_to_mpoly 0 (mpoly_to_poly 0 p) = p

goal (1 subgoal):
 1. poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0
[PROOF STEP]
by (auto simp: poly_to_mpoly0)
[PROOF STATE]
proof (state)
this:
poly (eliminate_aux_vars p qs []) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs [] \<noteq> 0

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
case (Cons i "is" p)
[PROOF STATE]
proof (state)
this:
\<lbrakk>distinct is; vars ?p \<subseteq> insert 0 (Suc ` set is); finite {a. mpoly_polys_zero_solution ?p qs (set is) a}; 0 \<notin> qs ` set is; mpoly_polys_solution ?p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars ?p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars ?p qs is \<noteq> 0
distinct (i # is)
vars p \<subseteq> insert 0 (Suc ` set (i # is))
finite {a. mpoly_polys_zero_solution p qs (set (i # is)) a}
0 \<notin> qs ` set (i # is)
mpoly_polys_solution p qs (set (i # is)) \<alpha>

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
let ?x = "Suc i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
let ?p = "resultant_mpoly_poly ?x p (qs i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
have dist: "distinct is"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct is
[PROOF STEP]
using Cons(2)
[PROOF STATE]
proof (prove)
using this:
distinct (i # is)

goal (1 subgoal):
 1. distinct is
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct is

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
have vars: "vars ?p \<subseteq> insert 0 (Suc ` set is)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (resultant_mpoly_poly (Suc i) p (qs i)) \<subseteq> insert 0 (Suc ` set is)
[PROOF STEP]
using Cons(3) vars_resultant_mpoly_poly[of ?x p "qs i"]
[PROOF STATE]
proof (prove)
using this:
vars p \<subseteq> insert 0 (Suc ` set (i # is))
vars (resultant_mpoly_poly (Suc i) p (qs i)) \<subseteq> vars p - {Suc i}

goal (1 subgoal):
 1. vars (resultant_mpoly_poly (Suc i) p (qs i)) \<subseteq> insert 0 (Suc ` set is)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vars (resultant_mpoly_poly (Suc i) p (qs i)) \<subseteq> insert 0 (Suc ` set is)

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
have fin: "finite {\<alpha>. mpoly_polys_zero_solution ?p qs (set is) \<alpha>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {\<alpha>. mpoly_polys_zero_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set is) \<alpha>}
[PROOF STEP]
using finite_resultant_mpoly_polys_non_empty[of qs "set (i # is)" i p, OF Cons(5)] Cons(2,4)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i \<in> set (i # is); finite {\<alpha>. mpoly_polys_zero_solution p qs (set (i # is)) \<alpha>}\<rbrakk> \<Longrightarrow> finite {\<alpha>. mpoly_polys_zero_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set (i # is) - {i}) \<alpha>}
distinct (i # is)
finite {a. mpoly_polys_zero_solution p qs (set (i # is)) a}

goal (1 subgoal):
 1. finite {\<alpha>. mpoly_polys_zero_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set is) \<alpha>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {\<alpha>. mpoly_polys_zero_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set is) \<alpha>}

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
have 0: "0 \<notin> qs ` set is"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> qs ` set is
[PROOF STEP]
using Cons(5)
[PROOF STATE]
proof (prove)
using this:
0 \<notin> qs ` set (i # is)

goal (1 subgoal):
 1. 0 \<notin> qs ` set is
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<notin> qs ` set is

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
have "(\<exists>v. mpoly_polys_solution p qs (set (i # is)) (\<alpha>(?x := v)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v. mpoly_polys_solution p qs (set (i # is)) (\<alpha>(Suc i := v))
[PROOF STEP]
using Cons(6)
[PROOF STATE]
proof (prove)
using this:
mpoly_polys_solution p qs (set (i # is)) \<alpha>

goal (1 subgoal):
 1. \<exists>v. mpoly_polys_solution p qs (set (i # is)) (\<alpha>(Suc i := v))
[PROOF STEP]
by (intro exI[of _ "\<alpha> ?x"], auto)
[PROOF STATE]
proof (state)
this:
\<exists>v. mpoly_polys_solution p qs (set (i # is)) (\<alpha>(Suc i := v))

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
from this resultant_mpoly_polys_solution[OF Cons(5), of i p \<alpha>]
[PROOF STATE]
proof (chain)
picking this:
\<exists>v. mpoly_polys_solution p qs (set (i # is)) (\<alpha>(Suc i := v))
i \<in> set (i # is) \<Longrightarrow> mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set (i # is) - {i}) \<alpha> = (\<exists>v. mpoly_polys_solution p qs (set (i # is)) (\<alpha>(Suc i := v)))
[PROOF STEP]
have "mpoly_polys_solution ?p qs (set (i # is) - {i}) \<alpha>"
[PROOF STATE]
proof (prove)
using this:
\<exists>v. mpoly_polys_solution p qs (set (i # is)) (\<alpha>(Suc i := v))
i \<in> set (i # is) \<Longrightarrow> mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set (i # is) - {i}) \<alpha> = (\<exists>v. mpoly_polys_solution p qs (set (i # is)) (\<alpha>(Suc i := v)))

goal (1 subgoal):
 1. mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set (i # is) - {i}) \<alpha>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set (i # is) - {i}) \<alpha>

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set (i # is) - {i}) \<alpha>

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
have "set (i # is) - {i} = set is"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (i # is) - {i} = set is
[PROOF STEP]
using Cons(2)
[PROOF STATE]
proof (prove)
using this:
distinct (i # is)

goal (1 subgoal):
 1. set (i # is) - {i} = set is
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (i # is) - {i} = set is

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set is) \<alpha>
[PROOF STEP]
have "mpoly_polys_solution ?p qs (set is) \<alpha>"
[PROOF STATE]
proof (prove)
using this:
mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set is) \<alpha>

goal (1 subgoal):
 1. mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set is) \<alpha>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mpoly_polys_solution (resultant_mpoly_poly (Suc i) p (qs i)) qs (set is) \<alpha>

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
note IH = Cons(1)[OF dist vars fin 0 this]
[PROOF STATE]
proof (state)
this:
poly (eliminate_aux_vars (resultant_mpoly_poly (Suc i) p (qs i)) qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars (resultant_mpoly_poly (Suc i) p (qs i)) qs is \<noteq> 0

goal (1 subgoal):
 1. \<And>a is p. \<lbrakk>\<And>p. \<lbrakk>distinct is; vars p \<subseteq> insert 0 (Suc ` set is); finite (Collect (mpoly_polys_zero_solution p qs (set is))); 0 \<notin> qs ` set is; mpoly_polys_solution p qs (set is) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs is \<noteq> 0; distinct (a # is); vars p \<subseteq> insert 0 (Suc ` set (a # is)); finite (Collect (mpoly_polys_zero_solution p qs (set (a # is)))); 0 \<notin> qs ` set (a # is); mpoly_polys_solution p qs (set (a # is)) \<alpha>\<rbrakk> \<Longrightarrow> poly (eliminate_aux_vars p qs (a # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (a # is) \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (eliminate_aux_vars p qs (i # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (i # is) \<noteq> 0
[PROOF STEP]
unfolding eliminate_aux_vars.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (eliminate_aux_vars (resultant_mpoly_poly (Suc i) p (qs i)) qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars (resultant_mpoly_poly (Suc i) p (qs i)) qs is \<noteq> 0
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
poly (eliminate_aux_vars (resultant_mpoly_poly (Suc i) p (qs i)) qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars (resultant_mpoly_poly (Suc i) p (qs i)) qs is \<noteq> 0

goal (1 subgoal):
 1. poly (eliminate_aux_vars (resultant_mpoly_poly (Suc i) p (qs i)) qs is) (\<alpha> 0) = 0 \<and> eliminate_aux_vars (resultant_mpoly_poly (Suc i) p (qs i)) qs is \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (eliminate_aux_vars p qs (i # is)) (\<alpha> 0) = 0 \<and> eliminate_aux_vars p qs (i # is) \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_fin_set_fold [code]:
  "Max (Set t) =
  (if RBT.is_empty t
   then Code.abort (STR ''not_non_empty_tree'') (\<lambda>_. Max (Set t))
   else r_max_opt t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (Set t) = (if RBT.is_empty t then Code.abort STR ''not_non_empty_tree'' (\<lambda>_. Max (Set t)) else r_max_opt t)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Max (Set t) = (if RBT.is_empty t then Code.abort STR ''not_non_empty_tree'' (\<lambda>_. Max (Set t)) else r_max_opt t)
[PROOF STEP]
have *: "semilattice (max :: 'a \<Rightarrow> 'a \<Rightarrow> 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semilattice max
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
semilattice max

goal (1 subgoal):
 1. Max (Set t) = (if RBT.is_empty t then Code.abort STR ''not_non_empty_tree'' (\<lambda>_. Max (Set t)) else r_max_opt t)
[PROOF STEP]
with finite_fold1_fold1_keys [OF *, folded Max_def]
[PROOF STATE]
proof (chain)
picking this:
\<not> RBT.is_empty ?t \<Longrightarrow> Max (Set ?t) = fold1_keys max ?t
semilattice max
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> RBT.is_empty ?t \<Longrightarrow> Max (Set ?t) = fold1_keys max ?t
semilattice max

goal (1 subgoal):
 1. Max (Set t) = (if RBT.is_empty t then Code.abort STR ''not_non_empty_tree'' (\<lambda>_. Max (Set t)) else r_max_opt t)
[PROOF STEP]
by (simp add: r_max_alt_def r_max_eq_r_max_opt [symmetric])
[PROOF STATE]
proof (state)
this:
Max (Set t) = (if RBT.is_empty t then Code.abort STR ''not_non_empty_tree'' (\<lambda>_. Max (Set t)) else r_max_opt t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma find_path_ex_rule:
    assumes "finite U0"
    assumes "finite (E\<^sup>*``U0)"
    assumes "\<exists>v\<in>E\<^sup>*``U0. P v"
    shows "find_path E U0 P \<le> SPEC (\<lambda>r.
      \<exists>p v. r = Some (p,v) \<and> P v \<and> (\<forall>v\<in>set p. \<not>P v) \<and> (\<exists>u0\<in>U0. path E u0 p v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. find_path E U0 P \<le> SPEC (\<lambda>r. \<exists>p v. r = Some (p, v) \<and> P v \<and> (\<forall>v\<in>set p. \<not> P v) \<and> (\<exists>u0\<in>U0. path E u0 p v))
[PROOF STEP]
unfolding find_path_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ASSERT (finite U0) \<bind> (\<lambda>_. ASSERT (finite (E\<^sup>* `` U0)) \<bind> (\<lambda>_. SPEC (\<lambda>p. case p of None \<Rightarrow> \<forall>u0\<in>U0. \<forall>v\<in>E\<^sup>* `` {u0}. \<not> P v | Some (p, v) \<Rightarrow> \<exists>u0\<in>U0. path E u0 p v \<and> P v \<and> (\<forall>v\<in>set p. \<not> P v)))) \<le> SPEC (\<lambda>r. \<exists>p v. r = Some (p, v) \<and> P v \<and> (\<forall>v\<in>set p. \<not> P v) \<and> (\<exists>u0\<in>U0. path E u0 p v))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite U0
finite (E\<^sup>* `` U0)
\<exists>v\<in>E\<^sup>* `` U0. P v

goal (1 subgoal):
 1. ASSERT (finite U0) \<bind> (\<lambda>_. ASSERT (finite (E\<^sup>* `` U0)) \<bind> (\<lambda>_. SPEC (\<lambda>p. case p of None \<Rightarrow> \<forall>u0\<in>U0. \<forall>v\<in>E\<^sup>* `` {u0}. \<not> P v | Some (p, v) \<Rightarrow> \<exists>u0\<in>U0. path E u0 p v \<and> P v \<and> (\<forall>v\<in>set p. \<not> P v)))) \<le> SPEC (\<lambda>r. \<exists>p v. r = Some (p, v) \<and> P v \<and> (\<forall>v\<in>set p. \<not> P v) \<and> (\<exists>u0\<in>U0. path E u0 p v))
[PROOF STEP]
by (fastforce split: option.splits)


[STATEMENT]
lemma bezout_matrix_works2:
  fixes A::"'a::bezout_domain^'cols^'rows"
  assumes ib: "is_bezout_ext bezout"
  and a_not_b: "a \<noteq> b"
  and not_0: "A $ a $ j \<noteq> 0 \<or> A $ b $ j \<noteq> 0"
  shows "(bezout_matrix A a b j bezout ** A) $ b $ j = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bezout_matrix A a b j bezout ** A) $ b $ j = (0::'a)
[PROOF STEP]
proof (unfold matrix_matrix_mult_def bezout_matrix_def Let_def, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
let ?a = "(A $ a $ j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
let ?b = "(A $ b $ j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
let ?z = "bezout (A $ a $ j) (A $ b $ j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
from ib
[PROOF STATE]
proof (chain)
picking this:
is_bezout_ext bezout
[PROOF STEP]
have foo: "(\<And>a b. let (p, q, u, v, gcd_a_b) = bezout a b
           in p * a + q * b = gcd_a_b \<and>
              gcd_a_b dvd a \<and>
              gcd_a_b dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd gcd_a_b) \<and> gcd_a_b * u = - b \<and> gcd_a_b * v = a)"
[PROOF STATE]
proof (prove)
using this:
is_bezout_ext bezout

goal (1 subgoal):
 1. \<And>a b. let (p, q, u, v, gcd_a_b) = bezout a b in p * a + q * b = gcd_a_b \<and> gcd_a_b dvd a \<and> gcd_a_b dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd gcd_a_b) \<and> gcd_a_b * u = - b \<and> gcd_a_b * v = a
[PROOF STEP]
using is_bezout_ext_def [of bezout]
[PROOF STATE]
proof (prove)
using this:
is_bezout_ext bezout
is_bezout_ext bezout = (\<forall>a b. let (p, q, u, v, gcd_a_b) = bezout a b in p * a + q * b = gcd_a_b \<and> gcd_a_b dvd a \<and> gcd_a_b dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd gcd_a_b) \<and> gcd_a_b * u = - b \<and> gcd_a_b * v = a)

goal (1 subgoal):
 1. \<And>a b. let (p, q, u, v, gcd_a_b) = bezout a b in p * a + q * b = gcd_a_b \<and> gcd_a_b dvd a \<and> gcd_a_b dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd gcd_a_b) \<and> gcd_a_b * u = - b \<and> gcd_a_b * v = a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
let (p, q, u, v, gcd_a_b) = bezout ?a ?b in p * ?a + q * ?b = gcd_a_b \<and> gcd_a_b dvd ?a \<and> gcd_a_b dvd ?b \<and> (\<forall>d'. d' dvd ?a \<and> d' dvd ?b \<longrightarrow> d' dvd gcd_a_b) \<and> gcd_a_b * u = - ?b \<and> gcd_a_b * v = ?a

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
obtain p q u v d where bz: "(p, q, u, v, d) = ?z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p q u v d. (p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases ?z, auto)
[PROOF STATE]
proof (state)
this:
(p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j)

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
hence pib: "p * ?a + q * ?b = d \<and> d dvd ?a \<and>
            d dvd ?b \<and> (\<forall>d'. d' dvd ?a \<and> d' dvd ?b \<longrightarrow> d' dvd d) \<and> d * u = - ?b \<and> d * v = ?a"
[PROOF STATE]
proof (prove)
using this:
(p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j)

goal (1 subgoal):
 1. p * A $ a $ j + q * A $ b $ j = d \<and> d dvd A $ a $ j \<and> d dvd A $ b $ j \<and> (\<forall>d'. d' dvd A $ a $ j \<and> d' dvd A $ b $ j \<longrightarrow> d' dvd d) \<and> d * u = - A $ b $ j \<and> d * v = A $ a $ j
[PROOF STEP]
using foo [of ?a ?b]
[PROOF STATE]
proof (prove)
using this:
(p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j)
let (p, q, u, v, gcd_a_b) = bezout (A $ a $ j) (A $ b $ j) in p * A $ a $ j + q * A $ b $ j = gcd_a_b \<and> gcd_a_b dvd A $ a $ j \<and> gcd_a_b dvd A $ b $ j \<and> (\<forall>d'. d' dvd A $ a $ j \<and> d' dvd A $ b $ j \<longrightarrow> d' dvd gcd_a_b) \<and> gcd_a_b * u = - A $ b $ j \<and> gcd_a_b * v = A $ a $ j

goal (1 subgoal):
 1. p * A $ a $ j + q * A $ b $ j = d \<and> d dvd A $ a $ j \<and> d dvd A $ b $ j \<and> (\<forall>d'. d' dvd A $ a $ j \<and> d' dvd A $ b $ j \<longrightarrow> d' dvd d) \<and> d * u = - A $ b $ j \<and> d * v = A $ a $ j
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
p * A $ a $ j + q * A $ b $ j = d \<and> d dvd A $ a $ j \<and> d dvd A $ b $ j \<and> (\<forall>d'. d' dvd A $ a $ j \<and> d' dvd A $ b $ j \<longrightarrow> d' dvd d) \<and> d * u = - A $ b $ j \<and> d * v = A $ a $ j

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
hence pa_bq_d: "p * ?a + ?b * q = d"
[PROOF STATE]
proof (prove)
using this:
p * A $ a $ j + q * A $ b $ j = d \<and> d dvd A $ a $ j \<and> d dvd A $ b $ j \<and> (\<forall>d'. d' dvd A $ a $ j \<and> d' dvd A $ b $ j \<longrightarrow> d' dvd d) \<and> d * u = - A $ b $ j \<and> d * v = A $ a $ j

goal (1 subgoal):
 1. p * A $ a $ j + A $ b $ j * q = d
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
p * A $ a $ j + A $ b $ j * q = d

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have d_dvd_a: "d dvd ?a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d dvd A $ a $ j
[PROOF STEP]
using pib
[PROOF STATE]
proof (prove)
using this:
p * A $ a $ j + q * A $ b $ j = d \<and> d dvd A $ a $ j \<and> d dvd A $ b $ j \<and> (\<forall>d'. d' dvd A $ a $ j \<and> d' dvd A $ b $ j \<longrightarrow> d' dvd d) \<and> d * u = - A $ b $ j \<and> d * v = A $ a $ j

goal (1 subgoal):
 1. d dvd A $ a $ j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d dvd A $ a $ j

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have d_dvd_b: "d dvd -?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d dvd - A $ b $ j
[PROOF STEP]
using pib
[PROOF STATE]
proof (prove)
using this:
p * A $ a $ j + q * A $ b $ j = d \<and> d dvd A $ a $ j \<and> d dvd A $ b $ j \<and> (\<forall>d'. d' dvd A $ a $ j \<and> d' dvd A $ b $ j \<longrightarrow> d' dvd d) \<and> d * u = - A $ b $ j \<and> d * v = A $ a $ j

goal (1 subgoal):
 1. d dvd - A $ b $ j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d dvd - A $ b $ j

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have pa_bq_d: "p * ?a + ?b * q = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * A $ a $ j + A $ b $ j * q = d
[PROOF STEP]
using pa_bq_d
[PROOF STATE]
proof (prove)
using this:
p * A $ a $ j + A $ b $ j * q = d

goal (1 subgoal):
 1. p * A $ a $ j + A $ b $ j * q = d
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
p * A $ a $ j + A $ b $ j * q = d

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
define f where "f k = (if b = a \<and> k = a then p
                 else if b = a \<and> k = b then q
                      else if b = b \<and> k = a then u
                           else if b = b \<and> k = b then v else if b = k then 1 else 0) *
                A $ k $ j" for k
[PROOF STATE]
proof (state)
this:
f ?k = (if b = a \<and> ?k = a then p else if b = a \<and> ?k = b then q else if b = b \<and> ?k = a then u else if b = b \<and> ?k = b then v else if b = ?k then 1::'a else (0::'a)) * A $ ?k $ j

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have UNIV_rw: "UNIV = insert b (insert a (UNIV - {a} - {b}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = insert b (insert a (UNIV - {a} - {b}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
UNIV = insert b (insert a (UNIV - {a} - {b}))

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have sum_rw: "sum f (insert a (UNIV - {a} - {b})) = f a + sum f (UNIV - {a} - {b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (insert a (UNIV - {a} - {b})) = f a + sum f (UNIV - {a} - {b})
[PROOF STEP]
by (rule sum.insert, auto)
[PROOF STATE]
proof (state)
this:
sum f (insert a (UNIV - {a} - {b})) = f a + sum f (UNIV - {a} - {b})

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have sum0: "sum f (UNIV - {a} - {b}) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (UNIV - {a} - {b}) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, simp add: f_def)
[PROOF STATE]
proof (state)
this:
sum f (UNIV - {a} - {b}) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have "(\<Sum>k\<in>UNIV.
       (case bezout (A $ a $ j) (A $ b $ j) of
        (p, q, u, v, d) \<Rightarrow>
          if b = a \<and> k = a then p
          else if b = a \<and> k = b then q
               else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1 else 0) *
       A $ k $ j) = sum f UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = sum f UNIV
[PROOF STEP]
unfolding f_def bz [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case (p, q, u, v, d) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (\<Sum>k\<in>UNIV. (if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = sum f UNIV

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = sum f UNIV

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have "sum f UNIV = sum f (insert b (insert a (UNIV - {a} - {b})))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f UNIV = sum f (insert b (insert a (UNIV - {a} - {b})))
[PROOF STEP]
using UNIV_rw
[PROOF STATE]
proof (prove)
using this:
UNIV = insert b (insert a (UNIV - {a} - {b}))

goal (1 subgoal):
 1. sum f UNIV = sum f (insert b (insert a (UNIV - {a} - {b})))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f UNIV = sum f (insert b (insert a (UNIV - {a} - {b})))

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f UNIV = sum f (insert b (insert a (UNIV - {a} - {b})))

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have "... = f b + sum f (insert a (UNIV - {a} - {b}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (insert b (insert a (UNIV - {a} - {b}))) = f b + sum f (insert a (UNIV - {a} - {b}))
[PROOF STEP]
by (rule sum.insert, auto, metis a_not_b)
[PROOF STATE]
proof (state)
this:
sum f (insert b (insert a (UNIV - {a} - {b}))) = f b + sum f (insert a (UNIV - {a} - {b}))

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f (insert b (insert a (UNIV - {a} - {b}))) = f b + sum f (insert a (UNIV - {a} - {b}))

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have "... = f b + f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f b + sum f (insert a (UNIV - {a} - {b})) = f b + f a
[PROOF STEP]
unfolding sum_rw sum0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f b + (f a + (0::'a)) = f b + f a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f b + sum f (insert a (UNIV - {a} - {b})) = f b + f a

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f b + sum f (insert a (UNIV - {a} - {b})) = f b + f a

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have "... = v * ?b + u * ?a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f b + f a = v * A $ b $ j + u * A $ a $ j
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if b = a \<and> b = a then p else if b = a \<and> b = b then q else if b = b \<and> b = a then u else if b = b \<and> b = b then v else if b = b then 1::'a else (0::'a)) * A $ b $ j + (if b = a \<and> a = a then p else if b = a \<and> a = b then q else if b = b \<and> a = a then u else if b = b \<and> a = b then v else if b = a then 1::'a else (0::'a)) * A $ a $ j = v * A $ b $ j + u * A $ a $ j
[PROOF STEP]
using a_not_b
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b

goal (1 subgoal):
 1. (if b = a \<and> b = a then p else if b = a \<and> b = b then q else if b = b \<and> b = a then u else if b = b \<and> b = b then v else if b = b then 1::'a else (0::'a)) * A $ b $ j + (if b = a \<and> a = a then p else if b = a \<and> a = b then q else if b = b \<and> a = a then u else if b = b \<and> a = b then v else if b = a then 1::'a else (0::'a)) * A $ a $ j = v * A $ b $ j + u * A $ a $ j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f b + f a = v * A $ b $ j + u * A $ a $ j

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f b + f a = v * A $ b $ j + u * A $ a $ j

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have "... = u * ?a + v * ?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v * A $ b $ j + u * A $ a $ j = u * A $ a $ j + v * A $ b $ j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v * A $ b $ j + u * A $ a $ j = u * A $ a $ j + v * A $ b $ j

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v * A $ b $ j + u * A $ a $ j = u * A $ a $ j + v * A $ b $ j

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * A $ a $ j + v * A $ b $ j = (0::'a)
[PROOF STEP]
using ua_vb_0 [OF ib] bz
[PROOF STATE]
proof (prove)
using this:
snd (snd (snd (snd (bezout ?a ?b)))) \<noteq> (0::'a) \<Longrightarrow> fst (snd (snd (bezout ?a ?b))) * ?a + fst (snd (snd (snd (bezout ?a ?b)))) * ?b = (0::'a)
(p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j)

goal (1 subgoal):
 1. u * A $ a $ j + v * A $ b $ j = (0::'a)
[PROOF STEP]
by (metis fst_conv minus_minus minus_zero mult_eq_0_iff pib snd_conv)
[PROOF STATE]
proof (state)
this:
u * A $ a $ j + v * A $ b $ j = (0::'a)

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
show "(\<Sum>k\<in>UNIV.
       (case bezout (A $ a $ j) (A $ b $ j) of
        (p, q, u, v, d) \<Rightarrow>
          if b = a \<and> k = a then p
          else if b = a \<and> k = b then q
               else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1 else 0) *
       A $ k $ j) =
       0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. (case bezout (A $ a $ j) (A $ b $ j) of (p, q, u, v, d) \<Rightarrow> if b = a \<and> k = a then p else if b = a \<and> k = b then q else if b = b \<and> k = a then u else if b = b \<and> k = b then v else if b = k then 1::'a else (0::'a)) * A $ k $ j) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_rel_irrefl: "irrefl adj_relation"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irrefl adj_relation
[PROOF STEP]
using irrefl_def is_rel_irrefl_alt
[PROOF STATE]
proof (prove)
using this:
irrefl ?r = (\<forall>a. (a, a) \<notin> ?r)
adj ?u ?v \<Longrightarrow> ?u \<noteq> ?v

goal (1 subgoal):
 1. irrefl adj_relation
[PROOF STEP]
by auto


[STATEMENT]
lemma v_mem_sub: assumes "card e = 2" "e \<in> G" shows "e \<subseteq> v G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e \<subseteq> v G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e \<subseteq> v G
[PROOF STEP]
obtain x y where e: "e = {x,y}" and xy: "x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>e = {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card e = 2
e \<in> G

goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>e = {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: card_2_iff)
[PROOF STATE]
proof (state)
this:
e = {x, y}
x \<noteq> y

goal (1 subgoal):
 1. e \<subseteq> v G
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
e \<in> G
[PROOF STEP]
have x: "x \<in> v G"
[PROOF STATE]
proof (prove)
using this:
e \<in> G

goal (1 subgoal):
 1. x \<in> v G
[PROOF STEP]
unfolding e
[PROOF STATE]
proof (prove)
using this:
{x, y} \<in> G

goal (1 subgoal):
 1. x \<in> v G
[PROOF STEP]
by (auto simp: v_def)
[PROOF STATE]
proof (state)
this:
x \<in> v G

goal (1 subgoal):
 1. e \<subseteq> v G
[PROOF STEP]
from e
[PROOF STATE]
proof (chain)
picking this:
e = {x, y}
[PROOF STEP]
have e: "e = {y,x}"
[PROOF STATE]
proof (prove)
using this:
e = {x, y}

goal (1 subgoal):
 1. e = {y, x}
[PROOF STEP]
unfolding e
[PROOF STATE]
proof (prove)
using this:
{x, y} = {x, y}

goal (1 subgoal):
 1. {x, y} = {y, x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e = {y, x}

goal (1 subgoal):
 1. e \<subseteq> v G
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
e \<in> G
[PROOF STEP]
have y: "y \<in> v G"
[PROOF STATE]
proof (prove)
using this:
e \<in> G

goal (1 subgoal):
 1. y \<in> v G
[PROOF STEP]
unfolding e
[PROOF STATE]
proof (prove)
using this:
{y, x} \<in> G

goal (1 subgoal):
 1. y \<in> v G
[PROOF STEP]
by (auto simp: v_def)
[PROOF STATE]
proof (state)
this:
y \<in> v G

goal (1 subgoal):
 1. e \<subseteq> v G
[PROOF STEP]
show "e \<subseteq> v G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e \<subseteq> v G
[PROOF STEP]
using x y
[PROOF STATE]
proof (prove)
using this:
x \<in> v G
y \<in> v G

goal (1 subgoal):
 1. e \<subseteq> v G
[PROOF STEP]
unfolding e
[PROOF STATE]
proof (prove)
using this:
x \<in> v G
y \<in> v G

goal (1 subgoal):
 1. {y, x} \<subseteq> v G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e \<subseteq> v G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SUP_emeasure_spmf_neq_top: "(SUP p\<in>Y. emeasure (measure_spmf p) A) \<noteq> \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>p\<in>Y. emeasure (measure_spmf p) A) \<noteq> \<top>
[PROOF STEP]
proof(rule neq_top_trans)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?y \<noteq> \<top>
 2. (\<Squnion>p\<in>Y. emeasure (measure_spmf p) A) \<le> ?y
[PROOF STEP]
show "(SUP p\<in>Y. emeasure (measure_spmf p) A) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>p\<in>Y. emeasure (measure_spmf p) A) \<le> 1
[PROOF STEP]
by(rule SUP_least)(simp add: measure_spmf.subprob_emeasure_le_1)
[PROOF STATE]
proof (state)
this:
(\<Squnion>p\<in>Y. emeasure (measure_spmf p) A) \<le> 1

goal (1 subgoal):
 1. 1 \<noteq> \<top>
[PROOF STEP]
qed simp


[STATEMENT]
lemma policy_step_eq_imp_opt:
  assumes "is_dec_det d" "d = policy_step d"
  shows "\<nu>\<^sub>b (mk_stationary (mk_dec_det d)) = \<nu>\<^sub>b_opt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary_det d) = \<nu>\<^sub>b_opt
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary_det d) = \<nu>\<^sub>b_opt
[PROOF STEP]
have "policy_eval d = \<L>\<^sub>b (policy_eval d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. policy_eval d = \<L>\<^sub>b (policy_eval d)
[PROOF STEP]
unfolding policy_eval_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary_det d) = \<L>\<^sub>b (\<nu>\<^sub>b (mk_stationary_det d))
[PROOF STEP]
using L_\<nu>_fix assms eval_policy_step_L[unfolded policy_eval_def]
[PROOF STATE]
proof (prove)
using this:
\<nu>\<^sub>b (mk_stationary ?d) = L ?d (\<nu>\<^sub>b (mk_stationary ?d))
is_dec_det d
d = policy_step d
is_dec_det ?d \<Longrightarrow> L (mk_dec_det (policy_step ?d)) (\<nu>\<^sub>b (mk_stationary_det ?d)) = \<L>\<^sub>b (\<nu>\<^sub>b (mk_stationary_det ?d))

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary_det d) = \<L>\<^sub>b (\<nu>\<^sub>b (mk_stationary_det d))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
policy_eval d = \<L>\<^sub>b (policy_eval d)

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary_det d) = \<nu>\<^sub>b_opt
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
policy_eval d = \<L>\<^sub>b (policy_eval d)

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary_det d) = \<nu>\<^sub>b_opt
[PROOF STEP]
unfolding policy_eval_def
[PROOF STATE]
proof (prove)
using this:
\<nu>\<^sub>b (mk_stationary_det d) = \<L>\<^sub>b (\<nu>\<^sub>b (mk_stationary_det d))

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary_det d) = \<nu>\<^sub>b_opt
[PROOF STEP]
using \<L>_fix_imp_opt
[PROOF STATE]
proof (prove)
using this:
\<nu>\<^sub>b (mk_stationary_det d) = \<L>\<^sub>b (\<nu>\<^sub>b (mk_stationary_det d))
?v = \<L>\<^sub>b ?v \<Longrightarrow> ?v = \<nu>\<^sub>b_opt

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary_det d) = \<nu>\<^sub>b_opt
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<nu>\<^sub>b (mk_stationary_det d) = \<nu>\<^sub>b_opt

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compl_less_swap1:
  assumes "y < - x"
  shows "x < - y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < - y
[PROOF STEP]
using assms compl_less_compl_iff
[PROOF STATE]
proof (prove)
using this:
y < - x
(- ?x < - ?y) = (?y < ?x)

goal (1 subgoal):
 1. x < - y
[PROOF STEP]
by fastforce


[STATEMENT]
lemma splitting_permutation_case_2_exists:
  assumes "i \<le> l1"
  assumes "i \<le> y \<and> y < l2 + i"
  shows "splitting_permutation l1 l2 i (y + l1 - i) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. splitting_permutation l1 l2 i (y + l1 - i) = y
[PROOF STEP]
unfolding splitting_permutation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if y + l1 - i < i then y + l1 - i else if i \<le> y + l1 - i \<and> y + l1 - i < l1 then l2 + (y + l1 - i) else if y + l1 - i < l1 + l2 then y + l1 - i - l1 + i else y + l1 - i) = y
[PROOF STEP]
using assms(1) assms(2) less_diff_conv2
[PROOF STATE]
proof (prove)
using this:
i \<le> l1
i \<le> y \<and> y < l2 + i
?k \<le> ?j \<Longrightarrow> (?j - ?k < ?i) = (?j < ?i + ?k)

goal (1 subgoal):
 1. (if y + l1 - i < i then y + l1 - i else if i \<le> y + l1 - i \<and> y + l1 - i < l1 then l2 + (y + l1 - i) else if y + l1 - i < l1 + l2 then y + l1 - i - l1 + i else y + l1 - i) = y
[PROOF STEP]
by auto


[STATEMENT]
lemma e_nth_append_zeros_big:
  assumes "i \<ge> e_length b"
  shows "e_nth (e_append_zeros b z) i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e_nth (e_append_zeros b z) i = 0
[PROOF STEP]
unfolding e_append_zeros_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e_nth (e_append b (Partial_Recursive.list_encode (replicate z 0))) i = 0
[PROOF STEP]
using e_nth_append_big[of b i "list_encode (replicate z 0)", OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
e_nth (e_append b (Partial_Recursive.list_encode (replicate z 0))) i = e_nth (Partial_Recursive.list_encode (replicate z 0)) (i - e_length b)

goal (1 subgoal):
 1. e_nth (e_append b (Partial_Recursive.list_encode (replicate z 0))) i = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma is_unit_polyE:
  fixes p :: "'a :: {comm_semiring_1,semiring_no_zero_divisors} poly"
  assumes "p dvd 1"
  obtains c where "p = [:c:]" "c dvd 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p dvd 1
[PROOF STEP]
obtain q where "1 = p * q"
[PROOF STATE]
proof (prove)
using this:
p dvd 1

goal (1 subgoal):
 1. (\<And>q. 1 = p * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule dvdE)
[PROOF STATE]
proof (state)
this:
1 = p * q

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 = p * q
[PROOF STEP]
have "p \<noteq> 0" and "q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
1 = p * q

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

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from \<open>1 = p * q\<close>
[PROOF STATE]
proof (chain)
picking this:
1 = p * q
[PROOF STEP]
have "degree 1 = degree (p * q)"
[PROOF STATE]
proof (prove)
using this:
1 = p * q

goal (1 subgoal):
 1. degree 1 = degree (p * q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree 1 = degree (p * q)

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree 1 = degree (p * q)

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from \<open>p \<noteq> 0\<close> and \<open>q \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
q \<noteq> 0
[PROOF STEP]
have "\<dots> = degree p + degree q"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
q \<noteq> 0

goal (1 subgoal):
 1. degree (p * q) = degree p + degree q
[PROOF STEP]
by (simp add: degree_mult_eq)
[PROOF STATE]
proof (state)
this:
degree (p * q) = degree p + degree q

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree 1 = degree p + degree q
[PROOF STEP]
have "degree p = 0"
[PROOF STATE]
proof (prove)
using this:
degree 1 = degree p + degree q

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

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with degree_eq_zeroE
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>degree ?p = 0; \<And>a. ?p = [:a:] \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
degree p = 0
[PROOF STEP]
obtain c where c: "p = [:c:]"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>degree ?p = 0; \<And>a. ?p = [:a:] \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
degree p = 0

goal (1 subgoal):
 1. (\<And>c. p = [:c:] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
p = [:c:]

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with \<open>p dvd 1\<close>
[PROOF STATE]
proof (chain)
picking this:
p dvd 1
p = [:c:]
[PROOF STEP]
have "c dvd 1"
[PROOF STATE]
proof (prove)
using this:
p dvd 1
p = [:c:]

goal (1 subgoal):
 1. c dvd (1::'a)
[PROOF STEP]
by (simp add: is_unit_const_poly_iff)
[PROOF STATE]
proof (state)
this:
c dvd (1::'a)

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with c
[PROOF STATE]
proof (chain)
picking this:
p = [:c:]
c dvd (1::'a)
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
p = [:c:]
c dvd (1::'a)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Arg2pi_exp: "0 \<le> Im z \<Longrightarrow> Im z < 2*pi \<Longrightarrow> Arg2pi(exp z) = Im z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> Im z; Im z < 2 * pi\<rbrakk> \<Longrightarrow> Arg2pi (exp z) = Im z
[PROOF STEP]
by (rule Arg2pi_unique [of "exp(Re z)"]) (auto simp: exp_eq_polar)


[STATEMENT]
lemma while_simulate_3:
  "y * (x \<star> 1) \<le> x \<star> 1 \<Longrightarrow> y \<star> (x \<star> 1) \<le> x \<star> (y \<star> 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y * (x \<star> (1::'a)) \<le> x \<star> (1::'a) \<Longrightarrow> y \<star> x \<star> (1::'a) \<le> x \<star> y \<star> (1::'a)
[PROOF STEP]
by (meson order.trans while_increasing while_right_isotone while_simulate_2)


[STATEMENT]
lemma is_amtx_bounded:
    shows "rdomp (is_amtx N M) m \<Longrightarrow> mtx_nonzero m \<subseteq> {0..<N}\<times>{0..<M}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rdomp (is_amtx N M) m \<Longrightarrow> mtx_nonzero m \<subseteq> {0..<N} \<times> {0..<M}
[PROOF STEP]
unfolding rdomp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>h c. h \<Turnstile> is_amtx N M m c \<Longrightarrow> mtx_nonzero m \<subseteq> {0..<N} \<times> {0..<M}
[PROOF STEP]
apply (clarsimp simp: mtx_nonzero_def is_amtx_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b aa ba c l. \<lbrakk>m (a, b) \<noteq> (0::'a); (aa, ba) \<Turnstile> c \<mapsto>\<^sub>a l; length l = N * M; \<forall>i<N. \<forall>j<M. l ! (i * M + j) = m (i, j); \<forall>i j. (N \<le> i \<longrightarrow> m (i, j) = (0::'a)) \<and> (M \<le> j \<longrightarrow> m (i, j) = (0::'a))\<rbrakk> \<Longrightarrow> a < N \<and> b < M
[PROOF STEP]
by (meson not_less)


[STATEMENT]
lemma dist_metric_completion_limit:
  fixes x y::"'a metric_completion"
  shows "(\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> dist x y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> dist x y
[PROOF STEP]
have C: "Cauchy (rep_metric_completion x)" "Cauchy (rep_metric_completion y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cauchy (rep_metric_completion x) &&& Cauchy (rep_metric_completion y)
[PROOF STEP]
using Quotient3_metric_completion Quotient3_rep_reflp
[PROOF STATE]
proof (prove)
using this:
Quotient3 (\<lambda>u v. Cauchy u \<and> Cauchy v \<and> (\<lambda>n. dist (u n) (v n)) \<longlonglongrightarrow> 0) abs_metric_completion rep_metric_completion
Quotient3 ?R ?Abs ?Rep \<Longrightarrow> ?R (?Rep ?a) (?Rep ?a)

goal (1 subgoal):
 1. Cauchy (rep_metric_completion x) &&& Cauchy (rep_metric_completion y)
[PROOF STEP]
by fastforce+
[PROOF STATE]
proof (state)
this:
Cauchy (rep_metric_completion x)
Cauchy (rep_metric_completion y)

goal (1 subgoal):
 1. (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> dist x y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> dist x y
[PROOF STEP]
unfolding dist_metric_completion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> map_fun rep_metric_completion (map_fun rep_metric_completion id) (\<lambda>x y. lim (\<lambda>n. dist (x n) (y n))) x y
[PROOF STEP]
using C
[PROOF STATE]
proof (prove)
using this:
Cauchy (rep_metric_completion x)
Cauchy (rep_metric_completion y)

goal (1 subgoal):
 1. (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> map_fun rep_metric_completion (map_fun rep_metric_completion id) (\<lambda>x y. lim (\<lambda>n. dist (x n) (y n))) x y
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Cauchy (rep_metric_completion x); Cauchy (rep_metric_completion y)\<rbrakk> \<Longrightarrow> (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> lim (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n))
[PROOF STEP]
using convergent_Cauchy_dist[OF C] convergent_LIMSEQ_iff
[PROOF STATE]
proof (prove)
using this:
convergent (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n))
convergent ?X = ?X \<longlonglongrightarrow> lim ?X

goal (1 subgoal):
 1. \<lbrakk>Cauchy (rep_metric_completion x); Cauchy (rep_metric_completion y)\<rbrakk> \<Longrightarrow> (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> lim (\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>n. dist (rep_metric_completion x n) (rep_metric_completion y n)) \<longlonglongrightarrow> dist x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_set_vwalk_arcs_append1:
  assumes "x \<in> set (vwalk_arcs p) \<or> x \<in> set (vwalk_arcs q)"
  shows "x \<in> set (vwalk_arcs (p @ q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> set (vwalk_arcs p) \<or> x \<in> set (vwalk_arcs q)

goal (1 subgoal):
 1. x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> set (vwalk_arcs p) \<Longrightarrow> x \<in> set (vwalk_arcs (p @ q))
 2. x \<in> set (vwalk_arcs q) \<Longrightarrow> x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
assume "x \<in> set (vwalk_arcs p)"
[PROOF STATE]
proof (state)
this:
x \<in> set (vwalk_arcs p)

goal (2 subgoals):
 1. x \<in> set (vwalk_arcs p) \<Longrightarrow> x \<in> set (vwalk_arcs (p @ q))
 2. x \<in> set (vwalk_arcs q) \<Longrightarrow> x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (vwalk_arcs p)
[PROOF STEP]
show "x \<in> set (vwalk_arcs (p @ q))"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (vwalk_arcs p)

goal (1 subgoal):
 1. x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
by (cases "q = []")
       (auto simp add: vwalk_arcs_append vwalk_arcs_set_nil)
[PROOF STATE]
proof (state)
this:
x \<in> set (vwalk_arcs (p @ q))

goal (1 subgoal):
 1. x \<in> set (vwalk_arcs q) \<Longrightarrow> x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> set (vwalk_arcs q) \<Longrightarrow> x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
assume "x \<in> set (vwalk_arcs q)"
[PROOF STATE]
proof (state)
this:
x \<in> set (vwalk_arcs q)

goal (1 subgoal):
 1. x \<in> set (vwalk_arcs q) \<Longrightarrow> x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (vwalk_arcs q)
[PROOF STEP]
show "x \<in> set (vwalk_arcs (p @ q))"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (vwalk_arcs q)

goal (1 subgoal):
 1. x \<in> set (vwalk_arcs (p @ q))
[PROOF STEP]
by (cases "p = []")
       (auto simp add: vwalk_arcs_append vwalk_arcs_set_nil)
[PROOF STATE]
proof (state)
this:
x \<in> set (vwalk_arcs (p @ q))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_linear_vec_lambda: "bounded_linear (\<lambda>x. vec_lambda (x :: 's \<Rightarrow>\<^sub>b real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>x. vec_lambda (apply_bfun x))
[PROOF STEP]
proof (intro bounded_linear_intro)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. vec_lambda (apply_bfun (x + y)) = vec_lambda (apply_bfun x) + vec_lambda (apply_bfun y)
 2. \<And>r x. vec_lambda (apply_bfun (r *\<^sub>R x)) = r *\<^sub>R vec_lambda (apply_bfun x)
 3. \<And>x. norm (vec_lambda (apply_bfun x)) \<le> norm x * ?K
[PROOF STEP]
fix x :: "'s \<Rightarrow>\<^sub>b real"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. vec_lambda (apply_bfun (x + y)) = vec_lambda (apply_bfun x) + vec_lambda (apply_bfun y)
 2. \<And>r x. vec_lambda (apply_bfun (r *\<^sub>R x)) = r *\<^sub>R vec_lambda (apply_bfun x)
 3. \<And>x. norm (vec_lambda (apply_bfun x)) \<le> norm x * ?K
[PROOF STEP]
have "sqrt (\<Sum> i \<in> UNIV . (apply_bfun x i)\<^sup>2) \<le> (\<Sum> i \<in> UNIV . \<bar>(apply_bfun x i)\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>UNIV. (apply_bfun x i)\<^sup>2) \<le> (\<Sum>i\<in>UNIV. \<bar>apply_bfun x i\<bar>)
[PROOF STEP]
using L2_set_le_sum_abs
[PROOF STATE]
proof (prove)
using this:
L2_set ?f ?A \<le> (\<Sum>i\<in>?A. \<bar>?f i\<bar>)

goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>UNIV. (apply_bfun x i)\<^sup>2) \<le> (\<Sum>i\<in>UNIV. \<bar>apply_bfun x i\<bar>)
[PROOF STEP]
unfolding L2_set_def
[PROOF STATE]
proof (prove)
using this:
sqrt (\<Sum>i\<in>?A. (?f i)\<^sup>2) \<le> (\<Sum>i\<in>?A. \<bar>?f i\<bar>)

goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>UNIV. (apply_bfun x i)\<^sup>2) \<le> (\<Sum>i\<in>UNIV. \<bar>apply_bfun x i\<bar>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sqrt (\<Sum>i\<in>UNIV. (apply_bfun x i)\<^sup>2) \<le> (\<Sum>i\<in>UNIV. \<bar>apply_bfun x i\<bar>)

goal (3 subgoals):
 1. \<And>x y. vec_lambda (apply_bfun (x + y)) = vec_lambda (apply_bfun x) + vec_lambda (apply_bfun y)
 2. \<And>r x. vec_lambda (apply_bfun (r *\<^sub>R x)) = r *\<^sub>R vec_lambda (apply_bfun x)
 3. \<And>x. norm (vec_lambda (apply_bfun x)) \<le> norm x * ?K
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (\<Sum>i\<in>UNIV. (apply_bfun x i)\<^sup>2) \<le> (\<Sum>i\<in>UNIV. \<bar>apply_bfun x i\<bar>)

goal (3 subgoals):
 1. \<And>x y. vec_lambda (apply_bfun (x + y)) = vec_lambda (apply_bfun x) + vec_lambda (apply_bfun y)
 2. \<And>r x. vec_lambda (apply_bfun (r *\<^sub>R x)) = r *\<^sub>R vec_lambda (apply_bfun x)
 3. \<And>x. norm (vec_lambda (apply_bfun x)) \<le> norm x * ?K
[PROOF STEP]
have "(\<Sum> i \<in> UNIV . \<bar>(apply_bfun x i)\<bar>) \<le> (card (UNIV :: 's set) * (\<Squnion>xa. \<bar>apply_bfun x xa\<bar>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<bar>apply_bfun x i\<bar>) \<le> real CARD('s) * (\<Squnion>xa. \<bar>apply_bfun x xa\<bar>)
[PROOF STEP]
by (auto intro!: cSup_upper sum_bounded_above)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<bar>apply_bfun x i\<bar>) \<le> real CARD('s) * (\<Squnion>xa. \<bar>apply_bfun x xa\<bar>)

goal (3 subgoals):
 1. \<And>x y. vec_lambda (apply_bfun (x + y)) = vec_lambda (apply_bfun x) + vec_lambda (apply_bfun y)
 2. \<And>r x. vec_lambda (apply_bfun (r *\<^sub>R x)) = r *\<^sub>R vec_lambda (apply_bfun x)
 3. \<And>x. norm (vec_lambda (apply_bfun x)) \<le> norm x * ?K
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sqrt (\<Sum>i\<in>UNIV. (apply_bfun x i)\<^sup>2) \<le> real CARD('s) * (\<Squnion>xa. \<bar>apply_bfun x xa\<bar>)
[PROOF STEP]
show "norm (vec_lambda (apply_bfun x)) \<le> norm x * CARD('s)"
[PROOF STATE]
proof (prove)
using this:
sqrt (\<Sum>i\<in>UNIV. (apply_bfun x i)\<^sup>2) \<le> real CARD('s) * (\<Squnion>xa. \<bar>apply_bfun x xa\<bar>)

goal (1 subgoal):
 1. norm (vec_lambda (apply_bfun x)) \<le> norm x * real CARD('s)
[PROOF STEP]
unfolding norm_vec_def norm_bfun_def dist_bfun_def L2_set_def
[PROOF STATE]
proof (prove)
using this:
sqrt (\<Sum>i\<in>UNIV. (apply_bfun x i)\<^sup>2) \<le> real CARD('s) * (\<Squnion>xa. \<bar>apply_bfun x xa\<bar>)

goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>UNIV. (norm (vec_lambda (apply_bfun x) $ i))\<^sup>2) \<le> map_fun apply_bfun (map_fun apply_bfun id) (\<lambda>f g. \<Squnion>x. dist (f x) (g x)) x 0 * real CARD('s)
[PROOF STEP]
by (auto simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
norm (vec_lambda (apply_bfun x)) \<le> norm x * real CARD('s)

goal (2 subgoals):
 1. \<And>x y. vec_lambda (apply_bfun (x + y)) = vec_lambda (apply_bfun x) + vec_lambda (apply_bfun y)
 2. \<And>r x. vec_lambda (apply_bfun (r *\<^sub>R x)) = r *\<^sub>R vec_lambda (apply_bfun x)
[PROOF STEP]
qed (auto simp: plus_vec_def scaleR_vec_def)


[STATEMENT]
lemma (in Module) l_span_closed2Tr:"\<lbrakk>ideal R A; H \<subseteq> carrier M\<rbrakk> \<Longrightarrow>
       s \<in> {j. j \<le> (n::nat)} \<rightarrow> A \<and>
       f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow>
            l_comb R M n s f \<in> linear_span R M A H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R A; H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H
[PROOF STEP]
apply (cut_tac sc_Ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> 0} \<rightarrow> A \<and> f \<in> {j. j \<le> 0} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M 0 s f \<in> linear_span R M A H
 2. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc n} \<rightarrow> A \<and> f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M (Suc n) s f \<in> linear_span R M A H
[PROOF STEP]
apply (rule impI, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> 0} \<rightarrow> A; f \<in> {j. j \<le> 0} \<rightarrow> linear_span R M (carrier R) H\<rbrakk> \<Longrightarrow> l_comb R M 0 s f \<in> linear_span R M A H
 2. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc n} \<rightarrow> A \<and> f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M (Suc n) s f \<in> linear_span R M A H
[PROOF STEP]
apply (case_tac "H = {}")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> 0} \<rightarrow> A; f \<in> {j. j \<le> 0} \<rightarrow> linear_span R M (carrier R) H; H = {}\<rbrakk> \<Longrightarrow> l_comb R M 0 s f \<in> linear_span R M A H
 2. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> 0} \<rightarrow> A; f \<in> {j. j \<le> 0} \<rightarrow> linear_span R M (carrier R) H; H \<noteq> {}\<rbrakk> \<Longrightarrow> l_comb R M 0 s f \<in> linear_span R M A H
 3. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc n} \<rightarrow> A \<and> f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M (Suc n) s f \<in> linear_span R M A H
[PROOF STEP]
apply (simp add:linear_span_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>ideal R A; Ring R; s 0 \<in> A; f 0 = \<zero>; H = {}\<rbrakk> \<Longrightarrow> l_comb R M 0 s f = \<zero>
 2. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> 0} \<rightarrow> A; f \<in> {j. j \<le> 0} \<rightarrow> linear_span R M (carrier R) H; H \<noteq> {}\<rbrakk> \<Longrightarrow> l_comb R M 0 s f \<in> linear_span R M A H
 3. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc n} \<rightarrow> A \<and> f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M (Suc n) s f \<in> linear_span R M A H
[PROOF STEP]
apply (simp add:l_comb_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>ideal R A; Ring R; s 0 \<in> A; f 0 = \<zero>; H = {}\<rbrakk> \<Longrightarrow> s 0 \<cdot>\<^sub>s \<zero> = \<zero>
 2. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> 0} \<rightarrow> A; f \<in> {j. j \<le> 0} \<rightarrow> linear_span R M (carrier R) H; H \<noteq> {}\<rbrakk> \<Longrightarrow> l_comb R M 0 s f \<in> linear_span R M A H
 3. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc n} \<rightarrow> A \<and> f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M (Suc n) s f \<in> linear_span R M A H
[PROOF STEP]
apply (rule sc_a_0,
        cut_tac sc_Ring,
        simp add:Pi_def Ring.ideal_subset)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> 0} \<rightarrow> A; f \<in> {j. j \<le> 0} \<rightarrow> linear_span R M (carrier R) H; H \<noteq> {}\<rbrakk> \<Longrightarrow> l_comb R M 0 s f \<in> linear_span R M A H
 2. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc n} \<rightarrow> A \<and> f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M (Suc n) s f \<in> linear_span R M A H
[PROOF STEP]
apply (simp add:l_comb_def l_span_closed2Tr0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M n s f \<in> linear_span R M A H\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc n} \<rightarrow> A \<and> f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H \<longrightarrow> l_comb R M (Suc n) s f \<in> linear_span R M A H
[PROOF STEP]
apply (rule impI, erule conjE,
       frule func_pre[of s], frule func_pre[of f], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; l_comb R M n s f \<in> linear_span R M A H; s \<in> {j. j \<le> Suc n} \<rightarrow> A; f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H; s \<in> {j. j \<le> n} \<rightarrow> A; f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H\<rbrakk> \<Longrightarrow> l_comb R M (Suc n) s f \<in> linear_span R M A H
[PROOF STEP]
apply (simp add:l_comb_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n \<in> linear_span R M A H; s \<in> {j. j \<le> Suc n} \<rightarrow> A; f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H; s \<in> {j. j \<le> n} \<rightarrow> A; f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n \<plusminus> s (Suc n) \<cdot>\<^sub>s f (Suc n) \<in> linear_span R M A H
[PROOF STEP]
apply (rule linear_span_pOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n \<in> linear_span R M A H; s \<in> {j. j \<le> Suc n} \<rightarrow> A; f \<in> {j. j \<le> Suc n} \<rightarrow> linear_span R M (carrier R) H; s \<in> {j. j \<le> n} \<rightarrow> A; f \<in> {j. j \<le> n} \<rightarrow> linear_span R M (carrier R) H\<rbrakk> \<Longrightarrow> s (Suc n) \<cdot>\<^sub>s f (Suc n) \<in> linear_span R M A H
[PROOF STEP]
apply (rule_tac s = "s (Suc n)" and f = "f (Suc n)" in
                 l_span_closed2Tr0[of A H], assumption+,
       (simp add:Pi_def)+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sfilter_eq:
  assumes "ev (holds P) s"
  shows "sfilter P s = x ## s' \<longleftrightarrow>
    P x \<and> (not (holds P) suntil (HLD {x} aand nxt (\<lambda>s. sfilter P s = s'))) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sfilter P s = x ## s') = (P x \<and> ((\<lambda>xs. \<not> holds P xs) suntil (\<lambda>xs. HLD {x} xs \<and> nxt (\<lambda>s. sfilter P s = s') xs)) s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ev (holds P) s

goal (1 subgoal):
 1. (sfilter P s = x ## s') = (P x \<and> ((\<lambda>xs. \<not> holds P xs) suntil (\<lambda>xs. HLD {x} xs \<and> nxt (\<lambda>s. sfilter P s = s') xs)) s)
[PROOF STEP]
by (induct rule: ev_induct_strong)
     (auto simp add: HLD_iff intro: suntil.intros elim: suntil.cases)


[STATEMENT]
lemma variation_comm: "variation x y= - variation y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. variation x y = - variation y x
[PROOF STEP]
unfolding variation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = - (if 0 \<le> y * x then 0 else if y < x then 1 else - 1)
[PROOF STEP]
by (auto simp add: mult.commute)