[STATEMENT]
lemma pop_pow_cancel: "u\<^sup>@k \<cdot> v = u\<^sup>@m \<cdot> w \<Longrightarrow> m \<le> k \<Longrightarrow> u\<^sup>@(k-m) \<cdot> v = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<^sup>@ k \<cdot> v = u \<^sup>@ m \<cdot> w; m \<le> k\<rbrakk> \<Longrightarrow> u \<^sup>@ (k - m) \<cdot> v = w
[PROOF STEP]
using  lassoc pop_pow[of m k u] same_append_eq[of "u\<^sup>@m" "u\<^sup>@(k-m)\<cdot>v" w, unfolded lassoc]
[PROOF STATE]
proof (prove)
using this:
?xs \<cdot> ?ys \<cdot> ?zs = (?xs \<cdot> ?ys) \<cdot> ?zs
m \<le> k \<Longrightarrow> u \<^sup>@ m \<cdot> u \<^sup>@ (k - m) = u \<^sup>@ k
((u \<^sup>@ m \<cdot> u \<^sup>@ (k - m)) \<cdot> v = u \<^sup>@ m \<cdot> w) = (u \<^sup>@ (k - m) \<cdot> v = w)

goal (1 subgoal):
 1. \<lbrakk>u \<^sup>@ k \<cdot> v = u \<^sup>@ m \<cdot> w; m \<le> k\<rbrakk> \<Longrightarrow> u \<^sup>@ (k - m) \<cdot> v = w
[PROOF STEP]
by argo


[STATEMENT]
lemma image2_Gr: "image2 A f g = (Gr A f)\<inverse> O (Gr A g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image2 A f g = (Gr A f)\<inverse> O Gr A g
[PROOF STEP]
unfolding image2_def Gr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(f a, g a) |a. a \<in> A} = {(a, f a) |a. a \<in> A}\<inverse> O {(a, g a) |a. a \<in> A}
[PROOF STEP]
by auto


[STATEMENT]
lemma iff_to_impl: "((\<nu> \<in> fml_sem I A) \<longleftrightarrow> (\<nu> \<in> fml_sem I B))
  \<longleftrightarrow> (((\<nu> \<in> fml_sem I A) \<longrightarrow> (\<nu> \<in> fml_sem I B))
     \<and> ((\<nu> \<in> fml_sem I B) \<longrightarrow> (\<nu> \<in> fml_sem I A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<nu> \<in> fml_sem I A) = (\<nu> \<in> fml_sem I B)) = ((\<nu> \<in> fml_sem I A \<longrightarrow> \<nu> \<in> fml_sem I B) \<and> (\<nu> \<in> fml_sem I B \<longrightarrow> \<nu> \<in> fml_sem I A))
[PROOF STEP]
by (auto)


[STATEMENT]
lemma "\<forall>x::real. real_of_int (2::int)*x - (real_of_int (1::int)) < real_of_int \<lfloor>x\<rfloor> + real_of_int \<lceil>x\<rceil> \<and> real_of_int \<lfloor>x\<rfloor> + real_of_int \<lceil>x\<rceil>  \<le> real_of_int (2::int)*x + (real_of_int (1::int))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. real_of_int 2 * x - real_of_int 1 < real_of_int \<lfloor>x\<rfloor> + real_of_int \<lceil>x\<rceil> \<and> real_of_int \<lfloor>x\<rfloor> + real_of_int \<lceil>x\<rceil> \<le> real_of_int 2 * x + real_of_int 1
[PROOF STEP]
by mir


[STATEMENT]
theorem possExImpliesNecEx_v1: "\<lfloor>\<^bold>\<diamond>\<^bold>\<exists> \<^bold>\<down>G \<^bold>\<rightarrow> \<^bold>\<box>\<^bold>\<exists>\<^sup>E \<^bold>\<down>G\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>\<^bold>\<diamond>(\<lambda>v. \<exists>x. \<forall>xa. \<P> xa v \<longrightarrow> xa x) \<^bold>\<rightarrow> \<^bold>\<box>(\<lambda>v. \<exists>x. existsAt x v \<and> (\<forall>xa. \<P> xa v \<longrightarrow> xa x))\<rfloor>
[PROOF STEP]
using GodExImpliesNecEx_v1 T3_deRe
[PROOF STATE]
proof (prove)
using this:
\<lfloor>(\<lambda>w. (\<exists>x. \<forall>xa. \<P> xa w \<longrightarrow> xa x) \<longrightarrow> (\<^bold>\<box>(\<lambda>v. \<exists>x. existsAt x v \<and> (\<forall>xa. \<P> xa v \<longrightarrow> xa x))) w)\<rfloor>
serial (\<lambda>w v. w r v \<and> (\<exists>x. existsAt x v \<and> (\<forall>xa. \<P> xa w \<longrightarrow> xa x)))

goal (1 subgoal):
 1. \<lfloor>\<^bold>\<diamond>(\<lambda>v. \<exists>x. \<forall>xa. \<P> xa v \<longrightarrow> xa x) \<^bold>\<rightarrow> \<^bold>\<box>(\<lambda>v. \<exists>x. existsAt x v \<and> (\<forall>xa. \<P> xa v \<longrightarrow> xa x))\<rfloor>
[PROOF STEP]
by metis


[STATEMENT]
lemma R_bb_assign: "g < (0::real) \<Longrightarrow> 0 \<le> h \<Longrightarrow>
  2 ::= (\<lambda>s. - s$2) \<le> rel_R
    \<lceil>\<lambda>s. s$1 = 0 \<and> 0 \<le> s$1 \<and> 2 \<cdot> g \<cdot> s$1 = 2 \<cdot> g \<cdot> h + s$2 \<cdot> s$2\<rceil>
    \<lceil>\<lambda>s. 0 \<le> s$1 \<and> 2 \<cdot> g \<cdot> s$1 = 2 \<cdot> g \<cdot> h + s$2 \<cdot> s$2\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> (2::'a) ::= (\<lambda>s. - s $ (2::'a)) \<subseteq> rel_R \<lceil>\<lambda>s. s $ (1::'a) = 0 \<and> 0 \<le> s $ (1::'a) \<and> 2 \<cdot> g \<cdot> s $ (1::'a) = 2 \<cdot> g \<cdot> h + s $ (2::'a) \<cdot> s $ (2::'a)\<rceil> \<lceil>\<lambda>s. 0 \<le> s $ (1::'a) \<and> 2 \<cdot> g \<cdot> s $ (1::'a) = 2 \<cdot> g \<cdot> h + s $ (2::'a) \<cdot> s $ (2::'a)\<rceil>
[PROOF STEP]
by (rule R_assign_law, auto)


[STATEMENT]
lemma atLeast_eq_iff[iff]: "({x\<le>\<^sub>a..} = {y\<le>\<^sub>a..}) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x\<le>\<^sub>a..} = {y\<le>\<^sub>a..}) = (x = y)
[PROOF STEP]
unfolding ray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({xa \<in> UNIV. x \<le>\<^sub>a xa} = {x \<in> UNIV. y \<le>\<^sub>a x}) = (x = y)
[PROOF STEP]
using antisym
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<le>\<^sub>a ?y; ?y \<le>\<^sub>a ?x\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. ({xa \<in> UNIV. x \<le>\<^sub>a xa} = {x \<in> UNIV. y \<le>\<^sub>a x}) = (x = y)
[PROOF STEP]
by auto


[STATEMENT]
lemma ex3_3: "\<bar>integral {0 .. pi} (\<lambda>x::real. (x * sin x) / (1 + (cos x)\<^sup>2)) - pi\<^sup>2/4\<bar> \<le> 1 / 10^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>integral {0..pi} (\<lambda>x. x * sin x / (1 + (cos x)\<^sup>2)) - pi\<^sup>2 / 4\<bar> \<le> 1 / 10 ^ 3
[PROOF STEP]
by (rule abs_minus_leI) (tactic \<open>integral_bnds_tac 1 30 10 6 15 "" [] @{context} 1\<close>)


[STATEMENT]
lemma fixes x::real
  shows "0 < x^6 + 42*x^5 + 840*x^4 + 10080*x^3 + 75600*x\<^sup>2 + 332640*x + 665280"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x ^ 6 + 42 * x ^ 5 + 840 * x ^ 4 + 10080 * x ^ 3 + 75600 * x\<^sup>2 + 332640 * x + 665280
[PROOF STEP]
by sturm


[STATEMENT]
lemma k2: "k > 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 < k
[PROOF STEP]
using pl l2 kp
[PROOF STATE]
proof (prove)
using this:
l < p
2 < l
p < k

goal (1 subgoal):
 1. 2 < k
[PROOF STEP]
by auto


[STATEMENT]
lemma "filterlim (\<lambda>i::real. i powr (-i/(i-1)) - i powr (-1/(i-1))) (at_right (-1)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM i at_top. i powr (- i / (i - 1)) - i powr (- 1 / (i - 1)) :> at_right (- 1)
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma index_of_const_inj: "index_of_const n1 = index_of_const n2 \<Longrightarrow> n1 = n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. index_of_const n1 = index_of_const n2 \<Longrightarrow> n1 = n2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. index_of_const n1 = index_of_const n2 \<Longrightarrow> n1 = n2
[PROOF STEP]
assume "index_of_const n1 = index_of_const n2"
[PROOF STATE]
proof (state)
this:
index_of_const n1 = index_of_const n2

goal (1 subgoal):
 1. index_of_const n1 = index_of_const n2 \<Longrightarrow> n1 = n2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
index_of_const n1 = index_of_const n2
[PROOF STEP]
have "(nat_to_pr (index_of_const n1)) 0  = (nat_to_pr (index_of_const n2)) 0"
[PROOF STATE]
proof (prove)
using this:
index_of_const n1 = index_of_const n2

goal (1 subgoal):
 1. nat_to_pr (index_of_const n1) 0 = nat_to_pr (index_of_const n2) 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nat_to_pr (index_of_const n1) 0 = nat_to_pr (index_of_const n2) 0

goal (1 subgoal):
 1. index_of_const n1 = index_of_const n2 \<Longrightarrow> n1 = n2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
nat_to_pr (index_of_const n1) 0 = nat_to_pr (index_of_const n2) 0

goal (1 subgoal):
 1. n1 = n2
[PROOF STEP]
by (simp add: index_of_const_lm_1)
[PROOF STATE]
proof (state)
this:
n1 = n2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Dirichlet_L_0_nonprincipal:
  assumes nonprincipal: "\<chi> \<noteq> \<chi>\<^sub>0"
  shows   "Dirichlet_L n \<chi> 0 = -(\<Sum>k=1..<n. of_nat k * \<chi> k) / of_nat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n
[PROOF STEP]
have "Dirichlet_L n \<chi> 0 = (\<Sum>k=1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = (\<Sum>k = 1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n))
[PROOF STEP]
using assms n
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> \<chi>\<^sub>0
1 < n

goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = (\<Sum>k = 1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n))
[PROOF STEP]
by (simp add: Dirichlet_L_conv_hurwitz_zeta_nonprincipal)
[PROOF STATE]
proof (state)
this:
Dirichlet_L n \<chi> 0 = (\<Sum>k = 1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n))

goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Dirichlet_L n \<chi> 0 = (\<Sum>k = 1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n))

goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n
[PROOF STEP]
have "\<dots> = -1/n * (\<Sum>k=1..n. of_nat k * \<chi> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n)) = complex_of_real (- 1 / real n) * (\<Sum>k = 1..n. of_nat k * \<chi> k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> \<chi>\<^sub>0

goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n)) = complex_of_real (- 1 / real n) * (\<Sum>k = 1..n. of_nat k * \<chi> k)
[PROOF STEP]
by (simp add: algebra_simps sum_subtractf sum_dcharacter_block'
                              sum_divide_distrib [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n)) = complex_of_real (- 1 / real n) * (\<Sum>k = 1..n. of_nat k * \<chi> k)

goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<chi> k * (1 / 2 - of_nat k / of_nat n)) = complex_of_real (- 1 / real n) * (\<Sum>k = 1..n. of_nat k * \<chi> k)

goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n
[PROOF STEP]
have "(\<Sum>k=1..n. of_nat k * \<chi> k) = (\<Sum>k=1..<n. of_nat k * \<chi> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. of_nat k * \<chi> k) = (\<Sum>k = 1..<n. of_nat k * \<chi> k)
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. (\<Sum>k = 1..n. of_nat k * \<chi> k) = (\<Sum>k = 1..<n. of_nat k * \<chi> k)
[PROOF STEP]
by (intro sum.mono_neutral_right) (auto simp: eq_zero_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. of_nat k * \<chi> k) = (\<Sum>k = 1..<n. of_nat k * \<chi> k)

goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Dirichlet_L n \<chi> 0 = complex_of_real (- 1 / real n) * (\<Sum>k = 1..<n. of_nat k * \<chi> k)
[PROOF STEP]
show eq: "Dirichlet_L n \<chi> 0 = -(\<Sum>k=1..<n. of_nat k * \<chi> k) / of_nat n"
[PROOF STATE]
proof (prove)
using this:
Dirichlet_L n \<chi> 0 = complex_of_real (- 1 / real n) * (\<Sum>k = 1..<n. of_nat k * \<chi> k)

