[STATEMENT]
lemma update_commute':
assumes g_unchanged: "\<forall>a m. a \<notin> G \<longrightarrow> g m a = m a"
assumes g_independent: "\<forall>a m\<^sub>1 m\<^sub>2. a \<in> G \<longrightarrow> g m\<^sub>1 a = g m\<^sub>2 a"
assumes f_unchanged: "\<forall>a m. a \<notin> F \<longrightarrow> f m a = m a"
assumes f_independent: "\<forall>a m\<^sub>1 m\<^sub>2. a \<in> F \<longrightarrow> f m\<^sub>1 a = f m\<^sub>2 a"
assumes disj: "G \<inter> F = {}"
shows "f (g m) = g (f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (g m) = g (f m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (g m) = g (f m)
[PROOF STEP]
from g_independent
[PROOF STATE]
proof (chain)
picking this:
\<forall>a m\<^sub>1 m\<^sub>2. a \<in> G \<longrightarrow> g m\<^sub>1 a = g m\<^sub>2 a
[PROOF STEP]
have g_ind': "\<forall>a m. a \<in> G \<longrightarrow> g (f m) a = g m a"
[PROOF STATE]
proof (prove)
using this:
\<forall>a m\<^sub>1 m\<^sub>2. a \<in> G \<longrightarrow> g m\<^sub>1 a = g m\<^sub>2 a

goal (1 subgoal):
 1. \<forall>a m. a \<in> G \<longrightarrow> g (f m) a = g m a
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>a m. a \<in> G \<longrightarrow> g (f m) a = g m a

goal (1 subgoal):
 1. f (g m) = g (f m)
[PROOF STEP]
from f_independent
[PROOF STATE]
proof (chain)
picking this:
\<forall>a m\<^sub>1 m\<^sub>2. a \<in> F \<longrightarrow> f m\<^sub>1 a = f m\<^sub>2 a
[PROOF STEP]
have f_ind': "\<forall>a m. a \<in> F \<longrightarrow> f (g m) a = f m a"
[PROOF STATE]
proof (prove)
using this:
\<forall>a m\<^sub>1 m\<^sub>2. a \<in> F \<longrightarrow> f m\<^sub>1 a = f m\<^sub>2 a

goal (1 subgoal):
 1. \<forall>a m. a \<in> F \<longrightarrow> f (g m) a = f m a
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>a m. a \<in> F \<longrightarrow> f (g m) a = f m a

goal (1 subgoal):
 1. f (g m) = g (f m)
[PROOF STEP]
from update_commute [OF g_unchanged g_ind' f_unchanged f_ind' disj]
[PROOF STATE]
proof (chain)
picking this:
f (g ?m) = g (f ?m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f (g ?m) = g (f ?m)

goal (1 subgoal):
 1. f (g m) = g (f m)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f (g m) = g (f m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ring_pow_function_ring_car_memE:
  assumes "f \<in> carrier (Fun\<^bsub>n\<^esub> R)"
  shows "f \<in> extensional (carrier (R\<^bsup>n\<^esup>))"
        "f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> extensional (carrier (R\<^bsup>n\<^esup>)) &&& f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
using ring_functions.function_ring_car_memE[of R f "carrier (R\<^bsup>n\<^esup>)"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ring_functions R; f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)\<rbrakk> \<Longrightarrow> f \<in> extensional (carrier (R\<^bsup>n\<^esup>))
\<lbrakk>ring_functions R; f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)\<rbrakk> \<Longrightarrow> f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)

goal (1 subgoal):
 1. f \<in> extensional (carrier (R\<^bsup>n\<^esup>)) &&& f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
unfolding ring_functions_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ring R; f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)\<rbrakk> \<Longrightarrow> f \<in> extensional (carrier (R\<^bsup>n\<^esup>))
\<lbrakk>ring R; f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)\<rbrakk> \<Longrightarrow> f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)

goal (1 subgoal):
 1. f \<in> extensional (carrier (R\<^bsup>n\<^esup>)) &&& f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
using  function_ring_def partial_object.select_convs(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ring R; f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)\<rbrakk> \<Longrightarrow> f \<in> extensional (carrier (R\<^bsup>n\<^esup>))
\<lbrakk>ring R; f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)\<rbrakk> \<Longrightarrow> f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)
function_ring ?S ?R = \<lparr>carrier = ?S \<rightarrow>\<^sub>E carrier ?R, monoid.mult = function_mult ?S ?R, one = function_one ?S ?R, zero = function_zero ?S ?R, add = function_add ?S ?R, smult = function_scalar_mult ?S ?R\<rparr>
carrier \<lparr>carrier = ?carrier, \<dots> = ?more\<rparr> = ?carrier

goal (1 subgoal):
 1. f \<in> extensional (carrier (R\<^bsup>n\<^esup>)) &&& f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
