[STATEMENT]
theorem sturm_ext_interval:
  assumes "a<b" "poly p a\<noteq>0" "poly p b\<noteq>0"
  shows "proots_count p {x. a<x \<and> x<b} = changes_itv_smods_ext a b p (pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
using assms(2,3)
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0
poly p b \<noteq> 0

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
proof (induct "smods_ext p (pderiv p)" arbitrary:p rule:length_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>ys. length ys < length (smods_ext p (pderiv p)) \<longrightarrow> (\<forall>x. ys = smods_ext x (pderiv x) \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> poly x b \<noteq> 0 \<longrightarrow> int (proots_count x {x. a < x \<and> x < b}) = changes_itv_smods_ext a b x (pderiv x)); poly p a \<noteq> 0; poly p b \<noteq> 0\<rbrakk> \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
\<forall>ys. length ys < length (smods_ext p (pderiv p)) \<longrightarrow> (\<forall>x. ys = smods_ext x (pderiv x) \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> poly x b \<noteq> 0 \<longrightarrow> int (proots_count x {x. a < x \<and> x < b}) = changes_itv_smods_ext a b x (pderiv x))
poly p a \<noteq> 0
poly p b \<noteq> 0

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>ys. length ys < length (smods_ext p (pderiv p)) \<longrightarrow> (\<forall>x. ys = smods_ext x (pderiv x) \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> poly x b \<noteq> 0 \<longrightarrow> int (proots_count x {x. a < x \<and> x < b}) = changes_itv_smods_ext a b x (pderiv x)); poly p a \<noteq> 0; poly p b \<noteq> 0\<rbrakk> \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have "p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
using \<open>poly p a \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0

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

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>ys. length ys < length (smods_ext p (pderiv p)) \<longrightarrow> (\<forall>x. ys = smods_ext x (pderiv x) \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> poly x b \<noteq> 0 \<longrightarrow> int (proots_count x {x. a < x \<and> x < b}) = changes_itv_smods_ext a b x (pderiv x)); poly p a \<noteq> 0; poly p b \<noteq> 0\<rbrakk> \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have ?case when "pderiv p=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
obtain c where "p=[:c:]" "c\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>p\<noteq>0\<close> \<open>pderiv p = 0\<close> pderiv_iszero
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
pderiv p = 0
pderiv ?p = 0 \<Longrightarrow> \<exists>h. ?p = [:h:]

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>p = [:c:]; c \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
p = [:c:]
c \<noteq> 0

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = [:c:]
c \<noteq> 0
[PROOF STEP]
have "proots_count p {x. a < x \<and> x < b} = 0"
[PROOF STATE]
proof (prove)
using this:
p = [:c:]
c \<noteq> 0

goal (1 subgoal):
 1. proots_count p {x. a < x \<and> x < b} = 0
[PROOF STEP]
unfolding proots_count_def
[PROOF STATE]
proof (prove)
using this:
p = [:c:]
c \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within p {x. a < x \<and> x < b}. order r p) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_count p {x. a < x \<and> x < b} = 0

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proots_count p {x. a < x \<and> x < b} = 0

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have "changes_itv_smods_ext a b p (pderiv p) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = 0
[PROOF STEP]
unfolding changes_itv_smods_ext_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (let ps = smods_ext p (pderiv p) in changes_poly_at ps a - changes_poly_at ps b) = 0
[PROOF STEP]
using \<open>p=[:c:]\<close> \<open>c\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p = [:c:]
c \<noteq> 0

goal (1 subgoal):
 1. (let ps = smods_ext p (pderiv p) in changes_poly_at ps a - changes_poly_at ps b) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
changes_itv_smods_ext a b p (pderiv p) = 0

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
proots_count p {x. a < x \<and> x < b} = 0
changes_itv_smods_ext a b p (pderiv p) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_count p {x. a < x \<and> x < b} = 0
changes_itv_smods_ext a b p (pderiv p) = 0

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pderiv p = 0 \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>ys. length ys < length (smods_ext p (pderiv p)) \<longrightarrow> (\<forall>x. ys = smods_ext x (pderiv x) \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> poly x b \<noteq> 0 \<longrightarrow> int (proots_count x {x. a < x \<and> x < b}) = changes_itv_smods_ext a b x (pderiv x)); poly p a \<noteq> 0; poly p b \<noteq> 0\<rbrakk> \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
pderiv p = 0 \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>ys. length ys < length (smods_ext p (pderiv p)) \<longrightarrow> (\<forall>x. ys = smods_ext x (pderiv x) \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> poly x b \<noteq> 0 \<longrightarrow> int (proots_count x {x. a < x \<and> x < b}) = changes_itv_smods_ext a b x (pderiv x)); poly p a \<noteq> 0; poly p b \<noteq> 0\<rbrakk> \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have ?case when "pderiv p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
define pp where "pp = last (smods p (pderiv p))"
[PROOF STATE]
proof (state)
this:
pp = last (smods p (pderiv p))

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
define lp where "lp = lead_coeff pp"
[PROOF STATE]
proof (state)
this:
lp = lead_coeff pp

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
define S where "S={x. a < x \<and> x< b}"
[PROOF STATE]
proof (state)
this:
S = {x. a < x \<and> x < b}

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have prefix:"smods_ext p (pderiv p) = smods p (pderiv p) @ tl (smods_ext pp (pderiv pp))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smods_ext p (pderiv p) = smods p (pderiv p) @ tl (smods_ext pp (pderiv pp))
[PROOF STEP]
using smods_ext_prefix[OF \<open>p\<noteq>0\<close> \<open>pderiv p\<noteq>0\<close>,folded pp_def]
[PROOF STATE]
proof (prove)
using this:
smods_ext p (pderiv p) = smods p (pderiv p) @ tl (smods_ext pp (pderiv pp))

goal (1 subgoal):
 1. smods_ext p (pderiv p) = smods p (pderiv p) @ tl (smods_ext pp (pderiv pp))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
smods_ext p (pderiv p) = smods p (pderiv p) @ tl (smods_ext pp (pderiv pp))

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have pp_gcd:"pp = smult lp (gcd p (pderiv p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pp = smult lp (gcd p (pderiv p))
[PROOF STEP]
using last_smods_gcd[OF \<open>p\<noteq>0\<close>,of "pderiv p",folded pp_def lp_def]
[PROOF STATE]
proof (prove)
using this:
pp = smult lp (gcd p (pderiv p))