goal (1 subgoal):
 1. Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Dirichlet_L n \<chi> 0 = - (\<Sum>k = 1..<n. of_nat k * \<chi> k) / of_nat n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wf_list_lverts_merge:
  "\<lbrakk>wf_list_lverts xs; wf_list_lverts ys;
    \<forall>v1 \<in> fst ` set xs. \<forall>v2 \<in> fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk>
    \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_list_lverts xs; wf_list_lverts ys; \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs ys)
[PROOF STEP]
proof(induction xs ys taking: cmp rule: Sorting_Algorithms.merge.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>ys. \<lbrakk>wf_list_lverts []; wf_list_lverts ys; \<forall>v1\<in>fst ` set []. \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp [] ys)
 2. \<And>xs. \<lbrakk>wf_list_lverts xs; wf_list_lverts []; \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set []. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs [])
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare cmp x y = Greater; wf_list_lverts (x # xs); wf_list_lverts ys; \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) ys); \<lbrakk>compare cmp x y \<noteq> Greater; wf_list_lverts xs; wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs (y # ys)); wf_list_lverts (x # xs); wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
case (3 x xs y ys)
[PROOF STATE]
proof (state)
this:
\<lbrakk>compare cmp x y = Greater; wf_list_lverts (x # xs); wf_list_lverts ys; \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) ys)
\<lbrakk>compare cmp x y \<noteq> Greater; wf_list_lverts xs; wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs (y # ys))
wf_list_lverts (x # xs)
wf_list_lverts (y # ys)
\<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}

goal (3 subgoals):
 1. \<And>ys. \<lbrakk>wf_list_lverts []; wf_list_lverts ys; \<forall>v1\<in>fst ` set []. \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp [] ys)
 2. \<And>xs. \<lbrakk>wf_list_lverts xs; wf_list_lverts []; \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set []. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs [])
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare cmp x y = Greater; wf_list_lverts (x # xs); wf_list_lverts ys; \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) ys); \<lbrakk>compare cmp x y \<noteq> Greater; wf_list_lverts xs; wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs (y # ys)); wf_list_lverts (x # xs); wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
obtain v1 e1 where v1_def[simp]: "x = (v1,e1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v1 e1. x = (v1, e1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x = (v1, e1)

goal (3 subgoals):
 1. \<And>ys. \<lbrakk>wf_list_lverts []; wf_list_lverts ys; \<forall>v1\<in>fst ` set []. \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp [] ys)
 2. \<And>xs. \<lbrakk>wf_list_lverts xs; wf_list_lverts []; \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set []. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs [])
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare cmp x y = Greater; wf_list_lverts (x # xs); wf_list_lverts ys; \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) ys); \<lbrakk>compare cmp x y \<noteq> Greater; wf_list_lverts xs; wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs (y # ys)); wf_list_lverts (x # xs); wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
obtain v2 e2 where v2_def[simp]: "y = (v2,e2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v2 e2. y = (v2, e2) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
y = (v2, e2)

goal (3 subgoals):
 1. \<And>ys. \<lbrakk>wf_list_lverts []; wf_list_lverts ys; \<forall>v1\<in>fst ` set []. \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp [] ys)
 2. \<And>xs. \<lbrakk>wf_list_lverts xs; wf_list_lverts []; \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set []. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs [])
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare cmp x y = Greater; wf_list_lverts (x # xs); wf_list_lverts ys; \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) ys); \<lbrakk>compare cmp x y \<noteq> Greater; wf_list_lverts xs; wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs (y # ys)); wf_list_lverts (x # xs); wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
proof(cases "compare cmp x y = Greater")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. compare cmp x y = Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
 2. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
compare cmp x y = Greater

goal (2 subgoals):
 1. compare cmp x y = Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
 2. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
have "\<forall>v \<in> fst ` set (x#xs). set v2 \<inter> set v = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>fst ` set (x # xs). set v2 \<inter> set v = {}
[PROOF STEP]
using "3.prems"(3)
[PROOF STATE]
proof (prove)
using this:
\<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}

goal (1 subgoal):
 1. \<forall>v\<in>fst ` set (x # xs). set v2 \<inter> set v = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fst ` set (x # xs). set v2 \<inter> set v = {}

goal (2 subgoals):
 1. compare cmp x y = Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
 2. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fst ` set (x # xs). set v2 \<inter> set v = {}

goal (2 subgoals):
 1. compare cmp x y = Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
 2. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
have "\<forall>v \<in> fst ` set ys. set v2 \<inter> set v = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>fst ` set ys. set v2 \<inter> set v = {}
[PROOF STEP]
using "3.prems"(2)
[PROOF STATE]
proof (prove)
using this:
wf_list_lverts (y # ys)

goal (1 subgoal):
 1. \<forall>v\<in>fst ` set ys. set v2 \<inter> set v = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fst ` set ys. set v2 \<inter> set v = {}

goal (2 subgoals):
 1. compare cmp x y = Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
 2. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>v\<in>fst ` set (x # xs). set v2 \<inter> set v = {}
\<forall>v\<in>fst ` set ys. set v2 \<inter> set v = {}
[PROOF STEP]
have "\<forall>v \<in> fst ` set (Sorting_Algorithms.merge cmp (x#xs) ys). set v2 \<inter> set v = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fst ` set (x # xs). set v2 \<inter> set v = {}
\<forall>v\<in>fst ` set ys. set v2 \<inter> set v = {}

goal (1 subgoal):
 1. \<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp (x # xs) ys). set v2 \<inter> set v = {}
[PROOF STEP]
using set_merge[of "x#xs"]
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fst ` set (x # xs). set v2 \<inter> set v = {}
\<forall>v\<in>fst ` set ys. set v2 \<inter> set v = {}
set (x # xs) \<union> set ?ys = set (Sorting_Algorithms.merge ?cmp (x # xs) ?ys)

goal (1 subgoal):
 1. \<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp (x # xs) ys). set v2 \<inter> set v = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp (x # xs) ys). set v2 \<inter> set v = {}

goal (2 subgoals):
 1. compare cmp x y = Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
 2. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp (x # xs) ys). set v2 \<inter> set v = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp (x # xs) ys). set v2 \<inter> set v = {}

goal (1 subgoal):
 1. wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
using True 3
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp (x # xs) ys). set v2 \<inter> set v = {}
compare cmp x y = Greater
\<lbrakk>compare cmp x y = Greater; wf_list_lverts (x # xs); wf_list_lverts ys; \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) ys)
\<lbrakk>compare cmp x y \<noteq> Greater; wf_list_lverts xs; wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs (y # ys))
wf_list_lverts (x # xs)
wf_list_lverts (y # ys)
\<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}

goal (1 subgoal):
 1. wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))

goal (1 subgoal):
 1. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
compare cmp x y \<noteq> Greater

goal (1 subgoal):
 1. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
have "\<forall>v \<in> fst ` set (y#ys). set v1 \<inter> set v = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>fst ` set (y # ys). set v1 \<inter> set v = {}
[PROOF STEP]
using "3.prems"(3)
[PROOF STATE]
proof (prove)
using this:
\<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}

goal (1 subgoal):
 1. \<forall>v\<in>fst ` set (y # ys). set v1 \<inter> set v = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fst ` set (y # ys). set v1 \<inter> set v = {}

goal (1 subgoal):
 1. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fst ` set (y # ys). set v1 \<inter> set v = {}

goal (1 subgoal):
 1. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
have "\<forall>v \<in> fst ` set xs. set v1 \<inter> set v = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>fst ` set xs. set v1 \<inter> set v = {}
[PROOF STEP]
using "3.prems"(1)
[PROOF STATE]
proof (prove)
using this:
wf_list_lverts (x # xs)

goal (1 subgoal):
 1. \<forall>v\<in>fst ` set xs. set v1 \<inter> set v = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fst ` set xs. set v1 \<inter> set v = {}

goal (1 subgoal):
 1. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>v\<in>fst ` set (y # ys). set v1 \<inter> set v = {}
\<forall>v\<in>fst ` set xs. set v1 \<inter> set v = {}
[PROOF STEP]
have "\<forall>v \<in> fst ` set (Sorting_Algorithms.merge cmp xs (y#ys)). set v1 \<inter> set v = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fst ` set (y # ys). set v1 \<inter> set v = {}
\<forall>v\<in>fst ` set xs. set v1 \<inter> set v = {}

goal (1 subgoal):
 1. \<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp xs (y # ys)). set v1 \<inter> set v = {}
[PROOF STEP]
using set_merge[of xs]
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fst ` set (y # ys). set v1 \<inter> set v = {}
\<forall>v\<in>fst ` set xs. set v1 \<inter> set v = {}
set xs \<union> set ?ys = set (Sorting_Algorithms.merge ?cmp xs ?ys)

goal (1 subgoal):
 1. \<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp xs (y # ys)). set v1 \<inter> set v = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp xs (y # ys)). set v1 \<inter> set v = {}

goal (1 subgoal):
 1. compare cmp x y \<noteq> Greater \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp xs (y # ys)). set v1 \<inter> set v = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp xs (y # ys)). set v1 \<inter> set v = {}

goal (1 subgoal):
 1. wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
using False 3
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>fst ` set (Sorting_Algorithms.merge cmp xs (y # ys)). set v1 \<inter> set v = {}
compare cmp x y \<noteq> Greater
\<lbrakk>compare cmp x y = Greater; wf_list_lverts (x # xs); wf_list_lverts ys; \<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) ys)
\<lbrakk>compare cmp x y \<noteq> Greater; wf_list_lverts xs; wf_list_lverts (y # ys); \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs (y # ys))
wf_list_lverts (x # xs)
wf_list_lverts (y # ys)
\<forall>v1\<in>fst ` set (x # xs). \<forall>v2\<in>fst ` set (y # ys). set v1 \<inter> set v2 = {}

goal (1 subgoal):
 1. wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
wf_list_lverts (Sorting_Algorithms.merge cmp (x # xs) (y # ys))

goal (2 subgoals):
 1. \<And>ys. \<lbrakk>wf_list_lverts []; wf_list_lverts ys; \<forall>v1\<in>fst ` set []. \<forall>v2\<in>fst ` set ys. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp [] ys)
 2. \<And>xs. \<lbrakk>wf_list_lverts xs; wf_list_lverts []; \<forall>v1\<in>fst ` set xs. \<forall>v2\<in>fst ` set []. set v1 \<inter> set v2 = {}\<rbrakk> \<Longrightarrow> wf_list_lverts (Sorting_Algorithms.merge cmp xs [])
[PROOF STEP]
qed (auto)


[STATEMENT]
lemma permutations_of_setD:
  assumes "xs \<in> permutations_of_set A"
  shows   "set xs = A" "distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set xs = A &&& distinct xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs \<in> permutations_of_set A

goal (1 subgoal):
 1. set xs = A &&& distinct xs
[PROOF STEP]
unfolding permutations_of_set_def
[PROOF STATE]
proof (prove)
using this:
xs \<in> {xs. set xs = A \<and> distinct xs}

goal (1 subgoal):
 1. set xs = A &&& distinct xs
[PROOF STEP]
by simp_all


[STATEMENT]
lemma degree_derivative :
  assumes "MPoly_Type.degree p x > 0"
  shows "MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
define f where "f i = (isolate_variable_sparse p x (i+1) * (Var x)^(i) * (Const (i+1)))" for i
[PROOF STATE]
proof (state)
this:
f ?i = isolate_variable_sparse p x (?i + 1) * Var x ^ ?i * Const (real ?i + 1)

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
define n where "n = MPoly_Type.degree p x-1"
[PROOF STATE]
proof (state)
this:
n = MPoly_Type.degree p x - 1

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have d : "\<exists>m\<in>monomials p. lookup m x = n+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m\<in>monomials p. lookup m x = n + 1
[PROOF STEP]
using n_def degree_eq_iff assms
[PROOF STATE]
proof (prove)
using this:
n = MPoly_Type.degree p x - 1
(MPoly_Type.degree ?p ?x = ?k) = (if ?k = 0 then \<forall>m\<in>monomials ?p. lookup m ?x = 0 else (\<exists>m\<in>monomials ?p. lookup m ?x = ?k) \<and> (\<forall>m\<in>monomials ?p. lookup m ?x \<le> ?k))
0 < MPoly_Type.degree p x

goal (1 subgoal):
 1. \<exists>m\<in>monomials p. lookup m x = n + 1
[PROOF STEP]
by (metis add.commute less_not_refl2 less_one linordered_semidom_class.add_diff_inverse)
[PROOF STATE]
proof (state)
this:
\<exists>m\<in>monomials p. lookup m x = n + 1

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h1a : "\<forall>i. MPoly_Type.degree (isolate_variable_sparse p x i) x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. MPoly_Type.degree (isolate_variable_sparse p x i) x = 0
[PROOF STEP]
by (simp add: not_in_isovarspar varNotIn_degree)
[PROOF STATE]
proof (state)
this:
\<forall>i. MPoly_Type.degree (isolate_variable_sparse p x i) x = 0

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h1b : "\<forall>i::nat. MPoly_Type.degree ((Var x)^i:: real mpoly) x = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. MPoly_Type.degree (Var x ^ i) x = i
[PROOF STEP]
using degree_var_i
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree (Var ?x ^ ?i) ?x = ?i

goal (1 subgoal):
 1. \<forall>i. MPoly_Type.degree (Var x ^ i) x = i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i. MPoly_Type.degree (Var x ^ i) x = i

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h1c1 : "\<forall>i. (Var(x)^(i)::real mpoly)\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. Var x ^ i \<noteq> 0
[PROOF STEP]
by (metis MPoly_Type.degree_zero h1b power_0 zero_neq_one)
[PROOF STATE]
proof (state)
this:
\<forall>i. Var x ^ i \<noteq> 0

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h1c1var: "((Var x)^i:: real mpoly) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Var x ^ i \<noteq> 0
[PROOF STEP]
using h1c1
[PROOF STATE]
proof (prove)
using this:
\<forall>i. Var x ^ i \<noteq> 0

goal (1 subgoal):
 1. Var x ^ i \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Var x ^ i \<noteq> 0

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h1c2 : "((Const ((i::nat) + 1))::real mpoly)\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Const (real (i + 1)) \<noteq> 0
[PROOF STEP]
using nonzero_const_is_nonzero
[PROOF STATE]
proof (prove)
using this:
?k \<noteq> 0 \<Longrightarrow> Const ?k \<noteq> 0

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

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h1c3: "(isolate_variable_sparse p x (n + 1)) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolate_variable_sparse p x (n + 1) \<noteq> 0
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
\<exists>m\<in>monomials p. lookup m x = n + 1

goal (1 subgoal):
 1. isolate_variable_sparse p x (n + 1) \<noteq> 0
[PROOF STEP]
by (metis One_nat_def Suc_pred add.commute assms isolate_variable_sparse_degree_eq_zero_iff n_def not_gr_zero not_in_isovarspar plus_1_eq_Suc varNotIn_degree)
[PROOF STATE]
proof (state)
this:
isolate_variable_sparse p x (n + 1) \<noteq> 0

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h3: "(isolate_variable_sparse p x (i+1) = 0) \<longrightarrow> (MPoly_Type.degree (f i) x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolate_variable_sparse p x (i + 1) = 0 \<longrightarrow> MPoly_Type.degree (f i) x = 0
[PROOF STEP]
by (simp add: f_def)
[PROOF STATE]
proof (state)
this:
isolate_variable_sparse p x (i + 1) = 0 \<longrightarrow> MPoly_Type.degree (f i) x = 0

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have degh1: "(MPoly_Type.degree (((Const ((i::nat)+1))::real mpoly)*(Var x)^i) x) =
    ((MPoly_Type.degree ((Const (i+1))::real mpoly) x) + (MPoly_Type.degree ((Var x)^i:: real mpoly) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = MPoly_Type.degree (Const (real (i + 1))) x + MPoly_Type.degree (Var x ^ i) x
[PROOF STEP]
using h1c2 h1c1var degree_mult[where p="((Const ((i::nat)+1))::real mpoly)", where q="((Var x)^i:: real mpoly)"]
[PROOF STATE]
proof (prove)
using this:
Const (real (i + 1)) \<noteq> 0
Var x ^ i \<noteq> 0
\<lbrakk>Const (real (i + 1)) \<noteq> 0; Var x ^ i \<noteq> 0\<rbrakk> \<Longrightarrow> MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) ?v = MPoly_Type.degree (Const (real (i + 1))) ?v + MPoly_Type.degree (Var x ^ i) ?v

goal (1 subgoal):
 1. MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = MPoly_Type.degree (Const (real (i + 1))) x + MPoly_Type.degree (Var x ^ i) x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = MPoly_Type.degree (Const (real (i + 1))) x + MPoly_Type.degree (Var x ^ i) x

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = MPoly_Type.degree (Const (real (i + 1))) x + MPoly_Type.degree (Var x ^ i) x
[PROOF STEP]
have degh2: "(MPoly_Type.degree (((Const ((i::nat)+1))::real mpoly)*(Var x)^i) x) = i"
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = MPoly_Type.degree (Const (real (i + 1))) x + MPoly_Type.degree (Var x ^ i) x

goal (1 subgoal):
 1. MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = i
[PROOF STEP]
using degree_var_i degree_const
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = MPoly_Type.degree (Const (real (i + 1))) x + MPoly_Type.degree (Var x ^ i) x
MPoly_Type.degree (Var ?x ^ ?i) ?x = ?i
MPoly_Type.degree (Const ?z) ?x = 0

goal (1 subgoal):
 1. MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = i

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have nonzerohyp: "(((Const ((i::nat)+1))::real mpoly)*(Var x)^i) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Const (real (i + 1)) * Var x ^ i \<noteq> 0
[PROOF STEP]
proof (induct i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Const (real (0 + 1)) * Var x ^ 0 \<noteq> 0
 2. \<And>i. Const (real (i + 1)) * Var x ^ i \<noteq> 0 \<Longrightarrow> Const (real (Suc i + 1)) * Var x ^ Suc i \<noteq> 0
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. Const (real (0 + 1)) * Var x ^ 0 \<noteq> 0
 2. \<And>i. Const (real (i + 1)) * Var x ^ i \<noteq> 0 \<Longrightarrow> Const (real (Suc i + 1)) * Var x ^ Suc i \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Const (real (0 + 1)) * Var x ^ 0 \<noteq> 0
[PROOF STEP]
by (simp add: nonzero_const_is_nonzero)
[PROOF STATE]
proof (state)
this:
Const (real (0 + 1)) * Var x ^ 0 \<noteq> 0

goal (1 subgoal):
 1. \<And>i. Const (real (i + 1)) * Var x ^ i \<noteq> 0 \<Longrightarrow> Const (real (Suc i + 1)) * Var x ^ Suc i \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. Const (real (i + 1)) * Var x ^ i \<noteq> 0 \<Longrightarrow> Const (real (Suc i + 1)) * Var x ^ Suc i \<noteq> 0
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
Const (real (i + 1)) * Var x ^ i \<noteq> 0

goal (1 subgoal):
 1. \<And>i. Const (real (i + 1)) * Var x ^ i \<noteq> 0 \<Longrightarrow> Const (real (Suc i + 1)) * Var x ^ Suc i \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Const (real (i + 1)) * Var x ^ i \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Const (real (i + 1)) * Var x ^ i \<noteq> 0

goal (1 subgoal):
 1. Const (real (Suc i + 1)) * Var x ^ Suc i \<noteq> 0
[PROOF STEP]
using degree_eq degh2
[PROOF STATE]
proof (prove)
using this:
Const (real (i + 1)) * Var x ^ i \<noteq> 0
?p = ?q \<Longrightarrow> MPoly_Type.degree ?p ?x = MPoly_Type.degree ?q ?x
MPoly_Type.degree (Const (real (i__ + 1)) * Var x ^ i__) x = i__

goal (1 subgoal):
 1. Const (real (Suc i + 1)) * Var x ^ Suc i \<noteq> 0
[PROOF STEP]
by (metis Suc_eq_plus1 h1c1 mult_eq_0_iff nat.simps(3) nonzero_const_is_nonzero of_nat_eq_0_iff)
[PROOF STATE]
proof (state)
this:
Const (real (Suc i + 1)) * Var x ^ Suc i \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Const (real (i + 1)) * Var x ^ i \<noteq> 0

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h4a1: "(isolate_variable_sparse p x (i+1) \<noteq> 0) \<longrightarrow> (MPoly_Type.degree (isolate_variable_sparse p x (i+1) * ((Var x)^(i) * (Const (i+1)))::real mpoly) x =
      (MPoly_Type.degree (isolate_variable_sparse p x (i+1):: real mpoly) x) + (MPoly_Type.degree (((Const (i+1)) *  (Var x)^(i))::real mpoly) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (isolate_variable_sparse p x (i + 1) * (Var x ^ i * Const (real (i + 1)))) x = MPoly_Type.degree (isolate_variable_sparse p x (i + 1)) x + MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x
[PROOF STEP]
using nonzerohyp degree_mult[where p = "(isolate_variable_sparse p x (i+1))::real mpoly", where q = "((Const (i+1)) *  (Var x)^(i)):: real mpoly", where v = "x"]
[PROOF STATE]
proof (prove)
using this:
Const (real (i + 1)) * Var x ^ i \<noteq> 0
\<lbrakk>isolate_variable_sparse p x (i + 1) \<noteq> 0; Const (real (i + 1)) * Var x ^ i \<noteq> 0\<rbrakk> \<Longrightarrow> MPoly_Type.degree (isolate_variable_sparse p x (i + 1) * (Const (real (i + 1)) * Var x ^ i)) x = MPoly_Type.degree (isolate_variable_sparse p x (i + 1)) x + MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x

goal (1 subgoal):
 1. isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (isolate_variable_sparse p x (i + 1) * (Var x ^ i * Const (real (i + 1)))) x = MPoly_Type.degree (isolate_variable_sparse p x (i + 1)) x + MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (isolate_variable_sparse p x (i + 1) * (Var x ^ i * Const (real (i + 1)))) x = MPoly_Type.degree (isolate_variable_sparse p x (i + 1)) x + MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h4: "(isolate_variable_sparse p x (i+1) \<noteq> 0) \<longrightarrow> (MPoly_Type.degree (f i) x) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (f i) x = i
[PROOF STEP]
using h4a1 f_def degh2 h1a
[PROOF STATE]
proof (prove)
using this:
isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (isolate_variable_sparse p x (i + 1) * (Var x ^ i * Const (real (i + 1)))) x = MPoly_Type.degree (isolate_variable_sparse p x (i + 1)) x + MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x
f ?i = isolate_variable_sparse p x (?i + 1) * Var x ^ ?i * Const (real ?i + 1)
MPoly_Type.degree (Const (real (i + 1)) * Var x ^ i) x = i
\<forall>i. MPoly_Type.degree (isolate_variable_sparse p x i) x = 0

goal (1 subgoal):
 1. isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (f i) x = i
[PROOF STEP]
by (metis (no_types, lifting) degh1 degree_const h1b mult.commute mult.left_commute of_nat_1 of_nat_add)
[PROOF STATE]
proof (state)
this:
isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (f i) x = i

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h5: "(MPoly_Type.degree (f i) x) \<le> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree (f i) x \<le> i
[PROOF STEP]
using h3 h4
[PROOF STATE]
proof (prove)
using this:
isolate_variable_sparse p x (i + 1) = 0 \<longrightarrow> MPoly_Type.degree (f i) x = 0
isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (f i) x = i

goal (1 subgoal):
 1. MPoly_Type.degree (f i) x \<le> i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree (f i) x \<le> i

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h6: "(MPoly_Type.degree (f n) x) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree (f n) x = n
[PROOF STEP]
using h1c3 h4
[PROOF STATE]
proof (prove)
using this:
isolate_variable_sparse p x (n + 1) \<noteq> 0
isolate_variable_sparse p x (i + 1) \<noteq> 0 \<longrightarrow> MPoly_Type.degree (f i) x = i

goal (1 subgoal):
 1. MPoly_Type.degree (f n) x = n
[PROOF STEP]
by (smt One_nat_def add.right_neutral add_Suc_right degree_const degree_mult divisors_zero f_def h1a h1b h1c1 mult.commute nonzero_const_is_nonzero of_nat_1 of_nat_add of_nat_neq_0)
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree (f n) x = n

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h7a: "derivative x p = (\<Sum>i\<in>{0..MPoly_Type.degree p x-1}. isolate_variable_sparse p x (i+1) * (Var x)^i * (Const (i+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. derivative x p = (\<Sum>i = 0..MPoly_Type.degree p x - 1. isolate_variable_sparse p x (i + 1) * Var x ^ i * Const (real (i + 1)))
[PROOF STEP]
using derivative_def
[PROOF STATE]
proof (prove)
using this:
derivative ?x ?p = (\<Sum>i = 0..MPoly_Type.degree ?p ?x - 1. isolate_variable_sparse ?p ?x (i + 1) * Var ?x ^ i * Const (real (i + 1)))

goal (1 subgoal):
 1. derivative x p = (\<Sum>i = 0..MPoly_Type.degree p x - 1. isolate_variable_sparse p x (i + 1) * Var x ^ i * Const (real (i + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
derivative x p = (\<Sum>i = 0..MPoly_Type.degree p x - 1. isolate_variable_sparse p x (i + 1) * Var x ^ i * Const (real (i + 1)))

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h7b: "(\<Sum>i\<in>{0..MPoly_Type.degree p x-1}. isolate_variable_sparse p x (i+1) * (Var x)^i * (Const (i+1))) = (\<Sum>i\<in>{0..MPoly_Type.degree p x-1}. (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..MPoly_Type.degree p x - 1. isolate_variable_sparse p x (i + 1) * Var x ^ i * Const (real (i + 1))) = sum f {0..MPoly_Type.degree p x - 1}
[PROOF STEP]
using f_def
[PROOF STATE]
proof (prove)
using this:
f ?i = isolate_variable_sparse p x (?i + 1) * Var x ^ ?i * Const (real ?i + 1)

goal (1 subgoal):
 1. (\<Sum>i = 0..MPoly_Type.degree p x - 1. isolate_variable_sparse p x (i + 1) * Var x ^ i * Const (real (i + 1))) = sum f {0..MPoly_Type.degree p x - 1}
[PROOF STEP]
by (metis Suc_eq_plus1 add.commute semiring_1_class.of_nat_simps(2))
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..MPoly_Type.degree p x - 1. isolate_variable_sparse p x (i + 1) * Var x ^ i * Const (real (i + 1))) = sum f {0..MPoly_Type.degree p x - 1}

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h7c: "derivative x p = (\<Sum>i\<in>{0..MPoly_Type.degree p x-1}. (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. derivative x p = sum f {0..MPoly_Type.degree p x - 1}
[PROOF STEP]
using h7a h7b
[PROOF STATE]
proof (prove)
using this:
derivative x p = (\<Sum>i = 0..MPoly_Type.degree p x - 1. isolate_variable_sparse p x (i + 1) * Var x ^ i * Const (real (i + 1)))
(\<Sum>i = 0..MPoly_Type.degree p x - 1. isolate_variable_sparse p x (i + 1) * Var x ^ i * Const (real (i + 1))) = sum f {0..MPoly_Type.degree p x - 1}

goal (1 subgoal):
 1. derivative x p = sum f {0..MPoly_Type.degree p x - 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
derivative x p = sum f {0..MPoly_Type.degree p x - 1}

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h7: "derivative x p = (\<Sum>i\<in>{0..n}. (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. derivative x p = sum f {0..n}
[PROOF STEP]
using n_def h7c
[PROOF STATE]
proof (prove)
using this:
n = MPoly_Type.degree p x - 1
derivative x p = sum f {0..MPoly_Type.degree p x - 1}

goal (1 subgoal):
 1. derivative x p = sum f {0..n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
derivative x p = sum f {0..n}

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h8: "n > 0 \<longrightarrow> ((MPoly_Type.degree (\<Sum>i\<in>{0..(n-1)}. (f i)) x) < n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < 0 \<longrightarrow> MPoly_Type.degree (sum f {0..0 - 1}) x < 0
 2. \<And>n. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n \<Longrightarrow> 0 < Suc n \<longrightarrow> MPoly_Type.degree (sum f {0..Suc n - 1}) x < Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. 0 < 0 \<longrightarrow> MPoly_Type.degree (sum f {0..0 - 1}) x < 0
 2. \<And>n. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n \<Longrightarrow> 0 < Suc n \<longrightarrow> MPoly_Type.degree (sum f {0..Suc n - 1}) x < Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 0 \<longrightarrow> MPoly_Type.degree (sum f {0..0 - 1}) x < 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < 0 \<longrightarrow> MPoly_Type.degree (sum f {0..0 - 1}) x < 0

goal (1 subgoal):
 1. \<And>n. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n \<Longrightarrow> 0 < Suc n \<longrightarrow> MPoly_Type.degree (sum f {0..Suc n - 1}) x < Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n \<Longrightarrow> 0 < Suc n \<longrightarrow> MPoly_Type.degree (sum f {0..Suc n - 1}) x < Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n

goal (1 subgoal):
 1. \<And>n. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n \<Longrightarrow> 0 < Suc n \<longrightarrow> MPoly_Type.degree (sum f {0..Suc n - 1}) x < Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n

goal (1 subgoal):
 1. 0 < Suc n \<longrightarrow> MPoly_Type.degree (sum f {0..Suc n - 1}) x < Suc n
[PROOF STEP]
using h5 degree_less_sum
[PROOF STATE]
proof (prove)
using this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n
MPoly_Type.degree (f i) x \<le> i
\<lbrakk>MPoly_Type.degree ?p ?var = ?n; MPoly_Type.degree ?q ?var = ?m; ?m < ?n\<rbrakk> \<Longrightarrow> MPoly_Type.degree (?p + ?q) ?var = ?n

goal (1 subgoal):
 1. 0 < Suc n \<longrightarrow> MPoly_Type.degree (sum f {0..Suc n - 1}) x < Suc n
[PROOF STEP]
by (smt add_cancel_right_right atLeastAtMost_iff degree_const degree_mult degree_sum_less degree_var_i diff_Suc_1 f_def h1a le_imp_less_Suc mult.commute mult_eq_0_iff)
[PROOF STATE]
proof (state)
this:
0 < Suc n \<longrightarrow> MPoly_Type.degree (sum f {0..Suc n - 1}) x < Suc n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h9a: "n = 0 \<longrightarrow> MPoly_Type.degree (\<Sum>i\<in>{0..n}. (f i)) x = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = 0 \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
using h6
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree (f n) x = n

goal (1 subgoal):
 1. n = 0 \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n = 0 \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h9b: "n > 0 \<longrightarrow> MPoly_Type.degree (\<Sum>i\<in>{0..n}. (f i)) x = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
have h9bhyp: "n > 0 \<longrightarrow> (MPoly_Type.degree (\<Sum>i\<in>{0..n}. (f i)) x = MPoly_Type.degree ((\<Sum>i\<in>{0..(n-1)}. (f i)) + (f n)) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = MPoly_Type.degree (sum f {0..n - 1} + f n) x
[PROOF STEP]
by (metis Suc_diff_1 sum.atLeast0_atMost_Suc)
[PROOF STATE]
proof (state)
this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = MPoly_Type.degree (sum f {0..n - 1} + f n) x

goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
have h9bhyp2: "n > 0 \<longrightarrow> ((MPoly_Type.degree ((\<Sum>i\<in>{0..(n-1)}. (f i)) + (f n)) x) = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1} + f n) x = n
[PROOF STEP]
using h6 h8 degree_less_sum
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree (f n) x = n
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1}) x < n
\<lbrakk>MPoly_Type.degree ?p ?var = ?n; MPoly_Type.degree ?q ?var = ?m; ?m < ?n\<rbrakk> \<Longrightarrow> MPoly_Type.degree (?p + ?q) ?var = ?n

goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1} + f n) x = n
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1} + f n) x = n

goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1} + f n) x = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1} + f n) x = n

goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
using h9bhyp2 h9bhyp
[PROOF STATE]
proof (prove)
using this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1} + f n) x = n
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n - 1} + f n) x = n
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = MPoly_Type.degree (sum f {0..n - 1} + f n) x

goal (1 subgoal):
 1. 0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h9:  "MPoly_Type.degree (\<Sum>i\<in>{0..n}. (f i)) x = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
using h9a h9b
[PROOF STATE]
proof (prove)
using this:
n = 0 \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n
0 < n \<longrightarrow> MPoly_Type.degree (sum f {0..n}) x = n

goal (1 subgoal):
 1. MPoly_Type.degree (sum f {0..n}) x = n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree (sum f {0..n}) x = n

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
have h10: "MPoly_Type.degree (derivative x p) x = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree (derivative x p) x = n
[PROOF STEP]
using h9 h7
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree (sum f {0..n}) x = n
derivative x p = sum f {0..n}

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

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
using h10 n_def
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree (derivative x p) x = n
n = MPoly_Type.degree p x - 1

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.degree (derivative x p) x = n
n = MPoly_Type.degree p x - 1
0 < MPoly_Type.degree p x

goal (1 subgoal):
 1. MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree p x = MPoly_Type.degree (derivative x p) x + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_roots_uminus [simp]: "poly_roots (-p) = poly_roots p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (- p) = poly_roots p
[PROOF STEP]
using poly_roots_smult[of "-1" p]
[PROOF STATE]
proof (prove)
using this:
- (1::'a) \<noteq> (0::'a) \<Longrightarrow> poly_roots (Polynomial.smult (- (1::'a)) p) = poly_roots p

goal (1 subgoal):
 1. poly_roots (- p) = poly_roots p
[PROOF STEP]
by (simp del: poly_roots_smult)


[STATEMENT]
lemma per_diag_real:
  fixes B::"complex Matrix.mat"
  assumes "B\<in> carrier_mat n n"
  and "\<forall>i< n. B$$(i,i) \<in> Reals"
  and "bij_betw f {..<n} {..<n}"
shows "\<forall>j<n. (per_diag B f)$$(j,j) \<in> Reals"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j<n. per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
proof (intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
assume "j < n"
[PROOF STATE]
proof (state)
this:
j < n

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
hence "per_diag B f $$ (j,j) = B $$ (f j, f j)"
[PROOF STATE]
proof (prove)
using this:
j < n

goal (1 subgoal):
 1. per_diag B f $$ (j, j) = B $$ (f j, f j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j < n
B \<in> carrier_mat n n
\<forall>i<n. B $$ (i, i) \<in> \<real>
bij_betw f {..<n} {..<n}

goal (1 subgoal):
 1. per_diag B f $$ (j, j) = B $$ (f j, f j)
[PROOF STEP]
unfolding per_diag_def
[PROOF STATE]
proof (prove)
using this:
j < n
B \<in> carrier_mat n n
\<forall>i<n. B $$ (i, i) \<in> \<real>
bij_betw f {..<n} {..<n}

goal (1 subgoal):
 1. Matrix.mat (dim_row B) (dim_col B) (\<lambda>(i, j). B $$ (f i, f j)) $$ (j, j) = B $$ (f j, f j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
per_diag B f $$ (j, j) = B $$ (f j, f j)

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
per_diag B f $$ (j, j) = B $$ (f j, f j)

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
have "... \<in> Reals"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (f j, f j) \<in> \<real>
[PROOF STEP]
using assms \<open>j < n\<close> bij_betwE
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n
\<forall>i<n. B $$ (i, i) \<in> \<real>
bij_betw f {..<n} {..<n}
j < n
bij_betw ?f ?A ?B \<Longrightarrow> \<forall>a\<in>?A. ?f a \<in> ?B

goal (1 subgoal):
 1. B $$ (f j, f j) \<in> \<real>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B $$ (f j, f j) \<in> \<real>

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
show "per_diag B f $$ (j,j) \<in> Reals"
[PROOF STATE]
proof (prove)
using this:
per_diag B f $$ (j, j) \<in> \<real>

goal (1 subgoal):
 1. per_diag B f $$ (j, j) \<in> \<real>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
per_diag B f $$ (j, j) \<in> \<real>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_segment_eq_real_ivl1:
  fixes a b::real
  assumes "a \<le> b"
  shows "closed_segment a b = {a .. b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment a b = {a..b}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> {a..b}
 2. \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> {a..b}
 2. \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
assume "x \<in> closed_segment a b"
[PROOF STATE]
proof (state)
this:
x \<in> closed_segment a b

goal (2 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> {a..b}
 2. \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> closed_segment a b
[PROOF STEP]
obtain u where u: "0 \<le> u" "u \<le> 1" and x_def: "x = (1 - u) * a + u * b"
[PROOF STATE]
proof (prove)
using this:
x \<in> closed_segment a b

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>0 \<le> u; u \<le> 1; x = (1 - u) * a + u * b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: closed_segment_def)
[PROOF STATE]
proof (state)
this:
0 \<le> u
u \<le> 1
x = (1 - u) * a + u * b

goal (2 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> {a..b}
 2. \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
have "u * a \<le> u * b" "(1 - u) * a \<le> (1 - u) * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * a \<le> u * b &&& (1 - u) * a \<le> (1 - u) * b
[PROOF STEP]
by (auto intro!: mult_left_mono u assms)
[PROOF STATE]
proof (state)
this:
u * a \<le> u * b
(1 - u) * a \<le> (1 - u) * b

goal (2 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> {a..b}
 2. \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u * a \<le> u * b
(1 - u) * a \<le> (1 - u) * b
[PROOF STEP]
show "x \<in> {a .. b}"
[PROOF STATE]
proof (prove)
using this:
u * a \<le> u * b
(1 - u) * a \<le> (1 - u) * b

goal (1 subgoal):
 1. x \<in> {a..b}
[PROOF STEP]
unfolding x_def
[PROOF STATE]
proof (prove)
using this:
u * a \<le> u * b
(1 - u) * a \<le> (1 - u) * b

goal (1 subgoal):
 1. (1 - u) * a + u * b \<in> {a..b}
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
x \<in> {a..b}

goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
show "\<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
by (force simp: closed_segment_def divide_simps algebra_simps
              intro: exI[where x="(x - a) / (b - a)" for x])
[PROOF STATE]
proof (state)
this:
?x \<in> {a..b} \<Longrightarrow> ?x \<in> closed_segment a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma loop_imp_unsat:
  assumes "(Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>*"
  assumes "(Neg x, Pos x) \<in> (imp_graph cnf)\<^sup>*"
  shows "\<not> satisfiable cnf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> satisfiable cnf
[PROOF STEP]
using assms ln_loop[of _ cnf "Pos x"] ln_loop[of _ cnf "Neg x"]
[PROOF STATE]
proof (prove)
using this:
(Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>*
(Neg x, Pos x) \<in> (imp_graph cnf)\<^sup>*
\<lbrakk>sat_cnf ?\<sigma> cnf; (Pos x, negate (Pos x)) \<in> (imp_graph cnf)\<^sup>*\<rbrakk> \<Longrightarrow> \<not> sat_lit ?\<sigma> (Pos x)
\<lbrakk>sat_cnf ?\<sigma> cnf; (Neg x, negate (Neg x)) \<in> (imp_graph cnf)\<^sup>*\<rbrakk> \<Longrightarrow> \<not> sat_lit ?\<sigma> (Neg x)

goal (1 subgoal):
 1. \<not> satisfiable cnf
[PROOF STEP]
unfolding satisfiable_def
[PROOF STATE]
proof (prove)
using this:
(Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>*
(Neg x, Pos x) \<in> (imp_graph cnf)\<^sup>*
\<lbrakk>sat_cnf ?\<sigma> cnf; (Pos x, negate (Pos x)) \<in> (imp_graph cnf)\<^sup>*\<rbrakk> \<Longrightarrow> \<not> sat_lit ?\<sigma> (Pos x)
\<lbrakk>sat_cnf ?\<sigma> cnf; (Neg x, negate (Neg x)) \<in> (imp_graph cnf)\<^sup>*\<rbrakk> \<Longrightarrow> \<not> sat_lit ?\<sigma> (Neg x)

goal (1 subgoal):
 1. \<nexists>\<sigma>. sat_cnf \<sigma> cnf
[PROOF STEP]
by(auto simp add: sat_lit_def)


[STATEMENT]
lemma "x > (1 :: real) \<Longrightarrow>
         ((\<lambda>n. abs (x powr n / (n * (1 + x powr (2 * n)))) powr (1 / n)) \<longlongrightarrow> 1 / x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> ((\<lambda>n. \<bar>x powr n / (n * (1 + x powr (2 * n)))\<bar> powr (1 / n)) \<longlongrightarrow> 1 / x) at_top
[PROOF STEP]
by (real_asymp simp add: exp_minus field_simps)


[STATEMENT]
lemma "filterlim (\<lambda>x::real. ln x ^ 2 * exp (sqrt (ln x) * ln (ln x) ^ 2 *
         exp (sqrt (ln (ln x)) * ln (ln (ln x)) ^ 3)) / sqrt x) (at_right 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. (ln x)\<^sup>2 * exp (sqrt (ln x) * (ln (ln x))\<^sup>2 * exp (sqrt (ln (ln x)) * ln (ln (ln x)) ^ 3)) / sqrt x :> at_right 0
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma distinct_set_zip: "length nsx = length xs \<Longrightarrow> distinct nsx \<Longrightarrow>
  (a, b) \<in> set (zip nsx xs) \<Longrightarrow> (a, ba) \<in> set (zip nsx xs) \<Longrightarrow> b = ba"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length nsx = length xs; distinct nsx; (a, b) \<in> set (zip nsx xs); (a, ba) \<in> set (zip nsx xs)\<rbrakk> \<Longrightarrow> b = ba
[PROOF STEP]
by (induction nsx xs rule: list_induct2) (auto dest: set_zip_leftD)


[STATEMENT]
lemma subset_fSuc_strict:
  assumes f: "\<And> u. f u \<subseteq> f (Suc u)"
  shows "u < v \<Longrightarrow> f u \<subseteq> f v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u < v \<Longrightarrow> f u \<subseteq> f v
[PROOF STEP]
proof (induct v)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u < 0 \<Longrightarrow> f u \<subseteq> f 0
 2. \<And>v. \<lbrakk>u < v \<Longrightarrow> f u \<subseteq> f v; u < Suc v\<rbrakk> \<Longrightarrow> f u \<subseteq> f (Suc v)
[PROOF STEP]
show "u < 0 \<Longrightarrow> f u \<subseteq> f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u < 0 \<Longrightarrow> f u \<subseteq> f 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u < 0 \<Longrightarrow> f u \<subseteq> f 0

goal (1 subgoal):
 1. \<And>v. \<lbrakk>u < v \<Longrightarrow> f u \<subseteq> f v; u < Suc v\<rbrakk> \<Longrightarrow> f u \<subseteq> f (Suc v)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. \<lbrakk>u < v \<Longrightarrow> f u \<subseteq> f v; u < Suc v\<rbrakk> \<Longrightarrow> f u \<subseteq> f (Suc v)
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. \<lbrakk>u < v \<Longrightarrow> f u \<subseteq> f v; u < Suc v\<rbrakk> \<Longrightarrow> f u \<subseteq> f (Suc v)
[PROOF STEP]
assume a:"(u < v \<Longrightarrow> f u \<subseteq> f v)"
[PROOF STATE]
proof (state)
this:
u < v \<Longrightarrow> f u \<subseteq> f v

goal (1 subgoal):
 1. \<And>v. \<lbrakk>u < v \<Longrightarrow> f u \<subseteq> f v; u < Suc v\<rbrakk> \<Longrightarrow> f u \<subseteq> f (Suc v)
[PROOF STEP]
assume b:"u < Suc v"
[PROOF STATE]
proof (state)
this:
u < Suc v

goal (1 subgoal):
 1. \<And>v. \<lbrakk>u < v \<Longrightarrow> f u \<subseteq> f v; u < Suc v\<rbrakk> \<Longrightarrow> f u \<subseteq> f (Suc v)
[PROOF STEP]
from b
[PROOF STATE]
proof (chain)
picking this:
u < Suc v
[PROOF STEP]
have c: "f u \<subseteq> f v"
[PROOF STATE]
proof (prove)
using this:
u < Suc v

goal (1 subgoal):
 1. f u \<subseteq> f v
[PROOF STEP]
apply (case_tac "u < v")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>u < Suc v; u < v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
 2. \<lbrakk>u < Suc v; \<not> u < v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
[PROOF STEP]
apply (simp add: a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u < Suc v; \<not> u < v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
[PROOF STEP]
apply (case_tac "u = v")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>u < Suc v; \<not> u < v; u = v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
 2. \<lbrakk>u < Suc v; \<not> u < v; u \<noteq> v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u < Suc v; \<not> u < v; u \<noteq> v\<rbrakk> \<Longrightarrow> f u \<subseteq> f v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f u \<subseteq> f v

goal (1 subgoal):
 1. \<And>v. \<lbrakk>u < v \<Longrightarrow> f u \<subseteq> f v; u < Suc v\<rbrakk> \<Longrightarrow> f u \<subseteq> f (Suc v)
[PROOF STEP]
show "f u \<subseteq> f (Suc v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f u \<subseteq> f (Suc v)
[PROOF STEP]
apply (rule subset_trans[OF c])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f v \<subseteq> f (Suc v)
[PROOF STEP]
by (rule f)
[PROOF STATE]
proof (state)
this:
f u \<subseteq> f (Suc v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma asymp_equiv_imp_bigo:
  assumes "f \<sim>[F] g"
  shows   "f \<in> O[F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> O[F](g)
[PROOF STEP]
proof (rule bigoI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm (f x) \<le> ?c * norm (g x)
[PROOF STEP]
have "(3/2::real) > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < 3 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < 3 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm (f x) \<le> ?c * norm (g x)
[PROOF STEP]
from asymp_equiv_imp_eventually_le[OF assms this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. norm (f x) \<le> 3 / 2 * norm (g x)
[PROOF STEP]
show "eventually (\<lambda>x. norm (f x) \<le> 3/2 * norm (g x)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. norm (f x) \<le> 3 / 2 * norm (g x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm (f x) \<le> 3 / 2 * norm (g x)
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. norm (f x) \<le> 3 / 2 * norm (g x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fejer_kernel_continuous_strong:
  "continuous_on {-(2 * pi)<..<2 * pi} (Fejer_kernel n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {- (2 * pi)<..<2 * pi} (Fejer_kernel n)
[PROOF STEP]
proof (cases "n=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> continuous_on {- (2 * pi)<..<2 * pi} (Fejer_kernel n)
 2. n \<noteq> 0 \<Longrightarrow> continuous_on {- (2 * pi)<..<2 * pi} (Fejer_kernel n)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> continuous_on {- (2 * pi)<..<2 * pi} (Fejer_kernel n)
 2. n \<noteq> 0 \<Longrightarrow> continuous_on {- (2 * pi)<..<2 * pi} (Fejer_kernel n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. continuous_on {- (2 * pi)<..<2 * pi} (Fejer_kernel n)
[PROOF STEP]
by (simp add: Fejer_kernel_def continuous_intros Dirichlet_kernel_continuous_strong)
[PROOF STATE]
proof (state)
this:
continuous_on {- (2 * pi)<..<2 * pi} (Fejer_kernel n)

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> continuous_on {- (2 * pi)<..<2 * pi} (Fejer_kernel n)
[PROOF STEP]
qed (simp add: Fejer_kernel_def)


[STATEMENT]
lemma orthogonal_nullspace_rowspace:
  fixes A :: "real^'n^'m"
  assumes 0: "A *v x = 0" and y: "y \<in> span(rows A)"
  shows "orthogonal x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal x y
[PROOF STEP]
using y
[PROOF STATE]
proof (prove)
using this:
y \<in> span (rows A)

goal (1 subgoal):
 1. orthogonal x y
[PROOF STEP]
proof (induction rule: span_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. subspace {a. orthogonal x a}
 2. \<And>xa. xa \<in> rows A \<Longrightarrow> orthogonal x xa
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. subspace {a. orthogonal x a}
 2. \<And>xa. xa \<in> rows A \<Longrightarrow> orthogonal x xa
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace {a. orthogonal x a}
[PROOF STEP]
by (simp add: subspace_orthogonal_to_vector)
[PROOF STATE]
proof (state)
this:
subspace {a. orthogonal x a}

goal (1 subgoal):
 1. \<And>xa. xa \<in> rows A \<Longrightarrow> orthogonal x xa
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> rows A \<Longrightarrow> orthogonal x xa
[PROOF STEP]
case (step v)
[PROOF STATE]
proof (state)
this:
v \<in> rows A

goal (1 subgoal):
 1. \<And>xa. xa \<in> rows A \<Longrightarrow> orthogonal x xa
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v \<in> rows A
[PROOF STEP]
obtain i where "v = row i A"
[PROOF STATE]
proof (prove)
using this:
v \<in> rows A

goal (1 subgoal):
 1. (\<And>i. v = row i A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: rows_def)
[PROOF STATE]
proof (state)
this:
v = row i A

goal (1 subgoal):
 1. \<And>xa. xa \<in> rows A \<Longrightarrow> orthogonal x xa
[PROOF STEP]
with 0
[PROOF STATE]
proof (chain)
picking this:
A *v x = 0
v = row i A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
A *v x = 0
v = row i A

goal (1 subgoal):
 1. orthogonal x v
[PROOF STEP]
unfolding orthogonal_def inner_vec_def matrix_vector_mult_def row_def
[PROOF STATE]
proof (prove)
using this:
(\<chi>i. \<Sum>j\<in>UNIV. A $ i $ j * x $ j) = 0
v = vec_lambda (($) (A $ i))

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. x $ i \<bullet> v $ i) = 0
[PROOF STEP]
by (simp add: mult.commute) (metis (no_types) vec_lambda_beta zero_index)
[PROOF STATE]
proof (state)
this:
orthogonal x v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma perm_vars_length: "perm_vars n vs \<Longrightarrow> length vs = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perm_vars n vs \<Longrightarrow> length vs = n
[PROOF STEP]
unfolding perm_vars_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct vs \<and> set vs = {0..<n} \<Longrightarrow> length vs = n
[PROOF STEP]
using distinct_card
[PROOF STATE]
proof (prove)
using this:
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs

goal (1 subgoal):
 1. distinct vs \<and> set vs = {0..<n} \<Longrightarrow> length vs = n
[PROOF STEP]
by force


[STATEMENT]
lemma vec_norm_ge_0:
  fixes v ::  "complex vec"
  assumes dim_v: "v \<in> carrier_vec n" and neq0: "v \<noteq> 0\<^sub>v n"
  shows "vec_norm v > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < vec_norm v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < vec_norm v
[PROOF STEP]
have geq: "vec_norm v \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> vec_norm v
[PROOF STEP]
using vec_norm_geq_0
[PROOF STATE]
proof (prove)
using this:
0 \<le> vec_norm ?v

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

goal (1 subgoal):
 1. 0 < vec_norm v
[PROOF STEP]
have neq: "vec_norm v \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_norm v \<noteq> 0
[PROOF STEP]
apply (insert dim_v neq0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v \<in> carrier_vec n; v \<noteq> 0\<^sub>v n\<rbrakk> \<Longrightarrow> vec_norm v \<noteq> 0
[PROOF STEP]
apply (drule vec_norm_zero, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
vec_norm v \<noteq> 0

goal (1 subgoal):
 1. 0 < vec_norm v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < vec_norm v
[PROOF STEP]
using neq geq
[PROOF STATE]
proof (prove)
using this:
vec_norm v \<noteq> 0
0 \<le> vec_norm v

goal (1 subgoal):
 1. 0 < vec_norm v
[PROOF STEP]
by (rule dual_order.not_eq_order_implies_strict)
[PROOF STATE]
proof (state)
this:
0 < vec_norm v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ffft_4: assumes dx: "dim_vec x = 4"
  and be: "x $ 0 = False \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = True"
  shows "ceros_of_boolean_input x = {0,1,2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input x = {0, 1, 2}
[PROOF STEP]
using dx be
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = False \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = True

goal (1 subgoal):
 1. ceros_of_boolean_input x = {0, 1, 2}
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = False \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = True

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {0, 1, 2}
[PROOF STEP]
using less_4_cases
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = False \<and> x $ 1 = False \<and> x $ 2 = False \<and> x $ 3 = True
?n < 4 \<Longrightarrow> ?n = 0 \<or> ?n = 1 \<or> ?n = 2 \<or> ?n = 3

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {0, 1, 2}
[PROOF STEP]
by auto


[STATEMENT]
lemma inf_continuous_compose:
  assumes f: "inf_continuous f" and g: "inf_continuous g"
  shows "inf_continuous (\<lambda>x. f (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf_continuous (\<lambda>x. f (g x))
[PROOF STEP]
unfolding inf_continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>M. decseq M \<longrightarrow> f (g (Inf (range M))) = (INF i. f (g (M i)))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>M. decseq M \<Longrightarrow> f (g (Inf (range M))) = (INF i. f (g (M i)))
[PROOF STEP]
fix M :: "nat \<Rightarrow> 'c"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>M. decseq M \<Longrightarrow> f (g (Inf (range M))) = (INF i. f (g (M i)))
[PROOF STEP]
assume M: "antimono M"
[PROOF STATE]
proof (state)
this:
decseq M

goal (1 subgoal):
 1. \<And>M. decseq M \<Longrightarrow> f (g (Inf (range M))) = (INF i. f (g (M i)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
decseq M
[PROOF STEP]
have "antimono (\<lambda>i. g (M i))"
[PROOF STATE]
proof (prove)
using this:
decseq M

goal (1 subgoal):
 1. decseq (\<lambda>i. g (M i))
[PROOF STEP]
using inf_continuous_mono[OF g]
[PROOF STATE]
proof (prove)
using this:
decseq M
mono g

goal (1 subgoal):
 1. decseq (\<lambda>i. g (M i))
[PROOF STEP]
by (auto simp: mono_def antimono_def)
[PROOF STATE]
proof (state)
this:
decseq (\<lambda>i. g (M i))

goal (1 subgoal):
 1. \<And>M. decseq M \<Longrightarrow> f (g (Inf (range M))) = (INF i. f (g (M i)))
[PROOF STEP]
with M
[PROOF STATE]
proof (chain)
picking this:
decseq M
decseq (\<lambda>i. g (M i))
[PROOF STEP]
show "f (g (Inf (M ` UNIV))) = (INF i. f (g (M i)))"
[PROOF STATE]
proof (prove)
using this:
decseq M
decseq (\<lambda>i. g (M i))

goal (1 subgoal):
 1. f (g (Inf (range M))) = (INF i. f (g (M i)))
[PROOF STEP]
by (auto simp: inf_continuous_def g[THEN inf_continuousD] f[THEN inf_continuousD])
[PROOF STATE]
proof (state)
this:
f (g (Inf (range M))) = (INF i. f (g (M i)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_generated_list_power: "u \<in> lists {x} \<Longrightarrow> \<exists>k. concat u = x\<^sup>@k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> lists {x} \<Longrightarrow> \<exists>k. concat u = x \<^sup>@ k
[PROOF STEP]
by(induction u rule: lists.induct, unfold concat.simps(1), use pow_zero[of x, symmetric] in fast,
        unfold concat.simps(2))
  (use pow_Suc[symmetric, of x] singletonD in metis)


[STATEMENT]
lemma is_arith_prog_onD:
  assumes "is_arith_prog_on l start step a b"
  assumes "c \<in> {0..<l}"
  shows   "arith_prog start step c \<in> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arith_prog start step c \<in> {a..b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arith_prog start step c \<in> {a..b}
[PROOF STEP]
have "arith_prog start step 0 \<le> arith_prog start step c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arith_prog start step 0 \<le> arith_prog start step c
[PROOF STEP]
by (rule arith_prog_mono) auto
[PROOF STATE]
proof (state)
this:
arith_prog start step 0 \<le> arith_prog start step c

goal (1 subgoal):
 1. arith_prog start step c \<in> {a..b}
[PROOF STEP]
hence "arith_prog start step c \<ge> a"
[PROOF STATE]
proof (prove)
using this:
arith_prog start step 0 \<le> arith_prog start step c

goal (1 subgoal):
 1. a \<le> arith_prog start step c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
arith_prog start step 0 \<le> arith_prog start step c
is_arith_prog_on l start step a b
c \<in> {0..<l}

goal (1 subgoal):
 1. a \<le> arith_prog start step c
[PROOF STEP]
by (simp add: arith_prog_def is_arith_prog_on_def
                      add_increasing2)
[PROOF STATE]
proof (state)
this:
a \<le> arith_prog start step c

goal (1 subgoal):
 1. arith_prog start step c \<in> {a..b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<le> arith_prog start step c

goal (1 subgoal):
 1. arith_prog start step c \<in> {a..b}
[PROOF STEP]
have "arith_prog start step (l-1) \<ge>
                   arith_prog start step c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arith_prog start step c \<le> arith_prog start step (l - 1)
[PROOF STEP]
by (rule arith_prog_mono) (use assms(2) in auto)
[PROOF STATE]
proof (state)
this:
arith_prog start step c \<le> arith_prog start step (l - 1)

goal (1 subgoal):
 1. arith_prog start step c \<in> {a..b}
[PROOF STEP]
hence "arith_prog start step c \<le> b"
[PROOF STATE]
proof (prove)
using this:
arith_prog start step c \<le> arith_prog start step (l - 1)

goal (1 subgoal):
 1. arith_prog start step c \<le> b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
arith_prog start step c \<le> arith_prog start step (l - 1)
is_arith_prog_on l start step a b
c \<in> {0..<l}

goal (1 subgoal):
 1. arith_prog start step c \<le> b
[PROOF STEP]
unfolding arith_prog_def is_arith_prog_on_def
[PROOF STATE]
proof (prove)
using this:
start + int (c * step) \<le> start + int ((l - 1) * step)
a \<le> start \<and> start + int ((l - 1) * step) \<le> b
c \<in> {0..<l}

goal (1 subgoal):
 1. start + int (c * step) \<le> b
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
arith_prog start step c \<le> b

goal (1 subgoal):
 1. arith_prog start step c \<in> {a..b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<le> arith_prog start step c
arith_prog start step c \<le> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<le> arith_prog start step c
arith_prog start step c \<le> b

goal (1 subgoal):
 1. arith_prog start step c \<in> {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
arith_prog start step c \<in> {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma disjuncts_NFOR:
  "\<lbrakk>finite X; X \<noteq> {}; \<forall>x \<in> X. \<not> is_FOr x\<rbrakk> \<Longrightarrow> disjuncts (NFOR X) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite X; X \<noteq> {}; \<forall>x\<in>X. \<not> is_FOr x\<rbrakk> \<Longrightarrow> disjuncts (NFOR X) = X
[PROOF STEP]
unfolding NFOR_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite X; X \<noteq> {}; \<forall>x\<in>X. \<not> is_FOr x\<rbrakk> \<Longrightarrow> disjuncts ((nFOR \<circ> sorted_list_of_set) X) = X
[PROOF STEP]
by (auto simp: juncts_eq_set_juncts_list list_all_iff disjuncts_list_nFOR)