apply (metis PiE_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
using Int_iff assms PiE_iff function_ring_def partial_object.select_convs(1)
[PROOF STATE]
proof (prove)
using this:
(?c \<in> ?A \<inter> ?B) = (?c \<in> ?A \<and> ?c \<in> ?B)
f \<in> carrier (function_ring (carrier (R\<^bsup>n\<^esup>)) R)
(?f \<in> Pi\<^sub>E ?I ?X) = ((\<forall>i\<in>?I. ?f i \<in> ?X i) \<and> ?f \<in> extensional ?I)
function_ring ?S ?R = \<lparr>carrier = ?S \<rightarrow>\<^sub>E carrier ?R, monoid.mult = function_mult ?S ?R, one = function_one ?S ?R, zero = function_zero ?S ?R, add = function_add ?S ?R, smult = function_scalar_mult ?S ?R\<rparr>
carrier \<lparr>carrier = ?carrier, \<dots> = ?more\<rparr> = ?carrier

goal (1 subgoal):
 1. f \<in> carrier (R\<^bsup>n\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
by (simp add: PiE_iff function_ring_def)


[STATEMENT]
lemma counting_ones_complexity:
  fixes A :: "'a :: real_normed_field mat"
  assumes A: "A \<in> carrier_mat n n"
  and upper_t: "upper_triangular A"
  and le_1: "\<And> a. a \<in> set (diag_mat A) \<Longrightarrow> norm a \<le> 1"
  and le_N: "\<And> a. a \<in> set (diag_mat A) \<Longrightarrow> norm a = 1 \<Longrightarrow> length (filter ((=) a) (diag_mat A)) \<le> N"
  shows "\<exists> c1 c2. \<forall> k. norm_bound (A ^\<^sub>m k) (c1 + c2 * of_nat k ^ (N - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c1 c2. \<forall>k. norm_bound (A ^\<^sub>m k) (c1 + c2 * real k ^ (N - 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>c1 c2. \<forall>k. norm_bound (A ^\<^sub>m k) (c1 + c2 * real k ^ (N - 1))
[PROOF STEP]
from triangular_to_jnf_vector[OF A upper_t]
[PROOF STATE]
proof (chain)
picking this:
jordan_nf A (triangular_to_jnf_vector A)
[PROOF STEP]
have jnf: "\<exists> n_as. jordan_nf A n_as"
[PROOF STATE]
proof (prove)
using this:
jordan_nf A (triangular_to_jnf_vector A)

goal (1 subgoal):
 1. \<exists>n_as. jordan_nf A n_as
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>n_as. jordan_nf A n_as

goal (1 subgoal):
 1. \<exists>c1 c2. \<forall>k. norm_bound (A ^\<^sub>m k) (c1 + c2 * real k ^ (N - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c1 c2. \<forall>k. norm_bound (A ^\<^sub>m k) (c1 + c2 * real k ^ (N - 1))
[PROOF STEP]
by (rule factored_char_poly_norm_bound[OF A char_poly_upper_triangular[OF A upper_t] jnf le_1 le_N])
[PROOF STATE]
proof (state)
this:
\<exists>c1 c2. \<forall>k. norm_bound (A ^\<^sub>m k) (c1 + c2 * real k ^ (N - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fundamental_theorem_of_algebra:
  assumes nc: "\<not> constant (poly p)"
  shows "\<exists>z::complex. poly p z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. poly p z = 0
[PROOF STEP]
using nc
[PROOF STATE]
proof (prove)
using this:
\<not> constant (poly p)

goal (1 subgoal):
 1. \<exists>z. poly p z = 0
[PROOF STEP]
proof (induct "psize p" arbitrary: p rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>psize pa < psize p; \<not> constant (poly pa)\<rbrakk> \<Longrightarrow> \<exists>z. poly pa z = 0; \<not> constant (poly p)\<rbrakk> \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
case less
[PROOF STATE]
proof (state)
this:
\<lbrakk>psize ?p < psize p; \<not> constant (poly ?p)\<rbrakk> \<Longrightarrow> \<exists>z. poly ?p z = 0
\<not> constant (poly p)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>psize pa < psize p; \<not> constant (poly pa)\<rbrakk> \<Longrightarrow> \<exists>z. poly pa z = 0; \<not> constant (poly p)\<rbrakk> \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
let ?p = "poly p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>psize pa < psize p; \<not> constant (poly pa)\<rbrakk> \<Longrightarrow> \<exists>z. poly pa z = 0; \<not> constant (poly p)\<rbrakk> \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
let ?ths = "\<exists>z. ?p z = 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>psize pa < psize p; \<not> constant (poly pa)\<rbrakk> \<Longrightarrow> \<exists>z. poly pa z = 0; \<not> constant (poly p)\<rbrakk> \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from nonconstant_length[OF less(2)]
[PROOF STATE]
proof (chain)
picking this:
2 \<le> psize p
[PROOF STEP]
have n2: "psize p \<ge> 2"
[PROOF STATE]
proof (prove)
using this:
2 \<le> psize p

goal (1 subgoal):
 1. 2 \<le> psize p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 \<le> psize p

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>psize pa < psize p; \<not> constant (poly pa)\<rbrakk> \<Longrightarrow> \<exists>z. poly pa z = 0; \<not> constant (poly p)\<rbrakk> \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from poly_minimum_modulus
[PROOF STATE]
proof (chain)
picking this:
\<exists>z. \<forall>w. cmod (poly ?p z) \<le> cmod (poly ?p w)
[PROOF STEP]
obtain c where c: "\<forall>w. cmod (?p c) \<le> cmod (?p w)"
[PROOF STATE]
proof (prove)
using this:
\<exists>z. \<forall>w. cmod (poly ?p z) \<le> cmod (poly ?p w)

goal (1 subgoal):
 1. (\<And>c. \<forall>w. cmod (poly p c) \<le> cmod (poly p w) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>w. cmod (poly p c) \<le> cmod (poly p w)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>psize pa < psize p; \<not> constant (poly pa)\<rbrakk> \<Longrightarrow> \<exists>z. poly pa z = 0; \<not> constant (poly p)\<rbrakk> \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
show ?ths
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. poly p z = 0
[PROOF STEP]
proof (cases "?p c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly p c = 0 \<Longrightarrow> \<exists>z. poly p z = 0
 2. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
poly p c = 0

goal (2 subgoals):
 1. poly p c = 0 \<Longrightarrow> \<exists>z. poly p z = 0
 2. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly p c = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly p c = 0

goal (1 subgoal):
 1. \<exists>z. poly p z = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>z. poly p z = 0

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
poly p c \<noteq> 0

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from poly_offset[of p c]
[PROOF STATE]
proof (chain)
picking this:
\<exists>q. psize q = psize p \<and> (\<forall>x. poly q x = poly p (c + x))
[PROOF STEP]
obtain q where q: "psize q = psize p" "\<forall>x. poly q x = ?p (c + x)"
[PROOF STATE]
proof (prove)
using this:
\<exists>q. psize q = psize p \<and> (\<forall>x. poly q x = poly p (c + x))

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>psize q = psize p; \<forall>x. poly q x = poly p (c + x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
psize q = psize p
\<forall>x. poly q x = poly p (c + x)

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
have False if h: "constant (poly q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
from q(2)
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. poly q x = poly p (c + x)
[PROOF STEP]
have th: "\<forall>x. poly q (x - c) = ?p x"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. poly q x = poly p (c + x)

goal (1 subgoal):
 1. \<forall>x. poly q (x - c) = poly p x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. poly q (x - c) = poly p x

goal (1 subgoal):
 1. False
[PROOF STEP]
have "?p x = ?p y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p x = poly p y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p x = poly p y
[PROOF STEP]
from th
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. poly q (x - c) = poly p x
[PROOF STEP]
have "?p x = poly q (x - c)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. poly q (x - c) = poly p x

goal (1 subgoal):
 1. poly p x = poly q (x - c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly p x = poly q (x - c)

goal (1 subgoal):
 1. poly p x = poly p y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly p x = poly q (x - c)

goal (1 subgoal):
 1. poly p x = poly p y
[PROOF STEP]
have "\<dots> = poly q (y - c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q (x - c) = poly q (y - c)
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
constant (poly q)

goal (1 subgoal):
 1. poly q (x - c) = poly q (y - c)
[PROOF STEP]
unfolding constant_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. poly q x = poly q y

goal (1 subgoal):
 1. poly q (x - c) = poly q (y - c)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
poly q (x - c) = poly q (y - c)

goal (1 subgoal):
 1. poly p x = poly p y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly q (x - c) = poly q (y - c)

goal (1 subgoal):
 1. poly p x = poly p y
[PROOF STEP]
have "\<dots> = ?p y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q (y - c) = poly p y
[PROOF STEP]
using th
[PROOF STATE]
proof (prove)
using this:
\<forall>x. poly q (x - c) = poly p x

goal (1 subgoal):
 1. poly q (y - c) = poly p y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly q (y - c) = poly p y

goal (1 subgoal):
 1. poly p x = poly p y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly p x = poly p y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly p x = poly p y

goal (1 subgoal):
 1. poly p x = poly p y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly p x = poly p y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly p ?x = poly p ?y

goal (1 subgoal):
 1. False
[PROOF STEP]
with less(2)
[PROOF STATE]
proof (chain)
picking this:
\<not> constant (poly p)
poly p ?x = poly p ?y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> constant (poly p)
poly p ?x = poly p ?y

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding constant_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>x y. poly p x = poly p y)
poly p ?x = poly p ?y

goal (1 subgoal):
 1. False
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
constant (poly q) \<Longrightarrow> False

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
constant (poly q) \<Longrightarrow> False
[PROOF STEP]
have qnc: "\<not> constant (poly q)"
[PROOF STATE]
proof (prove)
using this:
constant (poly q) \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> constant (poly q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> constant (poly q)

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from q(2)
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. poly q x = poly p (c + x)
[PROOF STEP]
have pqc0: "?p c = poly q 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. poly q x = poly p (c + x)

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

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from c pqc0
[PROOF STATE]
proof (chain)
picking this:
\<forall>w. cmod (poly p c) \<le> cmod (poly p w)
poly p c = poly q 0
[PROOF STEP]
have cq0: "\<forall>w. cmod (poly q 0) \<le> cmod (?p w)"
[PROOF STATE]
proof (prove)
using this:
\<forall>w. cmod (poly p c) \<le> cmod (poly p w)
poly p c = poly q 0

goal (1 subgoal):
 1. \<forall>w. cmod (poly q 0) \<le> cmod (poly p w)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>w. cmod (poly q 0) \<le> cmod (poly p w)

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
let ?a0 = "poly q 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from False pqc0
[PROOF STATE]
proof (chain)
picking this:
poly p c \<noteq> 0
poly p c = poly q 0
[PROOF STEP]
have a00: "?a0 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
poly p c \<noteq> 0
poly p c = poly q 0

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

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from a00
[PROOF STATE]
proof (chain)
picking this:
poly q 0 \<noteq> 0
[PROOF STEP]
have qr: "\<forall>z. poly q z = poly (smult (inverse ?a0) q) z * ?a0"
[PROOF STATE]
proof (prove)
using this:
poly q 0 \<noteq> 0

goal (1 subgoal):
 1. \<forall>z. poly q z = poly (smult (inverse (poly q 0)) q) z * poly q 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>z. poly q z = poly (smult (inverse (poly q 0)) q) z * poly q 0

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
let ?r = "smult (inverse ?a0) q"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
have lgqr: "psize q = psize ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. psize q = psize (smult (inverse (poly q 0)) q)
[PROOF STEP]
using a00
[PROOF STATE]
proof (prove)
using this:
poly q 0 \<noteq> 0

goal (1 subgoal):
 1. psize q = psize (smult (inverse (poly q 0)) q)
[PROOF STEP]
unfolding psize_def degree_def
[PROOF STATE]
proof (prove)
using this:
poly q 0 \<noteq> 0

goal (1 subgoal):
 1. (if q = 0 then 0 else Suc (LEAST n. \<forall>i>n. coeff q i = 0)) = (if smult (inverse (poly q 0)) q = 0 then 0 else Suc (LEAST n. \<forall>i>n. coeff (smult (inverse (poly q 0)) q) i = 0))
[PROOF STEP]
by (simp add: poly_eq_iff)
[PROOF STATE]
proof (state)
this:
psize q = psize (smult (inverse (poly q 0)) q)

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
have False if h: "\<And>x y. poly ?r x = poly ?r y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have "poly q x = poly q y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q x = poly q y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly q x = poly q y
[PROOF STEP]
from qr[rule_format, of x]
[PROOF STATE]
proof (chain)
picking this:
poly q x = poly (smult (inverse (poly q 0)) q) x * poly q 0
[PROOF STEP]
have "poly q x = poly ?r x * ?a0"
[PROOF STATE]
proof (prove)
using this:
poly q x = poly (smult (inverse (poly q 0)) q) x * poly q 0

goal (1 subgoal):
 1. poly q x = poly (smult (inverse (poly q 0)) q) x * poly q 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly q x = poly (smult (inverse (poly q 0)) q) x * poly q 0

goal (1 subgoal):
 1. poly q x = poly q y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly q x = poly (smult (inverse (poly q 0)) q) x * poly q 0

goal (1 subgoal):
 1. poly q x = poly q y
[PROOF STEP]
have "\<dots> = poly ?r y * ?a0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (smult (inverse (poly q 0)) q) x * poly q 0 = poly (smult (inverse (poly q 0)) q) y * poly q 0
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
poly (smult (inverse (poly q 0)) q) ?x = poly (smult (inverse (poly q 0)) q) ?y

goal (1 subgoal):
 1. poly (smult (inverse (poly q 0)) q) x * poly q 0 = poly (smult (inverse (poly q 0)) q) y * poly q 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (smult (inverse (poly q 0)) q) x * poly q 0 = poly (smult (inverse (poly q 0)) q) y * poly q 0

goal (1 subgoal):
 1. poly q x = poly q y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly (smult (inverse (poly q 0)) q) x * poly q 0 = poly (smult (inverse (poly q 0)) q) y * poly q 0

goal (1 subgoal):
 1. poly q x = poly q y
[PROOF STEP]
have "\<dots> = poly q y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (smult (inverse (poly q 0)) q) y * poly q 0 = poly q y
[PROOF STEP]
using qr[rule_format, of y]
[PROOF STATE]
proof (prove)
using this:
poly q y = poly (smult (inverse (poly q 0)) q) y * poly q 0

goal (1 subgoal):
 1. poly (smult (inverse (poly q 0)) q) y * poly q 0 = poly q y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (smult (inverse (poly q 0)) q) y * poly q 0 = poly q y

goal (1 subgoal):
 1. poly q x = poly q y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly q x = poly q y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly q x = poly q y

goal (1 subgoal):
 1. poly q x = poly q y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly q x = poly q y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly q ?x = poly q ?y

goal (1 subgoal):
 1. False
[PROOF STEP]
with qnc
[PROOF STATE]
proof (chain)
picking this:
\<not> constant (poly q)
poly q ?x = poly q ?y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> constant (poly q)
poly q ?x = poly q ?y

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding constant_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>x y. poly q x = poly q y)
poly q ?x = poly q ?y

goal (1 subgoal):
 1. False
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<And>x y. poly (smult (inverse (poly q 0)) q) x = poly (smult (inverse (poly q 0)) q) y) \<Longrightarrow> False

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. poly (smult (inverse (poly q 0)) q) x = poly (smult (inverse (poly q 0)) q) y) \<Longrightarrow> False
[PROOF STEP]
have rnc: "\<not> constant (poly ?r)"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. poly (smult (inverse (poly q 0)) q) x = poly (smult (inverse (poly q 0)) q) y) \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> constant (poly (smult (inverse (poly q 0)) q))
[PROOF STEP]
unfolding constant_def
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. poly (smult (inverse (poly q 0)) q) x = poly (smult (inverse (poly q 0)) q) y) \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> (\<forall>x y. poly (smult (inverse (poly q 0)) q) x = poly (smult (inverse (poly q 0)) q) y)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> constant (poly (smult (inverse (poly q 0)) q))

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from qr[rule_format, of 0] a00
[PROOF STATE]
proof (chain)
picking this:
poly q 0 = poly (smult (inverse (poly q 0)) q) 0 * poly q 0
poly q 0 \<noteq> 0
[PROOF STEP]
have r01: "poly ?r 0 = 1"
[PROOF STATE]
proof (prove)
using this:
poly q 0 = poly (smult (inverse (poly q 0)) q) 0 * poly q 0
poly q 0 \<noteq> 0

goal (1 subgoal):
 1. poly (smult (inverse (poly q 0)) q) 0 = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly (smult (inverse (poly q 0)) q) 0 = 1

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
have mrmq_eq: "cmod (poly ?r w) < 1 \<longleftrightarrow> cmod (poly q w) < cmod ?a0" for w
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
have "cmod (poly ?r w) < 1 \<longleftrightarrow> cmod (poly q w / ?a0) < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w / poly q 0) < 1)
[PROOF STEP]
using qr[rule_format, of w] a00
[PROOF STATE]
proof (prove)
using this:
poly q w = poly (smult (inverse (poly q 0)) q) w * poly q 0
poly q 0 \<noteq> 0

goal (1 subgoal):
 1. (cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w / poly q 0) < 1)
[PROOF STEP]
by (simp add: divide_inverse ac_simps)
[PROOF STATE]
proof (state)
this:
(cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w / poly q 0) < 1)

goal (1 subgoal):
 1. (cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w / poly q 0) < 1)

goal (1 subgoal):
 1. (cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> cmod (poly q w) < cmod ?a0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (poly q w / poly q 0) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
using a00
[PROOF STATE]
proof (prove)
using this:
poly q 0 \<noteq> 0

goal (1 subgoal):
 1. (cmod (poly q w / poly q 0) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
unfolding norm_divide
[PROOF STATE]
proof (prove)
using this:
poly q 0 \<noteq> 0

goal (1 subgoal):
 1. (cmod (poly q w) / cmod (poly q 0) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(cmod (poly q w / poly q 0) < 1) = (cmod (poly q w) < cmod (poly q 0))

goal (1 subgoal):
 1. (cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))

goal (1 subgoal):
 1. (cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(cmod (poly (smult (inverse (poly q 0)) q) w) < 1) = (cmod (poly q w) < cmod (poly q 0))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(cmod (poly (smult (inverse (poly q 0)) q) ?w) < 1) = (cmod (poly q ?w) < cmod (poly q 0))

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
from poly_decompose[OF rnc]
[PROOF STATE]
proof (chain)
picking this:
\<exists>k a qa. a \<noteq> 0 \<and> k \<noteq> 0 \<and> psize qa + k + 1 = psize (smult (inverse (poly q 0)) q) \<and> (\<forall>z. poly (smult (inverse (poly q 0)) q) z = poly (smult (inverse (poly q 0)) q) 0 + z ^ k * poly (pCons a qa) z)
[PROOF STEP]
obtain k a s where
      kas: "a \<noteq> 0" "k \<noteq> 0" "psize s + k + 1 = psize ?r"
        "\<forall>z. poly ?r z = poly ?r 0 + z^k* poly (pCons a s) z"
[PROOF STATE]
proof (prove)
using this:
\<exists>k a qa. a \<noteq> 0 \<and> k \<noteq> 0 \<and> psize qa + k + 1 = psize (smult (inverse (poly q 0)) q) \<and> (\<forall>z. poly (smult (inverse (poly q 0)) q) z = poly (smult (inverse (poly q 0)) q) 0 + z ^ k * poly (pCons a qa) z)

goal (1 subgoal):
 1. (\<And>a k s. \<lbrakk>a \<noteq> 0; k \<noteq> 0; psize s + k + 1 = psize (smult (inverse (poly q 0)) q); \<forall>z. poly (smult (inverse (poly q 0)) q) z = poly (smult (inverse (poly q 0)) q) 0 + z ^ k * poly (pCons a s) z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<noteq> 0
k \<noteq> 0
psize s + k + 1 = psize (smult (inverse (poly q 0)) q)
\<forall>z. poly (smult (inverse (poly q 0)) q) z = poly (smult (inverse (poly q 0)) q) 0 + z ^ k * poly (pCons a s) z

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
have "\<exists>w. cmod (poly ?r w) < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
proof (cases "psize p = k + 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. psize p = k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
 2. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
psize p = k + 1

goal (2 subgoals):
 1. psize p = k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
 2. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
with kas(3) lgqr[symmetric] q(1)
[PROOF STATE]
proof (chain)
picking this:
psize s + k + 1 = psize (smult (inverse (poly q 0)) q)
psize (smult (inverse (poly q 0)) q) = psize q
psize q = psize p
psize p = k + 1
[PROOF STEP]
have s0: "s = 0"
[PROOF STATE]
proof (prove)
using this:
psize s + k + 1 = psize (smult (inverse (poly q 0)) q)
psize (smult (inverse (poly q 0)) q) = psize q
psize q = psize p
psize p = k + 1

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

goal (2 subgoals):
 1. psize p = k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
 2. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have hth[symmetric]: "cmod (poly ?r w) = cmod (1 + a * w ^ k)" for w
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (poly (smult (inverse (poly q 0)) q) w) = cmod (1 + a * w ^ k)
[PROOF STEP]
using kas(4)[rule_format, of w] s0 r01
[PROOF STATE]
proof (prove)
using this:
poly (smult (inverse (poly q 0)) q) w = poly (smult (inverse (poly q 0)) q) 0 + w ^ k * poly (pCons a s) w
s = 0
poly (smult (inverse (poly q 0)) q) 0 = 1

goal (1 subgoal):
 1. cmod (poly (smult (inverse (poly q 0)) q) w) = cmod (1 + a * w ^ k)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
cmod (1 + a * ?w ^ k) = cmod (poly (smult (inverse (poly q 0)) q) ?w)

goal (2 subgoals):
 1. psize p = k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
 2. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from reduce_poly_simple[OF kas(1,2)]
[PROOF STATE]
proof (chain)
picking this:
\<exists>z. cmod (1 + a * z ^ k) < 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>z. cmod (1 + a * z ^ k) < 1

goal (1 subgoal):
 1. \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
unfolding hth
[PROOF STATE]
proof (prove)
using this:
\<exists>z. cmod (poly (smult (inverse (poly q 0)) q) z) < 1

goal (1 subgoal):
 1. \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
psize p \<noteq> k + 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
note kn = this
[PROOF STATE]
proof (state)
this:
psize p \<noteq> k + 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from kn kas(3) q(1) lgqr
[PROOF STATE]
proof (chain)
picking this:
psize p \<noteq> k + 1
psize s + k + 1 = psize (smult (inverse (poly q 0)) q)
psize q = psize p
psize q = psize (smult (inverse (poly q 0)) q)
[PROOF STEP]
have k1n: "k + 1 < psize p"
[PROOF STATE]
proof (prove)
using this:
psize p \<noteq> k + 1
psize s + k + 1 = psize (smult (inverse (poly q 0)) q)
psize q = psize p
psize q = psize (smult (inverse (poly q 0)) q)

goal (1 subgoal):
 1. k + 1 < psize p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k + 1 < psize p

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have th01: "\<not> constant (poly (pCons 1 (monom a (k - 1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> constant (poly (pCons 1 (monom a (k - 1))))
[PROOF STEP]
unfolding constant_def poly_pCons poly_monom
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>x y. 1 + x * (a * x ^ (k - 1)) = 1 + y * (a * y ^ (k - 1)))
[PROOF STEP]
using kas(1)
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. \<not> (\<forall>x y. 1 + x * (a * x ^ (k - 1)) = 1 + y * (a * y ^ (k - 1)))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> \<exists>x y. x * x ^ (k - Suc 0) \<noteq> y * y ^ (k - Suc 0)
[PROOF STEP]
apply (rule exI[where x=0])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> \<exists>y. 0 * 0 ^ (k - Suc 0) \<noteq> y * y ^ (k - Suc 0)
[PROOF STEP]
apply (rule exI[where x=1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> 0 * 0 ^ (k - Suc 0) \<noteq> 1 * 1 ^ (k - Suc 0)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<not> constant (poly (pCons 1 (monom a (k - 1))))

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from kas(1) kas(2)
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0
k \<noteq> 0
[PROOF STEP]
have th02: "k + 1 = psize (pCons 1 (monom a (k - 1)))"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
k \<noteq> 0

goal (1 subgoal):
 1. k + 1 = psize (pCons 1 (monom a (k - 1)))
[PROOF STEP]
by (simp add: psize_def degree_monom_eq)
[PROOF STATE]
proof (state)
this:
k + 1 = psize (pCons 1 (monom a (k - 1)))

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from less(1) [OF k1n [simplified th02] th01]
[PROOF STATE]
proof (chain)
picking this:
\<exists>z. poly (pCons 1 (monom a (k - 1))) z = 0
[PROOF STEP]
obtain w where w: "1 + w^k * a = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>z. poly (pCons 1 (monom a (k - 1))) z = 0

goal (1 subgoal):
 1. (\<And>w. 1 + w ^ k * a = 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding poly_pCons poly_monom
[PROOF STATE]
proof (prove)
using this:
\<exists>z. 1 + z * (a * z ^ (k - 1)) = 0

goal (1 subgoal):
 1. (\<And>w. 1 + w ^ k * a = 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using kas(2)
[PROOF STATE]
proof (prove)
using this:
\<exists>z. 1 + z * (a * z ^ (k - 1)) = 0
k \<noteq> 0

goal (1 subgoal):
 1. (\<And>w. 1 + w ^ k * a = 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases k) (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
1 + w ^ k * a = 0

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from poly_bound_exists[of "cmod w" s]
[PROOF STATE]
proof (chain)
picking this:
\<exists>m>0. \<forall>z. cmod z \<le> cmod w \<longrightarrow> cmod (poly s z) \<le> m
[PROOF STEP]
obtain m where
        m: "m > 0" "\<forall>z. cmod z \<le> cmod w \<longrightarrow> cmod (poly s z) \<le> m"
[PROOF STATE]
proof (prove)
using this:
\<exists>m>0. \<forall>z. cmod z \<le> cmod w \<longrightarrow> cmod (poly s z) \<le> m

goal (1 subgoal):
 1. (\<And>m. \<lbrakk>0 < m; \<forall>z. cmod z \<le> cmod w \<longrightarrow> cmod (poly s z) \<le> m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < m
\<forall>z. cmod z \<le> cmod w \<longrightarrow> cmod (poly s z) \<le> m

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have w0: "w \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<noteq> 0
[PROOF STEP]
using kas(2) w
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
1 + w ^ k * a = 0

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

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from w
[PROOF STATE]
proof (chain)
picking this:
1 + w ^ k * a = 0
[PROOF STEP]
have "(1 + w ^ k * a) - 1 = 0 - 1"
[PROOF STATE]
proof (prove)
using this:
1 + w ^ k * a = 0

goal (1 subgoal):
 1. 1 + w ^ k * a - 1 = 0 - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 + w ^ k * a - 1 = 0 - 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 + w ^ k * a - 1 = 0 - 1
[PROOF STEP]
have wm1: "w^k * a = - 1"
[PROOF STATE]
proof (prove)
using this:
1 + w ^ k * a - 1 = 0 - 1

goal (1 subgoal):
 1. w ^ k * a = - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
w ^ k * a = - 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have inv0: "0 < inverse (cmod w ^ (k + 1) * m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < inverse (cmod w ^ (k + 1) * m)
[PROOF STEP]
using norm_ge_zero[of w] w0 m(1)
[PROOF STATE]
proof (prove)
using this:
0 \<le> cmod w
w \<noteq> 0
0 < m

goal (1 subgoal):
 1. 0 < inverse (cmod w ^ (k + 1) * m)
[PROOF STEP]
by (simp add: inverse_eq_divide zero_less_mult_iff)
[PROOF STATE]
proof (state)
this:
0 < inverse (cmod w ^ (k + 1) * m)

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
with field_lbound_gt_zero[OF zero_less_one]
[PROOF STATE]
proof (chain)
picking this:
(0::?'a) < ?d2.0 \<Longrightarrow> \<exists>e>0::?'a. e < (1::?'a) \<and> e < ?d2.0
0 < inverse (cmod w ^ (k + 1) * m)
[PROOF STEP]
obtain t where
        t: "t > 0" "t < 1" "t < inverse (cmod w ^ (k + 1) * m)"
[PROOF STATE]
proof (prove)
using this:
(0::?'a) < ?d2.0 \<Longrightarrow> \<exists>e>0::?'a. e < (1::?'a) \<and> e < ?d2.0
0 < inverse (cmod w ^ (k + 1) * m)

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>0 < t; t < 1; t < inverse (cmod w ^ (k + 1) * m)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < t
t < 1
t < inverse (cmod w ^ (k + 1) * m)

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
let ?ct = "complex_of_real t"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
let ?w = "?ct * w"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have "1 + ?w^k * (a + ?w * poly s ?w) = 1 + ?ct^k * (w^k * a) + ?w^k * ?w * poly s ?w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w)) = 1 + complex_of_real t ^ k * (w ^ k * a) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)
[PROOF STEP]
using kas(1)
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. 1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w)) = 1 + complex_of_real t ^ k * (w ^ k * a) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)
[PROOF STEP]
by (simp add: algebra_simps power_mult_distrib)
[PROOF STATE]
proof (state)
this:
1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w)) = 1 + complex_of_real t ^ k * (w ^ k * a) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w)) = 1 + complex_of_real t ^ k * (w ^ k * a) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have "\<dots> = complex_of_real (1 - t^k) + ?w^k * ?w * poly s ?w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + complex_of_real t ^ k * (w ^ k * a) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w) = complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)
[PROOF STEP]
unfolding wm1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + complex_of_real t ^ k * - 1 + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w) = complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 + complex_of_real t ^ k * (w ^ k * a) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w) = complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w)) = complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)
[PROOF STEP]
have "cmod (1 + ?w^k * (a + ?w * poly s ?w)) =
        cmod (complex_of_real (1 - t^k) + ?w^k * ?w * poly s ?w)"
[PROOF STATE]
proof (prove)
using this:
1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w)) = complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)

goal (1 subgoal):
 1. cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) = cmod (complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) = cmod (complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
with norm_triangle_ineq[of "complex_of_real (1 - t^k)" "?w^k * ?w * poly s ?w"]
[PROOF STATE]
proof (chain)
picking this:
cmod (complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) \<le> cmod (complex_of_real (1 - t ^ k)) + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) = cmod (complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
[PROOF STEP]
have th11: "cmod (1 + ?w^k * (a + ?w * poly s ?w)) \<le> \<bar>1 - t^k\<bar> + cmod (?w^k * ?w * poly s ?w)"
[PROOF STATE]
proof (prove)
using this:
cmod (complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) \<le> cmod (complex_of_real (1 - t ^ k)) + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) = cmod (complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))