goal (1 subgoal):
 1. pp = smult lp (gcd p (pderiv p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
pp = smult lp (gcd p (pderiv p))

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have "pp\<noteq>0" "lp\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pp \<noteq> 0 &&& lp \<noteq> 0
[PROOF STEP]
unfolding pp_def lp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (smods p (pderiv p)) \<noteq> 0 &&& lead_coeff (last (smods p (pderiv p))) \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (smods p (pderiv p)) \<noteq> 0
[PROOF STEP]
by (rule last_smods_nzero[OF \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (last (smods p (pderiv p))) \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (last (smods p (pderiv p))) \<noteq> 0
[PROOF STEP]
using \<open>last (smods p (pderiv p)) \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
last (smods p (pderiv p)) \<noteq> 0

goal (1 subgoal):
 1. lead_coeff (last (smods p (pderiv p))) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
pp \<noteq> 0
lp \<noteq> 0

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have "poly pp a\<noteq>0" "poly pp b \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly pp a \<noteq> 0 &&& poly pp b \<noteq> 0
[PROOF STEP]
unfolding pp_gcd
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (smult lp (gcd p (pderiv p))) a \<noteq> 0 &&& poly (smult lp (gcd p (pderiv p))) b \<noteq> 0
[PROOF STEP]
using \<open>poly p a\<noteq>0\<close> \<open>poly p b\<noteq>0\<close> \<open>lp\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0
poly p b \<noteq> 0
lp \<noteq> 0

goal (1 subgoal):
 1. poly (smult lp (gcd p (pderiv p))) a \<noteq> 0 &&& poly (smult lp (gcd p (pderiv p))) b \<noteq> 0
[PROOF STEP]
by (simp_all add:poly_gcd_0_iff)
[PROOF STATE]
proof (state)
this:
poly pp a \<noteq> 0
poly pp b \<noteq> 0

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have "proots_count pp S = changes_itv_smods_ext a b pp (pderiv pp)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count pp S) = changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count pp {x. a < x \<and> x < b}) = changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
proof (rule 1(1)[rule_format,of "smods_ext pp (pderiv pp)" pp])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. length (smods_ext pp (pderiv pp)) < length (smods_ext p (pderiv p))
 2. smods_ext pp (pderiv pp) = smods_ext pp (pderiv pp)
 3. poly pp a \<noteq> 0
 4. poly pp b \<noteq> 0
[PROOF STEP]
show "length (smods_ext pp (pderiv pp)) < length (smods_ext p (pderiv p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (smods_ext pp (pderiv pp)) < length (smods_ext p (pderiv p))
[PROOF STEP]
unfolding prefix
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (smods_ext pp (pderiv pp)) < length (smods p (pderiv p) @ tl (smods_ext pp (pderiv pp)))
[PROOF STEP]
by (simp add: \<open>p \<noteq> 0\<close> that)
[PROOF STATE]
proof (state)
this:
length (smods_ext pp (pderiv pp)) < length (smods_ext p (pderiv p))

goal (3 subgoals):
 1. smods_ext pp (pderiv pp) = smods_ext pp (pderiv pp)
 2. poly pp a \<noteq> 0
 3. poly pp b \<noteq> 0
[PROOF STEP]
qed (use \<open>poly pp a\<noteq>0\<close> \<open>poly pp b\<noteq>0\<close> in simp_all)
[PROOF STATE]
proof (state)
this:
int (proots_count pp S) = changes_itv_smods_ext a b pp (pderiv pp)

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
int (proots_count pp S) = changes_itv_smods_ext a b pp (pderiv pp)

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have "proots_count p S = card (proots_within p S) + proots_count pp S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p S = card (proots_within p S) + proots_count pp S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_count p S = card (proots_within p S) + proots_count pp S
[PROOF STEP]
have "(\<Sum>r\<in>proots_within p S. order r p) = (\<Sum>r\<in> proots_within p S. order r pp + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within p S. order r p) = (\<Sum>r\<in>proots_within p S. order r pp + 1)
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
assume "x \<in> proots_within p S"
[PROOF STATE]
proof (state)
this:
x \<in> proots_within p S

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
have "order x pp = order x (gcd p (pderiv p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order x pp = order x (gcd p (pderiv p))
[PROOF STEP]
unfolding pp_gcd
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order x (smult lp (gcd p (pderiv p))) = order x (gcd p (pderiv p))
[PROOF STEP]
using \<open>lp\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
lp \<noteq> 0

goal (1 subgoal):
 1. order x (smult lp (gcd p (pderiv p))) = order x (gcd p (pderiv p))
[PROOF STEP]
by (simp add:order_smult)
[PROOF STATE]
proof (state)
this:
order x pp = order x (gcd p (pderiv p))

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
order x pp = order x (gcd p (pderiv p))

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
have "... = min (order x p) (order x (pderiv p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order x (gcd p (pderiv p)) = min (order x p) (order x (pderiv p))
[PROOF STEP]
apply (subst order_gcd)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. p \<noteq> 0
 2. pderiv p \<noteq> 0
 3. min (order x p) (order x (pderiv p)) = min (order x p) (order x (pderiv p))
[PROOF STEP]
using \<open>p\<noteq>0\<close> \<open>pderiv p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
pderiv p \<noteq> 0

goal (3 subgoals):
 1. p \<noteq> 0
 2. pderiv p \<noteq> 0
 3. min (order x p) (order x (pderiv p)) = min (order x p) (order x (pderiv p))
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
order x (gcd p (pderiv p)) = min (order x p) (order x (pderiv p))

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
order x (gcd p (pderiv p)) = min (order x p) (order x (pderiv p))

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
have "... = order x (pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (order x p) (order x (pderiv p)) = order x (pderiv p)
[PROOF STEP]
apply (subst order_pderiv)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. pderiv p \<noteq> 0
 2. order x p \<noteq> 0
 3. min (Suc (order x (pderiv p))) (order x (pderiv p)) = order x (pderiv p)
[PROOF STEP]
using \<open>pderiv p\<noteq>0\<close> \<open>p \<noteq> 0\<close> \<open>x \<in> proots_within p S\<close> order_root
[PROOF STATE]
proof (prove)
using this:
pderiv p \<noteq> 0
p \<noteq> 0
x \<in> proots_within p S
(poly ?p ?a = (0::?'a)) = (?p = 0 \<or> order ?a ?p \<noteq> 0)

goal (3 subgoals):
 1. pderiv p \<noteq> 0
 2. order x p \<noteq> 0
 3. min (Suc (order x (pderiv p))) (order x (pderiv p)) = order x (pderiv p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
min (order x p) (order x (pderiv p)) = order x (pderiv p)

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
order x pp = order x (pderiv p)
[PROOF STEP]
have "order x pp = order x (pderiv p)"
[PROOF STATE]
proof (prove)
using this:
order x pp = order x (pderiv p)

goal (1 subgoal):
 1. order x pp = order x (pderiv p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
order x pp = order x (pderiv p)

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
order x pp = order x (pderiv p)

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
have "order x p = order x (pderiv p) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order x p = order x (pderiv p) + 1
[PROOF STEP]
apply (subst order_pderiv)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. pderiv p \<noteq> 0
 2. order x p \<noteq> 0
 3. Suc (order x (pderiv p)) = order x (pderiv p) + 1
[PROOF STEP]
using \<open>pderiv p\<noteq>0\<close> \<open>p \<noteq> 0\<close> \<open>x \<in> proots_within p S\<close> order_root
[PROOF STATE]
proof (prove)
using this:
pderiv p \<noteq> 0
p \<noteq> 0
x \<in> proots_within p S
(poly ?p ?a = (0::?'a)) = (?p = 0 \<or> order ?a ?p \<noteq> 0)

goal (3 subgoals):
 1. pderiv p \<noteq> 0
 2. order x p \<noteq> 0
 3. Suc (order x (pderiv p)) = order x (pderiv p) + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order x p = order x (pderiv p) + 1

goal (2 subgoals):
 1. proots_within p S = proots_within p S
 2. \<And>x. x \<in> proots_within p S \<Longrightarrow> order x p = order x pp + 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
order x pp = order x (pderiv p)
order x p = order x (pderiv p) + 1
[PROOF STEP]
show "order x p = order x pp + 1"
[PROOF STATE]
proof (prove)
using this:
order x pp = order x (pderiv p)
order x p = order x (pderiv p) + 1

goal (1 subgoal):
 1. order x p = order x pp + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order x p = order x pp + 1

goal (1 subgoal):
 1. proots_within p S = proots_within p S
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>proots_within p S. order r p) = (\<Sum>r\<in>proots_within p S. order r pp + 1)

goal (1 subgoal):
 1. proots_count p S = card (proots_within p S) + proots_count pp S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>proots_within p S. order r p) = (\<Sum>r\<in>proots_within p S. order r pp + 1)

goal (1 subgoal):
 1. proots_count p S = card (proots_within p S) + proots_count pp S
[PROOF STEP]
have "... = card (proots_within p S) + (\<Sum>r\<in> proots_within p S. order r pp)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within p S. order r pp + 1) = card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp)
[PROOF STEP]
apply (subst sum.distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within p S. order r pp) + (\<Sum>r\<in>proots_within p S. 1) = card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>proots_within p S. order r pp + 1) = card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp)

goal (1 subgoal):
 1. proots_count p S = card (proots_within p S) + proots_count pp S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>proots_within p S. order r pp + 1) = card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp)

goal (1 subgoal):
 1. proots_count p S = card (proots_within p S) + proots_count pp S
[PROOF STEP]
have "... = card (proots_within p S) + (\<Sum>r\<in> proots_within pp S. order r pp)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)
[PROOF STEP]
have "(\<Sum>r\<in>proots_within p S. order r pp) = (\<Sum>r\<in>proots_within pp S. order r pp)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within p S. order r pp) = (\<Sum>r\<in>proots_within pp S. order r pp)
[PROOF STEP]
apply (rule sum.mono_neutral_right)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite (proots_within p S)
 2. proots_within pp S \<subseteq> proots_within p S
 3. \<forall>i\<in>proots_within p S - proots_within pp S. order i pp = 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (proots_within p S)
[PROOF STEP]
using \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. finite (proots_within p S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. proots_within pp S \<subseteq> proots_within p S
 2. \<forall>i\<in>proots_within p S - proots_within pp S. order i pp = 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within pp S \<subseteq> proots_within p S
[PROOF STEP]
unfolding pp_gcd
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within (smult lp (gcd p (pderiv p))) S \<subseteq> proots_within p S
[PROOF STEP]
using \<open>lp\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
lp \<noteq> 0

goal (1 subgoal):
 1. proots_within (smult lp (gcd p (pderiv p))) S \<subseteq> proots_within p S
[PROOF STEP]
by (auto simp:poly_gcd_0_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>proots_within p S - proots_within pp S. order i pp = 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>proots_within p S - proots_within pp S. order i pp = 0
[PROOF STEP]
unfolding pp_gcd
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>proots_within p S - proots_within (smult lp (gcd p (pderiv p))) S. order i (smult lp (gcd p (pderiv p))) = 0
[PROOF STEP]
using \<open>lp\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
lp \<noteq> 0

goal (1 subgoal):
 1. \<forall>i\<in>proots_within p S - proots_within (smult lp (gcd p (pderiv p))) S. order i (smult lp (gcd p (pderiv p))) = 0
[PROOF STEP]
apply (auto simp:poly_gcd_0_iff order_smult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>lp \<noteq> 0; poly (pderiv p) i \<noteq> 0; poly p i = 0; i \<in> S\<rbrakk> \<Longrightarrow> order i (gcd p (pderiv p)) = 0
[PROOF STEP]
apply (subst order_gcd)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i. \<lbrakk>lp \<noteq> 0; poly (pderiv p) i \<noteq> 0; poly p i = 0; i \<in> S\<rbrakk> \<Longrightarrow> p \<noteq> 0
 2. \<And>i. \<lbrakk>lp \<noteq> 0; poly (pderiv p) i \<noteq> 0; poly p i = 0; i \<in> S\<rbrakk> \<Longrightarrow> pderiv p \<noteq> 0
 3. \<And>i. \<lbrakk>lp \<noteq> 0; poly (pderiv p) i \<noteq> 0; poly p i = 0; i \<in> S\<rbrakk> \<Longrightarrow> min (order i p) (order i (pderiv p)) = 0
[PROOF STEP]
by (auto simp add: order_root)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>proots_within p S. order r pp) = (\<Sum>r\<in>proots_within pp S. order r pp)

goal (1 subgoal):
 1. card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>r\<in>proots_within p S. order r pp) = (\<Sum>r\<in>proots_within pp S. order r pp)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>r\<in>proots_within p S. order r pp) = (\<Sum>r\<in>proots_within pp S. order r pp)

goal (1 subgoal):
 1. card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (proots_within p S) + (\<Sum>r\<in>proots_within p S. order r pp) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)

goal (1 subgoal):
 1. proots_count p S = card (proots_within p S) + proots_count pp S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>r\<in>proots_within p S. order r p) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>r\<in>proots_within p S. order r p) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)