goal (1 subgoal):
 1. cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) \<le> \<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
[PROOF STEP]
unfolding norm_of_real
[PROOF STATE]
proof (prove)
using this:
cmod (complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) \<le> \<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) = cmod (complex_of_real (1 - t ^ k) + (complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))

goal (1 subgoal):
 1. cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) \<le> \<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) \<le> \<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have ath: "\<And>x t::real. 0 \<le> x \<Longrightarrow> x < t \<Longrightarrow> t \<le> 1 \<Longrightarrow> \<bar>1 - t\<bar> + x < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t. \<lbrakk>0 \<le> x; x < t; t \<le> 1\<rbrakk> \<Longrightarrow> \<bar>1 - t\<bar> + x < 1
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?x; ?x < ?t; ?t \<le> 1\<rbrakk> \<Longrightarrow> \<bar>1 - ?t\<bar> + ?x < 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have "t * cmod w \<le> 1 * cmod w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t * cmod w \<le> 1 * cmod w
[PROOF STEP]
apply (rule mult_mono)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. t \<le> 1
 2. cmod w \<le> cmod w
 3. 0 \<le> 1
 4. 0 \<le> cmod w
[PROOF STEP]
using t(1,2)
[PROOF STATE]
proof (prove)
using this:
0 < t
t < 1

goal (4 subgoals):
 1. t \<le> 1
 2. cmod w \<le> cmod w
 3. 0 \<le> 1
 4. 0 \<le> cmod w
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
t * cmod w \<le> 1 * cmod w

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t * cmod w \<le> 1 * cmod w
[PROOF STEP]
have tw: "cmod ?w \<le> cmod w"
[PROOF STATE]
proof (prove)
using this:
t * cmod w \<le> 1 * cmod w

goal (1 subgoal):
 1. cmod (complex_of_real t * w) \<le> cmod w
[PROOF STEP]
using t(1)
[PROOF STATE]
proof (prove)
using this:
t * cmod w \<le> 1 * cmod w
0 < t

goal (1 subgoal):
 1. cmod (complex_of_real t * w) \<le> cmod w
[PROOF STEP]
by (simp add: norm_mult)
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real t * w) \<le> cmod w

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from t inv0
[PROOF STATE]
proof (chain)
picking this:
0 < t
t < 1
t < inverse (cmod w ^ (k + 1) * m)
0 < inverse (cmod w ^ (k + 1) * m)
[PROOF STEP]
have "t * (cmod w ^ (k + 1) * m) < 1"
[PROOF STATE]
proof (prove)
using this:
0 < t
t < 1
t < inverse (cmod w ^ (k + 1) * m)
0 < inverse (cmod w ^ (k + 1) * m)

goal (1 subgoal):
 1. t * (cmod w ^ (k + 1) * m) < 1
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
t * (cmod w ^ (k + 1) * m) < 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
with zero_less_power[OF t(1), of k]
[PROOF STATE]
proof (chain)
picking this:
0 < t ^ k
t * (cmod w ^ (k + 1) * m) < 1
[PROOF STEP]
have th30: "t^k * (t* (cmod w ^ (k + 1) * m)) < t^k * 1"
[PROOF STATE]
proof (prove)
using this:
0 < t ^ k
t * (cmod w ^ (k + 1) * m) < 1

goal (1 subgoal):
 1. t ^ k * (t * (cmod w ^ (k + 1) * m)) < t ^ k * 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t ^ k * (t * (cmod w ^ (k + 1) * m)) < t ^ k * 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
have "cmod (?w^k * ?w * poly s ?w) = t^k * (t* (cmod w ^ (k + 1) * cmod (poly s ?w)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) = t ^ k * (t * (cmod w ^ (k + 1) * cmod (poly s (complex_of_real t * w))))
[PROOF STEP]
using w0 t(1)
[PROOF STATE]
proof (prove)
using this:
w \<noteq> 0
0 < t

goal (1 subgoal):
 1. cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) = t ^ k * (t * (cmod w ^ (k + 1) * cmod (poly s (complex_of_real t * w))))
[PROOF STEP]
by (simp add: algebra_simps power_mult_distrib norm_power norm_mult)
[PROOF STATE]
proof (state)
this:
cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) = t ^ k * (t * (cmod w ^ (k + 1) * cmod (poly s (complex_of_real t * w))))

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) = t ^ k * (t * (cmod w ^ (k + 1) * cmod (poly s (complex_of_real t * w))))
[PROOF STEP]
have "cmod (?w^k * ?w * poly s ?w) \<le> t^k * (t* (cmod w ^ (k + 1) * m))"
[PROOF STATE]
proof (prove)
using this:
cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) = t ^ k * (t * (cmod w ^ (k + 1) * cmod (poly s (complex_of_real t * w))))

goal (1 subgoal):
 1. cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) \<le> t ^ k * (t * (cmod w ^ (k + 1) * m))
[PROOF STEP]
using t(1,2) m(2)[rule_format, OF tw] w0
[PROOF STATE]
proof (prove)
using this:
cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) = t ^ k * (t * (cmod w ^ (k + 1) * cmod (poly s (complex_of_real t * w))))
0 < t
t < 1
cmod (poly s (complex_of_real t * w)) \<le> m
w \<noteq> 0