goal (1 subgoal):
 1. proots_count p S = card (proots_within p S) + proots_count pp S
[PROOF STEP]
unfolding proots_count_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>r\<in>proots_within p S. order r p) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)

goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within p S. order r p) = card (proots_within p S) + (\<Sum>r\<in>proots_within pp S. order r pp)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
proots_count p S = card (proots_within p S) + proots_count pp S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proots_count p S = card (proots_within p S) + proots_count pp S

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proots_count p S = card (proots_within p S) + proots_count pp S

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have "card (proots_within p S) = changes_itv_smods a b p (pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (card (proots_within p S)) = changes_itv_smods a b p (pderiv p)
[PROOF STEP]
using sturm_interval[OF \<open>a<b\<close> \<open>poly p a\<noteq>0\<close> \<open>poly p b\<noteq>0\<close>,symmetric]
[PROOF STATE]
proof (prove)
using this:
changes_itv_smods a b p (pderiv p) = int (card {x. poly p x = 0 \<and> a < x \<and> x < b})

goal (1 subgoal):
 1. int (card (proots_within p S)) = changes_itv_smods a b p (pderiv p)
[PROOF STEP]
unfolding S_def proots_within_def
[PROOF STATE]
proof (prove)
using this:
changes_itv_smods a b p (pderiv p) = int (card {x. poly p x = 0 \<and> a < x \<and> x < b})

goal (1 subgoal):
 1. int (card {x \<in> {x. a < x \<and> x < b}. poly p x = 0}) = changes_itv_smods a b p (pderiv p)
[PROOF STEP]
by (auto intro!:arg_cong[where f=card])
[PROOF STATE]
proof (state)
this:
int (card (proots_within p S)) = changes_itv_smods a b p (pderiv p)

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
int (card (proots_within p S)) = changes_itv_smods a b p (pderiv p)

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
have "changes_itv_smods_ext a b p (pderiv p)
            = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
define xs ys where "xs=smods p (pderiv p)" and "ys=smods_ext pp (pderiv pp)"
[PROOF STATE]
proof (state)
this:
xs = smods p (pderiv p)
ys = smods_ext pp (pderiv pp)

goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
have xys: "xs\<noteq>[]" "ys\<noteq>[]" "last xs=hd ys" "poly (last xs) a\<noteq>0" "poly (last xs) b\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs \<noteq> [] &&& ys \<noteq> []) &&& last xs = hd ys &&& poly (last xs) a \<noteq> 0 &&& poly (last xs) b \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> []
[PROOF STEP]
unfolding xs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smods p (pderiv p) \<noteq> []
[PROOF STEP]
using \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. smods p (pderiv p) \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. ys \<noteq> []
 2. last xs = hd ys
 3. poly (last xs) a \<noteq> 0
 4. poly (last xs) b \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ys \<noteq> []
[PROOF STEP]
unfolding ys_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smods_ext pp (pderiv pp) \<noteq> []
[PROOF STEP]
using \<open>pp\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
pp \<noteq> 0

goal (1 subgoal):
 1. smods_ext pp (pderiv pp) \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. last xs = hd ys
 2. poly (last xs) a \<noteq> 0
 3. poly (last xs) b \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last xs = hd ys
[PROOF STEP]
using \<open>pp\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
pp \<noteq> 0

goal (1 subgoal):
 1. last xs = hd ys
[PROOF STEP]
unfolding xs_def ys_def
[PROOF STATE]
proof (prove)
using this:
pp \<noteq> 0

goal (1 subgoal):
 1. last (smods p (pderiv p)) = hd (smods_ext pp (pderiv pp))
[PROOF STEP]
apply (fold pp_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pp \<noteq> 0 \<Longrightarrow> pp = hd (smods_ext pp (pderiv pp))
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. poly (last xs) a \<noteq> 0
 2. poly (last xs) b \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (last xs) a \<noteq> 0
[PROOF STEP]
using \<open>poly pp a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
poly pp a \<noteq> 0

goal (1 subgoal):
 1. poly (last xs) a \<noteq> 0
[PROOF STEP]
unfolding pp_def xs_def
[PROOF STATE]
proof (prove)
using this:
poly (last (smods p (pderiv p))) a \<noteq> 0

goal (1 subgoal):
 1. poly (last (smods p (pderiv p))) a \<noteq> 0
[PROOF STEP]
.
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (last xs) b \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (last xs) b \<noteq> 0
[PROOF STEP]
using \<open>poly pp b\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
poly pp b \<noteq> 0

goal (1 subgoal):
 1. poly (last xs) b \<noteq> 0
[PROOF STEP]
unfolding pp_def xs_def
[PROOF STATE]
proof (prove)
using this:
poly (last (smods p (pderiv p))) b \<noteq> 0

goal (1 subgoal):
 1. poly (last (smods p (pderiv p))) b \<noteq> 0
[PROOF STEP]
.
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
xs \<noteq> []
ys \<noteq> []
last xs = hd ys
poly (last xs) a \<noteq> 0
poly (last xs) b \<noteq> 0

goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
have "changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
[PROOF STEP]
have "changes_poly_at (xs @ tl ys) a  = changes_poly_at (xs @ ys) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) a = changes_poly_at (xs @ ys) a
[PROOF STEP]
unfolding changes_poly_at_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p a) (xs @ tl ys)) = changes (map (\<lambda>p. poly p a) (xs @ ys))
[PROOF STEP]
apply (simp add:map_tl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p a) xs @ tl (map (\<lambda>p. poly p a) ys)) = changes (map (\<lambda>p. poly p a) xs @ map (\<lambda>p. poly p a) ys)
[PROOF STEP]
apply (subst changes_drop_dup[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. map (\<lambda>p. poly p a) xs \<noteq> []
 2. map (\<lambda>p. poly p a) ys \<noteq> [] \<longrightarrow> last (map (\<lambda>p. poly p a) xs) = hd (map (\<lambda>p. poly p a) ys)
 3. changes (map (\<lambda>p. poly p a) xs @ map (\<lambda>p. poly p a) ys) = changes (map (\<lambda>p. poly p a) xs @ map (\<lambda>p. poly p a) ys)
[PROOF STEP]
using that xys
[PROOF STATE]
proof (prove)
using this:
pderiv p \<noteq> 0
xs \<noteq> []
ys \<noteq> []
last xs = hd ys
poly (last xs) a \<noteq> 0
poly (last xs) b \<noteq> 0

goal (3 subgoals):
 1. map (\<lambda>p. poly p a) xs \<noteq> []
 2. map (\<lambda>p. poly p a) ys \<noteq> [] \<longrightarrow> last (map (\<lambda>p. poly p a) xs) = hd (map (\<lambda>p. poly p a) ys)
 3. changes (map (\<lambda>p. poly p a) xs @ map (\<lambda>p. poly p a) ys) = changes (map (\<lambda>p. poly p a) xs @ map (\<lambda>p. poly p a) ys)
[PROOF STEP]
by (auto simp add: hd_map last_map)
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) a = changes_poly_at (xs @ ys) a

goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) a = changes_poly_at (xs @ ys) a

goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
[PROOF STEP]
have "... = changes_poly_at xs a + changes_poly_at ys a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (xs @ ys) a = changes_poly_at xs a + changes_poly_at ys a
[PROOF STEP]
unfolding changes_poly_at_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p a) (xs @ ys)) = changes (map (\<lambda>p. poly p a) xs) + changes (map (\<lambda>p. poly p a) ys)
[PROOF STEP]
apply (subst changes_append[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. map (\<lambda>p. poly p a) xs \<noteq> [] \<and> map (\<lambda>p. poly p a) ys \<noteq> [] \<longrightarrow> last (map (\<lambda>p. poly p a) xs) = hd (map (\<lambda>p. poly p a) ys) \<and> last (map (\<lambda>p. poly p a) xs) \<noteq> 0
 2. changes (map (\<lambda>p. poly p a) (xs @ ys)) = changes (map (\<lambda>p. poly p a) xs @ map (\<lambda>p. poly p a) ys)
[PROOF STEP]
using xys
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
ys \<noteq> []
last xs = hd ys
poly (last xs) a \<noteq> 0
poly (last xs) b \<noteq> 0

goal (2 subgoals):
 1. map (\<lambda>p. poly p a) xs \<noteq> [] \<and> map (\<lambda>p. poly p a) ys \<noteq> [] \<longrightarrow> last (map (\<lambda>p. poly p a) xs) = hd (map (\<lambda>p. poly p a) ys) \<and> last (map (\<lambda>p. poly p a) xs) \<noteq> 0
 2. changes (map (\<lambda>p. poly p a) (xs @ ys)) = changes (map (\<lambda>p. poly p a) xs @ map (\<lambda>p. poly p a) ys)
[PROOF STEP]
by (auto simp add: hd_map last_map)
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ ys) a = changes_poly_at xs a + changes_poly_at ys a

goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a

goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a

goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a

goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
have "changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
have "changes_poly_at (xs @ tl ys) b  = changes_poly_at (xs @ ys) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) b = changes_poly_at (xs @ ys) b
[PROOF STEP]
unfolding changes_poly_at_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p b) (xs @ tl ys)) = changes (map (\<lambda>p. poly p b) (xs @ ys))
[PROOF STEP]
apply (simp add:map_tl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p b) xs @ tl (map (\<lambda>p. poly p b) ys)) = changes (map (\<lambda>p. poly p b) xs @ map (\<lambda>p. poly p b) ys)
[PROOF STEP]
apply (subst changes_drop_dup[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. map (\<lambda>p. poly p b) xs \<noteq> []
 2. map (\<lambda>p. poly p b) ys \<noteq> [] \<longrightarrow> last (map (\<lambda>p. poly p b) xs) = hd (map (\<lambda>p. poly p b) ys)
 3. changes (map (\<lambda>p. poly p b) xs @ map (\<lambda>p. poly p b) ys) = changes (map (\<lambda>p. poly p b) xs @ map (\<lambda>p. poly p b) ys)
[PROOF STEP]
using that xys
[PROOF STATE]
proof (prove)
using this:
pderiv p \<noteq> 0
xs \<noteq> []
ys \<noteq> []
last xs = hd ys
poly (last xs) a \<noteq> 0
poly (last xs) b \<noteq> 0

goal (3 subgoals):
 1. map (\<lambda>p. poly p b) xs \<noteq> []
 2. map (\<lambda>p. poly p b) ys \<noteq> [] \<longrightarrow> last (map (\<lambda>p. poly p b) xs) = hd (map (\<lambda>p. poly p b) ys)
 3. changes (map (\<lambda>p. poly p b) xs @ map (\<lambda>p. poly p b) ys) = changes (map (\<lambda>p. poly p b) xs @ map (\<lambda>p. poly p b) ys)
[PROOF STEP]
by (auto simp add: hd_map last_map)
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) b = changes_poly_at (xs @ ys) b

goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) b = changes_poly_at (xs @ ys) b

goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
have "... = changes_poly_at xs b + changes_poly_at ys b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (xs @ ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
unfolding changes_poly_at_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (map (\<lambda>p. poly p b) (xs @ ys)) = changes (map (\<lambda>p. poly p b) xs) + changes (map (\<lambda>p. poly p b) ys)
[PROOF STEP]
apply (subst changes_append[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. map (\<lambda>p. poly p b) xs \<noteq> [] \<and> map (\<lambda>p. poly p b) ys \<noteq> [] \<longrightarrow> last (map (\<lambda>p. poly p b) xs) = hd (map (\<lambda>p. poly p b) ys) \<and> last (map (\<lambda>p. poly p b) xs) \<noteq> 0
 2. changes (map (\<lambda>p. poly p b) (xs @ ys)) = changes (map (\<lambda>p. poly p b) xs @ map (\<lambda>p. poly p b) ys)
[PROOF STEP]
using xys
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
ys \<noteq> []
last xs = hd ys
poly (last xs) a \<noteq> 0
poly (last xs) b \<noteq> 0

goal (2 subgoals):
 1. map (\<lambda>p. poly p b) xs \<noteq> [] \<and> map (\<lambda>p. poly p b) ys \<noteq> [] \<longrightarrow> last (map (\<lambda>p. poly p b) xs) = hd (map (\<lambda>p. poly p b) ys) \<and> last (map (\<lambda>p. poly p b) xs) \<noteq> 0
 2. changes (map (\<lambda>p. poly p b) (xs @ ys)) = changes (map (\<lambda>p. poly p b) xs @ map (\<lambda>p. poly p b) ys)
[PROOF STEP]
by (auto simp add: hd_map last_map)
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ ys) b = changes_poly_at xs b + changes_poly_at ys b

goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b

goal (1 subgoal):
 1. changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b

goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b

goal (1 subgoal):
 1. changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
unfolding changes_itv_smods_ext_def changes_itv_smods_def
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a
changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b

goal (1 subgoal):
 1. (let ps = smods_ext p (pderiv p) in changes_poly_at ps a - changes_poly_at ps b) = (let ps = smods p (pderiv p) in changes_poly_at ps a - changes_poly_at ps b) + (let ps = smods_ext pp (pderiv pp) in changes_poly_at ps a - changes_poly_at ps b)
[PROOF STEP]
apply (fold xs_def ys_def,unfold prefix[folded xs_def ys_def] Let_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a; changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b; changes_poly_at (xs @ tl ys) a = changes_poly_at xs a + changes_poly_at ys a; changes_poly_at (xs @ tl ys) b = changes_poly_at xs b + changes_poly_at ys b\<rbrakk> \<Longrightarrow> changes_poly_at (xs @ tl ys) a - changes_poly_at (xs @ tl ys) b = changes_poly_at xs a - changes_poly_at xs b + (changes_poly_at ys a - changes_poly_at ys b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
int (proots_count pp S) = changes_itv_smods_ext a b pp (pderiv pp)
proots_count p S = card (proots_within p S) + proots_count pp S
int (card (proots_within p S)) = changes_itv_smods a b p (pderiv p)
changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)
[PROOF STEP]
show "proots_count p S = changes_itv_smods_ext a b p (pderiv p)"
[PROOF STATE]
proof (prove)
using this:
int (proots_count pp S) = changes_itv_smods_ext a b pp (pderiv pp)
proots_count p S = card (proots_within p S) + proots_count pp S
int (card (proots_within p S)) = changes_itv_smods a b p (pderiv p)
changes_itv_smods_ext a b p (pderiv p) = changes_itv_smods a b p (pderiv p) + changes_itv_smods_ext a b pp (pderiv pp)

goal (1 subgoal):
 1. int (proots_count p S) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (proots_count p S) = changes_itv_smods_ext a b p (pderiv p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pderiv p \<noteq> 0 \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<forall>ys. length ys < length (smods_ext p (pderiv p)) \<longrightarrow> (\<forall>x. ys = smods_ext x (pderiv x) \<longrightarrow> poly x a \<noteq> 0 \<longrightarrow> poly x b \<noteq> 0 \<longrightarrow> int (proots_count x {x. a < x \<and> x < b}) = changes_itv_smods_ext a b x (pderiv x)); poly p a \<noteq> 0; poly p b \<noteq> 0\<rbrakk> \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
pderiv p = 0 \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
pderiv p \<noteq> 0 \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
pderiv p = 0 \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
pderiv p \<noteq> 0 \<Longrightarrow> int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)

goal (1 subgoal):
 1. int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
int (proots_count p {x. a < x \<and> x < b}) = changes_itv_smods_ext a b p (pderiv p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma support_impl: "support (\<lambda>l s. P s \<longrightarrow> Q l s) \<subseteq> support Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. support (\<lambda>l s. P s \<longrightarrow> Q l s) \<subseteq> support Q
[PROOF STEP]
unfolding support_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> (P s \<longrightarrow> Q l1 s) \<noteq> (P s \<longrightarrow> Q l2 s)} \<subseteq> {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> Q l1 s \<noteq> Q l2 s}
[PROOF STEP]
by blast


[STATEMENT]
lemma \<pi>_bigtheta: "\<pi> \<in> \<Theta>(\<lambda>x. x / ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> \<in> \<Theta>(\<lambda>x. x / ln x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<pi> \<in> O(\<lambda>x. x / ln x)
 2. \<pi> \<in> \<Omega>(\<lambda>x. x / ln x)
[PROOF STEP]
have "eventually (\<lambda>x. \<bar>\<pi> x\<bar> \<le> 3 * (exp (- 1) + ln 2) * \<bar>x / ln x\<bar>) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>\<pi> x\<bar> \<le> 3 * (exp (- 1) + ln 2) * \<bar>x / ln x\<bar>
[PROOF STEP]
using eventually_ge_at_top[of 2]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) (2::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>\<pi> x\<bar> \<le> 3 * (exp (- 1) + ln 2) * \<bar>x / ln x\<bar>
[PROOF STEP]
by eventually_elim (use \<pi>_upper_bound in \<open>auto intro!: less_imp_le\<close>)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>\<pi> x\<bar> \<le> 3 * (exp (- 1) + ln 2) * \<bar>x / ln x\<bar>

goal (2 subgoals):
 1. \<pi> \<in> O(\<lambda>x. x / ln x)
 2. \<pi> \<in> \<Omega>(\<lambda>x. x / ln x)
[PROOF STEP]
thus "\<pi> \<in> O(\<lambda>x. x / ln x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. \<bar>\<pi> x\<bar> \<le> 3 * (exp (- 1) + ln 2) * \<bar>x / ln x\<bar>

goal (1 subgoal):
 1. \<pi> \<in> O(\<lambda>x. x / ln x)
[PROOF STEP]
by (intro bigoI[where c = "3 * (exp (- 1) + ln 2)"]) auto
[PROOF STATE]
proof (state)
this:
\<pi> \<in> O(\<lambda>x. x / ln x)

goal (1 subgoal):
 1. \<pi> \<in> \<Omega>(\<lambda>x. x / ln x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<pi> \<in> \<Omega>(\<lambda>x. x / ln x)
[PROOF STEP]
have "eventually (\<lambda>x. \<bar>\<pi> x\<bar> \<ge> 1 / 6 * \<bar>x / ln x\<bar>) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 / 6 * \<bar>x / ln x\<bar> \<le> \<bar>\<pi> x\<bar>
[PROOF STEP]
using eventually_ge_at_top[of 2]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) (2::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 / 6 * \<bar>x / ln x\<bar> \<le> \<bar>\<pi> x\<bar>
[PROOF STEP]
by eventually_elim (use \<pi>_lower_bound in \<open>auto intro!: less_imp_le\<close>)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 1 / 6 * \<bar>x / ln x\<bar> \<le> \<bar>\<pi> x\<bar>

goal (1 subgoal):
 1. \<pi> \<in> \<Omega>(\<lambda>x. x / ln x)
[PROOF STEP]
thus "\<pi> \<in> \<Omega>(\<lambda>x. x / ln x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 1 / 6 * \<bar>x / ln x\<bar> \<le> \<bar>\<pi> x\<bar>

goal (1 subgoal):
 1. \<pi> \<in> \<Omega>(\<lambda>x. x / ln x)
[PROOF STEP]
by (intro landau_omega.bigI[where c = "1 / 6"]) auto
[PROOF STATE]
proof (state)
this:
\<pi> \<in> \<Omega>(\<lambda>x. x / ln x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_floor_iff: "z < \<lfloor>x\<rfloor> \<longleftrightarrow> of_int z + 1 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z < \<lfloor>x\<rfloor>) = (of_int z + (1::'a) \<le> x)
[PROOF STEP]
using le_floor_iff [of "z + 1" x]
[PROOF STATE]
proof (prove)
using this:
(z + 1 \<le> \<lfloor>x\<rfloor>) = (of_int (z + 1) \<le> x)

goal (1 subgoal):
 1. (z < \<lfloor>x\<rfloor>) = (of_int z + (1::'a) \<le> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma omax_ordLeq_elim:
assumes "finite R" and "\<forall> r \<in> R. Well_order r"
and "omax R \<le>o p" and "r \<in> R"
shows "r \<le>o p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le>o p
[PROOF STEP]
using assms omax_maxim[of R r]
[PROOF STATE]
proof (prove)
using this:
finite R
\<forall>r\<in>R. Well_order r
omax R \<le>o p
r \<in> R
\<lbrakk>finite R; \<forall>r\<in>R. Well_order r; r \<in> R\<rbrakk> \<Longrightarrow> r \<le>o omax R

goal (1 subgoal):
 1. r \<le>o p
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite R; \<forall>r\<in>R. Well_order r; omax R \<le>o p; r \<in> R; r \<le>o omax R\<rbrakk> \<Longrightarrow> r \<le>o p
[PROOF STEP]
using ordLeq_transitive
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?r \<le>o ?r'; ?r' \<le>o ?r''\<rbrakk> \<Longrightarrow> ?r \<le>o ?r''

goal (1 subgoal):
 1. \<lbrakk>finite R; \<forall>r\<in>R. Well_order r; omax R \<le>o p; r \<in> R; r \<le>o omax R\<rbrakk> \<Longrightarrow> r \<le>o p
[PROOF STEP]
by blast


[STATEMENT]
lemma mult_right [simp]: "f \<in> L F (g) \<Longrightarrow> (\<lambda>x. f x * h x) \<in> L F (\<lambda>x. g x * h x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> L F g \<Longrightarrow> (\<lambda>x. f x * h x) \<in> L F (\<lambda>x. g x * h x)
[PROOF STEP]
using mult_left
[PROOF STATE]
proof (prove)
using this:
?f \<in> L ?F ?g \<Longrightarrow> (\<lambda>x. ?h x * ?f x) \<in> L ?F (\<lambda>x. ?h x * ?g x)

goal (1 subgoal):
 1. f \<in> L F g \<Longrightarrow> (\<lambda>x. f x * h x) \<in> L F (\<lambda>x. g x * h x)
[PROOF STEP]
by (simp add: mult.commute)


[STATEMENT]
lemma cont2cont_minus [simp, cont2cont]:
  assumes "cont (\<lambda>x. f x)" and "cont (\<lambda>x. g x)"
  shows "cont (\<lambda>x. f x - g x :: 'a::minus_cpo)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cont (\<lambda>x. f x - g x)
[PROOF STEP]
apply (rule cont_apply [OF assms(1) cont_minus1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. cont (\<lambda>x. y - g x)
[PROOF STEP]
apply (rule cont_apply [OF assms(2) cont_minus2])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y ya. cont (\<lambda>x. y - ya)
[PROOF STEP]
apply (rule cont_const)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma separated_in_singleton:
  assumes "t1_space X"
  shows "separatedin X {a} S \<longleftrightarrow> a \<in> topspace X \<and> S \<subseteq> topspace X \<and> (a \<notin> X closure_of S)"
        "separatedin X S {a} \<longleftrightarrow> a \<in> topspace X \<and> S \<subseteq> topspace X \<and> (a \<notin> X closure_of S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. separatedin X {a} S = (a \<in> topspace X \<and> S \<subseteq> topspace X \<and> a \<notin> X closure_of S) &&& separatedin X S {a} = (a \<in> topspace X \<and> S \<subseteq> topspace X \<and> a \<notin> X closure_of S)
[PROOF STEP]
unfolding separatedin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a} \<subseteq> topspace X \<and> S \<subseteq> topspace X \<and> {a} \<inter> X closure_of S = {} \<and> S \<inter> X closure_of {a} = {}) = (a \<in> topspace X \<and> S \<subseteq> topspace X \<and> a \<notin> X closure_of S) &&& (S \<subseteq> topspace X \<and> {a} \<subseteq> topspace X \<and> S \<inter> X closure_of {a} = {} \<and> {a} \<inter> X closure_of S = {}) = (a \<in> topspace X \<and> S \<subseteq> topspace X \<and> a \<notin> X closure_of S)
[PROOF STEP]
using assms closure_of closure_of_singleton
[PROOF STATE]
proof (prove)
using this:
t1_space X
?X closure_of ?S = topspace ?X \<inter> (?S \<union> ?X derived_set_of ?S)
t1_space ?X \<Longrightarrow> ?X closure_of {?a} = (if ?a \<in> topspace ?X then {?a} else {})

goal (1 subgoal):
 1. ({a} \<subseteq> topspace X \<and> S \<subseteq> topspace X \<and> {a} \<inter> X closure_of S = {} \<and> S \<inter> X closure_of {a} = {}) = (a \<in> topspace X \<and> S \<subseteq> topspace X \<and> a \<notin> X closure_of S) &&& (S \<subseteq> topspace X \<and> {a} \<subseteq> topspace X \<and> S \<inter> X closure_of {a} = {} \<and> {a} \<inter> X closure_of S = {}) = (a \<in> topspace X \<and> S \<subseteq> topspace X \<and> a \<notin> X closure_of S)
[PROOF STEP]
by fastforce+


[STATEMENT]
lemma gcd_is_Max_divisors_int:
  fixes m n :: int
  assumes "n \<noteq> 0" shows "gcd m n = Max {d. d dvd m \<and> d dvd n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd m n = Max {d. d dvd m \<and> d dvd n}
[PROOF STEP]
proof (rule Max_eqI[THEN sym], simp_all)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {d. d dvd m \<and> d dvd n}
 2. \<And>y. y dvd m \<and> y dvd n \<Longrightarrow> y \<le> gcd m n
[PROOF STEP]
show "finite {d. d dvd m \<and> d dvd n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {d. d dvd m \<and> d dvd n}
[PROOF STEP]
by (simp add: \<open>n \<noteq> 0\<close>)
[PROOF STATE]
proof (state)
this:
finite {d. d dvd m \<and> d dvd n}

goal (1 subgoal):
 1. \<And>y. y dvd m \<and> y dvd n \<Longrightarrow> y \<le> gcd m n
[PROOF STEP]
show "\<And>y. y dvd m \<and> y dvd n \<Longrightarrow> y \<le> gcd m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y dvd m \<and> y dvd n \<Longrightarrow> y \<le> gcd m n
[PROOF STEP]
by (simp add: \<open>n \<noteq> 0\<close> zdvd_imp_le)
[PROOF STATE]
proof (state)
this:
?y dvd m \<and> ?y dvd n \<Longrightarrow> ?y \<le> gcd m n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma epm_3:
  assumes "e \<le> w"
      and "injective w"
    shows "e = w \<sqinter> top * e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e = w \<sqinter> top * e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e = w \<sqinter> top * e
[PROOF STEP]
have "w \<sqinter> top * e \<le> w * e\<^sup>T * e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<sqinter> top * e \<le> w * e\<^sup>T * e
[PROOF STEP]
by (metis (no_types, lifting) inf.absorb2 top.extremum dedekind_2 inf.commute)
[PROOF STATE]
proof (state)
this:
w \<sqinter> top * e \<le> w * e\<^sup>T * e

goal (1 subgoal):
 1. e = w \<sqinter> top * e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
w \<sqinter> top * e \<le> w * e\<^sup>T * e

goal (1 subgoal):
 1. e = w \<sqinter> top * e
[PROOF STEP]
have "... \<le> w * w\<^sup>T * e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w * e\<^sup>T * e \<le> w * w\<^sup>T * e
[PROOF STEP]
by (simp add: assms(1) conv_isotone mult_left_isotone mult_right_isotone)
[PROOF STATE]
proof (state)
this:
w * e\<^sup>T * e \<le> w * w\<^sup>T * e

goal (1 subgoal):
 1. e = w \<sqinter> top * e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
w * e\<^sup>T * e \<le> w * w\<^sup>T * e

goal (1 subgoal):
 1. e = w \<sqinter> top * e
[PROOF STEP]
have "... \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w * w\<^sup>T * e \<le> e
[PROOF STEP]
using assms(2) coreflexive_comp_top_inf inf.sup_right_divisibility
[PROOF STATE]
proof (prove)
using this:
injective w
coreflexive ?x \<Longrightarrow> ?x * top \<sqinter> ?y = ?x * ?y
(?y \<le> ?x) = (\<exists>z. z \<sqinter> ?x = ?y)

goal (1 subgoal):
 1. w * w\<^sup>T * e \<le> e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
w * w\<^sup>T * e \<le> e

goal (1 subgoal):
 1. e = w \<sqinter> top * e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
w \<sqinter> top * e \<le> e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
w \<sqinter> top * e \<le> e

goal (1 subgoal):
 1. e = w \<sqinter> top * e
[PROOF STEP]
by (simp add: assms(1) top_left_mult_increasing order.antisym)
[PROOF STATE]
proof (state)
this:
e = w \<sqinter> top * e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_compose_const:
  assumes "is_poly_tuple m fs"
  assumes "length fs = n"
  assumes "a \<in> carrier R"
  shows "poly_compose n m fs (coord_const a) = coord_const a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_compose n m fs (R.indexed_const a) = R.indexed_const a
[PROOF STEP]
using R.Pring_universal_prop(3)[of "(coord_ring R m)" "(\<lambda>i. fs!i)" "{..<n}" coord_const "(poly_compose n m fs)"]
        Pring_universal_prop_assms assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cring (R [\<X>\<^bsub>m\<^esub>]); (!) fs \<in> {..<n} \<rightarrow> carrier (R [\<X>\<^bsub>m\<^esub>]); ring_hom_ring R (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const; poly_compose n m fs = indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs)\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier R. poly_compose n m fs (R.indexed_const a) = R.indexed_const a
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n\<rbrakk> \<Longrightarrow> (!) ?fs \<in> {..<?n} \<rightarrow> carrier (R [\<X>\<^bsub>?m\<^esub>])
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n\<rbrakk> \<Longrightarrow> ring_hom_ring R (R [\<X>\<^bsub>?m\<^esub>]) R.indexed_const
is_poly_tuple m fs
length fs = n
a \<in> carrier R

goal (1 subgoal):
 1. poly_compose n m fs (R.indexed_const a) = R.indexed_const a
[PROOF STEP]
unfolding poly_compose_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cring (R [\<X>\<^bsub>m\<^esub>]); (!) fs \<in> {..<n} \<rightarrow> carrier (R [\<X>\<^bsub>m\<^esub>]); ring_hom_ring R (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const; indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs) = indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs)\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier R. indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs) (R.indexed_const a) = R.indexed_const a
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n\<rbrakk> \<Longrightarrow> (!) ?fs \<in> {..<?n} \<rightarrow> carrier (R [\<X>\<^bsub>?m\<^esub>])
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n\<rbrakk> \<Longrightarrow> ring_hom_ring R (R [\<X>\<^bsub>?m\<^esub>]) R.indexed_const
is_poly_tuple m fs
length fs = n
a \<in> carrier R

goal (1 subgoal):
 1. indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs) (R.indexed_const a) = R.indexed_const a
[PROOF STEP]
using R.Pring_is_cring coord_cring_cring
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cring (R [\<X>\<^bsub>m\<^esub>]); (!) fs \<in> {..<n} \<rightarrow> carrier (R [\<X>\<^bsub>m\<^esub>]); ring_hom_ring R (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const; indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs) = indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs)\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier R. indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs) (R.indexed_const a) = R.indexed_const a
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n\<rbrakk> \<Longrightarrow> (!) ?fs \<in> {..<?n} \<rightarrow> carrier (R [\<X>\<^bsub>?m\<^esub>])
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n\<rbrakk> \<Longrightarrow> ring_hom_ring R (R [\<X>\<^bsub>?m\<^esub>]) R.indexed_const
is_poly_tuple m fs
length fs = n
a \<in> carrier R
cring R \<Longrightarrow> cring (Pring R ?I)
cring (R [\<X>\<^bsub>?n\<^esub>])

goal (1 subgoal):
 1. indexed_poly_induced_morphism {..<n} (R [\<X>\<^bsub>m\<^esub>]) R.indexed_const ((!) fs) (R.indexed_const a) = R.indexed_const a
[PROOF STEP]
by blast


[STATEMENT]
lemma iT_Minus_Max: "
  \<lbrakk> I \<noteq> {}; iMin I \<le> k \<rbrakk> \<Longrightarrow> Max (k \<ominus> I) = k - (iMin I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; iMin I \<le> k\<rbrakk> \<Longrightarrow> Max (k \<ominus> I) = k - iMin I
[PROOF STEP]
apply (rule Max_equality)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>I \<noteq> {}; iMin I \<le> k\<rbrakk> \<Longrightarrow> k - iMin I \<in> k \<ominus> I
 2. \<lbrakk>I \<noteq> {}; iMin I \<le> k\<rbrakk> \<Longrightarrow> finite (k \<ominus> I)
 3. \<And>x. \<lbrakk>I \<noteq> {}; iMin I \<le> k; x \<in> k \<ominus> I\<rbrakk> \<Longrightarrow> x \<le> k - iMin I
[PROOF STEP]
apply (simp add: iT_Minus_mem_iff iMinI_ex2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>I \<noteq> {}; iMin I \<le> k\<rbrakk> \<Longrightarrow> finite (k \<ominus> I)
 2. \<And>x. \<lbrakk>I \<noteq> {}; iMin I \<le> k; x \<in> k \<ominus> I\<rbrakk> \<Longrightarrow> x \<le> k - iMin I
[PROOF STEP]
apply (simp add: iT_Minus_finite)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>I \<noteq> {}; iMin I \<le> k; x \<in> k \<ominus> I\<rbrakk> \<Longrightarrow> x \<le> k - iMin I
[PROOF STEP]
apply (fastforce simp: iT_Minus_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma llist_all2_conj:
  "llist_all2 (\<lambda>x y. P x y \<and> Q x y) xs ys \<longleftrightarrow> llist_all2 P xs ys \<and> llist_all2 Q xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 (\<lambda>x y. P x y \<and> Q x y) xs ys = (llist_all2 P xs ys \<and> llist_all2 Q xs ys)
[PROOF STEP]
by(auto simp add: llist_all2_conv_all_lnth)


[STATEMENT]
lemma in_Chains_subset: "\<lbrakk> M \<in> Chains r; M' \<subseteq> M \<rbrakk> \<Longrightarrow> M' \<in> Chains r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M \<in> Chains r; M' \<subseteq> M\<rbrakk> \<Longrightarrow> M' \<in> Chains r
[PROOF STEP]
by(auto simp add: Chains_def)


[STATEMENT]
lemma len_lexext_mono_strong:
  "(\<forall>y \<in> set ys. \<forall>x \<in> set xs. gt y x \<longrightarrow> gt' y x) \<Longrightarrow> len_lexext gt ys xs \<Longrightarrow> len_lexext gt' ys xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>y\<in>set ys. \<forall>x\<in>set xs. gt y x \<longrightarrow> gt' y x; len_lexext gt ys xs\<rbrakk> \<Longrightarrow> len_lexext gt' ys xs
[PROOF STEP]
by (rule lenext_mono_strong[OF lexext_mono_strong])


[STATEMENT]
lemma map_values_update: "map_values f (update k v m) = update k (f k v) (map_values f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_values f (update k v m) = update k (f k v) (map_values f m)
[PROOF STEP]
by transfer (simp_all add: fun_eq_iff)


[STATEMENT]
lemma SizeOfObjectPos: "ssize (Obj (f::Label -~> sterm) T) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < ssize (Obj f T)
[PROOF STEP]
proof (simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (dom f)
[PROOF STEP]
from finite_dom_fmap
[PROOF STATE]
proof (chain)
picking this:
finite (dom ?F)
[PROOF STEP]
have "finite (dom f)"
[PROOF STATE]
proof (prove)
using this:
finite (dom ?F)

goal (1 subgoal):
 1. finite (dom f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (dom f)

goal (1 subgoal):
 1. 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (dom f)
[PROOF STEP]
thus "0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (dom f)"
[PROOF STATE]
proof (prove)
using this:
finite (dom f)

goal (1 subgoal):
 1. 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (dom f)
[PROOF STEP]
proof (induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) F\<rbrakk> \<Longrightarrow> 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) F\<rbrakk> \<Longrightarrow> 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (insert x F)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) {}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) F\<rbrakk> \<Longrightarrow> 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) F\<rbrakk> \<Longrightarrow> 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (insert x F)
[PROOF STEP]
case (insert A a)
[PROOF STATE]
proof (state)
this:
finite a
A \<notin> a
0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) a

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) F\<rbrakk> \<Longrightarrow> 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (insert x F)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
finite a
A \<notin> a
0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) a