goal (1 subgoal):
 1. cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) \<le> t ^ k * (t * (cmod w ^ (k + 1) * m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) \<le> t ^ k * (t * (cmod w ^ (k + 1) * m))

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
with th30
[PROOF STATE]
proof (chain)
picking this:
t ^ k * (t * (cmod w ^ (k + 1) * m)) < t ^ k * 1
cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) \<le> t ^ k * (t * (cmod w ^ (k + 1) * m))
[PROOF STEP]
have th120: "cmod (?w^k * ?w * poly s ?w) < t^k"
[PROOF STATE]
proof (prove)
using this:
t ^ k * (t * (cmod w ^ (k + 1) * m)) < t ^ k * 1
cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) \<le> t ^ k * (t * (cmod w ^ (k + 1) * m))

goal (1 subgoal):
 1. cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) < t ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) < t ^ k

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from power_strict_mono[OF t(2), of k] t(1) kas(2)
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 \<le> t; 0 < k\<rbrakk> \<Longrightarrow> t ^ k < 1 ^ k
0 < t
k \<noteq> 0
[PROOF STEP]
have th121: "t^k \<le> 1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> t; 0 < k\<rbrakk> \<Longrightarrow> t ^ k < 1 ^ k
0 < t
k \<noteq> 0

goal (1 subgoal):
 1. t ^ k \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t ^ k \<le> 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from ath[OF norm_ge_zero[of "?w^k * ?w * poly s ?w"] th120 th121]
[PROOF STATE]
proof (chain)
picking this:
\<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) < 1
[PROOF STEP]
have th12: "\<bar>1 - t^k\<bar> + cmod (?w^k * ?w * poly s ?w) < 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) < 1

goal (1 subgoal):
 1. \<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) < 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) < 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
from th11 th12
[PROOF STATE]
proof (chain)
picking this:
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) \<le> \<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
\<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) < 1
[PROOF STEP]
have "cmod (1 + ?w^k * (a + ?w * poly s ?w)) < 1"
[PROOF STATE]
proof (prove)
using this:
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) \<le> \<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w))
\<bar>1 - t ^ k\<bar> + cmod ((complex_of_real t * w) ^ k * (complex_of_real t * w) * poly s (complex_of_real t * w)) < 1

goal (1 subgoal):
 1. cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) < 1
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) < 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) < 1
[PROOF STEP]
have "cmod (poly ?r ?w) < 1"
[PROOF STATE]
proof (prove)
using this:
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) < 1

goal (1 subgoal):
 1. cmod (poly (smult (inverse (poly q 0)) q) (complex_of_real t * w)) < 1
[PROOF STEP]
unfolding kas(4)[rule_format, of ?w] r01
[PROOF STATE]
proof (prove)
using this:
cmod (1 + (complex_of_real t * w) ^ k * (a + complex_of_real t * w * poly s (complex_of_real t * w))) < 1

goal (1 subgoal):
 1. cmod (1 + (complex_of_real t * w) ^ k * poly (pCons a s) (complex_of_real t * w)) < 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (poly (smult (inverse (poly q 0)) q) (complex_of_real t * w)) < 1

goal (1 subgoal):
 1. psize p \<noteq> k + 1 \<Longrightarrow> \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod (poly (smult (inverse (poly q 0)) q) (complex_of_real t * w)) < 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (poly (smult (inverse (poly q 0)) q) (complex_of_real t * w)) < 1

goal (1 subgoal):
 1. \<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1

goal (1 subgoal):
 1. poly p c \<noteq> 0 \<Longrightarrow> \<exists>z. poly p z = 0
[PROOF STEP]
with cq0 q(2)
[PROOF STATE]
proof (chain)
picking this:
\<forall>w. cmod (poly q 0) \<le> cmod (poly p w)
\<forall>x. poly q x = poly p (c + x)
\<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>w. cmod (poly q 0) \<le> cmod (poly p w)
\<forall>x. poly q x = poly p (c + x)
\<exists>w. cmod (poly (smult (inverse (poly q 0)) q) w) < 1

goal (1 subgoal):
 1. \<exists>z. poly p z = 0
[PROOF STEP]
unfolding mrmq_eq not_less[symmetric]
[PROOF STATE]
proof (prove)
using this:
\<forall>w. \<not> cmod (poly p w) < cmod (poly q 0)
\<forall>x. poly q x = poly p (c + x)
\<exists>w. cmod (poly q w) < cmod (poly q 0)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>z. poly p z = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Scons_Scons_eq [iff]: "(Scons M N = Scons M' N') = (M=M' \<and> N=N')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Scons M N = Scons M' N') = (M = M' \<and> N = N')
[PROOF STEP]
by (blast elim!: Scons_inject)


[STATEMENT]
lemma set_sublist_list_if: "\<And>xs. set (sublist_list_if xs ys) = {xs ! i |i. i < length xs \<and> i \<in> set ys}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. set (sublist_list_if xs ys) = {xs ! i |i. i < length xs \<and> i \<in> set ys}
[PROOF STEP]
apply (induct ys, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a ys xs. (\<And>xs. set (sublist_list_if xs ys) = {xs ! i |i. i < length xs \<and> i \<in> set ys}) \<Longrightarrow> (a < length xs \<longrightarrow> insert (xs ! a) {xs ! i |i. i < length xs \<and> i \<in> set ys} = {xs ! i |i. i < length xs \<and> (i = a \<or> i \<in> set ys)}) \<and> (\<not> a < length xs \<longrightarrow> {xs ! i |i. i < length xs \<and> i \<in> set ys} = {xs ! i |i. i < length xs \<and> (i = a \<or> i \<in> set ys)})
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem gcsort_count:
  assumes
    A: "index_less index key" and
    B: "length xs \<le> p"
  shows "count (mset (gcsort index key p xs)) x = count (mset xs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (mset (gcsort index key p xs)) x = count (mset xs) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count (mset (gcsort index key p xs)) x = count (mset xs) x
[PROOF STEP]
let ?t = "(0, [length xs], xs)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count (mset (gcsort index key p xs)) x = count (mset xs) x
[PROOF STEP]
have "count_inv (count (mset xs)) (gcsort_aux index key p ?t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_inv (count (mset xs)) (gcsort_aux index key p (0, [length xs], xs))
[PROOF STEP]
by (rule gcsort_count_inv [OF A _ B], rule gcsort_add_input,
     rule gcsort_aux_set, rule gcsort_count_input)
[PROOF STATE]
proof (state)
this:
count_inv (count (mset xs)) (gcsort_aux index key p (0, [length xs], xs))

goal (1 subgoal):
 1. count (mset (gcsort index key p xs)) x = count (mset xs) x
[PROOF STEP]
hence "count (mset (gcsort_out (gcsort_aux index key p ?t))) x =
    (count (mset xs)) x"
[PROOF STATE]
proof (prove)
using this:
count_inv (count (mset xs)) (gcsort_aux index key p (0, [length xs], xs))

goal (1 subgoal):
 1. count (mset (gcsort_out (gcsort_aux index key p (0, [length xs], xs)))) x = count (mset xs) x
[PROOF STEP]
by (rule gcsort_count_intro)
[PROOF STATE]
proof (state)
this:
count (mset (gcsort_out (gcsort_aux index key p (0, [length xs], xs)))) x = count (mset xs) x

goal (1 subgoal):
 1. count (mset (gcsort index key p xs)) x = count (mset xs) x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
count (mset (gcsort_out (gcsort_aux index key p (0, [length xs], xs)))) x = count (mset xs) x

goal (1 subgoal):
 1. count (mset (gcsort index key p xs)) x = count (mset xs) x
[PROOF STEP]
have "?t = gcsort_in xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0, [length xs], xs) = gcsort_in xs
[PROOF STEP]
by (simp add: gcsort_in_def)
[PROOF STATE]
proof (state)
this:
(0, [length xs], xs) = gcsort_in xs

goal (1 subgoal):
 1. count (mset (gcsort index key p xs)) x = count (mset xs) x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
count (mset (gcsort_out (gcsort_aux index key p (0, [length xs], xs)))) x = count (mset xs) x
(0, [length xs], xs) = gcsort_in xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count (mset (gcsort_out (gcsort_aux index key p (0, [length xs], xs)))) x = count (mset xs) x
(0, [length xs], xs) = gcsort_in xs

goal (1 subgoal):
 1. count (mset (gcsort index key p xs)) x = count (mset xs) x
[PROOF STEP]
by (simp add: gcsort_def)
[PROOF STATE]
proof (state)
this:
count (mset (gcsort index key p xs)) x = count (mset xs) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_minus_ln_floor_bound:
  assumes "x \<ge> 2"
  shows   "ln x - ln (floor x) \<in> {0..<1 / (x - 1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
2 \<le> x
[PROOF STEP]
have "ln (floor x) \<ge> ln (x - 1)"
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. ln (x - 1) \<le> ln (real_of_int \<lfloor>x\<rfloor>)
[PROOF STEP]
by (subst ln_le_cancel_iff) simp_all
[PROOF STATE]
proof (state)
this:
ln (x - 1) \<le> ln (real_of_int \<lfloor>x\<rfloor>)

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
hence "ln x - ln (floor x) \<le> ln ((x - 1) + 1) - ln (x - 1)"
[PROOF STATE]
proof (prove)
using this:
ln (x - 1) \<le> ln (real_of_int \<lfloor>x\<rfloor>)

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<le> ln (x - 1 + 1) - ln (x - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<le> ln (x - 1 + 1) - ln (x - 1)

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<le> ln (x - 1 + 1) - ln (x - 1)

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
2 \<le> x
[PROOF STEP]
have "\<dots> < 1 / (x - 1)"
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. ln (x - 1 + 1) - ln (x - 1) < 1 / (x - 1)
[PROOF STEP]
by (intro ln_diff_le_inverse) simp_all
[PROOF STATE]
proof (state)
this:
ln (x - 1 + 1) - ln (x - 1) < 1 / (x - 1)

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) < 1 / (x - 1)
[PROOF STEP]
have "ln x - ln (floor x) < 1 / (x - 1)"
[PROOF STATE]
proof (prove)
using this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) < 1 / (x - 1)

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) < 1 / (x - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) < 1 / (x - 1)

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) < 1 / (x - 1)

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
2 \<le> x
[PROOF STEP]
have "ln x \<ge> ln (of_int \<lfloor>x\<rfloor>)"
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. ln (real_of_int \<lfloor>x\<rfloor>) \<le> ln x
[PROOF STEP]
by (subst ln_le_cancel_iff) simp_all
[PROOF STATE]
proof (state)
this:
ln (real_of_int \<lfloor>x\<rfloor>) \<le> ln x

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) < 1 / (x - 1)
ln (real_of_int \<lfloor>x\<rfloor>) \<le> ln x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) < 1 / (x - 1)
ln (real_of_int \<lfloor>x\<rfloor>) \<le> ln x

goal (1 subgoal):
 1. ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln x - ln (real_of_int \<lfloor>x\<rfloor>) \<in> {0..<1 / (x - 1)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma c_pair_inj':
  "c_pair x1 y1 = c_pair x2 y2 \<longleftrightarrow> x1 = x2 \<and> y1 = y2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c_pair x1 y1 = c_pair x2 y2) = (x1 = x2 \<and> y1 = y2)
[PROOF STEP]
by (metis c_fst_of_c_pair c_snd_of_c_pair)


[STATEMENT]
lemma is_unifier_subst_atm_eqI:
  assumes "finite AA"
  shows "is_unifier \<sigma> AA \<Longrightarrow> A \<in> AA \<Longrightarrow> B \<in> AA \<Longrightarrow> A \<cdot>a \<sigma> = B \<cdot>a \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_unifier \<sigma> AA; A \<in> AA; B \<in> AA\<rbrakk> \<Longrightarrow> A \<cdot>a \<sigma> = B \<cdot>a \<sigma>
[PROOF STEP]
unfolding is_unifier_def subst_atms_def card_le_one_alt[OF finite_imageI[OF assms]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>A. A \<cdot>a \<sigma>) ` AA = {} \<or> (\<exists>x. (\<lambda>A. A \<cdot>a \<sigma>) ` AA = {x}); A \<in> AA; B \<in> AA\<rbrakk> \<Longrightarrow> A \<cdot>a \<sigma> = B \<cdot>a \<sigma>
[PROOF STEP]
by (metis equals0D imageI insert_iff)


[STATEMENT]
lemma ex_distrib[no_atp]: "(\<exists>x. P x \<or> Q x) \<longleftrightarrow> ((\<exists>x. P x) \<or> (\<exists>x. Q x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x \<or> Q x) = ((\<exists>x. P x) \<or> (\<exists>x. Q x))
[PROOF STEP]
by blast