goal (1 subgoal):
 1. 0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (insert A a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (insert A a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < Finite_Set.fold (\<lambda>x y. y + ssize_option (f x)) (Suc 0) (dom f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma horiz_vector_helper_pos_ind:
  fixes p:: "real poly"
  assumes nonzero: "p\<noteq>0"
  fixes qs:: "real poly list"
  assumes pairwise_rel_prime_1: "\<forall>q. ((List.member qs q) \<longrightarrow> (coprime p q))"
  fixes I:: "nat list"
  fixes sign:: "rat list"
  fixes x:: "real"
  assumes root_p: "x \<in> {x. poly p x = 0}"
  assumes sign_fix: "sign = consistent_sign_vec_copr qs x"
  shows "(list_constr I (length qs)) \<longrightarrow> (poly (prod_list (retrieve_polys qs I)) x > 0) \<longleftrightarrow> (z I sign = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)
[PROOF STEP]
proof (induct I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. list_constr [] (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs [])) x) = (z [] sign = 1)
 2. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. list_constr [] (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs [])) x) = (z [] sign = 1)
 2. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr [] (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs [])) x) = (z [] sign = 1)
[PROOF STEP]
by (simp add: retrieve_polys_def z_def)
[PROOF STATE]
proof (state)
this:
list_constr [] (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs [])) x) = (z [] sign = 1)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
case (Cons a I)
[PROOF STATE]
proof (state)
this:
list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have welldef: "list_constr (a#I) (length qs) \<longrightarrow> (list_constr I (length qs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> list_constr I (length qs)
[PROOF STEP]
unfolding list_constr_def list_all_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>set (a # I). x < length qs) \<longrightarrow> (\<forall>x\<in>set I. x < length qs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> list_constr I (length qs)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have set_hyp: "list_constr I (length qs) \<longrightarrow> sign \<in> set (characterize_consistent_signs_at_roots_copr p qs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr I (length qs) \<longrightarrow> sign \<in> set (characterize_consistent_signs_at_roots_copr p qs)
[PROOF STEP]
using in_set
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p \<noteq> 0; ?x \<in> {x. poly ?p x = 0}; ?sign = consistent_sign_vec_copr ?qs ?x; list_constr ?I (length ?qs)\<rbrakk> \<Longrightarrow> ?sign \<in> set (characterize_consistent_signs_at_roots_copr ?p ?qs)

goal (1 subgoal):
 1. list_constr I (length qs) \<longrightarrow> sign \<in> set (characterize_consistent_signs_at_roots_copr p qs)
[PROOF STEP]
using nonzero root_p sign_fix
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p \<noteq> 0; ?x \<in> {x. poly ?p x = 0}; ?sign = consistent_sign_vec_copr ?qs ?x; list_constr ?I (length ?qs)\<rbrakk> \<Longrightarrow> ?sign \<in> set (characterize_consistent_signs_at_roots_copr ?p ?qs)
p \<noteq> 0
x \<in> {x. poly p x = 0}
sign = consistent_sign_vec_copr qs x

goal (1 subgoal):
 1. list_constr I (length qs) \<longrightarrow> sign \<in> set (characterize_consistent_signs_at_roots_copr p qs)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
list_constr I (length qs) \<longrightarrow> sign \<in> set (characterize_consistent_signs_at_roots_copr p qs)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have z_hyp: "list_constr I (length qs) \<longrightarrow> ((z I sign = 1) \<or> (z I sign = -1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr I (length qs) \<longrightarrow> z I sign = 1 \<or> z I sign = - 1
[PROOF STEP]
using set_hyp z_lemma[where sign="sign", where I = "I", where p="p", where qs="qs"]
[PROOF STATE]
proof (prove)
using this:
list_constr I (length qs) \<longrightarrow> sign \<in> set (characterize_consistent_signs_at_roots_copr p qs)
\<lbrakk>sign \<in> set (characterize_consistent_signs_at_roots_copr p qs); list_constr I (length qs)\<rbrakk> \<Longrightarrow> z I sign = 1 \<or> z I sign = - 1

goal (1 subgoal):
 1. list_constr I (length qs) \<longrightarrow> z I sign = 1 \<or> z I sign = - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
list_constr I (length qs) \<longrightarrow> z I sign = 1 \<or> z I sign = - 1

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have sign_hyp: "sign = map (\<lambda> q. if (poly q x > 0) then 1 else -1) qs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign = map (\<lambda>q. if 0 < poly q x then 1 else - 1) qs
[PROOF STEP]
using sign_fix
[PROOF STATE]
proof (prove)
using this:
sign = consistent_sign_vec_copr qs x

goal (1 subgoal):
 1. sign = map (\<lambda>q. if 0 < poly q x then 1 else - 1) qs
[PROOF STEP]
unfolding consistent_sign_vec_copr_def
[PROOF STATE]
proof (prove)
using this:
sign = map (\<lambda>q. if 0 < poly q x then 1 else - 1) qs

goal (1 subgoal):
 1. sign = map (\<lambda>q. if 0 < poly q x then 1 else - 1) qs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sign = map (\<lambda>q. if 0 < poly q x then 1 else - 1) qs

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have ind_hyp_1: "list_constr (a#I) (length qs) \<longrightarrow>
    ((0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)
[PROOF STEP]
using welldef Cons.hyps
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> list_constr I (length qs)
list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have ind_hyp_2: "list_constr (a#I) (length qs) \<longrightarrow>
    ((0 > poly (prod_list (retrieve_polys qs I)) x) = (z I sign = -1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (poly (prod_list (retrieve_polys qs I)) x < 0) = (z I sign = - 1)
[PROOF STEP]
using welldef z_hyp Cons.hyps nonzero_product
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> list_constr I (length qs)
list_constr I (length qs) \<longrightarrow> z I sign = 1 \<or> z I sign = - 1
list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)
\<lbrakk>?p \<noteq> 0; \<forall>q. List.member ?qs q \<longrightarrow> coprime ?p q; ?x \<in> {x. poly ?p x = 0}; list_constr ?I (length ?qs)\<rbrakk> \<Longrightarrow> 0 < poly (prod_list (retrieve_polys ?qs ?I)) ?x \<or> poly (prod_list (retrieve_polys ?qs ?I)) ?x < 0

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (poly (prod_list (retrieve_polys qs I)) x < 0) = (z I sign = - 1)
[PROOF STEP]
using pairwise_rel_prime_1 nonzero root_p
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> list_constr I (length qs)
list_constr I (length qs) \<longrightarrow> z I sign = 1 \<or> z I sign = - 1
list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)
\<lbrakk>?p \<noteq> 0; \<forall>q. List.member ?qs q \<longrightarrow> coprime ?p q; ?x \<in> {x. poly ?p x = 0}; list_constr ?I (length ?qs)\<rbrakk> \<Longrightarrow> 0 < poly (prod_list (retrieve_polys ?qs ?I)) ?x \<or> poly (prod_list (retrieve_polys ?qs ?I)) ?x < 0
\<forall>q. List.member qs q \<longrightarrow> coprime p q
p \<noteq> 0
x \<in> {x. poly p x = 0}

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (poly (prod_list (retrieve_polys qs I)) x < 0) = (z I sign = - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> (poly (prod_list (retrieve_polys qs I)) x < 0) = (z I sign = - 1)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have h1: "prod_list (retrieve_polys qs (a # I)) = (nth qs a)*(prod_list (retrieve_polys qs I))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (retrieve_polys qs (a # I)) = qs ! a * prod_list (retrieve_polys qs I)
[PROOF STEP]
by (simp add: retrieve_polys_def)
[PROOF STATE]
proof (state)
this:
prod_list (retrieve_polys qs (a # I)) = qs ! a * prod_list (retrieve_polys qs I)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have h2: "(z (a # I) sign) = (nth sign a)*(z I sign)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z (a # I) sign = sign ! a * z I sign
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) list.simps(9) prod_list.Cons z_def)
[PROOF STATE]
proof (state)
this:
z (a # I) sign = sign ! a * z I sign

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have h3help: "list_constr (a#I) (length qs) \<longrightarrow> a < length qs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> a < length qs
[PROOF STEP]
unfolding list_constr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all (\<lambda>x. x < length qs) (a # I) \<longrightarrow> a < length qs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> a < length qs

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_constr (a # I) (length qs) \<longrightarrow> a < length qs
[PROOF STEP]
have h3: "list_constr (a#I) (length qs) \<longrightarrow>
    ((nth sign a) = (if (poly (nth qs a) x > 0) then 1 else -1))"
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> a < length qs

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> sign ! a = (if 0 < poly (qs ! a) x then 1 else - 1)
[PROOF STEP]
using nth_map sign_hyp
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> a < length qs
?n < length ?xs \<Longrightarrow> map ?f ?xs ! ?n = ?f (?xs ! ?n)
sign = map (\<lambda>q. if 0 < poly q x then 1 else - 1) qs

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> sign ! a = (if 0 < poly (qs ! a) x then 1 else - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> sign ! a = (if 0 < poly (qs ! a) x then 1 else - 1)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have h2: "(0 < poly ((nth qs a)*(prod_list (retrieve_polys qs I))) x) \<longleftrightarrow>
    ((0 < poly (nth qs a) x \<and> (0 < poly (prod_list (retrieve_polys qs I)) x)) \<or>
   (0 > poly (nth qs a) x \<and> (0 > poly (prod_list (retrieve_polys qs I)) x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < poly (qs ! a * prod_list (retrieve_polys qs I)) x) = (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0)
[PROOF STEP]
by (simp add: zero_less_mult_iff)
[PROOF STATE]
proof (state)
this:
(0 < poly (qs ! a * prod_list (retrieve_polys qs I)) x) = (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
have final_hyp_a: "list_constr (a#I) (length qs) \<longrightarrow> (((0 < poly (nth qs a) x \<and> (0 < poly (prod_list (retrieve_polys qs I)) x))
    \<or> (0 > poly (nth qs a) x \<and> (0 > poly (prod_list (retrieve_polys qs I)) x))) =
    ((nth sign a)*(z I sign) = 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
[PROOF STEP]
have extra_hyp_a: "list_constr (a#I) (length qs) \<longrightarrow> (0 < poly (nth qs a) x = ((nth sign a) = 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x) = (sign ! a = 1)
[PROOF STEP]
using h3
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> sign ! a = (if 0 < poly (qs ! a) x then 1 else - 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x) = (sign ! a = 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x) = (sign ! a = 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
[PROOF STEP]
have extra_hyp_b: "list_constr (a#I) (length qs) \<longrightarrow>  (0 > poly (nth qs a) x = ((nth sign a) = -1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (poly (qs ! a) x < 0) = (sign ! a = - 1)
[PROOF STEP]
using h3
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> sign ! a = (if 0 < poly (qs ! a) x then 1 else - 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (poly (qs ! a) x < 0) = (sign ! a = - 1)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> 0 < poly (qs ! a) x; list_constr (a # I) (length qs); sign ! a = - 1\<rbrakk> \<Longrightarrow> poly (qs ! a) x < 0
[PROOF STEP]
using coprime_poly_0 h3help in_set_member nth_mem pairwise_rel_prime_1 root_p
[PROOF STATE]
proof (prove)
using this:
coprime ?p ?q \<Longrightarrow> poly ?p ?x \<noteq> (0::?'a) \<or> poly ?q ?x \<noteq> (0::?'a)
list_constr (a # I) (length qs) \<longrightarrow> a < length qs
(?x \<in> set ?xs) = List.member ?xs ?x
?n < length ?xs \<Longrightarrow> ?xs ! ?n \<in> set ?xs
\<forall>q. List.member qs q \<longrightarrow> coprime p q
x \<in> {x. poly p x = 0}

goal (1 subgoal):
 1. \<lbrakk>\<not> 0 < poly (qs ! a) x; list_constr (a # I) (length qs); sign ! a = - 1\<rbrakk> \<Longrightarrow> poly (qs ! a) x < 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> (poly (qs ! a) x < 0) = (sign ! a = - 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
[PROOF STEP]
have ind_hyp_1: "list_constr (a#I) (length qs) \<longrightarrow> (((0 < poly (nth qs a) x \<and> (z I sign = 1)) \<or>
    (0 > poly (nth qs a) x \<and> (z I sign = -1)))
      = ((nth sign a)*(z I sign) = 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> z I sign = 1 \<or> poly (qs ! a) x < 0 \<and> z I sign = - 1) = (sign ! a * z I sign = 1)
[PROOF STEP]
using extra_hyp_a extra_hyp_b
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x) = (sign ! a = 1)
list_constr (a # I) (length qs) \<longrightarrow> (poly (qs ! a) x < 0) = (sign ! a = - 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> z I sign = 1 \<or> poly (qs ! a) x < 0 \<and> z I sign = - 1) = (sign ! a * z I sign = 1)
[PROOF STEP]
using zmult_eq_1_iff
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x) = (sign ! a = 1)
list_constr (a # I) (length qs) \<longrightarrow> (poly (qs ! a) x < 0) = (sign ! a = - 1)
(?m * ?n = 1) = (?m = 1 \<and> ?n = 1 \<or> ?m = - 1 \<and> ?n = - 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> z I sign = 1 \<or> poly (qs ! a) x < 0 \<and> z I sign = - 1) = (sign ! a * z I sign = 1)
[PROOF STEP]
by (simp add: h3)
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> z I sign = 1 \<or> poly (qs ! a) x < 0 \<and> z I sign = - 1) = (sign ! a * z I sign = 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> z I sign = 1 \<or> poly (qs ! a) x < 0 \<and> z I sign = - 1) = (sign ! a * z I sign = 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> z I sign = 1 \<or> poly (qs ! a) x < 0 \<and> z I sign = - 1) = (sign ! a * z I sign = 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
[PROOF STEP]
using ind_hyp_1 ind_hyp_2
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> z I sign = 1 \<or> poly (qs ! a) x < 0 \<and> z I sign = - 1) = (sign ! a * z I sign = 1)
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> z I sign = 1 \<or> poly (qs ! a) x < 0 \<and> z I sign = - 1) = (sign ! a * z I sign = 1)
list_constr (a # I) (length qs) \<longrightarrow> (poly (prod_list (retrieve_polys qs I)) x < 0) = (z I sign = - 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
[PROOF STEP]
by (simp add: Cons.hyps welldef)
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)

goal (1 subgoal):
 1. \<And>a I. list_constr I (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1) \<Longrightarrow> list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
using h1 z_def
[PROOF STATE]
proof (prove)
using this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (qs ! a) x \<and> 0 < poly (prod_list (retrieve_polys qs I)) x \<or> poly (qs ! a) x < 0 \<and> poly (prod_list (retrieve_polys qs I)) x < 0) = (sign ! a * z I sign = 1)
prod_list (retrieve_polys qs (a # I)) = qs ! a * prod_list (retrieve_polys qs I)
z ?index_list ?sign_asg \<equiv> prod_list (map ((!) ?sign_asg) ?index_list)

goal (1 subgoal):
 1. list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)
[PROOF STEP]
by (simp add: zero_less_mult_iff)
[PROOF STATE]
proof (state)
this:
list_constr (a # I) (length qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys qs (a # I))) x) = (z (a # I) sign = 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma represents_nth_root_odd_real:
  assumes alg: "p represents x" and odd: "odd n"
  shows "(poly_nth_root p) represents (root n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.poly_nth_root p represents root n x
[PROOF STEP]
by (rule represents_nth_root[OF odd_real_root_pow[OF odd] alg])


[STATEMENT]
lemma config_rand_length: "\<forall>x\<in>set_pmf (config_rand  A init qs). length (fst x) = length init"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set_pmf (config'_rand A (fst A init \<bind> (\<lambda>is. return_pmf (init, is))) qs). length (fst x) = length init
[PROOF STEP]
apply (induct rule: config_rand_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length init = length init
 2. \<And>s q a. length s = length init \<Longrightarrow> length (step s q a) = length init
[PROOF STEP]
by (simp_all)


[STATEMENT]
lemma diff_size_le_size_Diff: "size (M :: _ multiset) - size M' \<le> size (M - M')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size M - size M' \<le> size (M - M')
[PROOF STEP]
by (simp add: diff_le_mono2 size_Diff_subset_Int size_mset_mono)


[STATEMENT]
lemma supp_of_finite_insert:
  fixes S::"('a::fs) set"
  assumes fin:  "finite S"
  shows "supp (insert x S) = supp x \<union> supp S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp (insert x S) = supp x \<union> supp S
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. supp (insert x S) = supp x \<union> supp S
[PROOF STEP]
by (simp add: supp_of_finite_sets)