[STATEMENT]
lemma elementary_reduction_App_iff:
    shows "is_App t \<Longrightarrow> elementary_reduction t \<longleftrightarrow>
                        (elementary_reduction (un_App1 t) \<and> ide (un_App2 t)) \<or>
                        (ide (un_App1 t) \<and> elementary_reduction (un_App2 t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_App t \<Longrightarrow> elementary_reduction t = (elementary_reduction (un_App1 t) \<and> ide (un_App2 t) \<or> ide (un_App1 t) \<and> elementary_reduction (un_App2 t))
[PROOF STEP]
using ide_char
[PROOF STATE]
proof (prove)
using this:
ide ?t = Ide ?t

goal (1 subgoal):
 1. is_App t \<Longrightarrow> elementary_reduction t = (elementary_reduction (un_App1 t) \<and> ide (un_App2 t) \<or> ide (un_App1 t) \<and> elementary_reduction (un_App2 t))
[PROOF STEP]
by (metis elementary_reduction.simps(4) lambda.collapse(3))


[STATEMENT]
theorem concat_cuts: "concat (cuts xs) = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (cuts xs) = xs
[PROOF STEP]
apply (induction xs rule: cuts.induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. (\<And>x xa y. \<lbrakk>xs \<noteq> []; x = take2 xs; (xa, y) = x\<rbrakk> \<Longrightarrow> concat (cuts y) = y) \<Longrightarrow> concat (cuts xs) = xs
[PROOF STEP]
apply (subst cuts.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. (\<And>x xa y. \<lbrakk>xs \<noteq> []; x = take2 xs; (xa, y) = x\<rbrakk> \<Longrightarrow> concat (cuts y) = y) \<Longrightarrow> concat (if xs = [] then [] else let (c, xs) = take2 xs in c # cuts xs) = xs
[PROOF STEP]
apply (auto simp: take2_def Let_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<And>a xa. \<lbrakk>a = Challenge1A.take xs; xa = Challenge1A.take xs\<rbrakk> \<Longrightarrow> concat (cuts (drop (length (Challenge1A.take xs)) xs)) = drop (length (Challenge1A.take xs)) xs; xs \<noteq> []\<rbrakk> \<Longrightarrow> Challenge1A.take xs @ drop (length (Challenge1A.take xs)) xs = xs
[PROOF STEP]
by (metis append_eq_conv_conj take_conc)


[STATEMENT]
lemma nonneg_cexprI:
    "(\<And>\<sigma>. \<sigma> \<in> space (state_measure V \<Gamma>) \<Longrightarrow> extract_real (cexpr_sem \<sigma> e) \<ge> 0) \<Longrightarrow> nonneg_cexpr V \<Gamma> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<sigma>. \<sigma> \<in> space (state_measure V \<Gamma>) \<Longrightarrow> 0 \<le> extract_real (cexpr_sem \<sigma> e)) \<Longrightarrow> nonneg_cexpr V \<Gamma> e
[PROOF STEP]
unfolding nonneg_cexpr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<sigma>. \<sigma> \<in> space (state_measure V \<Gamma>) \<Longrightarrow> 0 \<le> extract_real (cexpr_sem \<sigma> e)) \<Longrightarrow> \<forall>\<sigma>\<in>space (state_measure V \<Gamma>). 0 \<le> extract_real (cexpr_sem \<sigma> e)
[PROOF STEP]
by simp


[STATEMENT]
lemma compl_sup [simp]: "\<^bold>- (x \<squnion> y) = \<^bold>- x \<sqinter> \<^bold>- y" if "x \<in> carrier L" "y \<in> carrier L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>- (x \<squnion> y) = \<^bold>- x \<sqinter> \<^bold>- y
[PROOF STEP]
by (metis compl_closed compl_inf double_compl meet_closed that)


[STATEMENT]
lemma p_prod_assoc: "(X \<cdot> Y) \<cdot> Z = X \<cdot> (Y \<cdot> Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<cdot> Y \<cdot> Z = X \<cdot> (Y \<cdot> Z)
[PROOF STEP]
proof (rule set_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in> X \<cdot> Y \<cdot> Z) = (x \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
fix ps
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in> X \<cdot> Y \<cdot> Z) = (x \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
show "ps \<in> (X \<cdot> Y) \<cdot> Z \<longleftrightarrow> ps \<in> X \<cdot> (Y \<cdot> Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
proof (cases ps)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ps = [] \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
 2. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
ps = []

goal (2 subgoals):
 1. ps = [] \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
 2. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ps = []

goal (1 subgoal):
 1. (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
by auto (metis nonempty_p_fusion p_prod_iff)+
[PROOF STATE]
proof (state)
this:
(ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))

goal (1 subgoal):
 1. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
ps = a_ # list_

goal (1 subgoal):
 1. \<And>a list. ps = a # list \<Longrightarrow> (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ps = a_ # list_

goal (1 subgoal):
 1. (ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))
[PROOF STEP]
by (auto simp add: p_prod_iff) (metis (opaque_lifting, mono_tags) nonempty_p_fusion p_fusion_assoc p_fusion_hd p_fusion_last)+
[PROOF STATE]
proof (state)
this:
(ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(ps \<in> X \<cdot> Y \<cdot> Z) = (ps \<in> X \<cdot> (Y \<cdot> Z))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in mpt) birkhoff_sum_integral:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  assumes [measurable]: "integrable M f"
  shows "integrable M (birkhoff_sum f n)" "(\<integral>x. birkhoff_sum f n x \<partial>M) = n *\<^sub>R (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (birkhoff_sum f n) &&& integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable M (birkhoff_sum f n)
 2. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
have a: "\<And>k. integrable M (\<lambda>x. f((T^^k) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. integrable M (\<lambda>x. f ((T ^^ k) x))
[PROOF STEP]
using Tn_integral_preserving(1) assms
[PROOF STATE]
proof (prove)
using this:
integrable M ?f \<Longrightarrow> integrable M (\<lambda>x. ?f ((T ^^ ?n) x))
integrable M f

goal (1 subgoal):
 1. \<And>k. integrable M (\<lambda>x. f ((T ^^ k) x))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. f ((T ^^ ?k1) x))

goal (2 subgoals):
 1. integrable M (birkhoff_sum f n)
 2. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable M (\<lambda>x. f ((T ^^ ?k1) x))
[PROOF STEP]
have "integrable M (\<lambda>x. \<Sum>k\<in>{..<n}. f((T^^k) x))"
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. f ((T ^^ ?k1) x))

goal (1 subgoal):
 1. integrable M (\<lambda>x. \<Sum>k<n. f ((T ^^ k) x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. \<Sum>k<n. f ((T ^^ k) x))

goal (2 subgoals):
 1. integrable M (birkhoff_sum f n)
 2. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable M (\<lambda>x. \<Sum>k<n. f ((T ^^ k) x))
[PROOF STEP]
have "integrable M (\<lambda>x. birkhoff_sum f n x)"
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. \<Sum>k<n. f ((T ^^ k) x))

goal (1 subgoal):
 1. integrable M (birkhoff_sum f n)
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. \<Sum>k<n. f ((T ^^ k) x))

goal (1 subgoal):
 1. integrable M (\<lambda>x. \<Sum>i<n. f ((T ^^ i) x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M (birkhoff_sum f n)

goal (2 subgoals):
 1. integrable M (birkhoff_sum f n)
 2. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable M (birkhoff_sum f n)
[PROOF STEP]
show "integrable M (birkhoff_sum f n)"
[PROOF STATE]
proof (prove)
using this:
integrable M (birkhoff_sum f n)

goal (1 subgoal):
 1. integrable M (birkhoff_sum f n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integrable M (birkhoff_sum f n)

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
have b: "\<And>k. (\<integral>x. f((T^^k)x) \<partial>M) = (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. LINT x|M. f ((T ^^ k) x) = integral\<^sup>L M f
[PROOF STEP]
using Tn_integral_preserving(2) assms
[PROOF STATE]
proof (prove)
using this:
integrable M ?f \<Longrightarrow> LINT x|M. ?f ((T ^^ ?n) x) = integral\<^sup>L M ?f
integrable M f

goal (1 subgoal):
 1. \<And>k. LINT x|M. f ((T ^^ k) x) = integral\<^sup>L M f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
LINT x|M. f ((T ^^ ?k1) x) = integral\<^sup>L M f

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
have "(\<integral>x. birkhoff_sum f n x \<partial>M) = (\<integral>x. (\<Sum>k\<in>{..<n}. f((T^^k) x)) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = LINT x|M. (\<Sum>k<n. f ((T ^^ k) x))
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. (\<Sum>i<n. f ((T ^^ i) x)) = LINT x|M. (\<Sum>k<n. f ((T ^^ k) x))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M (birkhoff_sum f n) = LINT x|M. (\<Sum>k<n. f ((T ^^ k) x))

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M (birkhoff_sum f n) = LINT x|M. (\<Sum>k<n. f ((T ^^ k) x))

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
have "... = (\<Sum>k\<in>{..<n}. (\<integral>x. f((T^^k) x) \<partial>M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. (\<Sum>k<n. f ((T ^^ k) x)) = (\<Sum>k<n. LINT x|M. f ((T ^^ k) x))
[PROOF STEP]
by (rule Bochner_Integration.integral_sum, simp add: a)
[PROOF STATE]
proof (state)
this:
LINT x|M. (\<Sum>k<n. f ((T ^^ k) x)) = (\<Sum>k<n. LINT x|M. f ((T ^^ k) x))

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT x|M. (\<Sum>k<n. f ((T ^^ k) x)) = (\<Sum>k<n. LINT x|M. f ((T ^^ k) x))

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
have "... = (\<Sum>k\<in>{..<n}. (\<integral>x. f x \<partial>M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n. LINT x|M. f ((T ^^ k) x)) = (\<Sum>k<n. integral\<^sup>L M f)
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
LINT x|M. f ((T ^^ ?k1) x) = integral\<^sup>L M f

goal (1 subgoal):
 1. (\<Sum>k<n. LINT x|M. f ((T ^^ k) x)) = (\<Sum>k<n. integral\<^sup>L M f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n. LINT x|M. f ((T ^^ k) x)) = (\<Sum>k<n. integral\<^sup>L M f)

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n. LINT x|M. f ((T ^^ k) x)) = (\<Sum>k<n. integral\<^sup>L M f)

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
have "... = n *\<^sub>R (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n. integral\<^sup>L M f) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
by (simp add: sum_constant_scaleR)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n. integral\<^sup>L M f) = real n *\<^sub>R integral\<^sup>L M f

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
show "(\<integral>x. birkhoff_sum f n x \<partial>M) = n *\<^sub>R (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f

goal (1 subgoal):
 1. integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M (birkhoff_sum f n) = real n *\<^sub>R integral\<^sup>L M f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in domain) degree_one_roots:
  assumes "a \<in> carrier R" "a' \<in> carrier R" and "b \<in> carrier R" and "a \<otimes> a' = \<one>"
  shows "roots [ a , b ] = {# \<ominus> (a' \<otimes> b) #}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. roots [a, b] = {#\<ominus> (a' \<otimes> b)#}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. roots [a, b] = {#\<ominus> (a' \<otimes> b)#}
[PROOF STEP]
have "[ a, b ] \<in> carrier (poly_ring R)" and "[ \<one>, a' \<otimes> b ] \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a, b] \<in> carrier (poly_ring R) &&& [\<one>, a' \<otimes> b] \<in> carrier (poly_ring R)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
a' \<in> carrier R
b \<in> carrier R
a \<otimes> a' = \<one>

goal (1 subgoal):
 1. [a, b] \<in> carrier (poly_ring R) &&& [\<one>, a' \<otimes> b] \<in> carrier (poly_ring R)
[PROOF STEP]
unfolding sym[OF univ_poly_carrier] polynomial_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
a' \<in> carrier R
b \<in> carrier R
a \<otimes> a' = \<one>

goal (1 subgoal):
 1. [a, b] = [] \<or> set [a, b] \<subseteq> carrier R \<and> lead_coeff [a, b] \<noteq> \<zero> &&& [\<one>, a' \<otimes> b] = [] \<or> set [\<one>, a' \<otimes> b] \<subseteq> carrier R \<and> lead_coeff [\<one>, a' \<otimes> b] \<noteq> \<zero>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[a, b] \<in> carrier (poly_ring R)
[\<one>, a' \<otimes> b] \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. roots [a, b] = {#\<ominus> (a' \<otimes> b)#}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
[a, b] \<in> carrier (poly_ring R)
[\<one>, a' \<otimes> b] \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. roots [a, b] = {#\<ominus> (a' \<otimes> b)#}
[PROOF STEP]
using subring_degree_one_associatedI[OF carrier_is_subring assms] assms
          monic_degree_one_roots associated_polynomials_imp_same_roots
[PROOF STATE]
proof (prove)
using this:
[a, b] \<in> carrier (poly_ring R)
[\<one>, a' \<otimes> b] \<in> carrier (poly_ring R)
[a, b] \<sim>\<^bsub>poly_ring R\<^esub> [\<one>, a' \<otimes> b]
a \<in> carrier R
a' \<in> carrier R
b \<in> carrier R
a \<otimes> a' = \<one>
?a \<in> carrier R \<Longrightarrow> roots [\<one>, \<ominus> ?a] = {#?a#}
\<lbrakk>?p \<in> carrier (poly_ring R); ?q \<in> carrier (poly_ring R); ?p \<sim>\<^bsub>poly_ring R\<^esub> ?q\<rbrakk> \<Longrightarrow> roots ?p = roots ?q

goal (1 subgoal):
 1. roots [a, b] = {#\<ominus> (a' \<otimes> b)#}
[PROOF STEP]
by (metis add.inv_closed local.minus_minus m_closed)
[PROOF STATE]
proof (state)
this:
roots [a, b] = {#\<ominus> (a' \<otimes> b)#}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma last_message_hold_append': "
  last_message_hold (xs @ ys) =
  last_message_hold xs @ tl (last_message_hold (last_message xs # ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last_message_hold (xs @ ys) = last_message_hold xs @ tl (last_message_hold (last_message xs # ys))
[PROOF STEP]
apply (simp add: last_message_hold_append)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last_message_hold_init ys (last_message xs) = tl (last_message_hold (last_message xs # ys))
[PROOF STEP]
apply (simp add: last_message_hold_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma newton_seq_fact9:
  assumes "f\<bullet>(ns n) \<noteq>\<zero>"
  shows "val_Zp((ns (Suc n)) \<ominus> (ns n)) = val_Zp (f\<bullet>(ns n)) - val_Zp (f'\<bullet>(ns n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val_Zp (ns (Suc n) \<ominus> ns n) = val_Zp (f \<bullet> ns n) - val_Zp (f' \<bullet> ns n)
[PROOF STEP]
using newton_seq_fact7 val_of_divide newton_seq_fact6 assms nonzero_memI
        f_of_newton_seq_closed newton_seq_fact4 newton_seq_fact5
[PROOF STATE]
proof (prove)
using this:
ns (Suc ?n) \<ominus> ns ?n = \<ominus> local.divide (f \<bullet> ns ?n) (f' \<bullet> ns ?n)
\<lbrakk>?x \<in> carrier Zp; ?y \<in> nonzero Zp; val_Zp ?y \<le> val_Zp ?x\<rbrakk> \<Longrightarrow> val_Zp (local.divide ?x ?y) = val_Zp ?x - val_Zp ?y
f' \<bullet> ns ?l \<in> nonzero Zp
f \<bullet> ns n \<noteq> \<zero>
\<lbrakk>?a \<in> carrier Zp; ?a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> ?a \<in> nonzero Zp
f \<bullet> ns ?m \<in> carrier Zp
f \<bullet> ns ?l \<noteq> \<zero> \<Longrightarrow> val_Zp (f' \<bullet> ns ?l) \<le> val_Zp (f \<bullet> ns ?l)
local.divide (f \<bullet> ns ?l) (f' \<bullet> ns ?l) \<in> carrier Zp

goal (1 subgoal):
 1. val_Zp (ns (Suc n) \<ominus> ns n) = val_Zp (f \<bullet> ns n) - val_Zp (f' \<bullet> ns n)
[PROOF STEP]
by (metis val_Zp_of_minus)


[STATEMENT]
lemma vint_plus_closed:
  assumes "x \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>" and "y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>"
  shows "x +\<^sub>\<int> y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x +\<^sub>\<int> y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x +\<^sub>\<int> y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>
[PROOF STEP]
have "x' + y' \<in> UNIV" for x' y' :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x' + y' \<in> UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?x' + ?y' \<in> UNIV

goal (1 subgoal):
 1. x +\<^sub>\<int> y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>
[PROOF STEP]
from this[untransferred, OF assms]
[PROOF STATE]
proof (chain)
picking this:
x +\<^sub>\<int> y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x +\<^sub>\<int> y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>

goal (1 subgoal):
 1. x +\<^sub>\<int> y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x +\<^sub>\<int> y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subcocycle_avg_ereal_max:
  assumes "subcocycle u" "subcocycle v"
  shows "subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x)) \<ge> max (subcocycle_avg_ereal u) (subcocycle_avg_ereal v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (subcocycle_avg_ereal u) (subcocycle_avg_ereal v) \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
 2. subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
have int: "integrable M (u n)" "integrable M (v n)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (u n) &&& integrable M (v n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subcocycle u
subcocycle v

goal (1 subgoal):
 1. integrable M (u n) &&& integrable M (v n)
[PROOF STEP]
unfolding subcocycle_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>n. integrable M (u n)) \<and> (\<forall>n m x. u (n + m) x \<le> u n x + u m ((T ^^ n) x))
(\<forall>n. integrable M (v n)) \<and> (\<forall>n m x. v (n + m) x \<le> v n x + v m ((T ^^ n) x))

goal (1 subgoal):
 1. integrable M (u n) &&& integrable M (v n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M (u ?n3)
integrable M (v ?n3)

goal (2 subgoals):
 1. subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
 2. subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
have int2: "integrable M (\<lambda>x. max (u n x) (v n x))" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. max (u n x) (v n x))
[PROOF STEP]
using integrable_max int
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable ?M ?f; integrable ?M ?g\<rbrakk> \<Longrightarrow> integrable ?M (\<lambda>x. max (?f x) (?g x))
integrable M (u ?n3)
integrable M (v ?n3)

goal (1 subgoal):
 1. integrable M (\<lambda>x. max (u n x) (v n x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. max (u ?n3 x) (v ?n3 x))

goal (2 subgoals):
 1. subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
 2. subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
have "(\<integral>x. u n x / n \<partial>M) \<le> (\<integral>x. max (u n x) (v n x) / n \<partial>M)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. u n x / real n \<le> LINT x|M. max (u n x) (v n x) / real n
[PROOF STEP]
apply (rule integral_mono)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. integrable M (\<lambda>x. u n x / real n)
 2. integrable M (\<lambda>x. max (u n x) (v n x) / real n)
 3. \<And>x. x \<in> space M \<Longrightarrow> u n x / real n \<le> max (u n x) (v n x) / real n
[PROOF STEP]
using int int2
[PROOF STATE]
proof (prove)
using this:
integrable M (u ?n3)
integrable M (v ?n3)
integrable M (\<lambda>x. max (u ?n3 x) (v ?n3 x))

goal (3 subgoals):
 1. integrable M (\<lambda>x. u n x / real n)
 2. integrable M (\<lambda>x. max (u n x) (v n x) / real n)
 3. \<And>x. x \<in> space M \<Longrightarrow> u n x / real n \<le> max (u n x) (v n x) / real n
[PROOF STEP]
by (auto simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
LINT x|M. u ?n3 x / real ?n3 \<le> LINT x|M. max (u ?n3 x) (v ?n3 x) / real ?n3

goal (2 subgoals):
 1. subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
 2. subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LINT x|M. u ?n3 x / real ?n3 \<le> LINT x|M. max (u ?n3 x) (v ?n3 x) / real ?n3
[PROOF STEP]
show "subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))"
[PROOF STATE]
proof (prove)
using this:
LINT x|M. u ?n3 x / real ?n3 \<le> LINT x|M. max (u ?n3 x) (v ?n3 x) / real ?n3

goal (1 subgoal):
 1. subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
using LIMSEQ_le[OF subcocycle_int_tendsto_avg_ereal[OF assms(1)]
          subcocycle_int_tendsto_avg_ereal[OF subcocycle_max[OF assms]]]
[PROOF STATE]
proof (prove)
using this:
LINT x|M. u ?n3 x / real ?n3 \<le> LINT x|M. max (u ?n3 x) (v ?n3 x) / real ?n3
\<exists>N. \<forall>n\<ge>N. ereal (LINT x|M. u n x / real n) \<le> ereal (LINT x|M. max (u n x) (v n x) / real n) \<Longrightarrow> subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))

goal (1 subgoal):
 1. subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subcocycle_avg_ereal u \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))

goal (1 subgoal):
 1. subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
have "(\<integral>x. v n x / n \<partial>M) \<le> (\<integral>x. max (u n x) (v n x) / n \<partial>M)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. v n x / real n \<le> LINT x|M. max (u n x) (v n x) / real n
[PROOF STEP]
apply (rule integral_mono)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. integrable M (\<lambda>x. v n x / real n)
 2. integrable M (\<lambda>x. max (u n x) (v n x) / real n)
 3. \<And>x. x \<in> space M \<Longrightarrow> v n x / real n \<le> max (u n x) (v n x) / real n
[PROOF STEP]
using int int2
[PROOF STATE]
proof (prove)
using this:
integrable M (u ?n3)
integrable M (v ?n3)
integrable M (\<lambda>x. max (u ?n3 x) (v ?n3 x))

goal (3 subgoals):
 1. integrable M (\<lambda>x. v n x / real n)
 2. integrable M (\<lambda>x. max (u n x) (v n x) / real n)
 3. \<And>x. x \<in> space M \<Longrightarrow> v n x / real n \<le> max (u n x) (v n x) / real n
[PROOF STEP]
by (auto simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
LINT x|M. v ?n3 x / real ?n3 \<le> LINT x|M. max (u ?n3 x) (v ?n3 x) / real ?n3

goal (1 subgoal):
 1. subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LINT x|M. v ?n3 x / real ?n3 \<le> LINT x|M. max (u ?n3 x) (v ?n3 x) / real ?n3
[PROOF STEP]
show "subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))"
[PROOF STATE]
proof (prove)
using this:
LINT x|M. v ?n3 x / real ?n3 \<le> LINT x|M. max (u ?n3 x) (v ?n3 x) / real ?n3

goal (1 subgoal):
 1. subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
using LIMSEQ_le[OF subcocycle_int_tendsto_avg_ereal[OF assms(2)]
          subcocycle_int_tendsto_avg_ereal[OF subcocycle_max[OF assms]]]
[PROOF STATE]
proof (prove)
using this:
LINT x|M. v ?n3 x / real ?n3 \<le> LINT x|M. max (u ?n3 x) (v ?n3 x) / real ?n3
\<exists>N. \<forall>n\<ge>N. ereal (LINT x|M. v n x / real n) \<le> ereal (LINT x|M. max (u n x) (v n x) / real n) \<Longrightarrow> subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))

goal (1 subgoal):
 1. subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subcocycle_avg_ereal v \<le> subcocycle_avg_ereal (\<lambda>n x. max (u n x) (v n x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem factor_composition [simp]:
  "\<lbrakk> g \<in> G; h \<in> G \<rbrakk> \<Longrightarrow> (g \<cdot>| K) [\<cdot>] (h \<cdot>| K) = g \<cdot> h \<cdot>| K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> G; h \<in> G\<rbrakk> \<Longrightarrow> g \<cdot>| K [\<cdot>] (h \<cdot>| K) = g \<cdot> h \<cdot>| K
[PROOF STEP]
using Class_commutes_with_composition Class_is_Left_Coset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> G; ?b \<in> G\<rbrakk> \<Longrightarrow> Class ?a [\<cdot>] Class ?b = Class (?a \<cdot> ?b)
?g \<in> G \<Longrightarrow> Class ?g = ?g \<cdot>| K

goal (1 subgoal):
 1. \<lbrakk>g \<in> G; h \<in> G\<rbrakk> \<Longrightarrow> g \<cdot>| K [\<cdot>] (h \<cdot>| K) = g \<cdot> h \<cdot>| K
[PROOF STEP]
by auto


[STATEMENT]
lemma mirror_elem_Min: "
  \<lbrakk> finite I; I \<noteq> {} \<rbrakk> \<Longrightarrow> mirror_elem (iMin I) I = Max I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> mirror_elem (iMin I) I = Max I
[PROOF STEP]
unfolding mirror_elem_def nat_mirror_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> iMin I + Max I - iMin I = Max I
[PROOF STEP]
by simp


[STATEMENT]
lemma le_left_combine_matrix:
  assumes
  "f 0 0 = 0"
  "\<forall>a b c. a <= b \<longrightarrow> f c a <= f c b"
  "A <= B"
  shows
  "combine_matrix f C A <= combine_matrix f C B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. combine_matrix f C A \<le> combine_matrix f C B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f (0::'b) (0::'c) = (0::'a)
\<forall>a b c. a \<le> b \<longrightarrow> f c a \<le> f c b
A \<le> B

goal (1 subgoal):
 1. combine_matrix f C A \<le> combine_matrix f C B
[PROOF STEP]
by (simp add: le_matrix_def)


[STATEMENT]
lemma finite_nat_iff_bounded_le: "finite S \<longleftrightarrow> (\<exists>k. S \<subseteq> {.. k})"
  for S :: "nat set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S = (\<exists>k. S \<subseteq> {..k})
[PROOF STEP]
using infinite_nat_iff_unbounded[of S]
[PROOF STATE]
proof (prove)
using this:
infinite S = (\<forall>m. \<exists>n>m. n \<in> S)

goal (1 subgoal):
 1. finite S = (\<exists>k. S \<subseteq> {..k})
[PROOF STEP]
by (simp add: subset_eq) (metis not_le)


[STATEMENT]
lemma fds_deriv_zeta:
  "fds_deriv fds_zeta =
     -fds mangoldt * (fds_zeta :: 'a :: {comm_semiring_1,real_algebra_1} fds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_deriv fds_zeta = - fds mangoldt * fds_zeta
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fds_deriv fds_zeta = - fds mangoldt * fds_zeta
[PROOF STEP]
have "completely_multiplicative_function (\<lambda>n. if n = 0 then 0 else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. if n = 0 then 0::'b else (1::'b))
[PROOF STEP]
by standard simp_all
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (\<lambda>n. if n = 0 then 0::?'b1 else (1::?'b1))

goal (1 subgoal):
 1. fds_deriv fds_zeta = - fds mangoldt * fds_zeta
[PROOF STEP]
from completely_multiplicative_fds_deriv [OF this, folded fds_zeta_altdef]
[PROOF STATE]
proof (chain)
picking this:
fds_deriv fds_zeta = - fds (\<lambda>n. (if n = 0 then 0::?'a else (1::?'a)) * mangoldt n) * fds_zeta
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fds_deriv fds_zeta = - fds (\<lambda>n. (if n = 0 then 0::?'a else (1::?'a)) * mangoldt n) * fds_zeta

goal (1 subgoal):
 1. fds_deriv fds_zeta = - fds mangoldt * fds_zeta
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fds_deriv fds_zeta = - fds mangoldt * fds_zeta

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma algebraic_1[simp]: "algebraic 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic (1::'a)
[PROOF STEP]
unfolding algebraic_altdef_ipoly
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. ipoly p (1::'a) = (0::'a) \<and> p \<noteq> 0
[PROOF STEP]
by (intro exI[of _ "[:-1,1:]"], auto)


[STATEMENT]
lemma lfp_lowerbound:
  "\<lbrakk> a \<in> L;  f a \<le> a \<rbrakk> \<Longrightarrow> lfp f \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> L; f a \<le> a\<rbrakk> \<Longrightarrow> local.lfp f \<le> a
[PROOF STEP]
by (auto simp add: lfp_def intro: Glb_lower)