[STATEMENT]
lemma sqr_rat_of_int: assumes x: "x * x = rat_of_int i"
  shows "\<exists> j :: int. j * j = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>j. j * j = i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>j. j * j = i
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x * x = rat_of_int i
[PROOF STEP]
have mem: "x \<in> set (sqrt_rat (rat_of_int i))"
[PROOF STATE]
proof (prove)
using this:
x * x = rat_of_int i

goal (1 subgoal):
 1. x \<in> set (sqrt_rat (rat_of_int i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> set (sqrt_rat (rat_of_int i))

goal (1 subgoal):
 1. \<exists>j. j * j = i
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x * x = rat_of_int i
[PROOF STEP]
have "rat_of_int i \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
x * x = rat_of_int i

goal (1 subgoal):
 1. 0 \<le> rat_of_int i
[PROOF STEP]
by (metis zero_le_square)
[PROOF STATE]
proof (state)
this:
0 \<le> rat_of_int i

goal (1 subgoal):
 1. \<exists>j. j * j = i
[PROOF STEP]
hence *: "quotient_of (rat_of_int i) = (i,1)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> rat_of_int i

goal (1 subgoal):
 1. quotient_of (rat_of_int i) = (i, 1)
[PROOF STEP]
by (metis quotient_of_int)
[PROOF STATE]
proof (state)
this:
quotient_of (rat_of_int i) = (i, 1)

goal (1 subgoal):
 1. \<exists>j. j * j = i
[PROOF STEP]
have 1: "sqrt_int 1 = [1,-1]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt_int 1 = [1, - 1]
[PROOF STEP]
by code_simp
[PROOF STATE]
proof (state)
this:
sqrt_int 1 = [1, - 1]

goal (1 subgoal):
 1. \<exists>j. j * j = i
[PROOF STEP]
from mem sqrt_rat_code * split 1
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (sqrt_rat (rat_of_int i))
sqrt_rat ?x = (case quotient_of ?x of (z, n) \<Rightarrow> case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z))
quotient_of (rat_of_int i) = (i, 1)
(case (?a, ?b) of (c, d) \<Rightarrow> ?f c d) = ?f ?a ?b
sqrt_int 1 = [1, - 1]
[PROOF STEP]
have x: "x \<in> rat_of_int ` {y. y * y = i}"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (sqrt_rat (rat_of_int i))
sqrt_rat ?x = (case quotient_of ?x of (z, n) \<Rightarrow> case sqrt_int n of [] \<Rightarrow> [] | sn # xs \<Rightarrow> map (\<lambda>sz. rat_of_int sz / rat_of_int sn) (sqrt_int z))
quotient_of (rat_of_int i) = (i, 1)
(case (?a, ?b) of (c, d) \<Rightarrow> ?f c d) = ?f ?a ?b
sqrt_int 1 = [1, - 1]

goal (1 subgoal):
 1. x \<in> rat_of_int ` {y. y * y = i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> rat_of_int ` {y. y * y = i}

goal (1 subgoal):
 1. \<exists>j. j * j = i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> rat_of_int ` {y. y * y = i}

goal (1 subgoal):
 1. \<exists>j. j * j = i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>j. j * j = i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rep_one_matrix[simp]: "Rep_matrix (one_matrix n) j i = (if (j = i & j < n) then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (one_matrix n) j i = (if j = i \<and> j < n then 1::'a else (0::'a))
[PROOF STEP]
apply (simp add: one_matrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j = i \<and> j < n \<longrightarrow> Rep_matrix (Abs_matrix (\<lambda>j i. if j = i \<and> j < n then 1::'a else (0::'a))) i i = (1::'a)) \<and> ((j = i \<longrightarrow> \<not> i < n) \<longrightarrow> Rep_matrix (Abs_matrix (\<lambda>j i. if j = i \<and> j < n then 1::'a else (0::'a))) j i = (0::'a))
[PROOF STEP]
apply (simplesubst RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<exists>m. \<forall>j i. m \<le> j \<longrightarrow> (if j = i \<and> j < n then 1::'a else (0::'a)) = (0::'a)
 2. \<exists>na. \<forall>j i. na \<le> i \<longrightarrow> (if j = i \<and> j < n then 1::'a else (0::'a)) = (0::'a)
 3. (j = i \<and> j < n \<longrightarrow> (if i = i \<and> i < n then 1::'a else (0::'a)) = (1::'a)) \<and> ((j = i \<longrightarrow> \<not> i < n) \<longrightarrow> (if j = i \<and> j < n then 1::'a else (0::'a)) = (0::'a))
[PROOF STEP]
apply (rule exI[of _ n], simp add: if_split)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j = i \<and> j < n \<longrightarrow> (if i = i \<and> i < n then 1::'a else (0::'a)) = (1::'a)) \<and> ((j = i \<longrightarrow> \<not> i < n) \<longrightarrow> (if j = i \<and> j < n then 1::'a else (0::'a)) = (0::'a))
[PROOF STEP]
by (simp add: if_split)


[STATEMENT]
lemma remove_nth_length :
  assumes n_bd: "n < length xs"
  shows "length (remove_nth n xs) = length xs - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (remove_nth n xs) = length xs - 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (remove_nth n xs) = length xs - 1
[PROOF STEP]
from length_take
[PROOF STATE]
proof (chain)
picking this:
length (take ?n ?xs) = min (length ?xs) ?n
[PROOF STEP]
have ll:"n < length xs \<longrightarrow> length (take n xs) = n"
[PROOF STATE]
proof (prove)
using this:
length (take ?n ?xs) = min (length ?xs) ?n

goal (1 subgoal):
 1. n < length xs \<longrightarrow> length (take n xs) = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n < length xs \<longrightarrow> length (take n xs) = n

goal (1 subgoal):
 1. length (remove_nth n xs) = length xs - 1
[PROOF STEP]
from length_drop
[PROOF STATE]
proof (chain)
picking this:
length (drop ?n ?xs) = length ?xs - ?n
[PROOF STEP]
have lr: "length (drop (Suc n) xs) = length xs - (Suc n)"
[PROOF STATE]
proof (prove)
using this:
length (drop ?n ?xs) = length ?xs - ?n

goal (1 subgoal):
 1. length (drop (Suc n) xs) = length xs - Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (drop (Suc n) xs) = length xs - Suc n

goal (1 subgoal):
 1. length (remove_nth n xs) = length xs - 1
[PROOF STEP]
from ll and lr and length_append and n_bd
[PROOF STATE]
proof (chain)
picking this:
n < length xs \<longrightarrow> length (take n xs) = n
length (drop (Suc n) xs) = length xs - Suc n
length (?xs @ ?ys) = length ?xs + length ?ys
n < length xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n < length xs \<longrightarrow> length (take n xs) = n
length (drop (Suc n) xs) = length xs - Suc n
length (?xs @ ?ys) = length ?xs + length ?ys
n < length xs

goal (1 subgoal):
 1. length (remove_nth n xs) = length xs - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (remove_nth n xs) = length xs - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma qp_ineq: "int p * k \<le> (int p * int q - 1) div 2 \<longleftrightarrow> k \<le> (int q - 1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int p * k \<le> (int p * int q - 1) div 2) = (k \<le> (int q - 1) div 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (int p * k \<le> (int p * int q - 1) div 2) = (k \<le> (int q - 1) div 2)
[PROOF STEP]
have "2 * int p * k \<le> int p * int q - 1 \<longleftrightarrow> 2 * k \<le> int q - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 * int p * k \<le> int p * int q - 1) = (2 * k \<le> int q - 1)
[PROOF STEP]
using p_ge_0
[PROOF STATE]
proof (prove)
using this:
0 < int p

goal (1 subgoal):
 1. (2 * int p * k \<le> int p * int q - 1) = (2 * k \<le> int q - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(2 * int p * k \<le> int p * int q - 1) = (2 * k \<le> int q - 1)

goal (1 subgoal):
 1. (int p * k \<le> (int p * int q - 1) div 2) = (k \<le> (int q - 1) div 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(2 * int p * k \<le> int p * int q - 1) = (2 * k \<le> int q - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(2 * int p * k \<le> int p * int q - 1) = (2 * k \<le> int q - 1)

goal (1 subgoal):
 1. (int p * k \<le> (int p * int q - 1) div 2) = (k \<le> (int q - 1) div 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(int p * k \<le> (int p * int q - 1) div 2) = (k \<le> (int q - 1) div 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scaling_mono:
  assumes "u \<le> v" and "0 \<le> r" and "r \<le> s"
  shows "u + r * (v - u) / s \<le> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
have "r/s \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r / s \<le> (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<le> v
(0::'a) \<le> r
r \<le> s

goal (1 subgoal):
 1. r / s \<le> (1::'a)
[PROOF STEP]
by (metis local.divide_le_eq_1_pos local.division_ring_divide_zero
        local.dual_order.order_iff_strict local.dual_order.trans local.zero_less_one)
[PROOF STATE]
proof (state)
this:
r / s \<le> (1::'a)

goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
hence "(r/s) * (v - u) \<le> 1 * (v - u)"
[PROOF STATE]
proof (prove)
using this:
r / s \<le> (1::'a)

goal (1 subgoal):
 1. r / s * (v - u) \<le> (1::'a) * (v - u)
[PROOF STEP]
using assms(1) local.diff_ge_0_iff_ge local.mult_right_mono
[PROOF STATE]
proof (prove)
using this:
r / s \<le> (1::'a)
u \<le> v
((0::'a) \<le> ?a - ?b) = (?b \<le> ?a)
\<lbrakk>?a \<le> ?b; (0::'a) \<le> ?c\<rbrakk> \<Longrightarrow> ?a * ?c \<le> ?b * ?c

goal (1 subgoal):
 1. r / s * (v - u) \<le> (1::'a) * (v - u)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r / s * (v - u) \<le> (1::'a) * (v - u)

goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r / s * (v - u) \<le> (1::'a) * (v - u)

goal (1 subgoal):
 1. u + r * (v - u) / s \<le> v
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
u + r * (v - u) / s \<le> v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transition_subset_path :
  assumes "transitions A \<subseteq> transitions B"
  and "path A q p"
  and "q \<in> states B"
shows "path B q p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path B q p
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
path A q p

goal (1 subgoal):
 1. path B q p
[PROOF STEP]
proof (induction p rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. path A q [] \<Longrightarrow> path B q []
 2. \<And>x xs. \<lbrakk>path A q xs \<Longrightarrow> path B q xs; path A q (xs @ [x])\<rbrakk> \<Longrightarrow> path B q (xs @ [x])
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
path A q []

goal (2 subgoals):
 1. path A q [] \<Longrightarrow> path B q []
 2. \<And>x xs. \<lbrakk>path A q xs \<Longrightarrow> path B q xs; path A q (xs @ [x])\<rbrakk> \<Longrightarrow> path B q (xs @ [x])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path B q []
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
q \<in> FSM.states B

goal (1 subgoal):
 1. path B q []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path B q []

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path A q xs \<Longrightarrow> path B q xs; path A q (xs @ [x])\<rbrakk> \<Longrightarrow> path B q (xs @ [x])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path A q xs \<Longrightarrow> path B q xs; path A q (xs @ [x])\<rbrakk> \<Longrightarrow> path B q (xs @ [x])
[PROOF STEP]
case (snoc t p)
[PROOF STATE]
proof (state)
this:
path A q p \<Longrightarrow> path B q p
path A q (p @ [t])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>path A q xs \<Longrightarrow> path B q xs; path A q (xs @ [x])\<rbrakk> \<Longrightarrow> path B q (xs @ [x])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path A q p \<Longrightarrow> path B q p
path A q (p @ [t])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
path A q p \<Longrightarrow> path B q p
path A q (p @ [t])

goal (1 subgoal):
 1. path B q (p @ [t])
[PROOF STEP]
using assms(1) path_suffix
[PROOF STATE]
proof (prove)
using this:
path A q p \<Longrightarrow> path B q p
path A q (p @ [t])
FSM.transitions A \<subseteq> FSM.transitions B
path ?M ?q (?p1.0 @ ?p2.0) \<Longrightarrow> path ?M (target ?q ?p1.0) ?p2.0

goal (1 subgoal):
 1. path B q (p @ [t])
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
path B q (p @ [t])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_cong_2143:
  assumes "\<not> Cong A B C D"
  shows "\<not> Cong B A D C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> Cong B A D C
[PROOF STEP]
using assms cong_commutativity
[PROOF STATE]
proof (prove)
using this:
\<not> Cong A B C D
Cong ?A ?B ?C ?D \<Longrightarrow> Cong ?B ?A ?D ?C

goal (1 subgoal):
 1. \<not> Cong B A D C
[PROOF STEP]
by blast


[STATEMENT]
lemma arg_complex_of_real_times_i_positive [simp]:
  assumes "k > 0"
  shows "Arg (cor k * \<i>) = pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (cor k * \<i>) = pi / 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Arg (cor k * \<i>) = pi / 2
[PROOF STEP]
have "sin (Arg (Complex 0 k)) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sin (Arg (Complex 0 k))
[PROOF STEP]
using \<open>k > 0\<close> rcis_cmod_Arg[of "Complex 0 k"] Im_rcis[of "cmod (Complex 0 k)" "Arg (Complex 0 k)"]
[PROOF STATE]
proof (prove)
using this:
0 < k
rcis (cmod (Complex 0 k)) (Arg (Complex 0 k)) = Complex 0 k
Im (rcis (cmod (Complex 0 k)) (Arg (Complex 0 k))) = cmod (Complex 0 k) * sin (Arg (Complex 0 k))

goal (1 subgoal):
 1. 0 < sin (Arg (Complex 0 k))
[PROOF STEP]
by (smt complex.sel(2) mult_nonneg_nonpos norm_ge_zero)
[PROOF STATE]
proof (state)
this:
0 < sin (Arg (Complex 0 k))

goal (1 subgoal):
 1. Arg (cor k * \<i>) = pi / 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < sin (Arg (Complex 0 k))

goal (1 subgoal):
 1. Arg (cor k * \<i>) = pi / 2
[PROOF STEP]
using assms is_imag_arg2[of "cor k * \<i>"]
[PROOF STATE]
proof (prove)
using this:
0 < sin (Arg (Complex 0 k))
0 < k
\<lbrakk>is_imag (cor k * \<i>); cor k * \<i> \<noteq> 0\<rbrakk> \<Longrightarrow> Arg (cor k * \<i>) = pi / 2 \<or> Arg (cor k * \<i>) = - pi / 2

goal (1 subgoal):
 1. Arg (cor k * \<i>) = pi / 2
[PROOF STEP]
using Arg_zero complex_of_real_i
[PROOF STATE]
proof (prove)
using this:
0 < sin (Arg (Complex 0 k))
0 < k
\<lbrakk>is_imag (cor k * \<i>); cor k * \<i> \<noteq> 0\<rbrakk> \<Longrightarrow> Arg (cor k * \<i>) = pi / 2 \<or> Arg (cor k * \<i>) = - pi / 2
Arg 0 = 0
cor ?r * \<i> = Complex 0 ?r

goal (1 subgoal):
 1. Arg (cor k * \<i>) = pi / 2
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Arg (cor k * \<i>) = pi / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in finite_field) card_irred_gt_2:
  assumes "n > 2"
  shows "real (order R)^n / (2*real n) \<le>
    card {f. monic_irreducible_poly R f \<and> degree f = n}"
    (is "?lhs \<le> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
let ?m = "real (order R)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have a:"?m \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> real (order R)
[PROOF STEP]
using finite_field_min_order
[PROOF STATE]
proof (prove)
using this:
1 < order R

goal (1 subgoal):
 1. 2 \<le> real (order R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 \<le> real (order R)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have b:"moebius_mu n \<ge> -(1::real)" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 \<le> moebius_mu n
[PROOF STEP]
using abs_moebius_mu_le[where n="n"]
[PROOF STATE]
proof (prove)
using this:
\<bar>moebius_mu n\<bar> \<le> (1::?'a)

goal (1 subgoal):
 1. - 1 \<le> moebius_mu n
[PROOF STEP]
unfolding abs_le_iff
[PROOF STATE]
proof (prove)
using this:
moebius_mu n \<le> (1::?'a) \<and> - moebius_mu n \<le> (1::?'a)

goal (1 subgoal):
 1. - 1 \<le> moebius_mu n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- 1 \<le> moebius_mu ?n

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have c: "n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < n

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

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have d: "x < n - 1" if d_assms: "x dvd n" "x \<noteq> n" for x :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < n - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x < n - 1
[PROOF STEP]
have "x < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < n
[PROOF STEP]
using d_assms dvd_nat_bounds c
[PROOF STATE]
proof (prove)
using this:
x dvd n
x \<noteq> n
\<lbrakk>0 < ?p; ?n dvd ?p\<rbrakk> \<Longrightarrow> 0 < ?n \<and> ?n \<le> ?p
0 < n

goal (1 subgoal):
 1. x < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x < n

goal (1 subgoal):
 1. x < n - 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x < n

goal (1 subgoal):
 1. x < n - 1
[PROOF STEP]
have "\<not>(n-1 dvd n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> n - 1 dvd n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < n

goal (1 subgoal):
 1. \<not> n - 1 dvd n
[PROOF STEP]
by (metis One_nat_def Suc_diff_Suc c diff_zero
          dvd_add_triv_right_iff nat_dvd_1_iff_1
          nat_neq_iff numeral_2_eq_2 plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
\<not> n - 1 dvd n

goal (1 subgoal):
 1. x < n - 1
[PROOF STEP]
hence "x \<noteq> n-1"
[PROOF STATE]
proof (prove)
using this:
\<not> n - 1 dvd n

goal (1 subgoal):
 1. x \<noteq> n - 1
[PROOF STEP]
using d_assms
[PROOF STATE]
proof (prove)
using this:
\<not> n - 1 dvd n
x dvd n
x \<noteq> n

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

goal (1 subgoal):
 1. x < n - 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x < n
x \<noteq> n - 1
[PROOF STEP]
show "x < n-1"
[PROOF STATE]
proof (prove)
using this:
x < n
x \<noteq> n - 1

goal (1 subgoal):
 1. x < n - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x < n - 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x dvd n; ?x \<noteq> n\<rbrakk> \<Longrightarrow> ?x < n - 1

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "?m^n / 2 = ?m^n - ?m^n/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n / 2 = real (order R) ^ n - real (order R) ^ n / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (order R) ^ n / 2 = real (order R) ^ n - real (order R) ^ n / 2

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n / 2 = real (order R) ^ n - real (order R) ^ n / 2

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... \<le> ?m^n - ?m^n/?m^1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n - real (order R) ^ n / 2 \<le> real (order R) ^ n - real (order R) ^ n / real (order R) ^ 1
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
2 \<le> real (order R)

goal (1 subgoal):
 1. real (order R) ^ n - real (order R) ^ n / 2 \<le> real (order R) ^ n - real (order R) ^ n / real (order R) ^ 1
[PROOF STEP]
by (intro diff_mono divide_left_mono, simp_all)
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - real (order R) ^ n / 2 \<le> real (order R) ^ n - real (order R) ^ n / real (order R) ^ 1

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - real (order R) ^ n / 2 \<le> real (order R) ^ n - real (order R) ^ n / real (order R) ^ 1

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... \<le> ?m^n - ?m^(n-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n - real (order R) ^ n / real (order R) ^ 1 \<le> real (order R) ^ n - real (order R) ^ (n - 1)
[PROOF STEP]
using a c
[PROOF STATE]
proof (prove)
using this:
2 \<le> real (order R)
0 < n

goal (1 subgoal):
 1. real (order R) ^ n - real (order R) ^ n / real (order R) ^ 1 \<le> real (order R) ^ n - real (order R) ^ (n - 1)
[PROOF STEP]
by (subst power_diff, simp_all)
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - real (order R) ^ n / real (order R) ^ 1 \<le> real (order R) ^ n - real (order R) ^ (n - 1)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - real (order R) ^ n / real (order R) ^ 1 \<le> real (order R) ^ n - real (order R) ^ (n - 1)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... \<le> ?m^n - (?m^(n-1) - 1)/1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n - real (order R) ^ (n - 1) \<le> real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - real (order R) ^ (n - 1) \<le> real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / 1

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - real (order R) ^ (n - 1) \<le> real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / 1

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... \<le> ?m^n - (?m^(n-1)-1)/(?m-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / 1 \<le> real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / (real (order R) - 1)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
2 \<le> real (order R)

goal (1 subgoal):
 1. real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / 1 \<le> real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / (real (order R) - 1)
[PROOF STEP]
by (intro diff_left_mono divide_left_mono, simp_all)
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / 1 \<le> real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / (real (order R) - 1)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / 1 \<le> real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / (real (order R) - 1)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... = ?m^n - (\<Sum>i \<in> {..<n-1}. ?m^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / (real (order R) - 1) = real (order R) ^ n - sum ((^) (real (order R))) {..<n - 1}
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
2 \<le> real (order R)

goal (1 subgoal):
 1. real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / (real (order R) - 1) = real (order R) ^ n - sum ((^) (real (order R))) {..<n - 1}
[PROOF STEP]
by (subst geometric_sum, simp_all)
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / (real (order R) - 1) = real (order R) ^ n - sum ((^) (real (order R))) {..<n - 1}

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - (real (order R) ^ (n - 1) - 1) / (real (order R) - 1) = real (order R) ^ n - sum ((^) (real (order R))) {..<n - 1}

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... \<le> ?m^n - (\<Sum>i \<in> {k. k dvd n \<and> k \<noteq> n}. ?m^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n - sum ((^) (real (order R))) {..<n - 1} \<le> real (order R) ^ n - sum ((^) (real (order R))) {k. k dvd n \<and> k \<noteq> n}
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x dvd n; ?x \<noteq> n\<rbrakk> \<Longrightarrow> ?x < n - 1

goal (1 subgoal):
 1. real (order R) ^ n - sum ((^) (real (order R))) {..<n - 1} \<le> real (order R) ^ n - sum ((^) (real (order R))) {k. k dvd n \<and> k \<noteq> n}
[PROOF STEP]
by (intro diff_mono sum_mono2 subsetI, auto simp add:not_less)
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - sum ((^) (real (order R))) {..<n - 1} \<le> real (order R) ^ n - sum ((^) (real (order R))) {k. k dvd n \<and> k \<noteq> n}

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - sum ((^) (real (order R))) {..<n - 1} \<le> real (order R) ^ n - sum ((^) (real (order R))) {k. k dvd n \<and> k \<noteq> n}

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... = ?m^n + (\<Sum>i \<in> {k. k dvd n \<and> k \<noteq> n}. (-1) * ?m^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n - sum ((^) (real (order R))) {k. k dvd n \<and> k \<noteq> n} = real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. - 1 * real (order R) ^ i)
[PROOF STEP]
by (subst sum_distrib_left[symmetric], simp)
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - sum ((^) (real (order R))) {k. k dvd n \<and> k \<noteq> n} = real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. - 1 * real (order R) ^ i)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n - sum ((^) (real (order R))) {k. k dvd n \<and> k \<noteq> n} = real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. - 1 * real (order R) ^ i)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... \<le> moebius_mu 1 * ?m^n +
    (\<Sum>i \<in> {k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * ?m^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. - 1 * real (order R) ^ i) \<le> moebius_mu 1 * real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i)
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> moebius_mu ?n

goal (1 subgoal):
 1. real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. - 1 * real (order R) ^ i) \<le> moebius_mu 1 * real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i)
[PROOF STEP]
by (intro add_mono sum_mono mult_right_mono)
      (simp_all add:not_less)
[PROOF STATE]
proof (state)
this:
real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. - 1 * real (order R) ^ i) \<le> moebius_mu 1 * real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. - 1 * real (order R) ^ i) \<le> moebius_mu 1 * real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... =  (\<Sum>i \<in> insert n {k. k dvd n \<and> k \<noteq> n}.
    moebius_mu (n div i) * ?m^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_mu 1 * real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i) = (\<Sum>i\<in>insert n {k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i)
[PROOF STEP]
using c
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. moebius_mu 1 * real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i) = (\<Sum>i\<in>insert n {k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i)
[PROOF STEP]
by (subst sum.insert, auto)
[PROOF STATE]
proof (state)
this:
moebius_mu 1 * real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i) = (\<Sum>i\<in>insert n {k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
moebius_mu 1 * real (order R) ^ n + (\<Sum>i\<in>{k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i) = (\<Sum>i\<in>insert n {k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... = (\<Sum>i \<in> {k. k dvd n}. moebius_mu (n div i) * ?m^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>insert n {k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i) = (\<Sum>i\<in>{k. k dvd n}. moebius_mu (n div i) * real (order R) ^ i)
[PROOF STEP]
by (intro sum.cong, auto simp add:set_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert n {k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i) = (\<Sum>i\<in>{k. k dvd n}. moebius_mu (n div i) * real (order R) ^ i)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert n {k. k dvd n \<and> k \<noteq> n}. moebius_mu (n div i) * real (order R) ^ i) = (\<Sum>i\<in>{k. k dvd n}. moebius_mu (n div i) * real (order R) ^ i)

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... = dirichlet_prod (\<lambda>i. ?m^i) moebius_mu n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{k. k dvd n}. moebius_mu (n div i) * real (order R) ^ i) = dirichlet_prod ((^) (real (order R))) moebius_mu n
[PROOF STEP]
unfolding dirichlet_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{k. k dvd n}. moebius_mu (n div i) * real (order R) ^ i) = (\<Sum>d | d dvd n. real (order R) ^ d * moebius_mu (n div d))
[PROOF STEP]
by (intro sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{k. k dvd n}. moebius_mu (n div i) * real (order R) ^ i) = dirichlet_prod ((^) (real (order R))) moebius_mu n

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{k. k dvd n}. moebius_mu (n div i) * real (order R) ^ i) = dirichlet_prod ((^) (real (order R))) moebius_mu n

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... = dirichlet_prod moebius_mu (\<lambda>i. ?m^i) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod ((^) (real (order R))) moebius_mu n = dirichlet_prod moebius_mu ((^) (real (order R))) n
[PROOF STEP]
using dirichlet_prod_moebius_commute
[PROOF STATE]
proof (prove)
using this:
dirichlet_prod ?f moebius_mu = dirichlet_prod moebius_mu ?f

goal (1 subgoal):
 1. dirichlet_prod ((^) (real (order R))) moebius_mu n = dirichlet_prod moebius_mu ((^) (real (order R))) n
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
dirichlet_prod ((^) (real (order R))) moebius_mu n = dirichlet_prod moebius_mu ((^) (real (order R))) n

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dirichlet_prod ((^) (real (order R))) moebius_mu n = dirichlet_prod moebius_mu ((^) (real (order R))) n

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... =
    of_int (\<Sum>d | d dvd n. moebius_mu d * order R^(n div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod moebius_mu ((^) (real (order R))) n = real_of_int (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
unfolding dirichlet_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * real (order R) ^ (n div d)) = real_of_int (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dirichlet_prod moebius_mu ((^) (real (order R))) n = real_of_int (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dirichlet_prod moebius_mu ((^) (real (order R))) n = real_of_int (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... = of_int (n *
    card {f. monic_irreducible_poly R f \<and> length f - 1 = n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d))) = real_of_int (int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}))
[PROOF STEP]
using card_irred[OF c]
[PROOF STATE]
proof (prove)
using this:
int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))

goal (1 subgoal):
 1. real_of_int (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d))) = real_of_int (int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d))) = real_of_int (int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}))

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d))) = real_of_int (int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}))

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "... = n * ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n})) = real n * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int (int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n})) = real n * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (order R) ^ n / 2 \<le> real n * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
have "?m^n / 2 \<le> n * ?rhs"
[PROOF STATE]
proof (prove)
using this:
real (order R) ^ n / 2 \<le> real n * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal (1 subgoal):
 1. real (order R) ^ n / 2 \<le> real n * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (order R) ^ n / 2 \<le> real n * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
hence "?m ^ n \<le> 2 * n * ?rhs"
[PROOF STATE]
proof (prove)
using this:
real (order R) ^ n / 2 \<le> real n * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal (1 subgoal):
 1. real (order R) ^ n \<le> real (2 * n) * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (order R) ^ n \<le> real (2 * n) * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
hence "?m^n/(2*real n) \<le> ?rhs"
[PROOF STATE]
proof (prove)
using this:
real (order R) ^ n \<le> real (2 * n) * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
using c
[PROOF STATE]
proof (prove)
using this:
real (order R) ^ n \<le> real (2 * n) * real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
0 < n

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
by (subst pos_divide_le_eq, simp_all add:algebra_simps)
[PROOF STATE]
proof (state)
this:
real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal (1 subgoal):
 1. real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (order R) ^ n / (2 * real n) \<le> real (card {f. m_i_p R f \<and> Polynomials.degree f = n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<pi>_upper_bound_strong:
  fixes \<alpha> :: real and n :: nat
  assumes n: "n \<ge> 2" and \<alpha>: "\<alpha> \<in> {0<..<1}"
  shows "\<pi> n < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * n / ln n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "real n powr \<alpha> \<le> real n powr 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n powr \<alpha> \<le> real n powr 1
[PROOF STEP]
using assms n
[PROOF STATE]
proof (prove)
using this:
2 \<le> n
\<alpha> \<in> {0<..<1}
2 \<le> n

goal (1 subgoal):
 1. real n powr \<alpha> \<le> real n powr 1
[PROOF STEP]
by (intro powr_mono) auto
[PROOF STATE]
proof (state)
this:
real n powr \<alpha> \<le> real n powr 1

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
hence n': "real n powr \<alpha> \<le> real n"
[PROOF STATE]
proof (prove)
using this:
real n powr \<alpha> \<le> real n powr 1

goal (1 subgoal):
 1. real n powr \<alpha> \<le> real n
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
real n powr \<alpha> \<le> real n powr 1
2 \<le> n

goal (1 subgoal):
 1. real n powr \<alpha> \<le> real n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n powr \<alpha> \<le> real n

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
define P where "P = (\<lambda>x. {p. prime p \<and> real p \<le> x})"
[PROOF STATE]
proof (state)
this:
P = (\<lambda>x. {p. prime p \<and> real p \<le> x})

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
define Q where "Q = {p. prime p \<and> real p \<in> {n powr \<alpha><..n}}"
[PROOF STATE]
proof (state)
this:
Q = {p. prime p \<and> real p \<in> {real n powr \<alpha><..real n}}

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have finite_P [intro]: "finite (P x)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (P x)
[PROOF STEP]
proof (cases "x \<ge> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> finite (P x)
 2. \<not> 0 \<le> x \<Longrightarrow> finite (P x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> finite (P x)
 2. \<not> 0 \<le> x \<Longrightarrow> finite (P x)
[PROOF STEP]
hence "P x \<subseteq> {..nat \<lfloor>x\<rfloor>}"
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. P x \<subseteq> {..nat \<lfloor>x\<rfloor>}
[PROOF STEP]
by (auto simp: le_nat_iff le_floor_iff P_def)
[PROOF STATE]
proof (state)
this:
P x \<subseteq> {..nat \<lfloor>x\<rfloor>}

goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> finite (P x)
 2. \<not> 0 \<le> x \<Longrightarrow> finite (P x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
P x \<subseteq> {..nat \<lfloor>x\<rfloor>}

goal (1 subgoal):
 1. finite (P x)
[PROOF STEP]
by (rule finite_subset) auto
[PROOF STATE]
proof (state)
this:
finite (P x)

goal (1 subgoal):
 1. \<not> 0 \<le> x \<Longrightarrow> finite (P x)
[PROOF STEP]
qed (auto simp: P_def)
[PROOF STATE]
proof (state)
this:
finite (P ?x)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have P_subset: "P x \<subseteq> P y" if "x \<le> y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P x \<subseteq> P y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<le> y

goal (1 subgoal):
 1. P x \<subseteq> P y
[PROOF STEP]
by (auto simp: P_def)
[PROOF STATE]
proof (state)
this:
?x \<le> ?y \<Longrightarrow> P ?x \<subseteq> P ?y

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "Q = P n - P (n powr \<alpha>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q = P (real n) - P (real n powr \<alpha>)
[PROOF STEP]
by (auto simp: Q_def P_def)
[PROOF STATE]
proof (state)
this:
Q = P (real n) - P (real n powr \<alpha>)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Q = P (real n) - P (real n powr \<alpha>)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "card \<dots> = card (P n) - card (P (n powr \<alpha>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (P (real n) - P (real n powr \<alpha>)) = card (P (real n)) - card (P (real n powr \<alpha>))
[PROOF STEP]
by (intro card_Diff_subset finite_P P_subset n')
[PROOF STATE]
proof (state)
this:
card (P (real n) - P (real n powr \<alpha>)) = card (P (real n)) - card (P (real n powr \<alpha>))

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (P (real n) - P (real n powr \<alpha>)) = card (P (real n)) - card (P (real n powr \<alpha>))

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "real \<dots> = \<pi> n - \<pi> (n powr \<alpha>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (P (real n)) - card (P (real n powr \<alpha>))) = \<pi> (real n) - \<pi> (real n powr \<alpha>)
[PROOF STEP]
by (subst of_nat_diff[OF card_mono[OF _ P_subset]])
       (use n' in \<open>auto simp: \<pi>_def prime_sum_upto_def P_def\<close>)
[PROOF STATE]
proof (state)
this:
real (card (P (real n)) - card (P (real n powr \<alpha>))) = \<pi> (real n) - \<pi> (real n powr \<alpha>)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (card Q) = \<pi> (real n) - \<pi> (real n powr \<alpha>)
[PROOF STEP]
have card_Q: "real (card Q) = \<pi> n - \<pi> (n powr \<alpha>)"
[PROOF STATE]
proof (prove)
using this:
real (card Q) = \<pi> (real n) - \<pi> (real n powr \<alpha>)

goal (1 subgoal):
 1. real (card Q) = \<pi> (real n) - \<pi> (real n powr \<alpha>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (card Q) = \<pi> (real n) - \<pi> (real n powr \<alpha>)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "(\<pi> n - \<pi> (n powr \<alpha>)) * ln (n powr \<alpha>) = (\<Sum>p\<in>Q. ln (n powr \<alpha>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) = (\<Sum>p\<in>Q. ln (real n powr \<alpha>))
[PROOF STEP]
using card_Q
[PROOF STATE]
proof (prove)
using this:
real (card Q) = \<pi> (real n) - \<pi> (real n powr \<alpha>)

goal (1 subgoal):
 1. (\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) = (\<Sum>p\<in>Q. ln (real n powr \<alpha>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) = (\<Sum>p\<in>Q. ln (real n powr \<alpha>))

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) = (\<Sum>p\<in>Q. ln (real n powr \<alpha>))

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "\<dots> \<le> (\<Sum>p\<in>Q. ln p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>Q. ln (real n powr \<alpha>)) \<le> (\<Sum>p\<in>Q. ln (real p))
[PROOF STEP]
using n \<alpha>
[PROOF STATE]
proof (prove)
using this:
2 \<le> n
\<alpha> \<in> {0<..<1}

goal (1 subgoal):
 1. (\<Sum>p\<in>Q. ln (real n powr \<alpha>)) \<le> (\<Sum>p\<in>Q. ln (real p))
[PROOF STEP]
by (intro sum_mono, subst ln_le_cancel_iff) (auto simp: Q_def dest: prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>Q. ln (real n powr \<alpha>)) \<le> (\<Sum>p\<in>Q. ln (real p))

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>Q. ln (real n powr \<alpha>)) \<le> (\<Sum>p\<in>Q. ln (real p))

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "\<dots> \<le> \<theta> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>Q. ln (real p)) \<le> \<theta> (real n)
[PROOF STEP]
unfolding \<theta>_def prime_sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>Q. ln (real p)) \<le> (\<Sum>p | prime p \<and> real p \<le> real n. ln (real p))
[PROOF STEP]
by (intro sum_mono2) (auto simp: Q_def dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>Q. ln (real p)) \<le> \<theta> (real n)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>Q. ln (real p)) \<le> \<theta> (real n)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "\<dots> < ln 4 * real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<theta> (real n) < ln 4 * real n
[PROOF STEP]
by (rule \<theta>_upper_bound) (use n in auto)
[PROOF STATE]
proof (state)
this:
\<theta> (real n) < ln 4 * real n

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) < ln 4 * real n
[PROOF STEP]
have ineq: "(\<pi> n - \<pi> (n powr \<alpha>)) * ln (n powr \<alpha>) < ln 4 * n"
[PROOF STATE]
proof (prove)
using this:
(\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) < ln 4 * real n

goal (1 subgoal):
 1. (\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) < ln 4 * real n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) < ln 4 * real n

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
with n assms
[PROOF STATE]
proof (chain)
picking this:
2 \<le> n
2 \<le> n
\<alpha> \<in> {0<..<1}
(\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) < ln 4 * real n
[PROOF STEP]
have "\<pi> n < \<pi> (n powr \<alpha>) + (ln 4 / \<alpha>) * n / ln n"
[PROOF STATE]
proof (prove)
using this:
2 \<le> n
2 \<le> n
\<alpha> \<in> {0<..<1}
(\<pi> (real n) - \<pi> (real n powr \<alpha>)) * ln (real n powr \<alpha>) < ln 4 * real n

goal (1 subgoal):
 1. \<pi> (real n) < \<pi> (real n powr \<alpha>) + ln 4 / \<alpha> * real n / ln (real n)
[PROOF STEP]
by (simp add: field_simps ln_powr
             del: div_mult_self3 div_mult_self4 div_mult_self2 div_mult_self1)
[PROOF STATE]
proof (state)
this:
\<pi> (real n) < \<pi> (real n powr \<alpha>) + ln 4 / \<alpha> * real n / ln (real n)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<pi> (real n) < \<pi> (real n powr \<alpha>) + ln 4 / \<alpha> * real n / ln (real n)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "\<pi> (n powr \<alpha>) \<le> n powr \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> (real n powr \<alpha>) \<le> real n powr \<alpha>
[PROOF STEP]
by (rule \<pi>_le_self) auto
[PROOF STATE]
proof (state)
this:
\<pi> (real n powr \<alpha>) \<le> real n powr \<alpha>

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<pi> (real n powr \<alpha>) \<le> real n powr \<alpha>

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "n powr \<alpha> + ln 4 / \<alpha> * n / ln n =
               (n powr (-(1 - \<alpha>)) * ln n + ln 4 / \<alpha>) * n / ln n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n powr \<alpha> + ln 4 / \<alpha> * real n / ln (real n) = (real n powr - (1 - \<alpha>) * ln (real n) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
using n \<alpha>
[PROOF STATE]
proof (prove)
using this:
2 \<le> n
\<alpha> \<in> {0<..<1}

goal (1 subgoal):
 1. real n powr \<alpha> + ln 4 / \<alpha> * real n / ln (real n) = (real n powr - (1 - \<alpha>) * ln (real n) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
by (simp add: field_simps powr_diff
                       del: div_mult_self3 div_mult_self4 div_mult_self2 div_mult_self1)
[PROOF STATE]
proof (state)
this:
real n powr \<alpha> + ln 4 / \<alpha> * real n / ln (real n) = (real n powr - (1 - \<alpha>) * ln (real n) + ln 4 / \<alpha>) * real n / ln (real n)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n powr \<alpha> + ln 4 / \<alpha> * real n / ln (real n) = (real n powr - (1 - \<alpha>) * ln (real n) + ln 4 / \<alpha>) * real n / ln (real n)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
have "n powr (-(1 - \<alpha>)) * ln n \<le> 1 / ((1 - \<alpha>) * exp 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n powr - (1 - \<alpha>) * ln (real n) \<le> 1 / ((1 - \<alpha>) * exp 1)
[PROOF STEP]
by (intro \<pi>_upper_bound_aux) (use \<alpha> n in auto)
[PROOF STATE]
proof (state)
this:
real n powr - (1 - \<alpha>) * ln (real n) \<le> 1 / ((1 - \<alpha>) * exp 1)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
hence "(n powr (-(1 - \<alpha>)) * ln n + ln 4 / \<alpha>) * n / ln n \<le>
           (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * n / ln n"
[PROOF STATE]
proof (prove)
using this:
real n powr - (1 - \<alpha>) * ln (real n) \<le> 1 / ((1 - \<alpha>) * exp 1)

goal (1 subgoal):
 1. (real n powr - (1 - \<alpha>) * ln (real n) + ln 4 / \<alpha>) * real n / ln (real n) \<le> (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
using n \<alpha>
[PROOF STATE]
proof (prove)
using this:
real n powr - (1 - \<alpha>) * ln (real n) \<le> 1 / ((1 - \<alpha>) * exp 1)
2 \<le> n
\<alpha> \<in> {0<..<1}

goal (1 subgoal):
 1. (real n powr - (1 - \<alpha>) * ln (real n) + ln 4 / \<alpha>) * real n / ln (real n) \<le> (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
by (intro divide_right_mono mult_right_mono add_mono) auto
[PROOF STATE]
proof (state)
this:
(real n powr - (1 - \<alpha>) * ln (real n) + ln 4 / \<alpha>) * real n / ln (real n) \<le> (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> x + ln 4 / \<alpha> * real n / ln (real n) \<le> y + ln 4 / \<alpha> * real n / ln (real n)) \<Longrightarrow> \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
show "\<pi> n < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * n / ln n"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x + ln 4 / \<alpha> * real n / ln (real n) \<le> y + ln 4 / \<alpha> * real n / ln (real n)) \<Longrightarrow> \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)

goal (1 subgoal):
 1. \<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<pi> (real n) < (1 / ((1 - \<alpha>) * exp 1) + ln 4 / \<alpha>) * real n / ln (real n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_inverse_0:
  fixes x :: "_ \<Rightarrow> 'a::real_normed_div_algebra"
  shows "(inverse \<longlongrightarrow> (0::'a)) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inverse \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
unfolding tendsto_Zfun_iff diff_0_right Zfun_def eventually_at_infinity
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>r>0. \<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> norm (inverse x) < r
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> norm (inverse x) < r
[PROOF STEP]
fix r :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> norm (inverse x) < r
[PROOF STEP]
assume "0 < r"
[PROOF STATE]
proof (state)
this:
0 < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> norm (inverse x) < r
[PROOF STEP]
show "\<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> norm (inverse x :: 'a) < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> norm (inverse x) < r
[PROOF STEP]
proof (intro exI[of _ "inverse (r / 2)"] allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. inverse (r / 2) \<le> norm x \<Longrightarrow> norm (inverse x) < r
[PROOF STEP]
fix x :: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. inverse (r / 2) \<le> norm x \<Longrightarrow> norm (inverse x) < r
[PROOF STEP]
from \<open>0 < r\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < r
[PROOF STEP]
have "0 < inverse (r / 2)"
[PROOF STATE]
proof (prove)
using this:
0 < r

goal (1 subgoal):
 1. 0 < inverse (r / 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < inverse (r / 2)

goal (1 subgoal):
 1. \<And>x. inverse (r / 2) \<le> norm x \<Longrightarrow> norm (inverse x) < r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 < inverse (r / 2)

goal (1 subgoal):
 1. \<And>x. inverse (r / 2) \<le> norm x \<Longrightarrow> norm (inverse x) < r
[PROOF STEP]
assume *: "inverse (r / 2) \<le> norm x"
[PROOF STATE]
proof (state)
this:
inverse (r / 2) \<le> norm x

goal (1 subgoal):
 1. \<And>x. inverse (r / 2) \<le> norm x \<Longrightarrow> norm (inverse x) < r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < norm x
[PROOF STEP]
show "norm (inverse x) < r"
[PROOF STATE]
proof (prove)
using this:
0 < norm x

goal (1 subgoal):
 1. norm (inverse x) < r
[PROOF STEP]
using * \<open>0 < r\<close>
[PROOF STATE]
proof (prove)
using this:
0 < norm x
inverse (r / 2) \<le> norm x
0 < r

goal (1 subgoal):
 1. norm (inverse x) < r
[PROOF STEP]
by (subst nonzero_norm_inverse) (simp_all add: inverse_eq_divide field_simps)
[PROOF STATE]
proof (state)
this:
norm (inverse x) < r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>b. \<forall>x. b \<le> norm x \<longrightarrow> norm (inverse x) < r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gram_Schmidt_upt_k_suc:
  "Gram_Schmidt_upt_k A (Suc k) = (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gram_Schmidt_upt_k A (Suc k) = Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Gram_Schmidt_upt_k A (Suc k) = Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)
[PROOF STEP]
have rw: "[0..<Suc (Suc k)] = [0..<Suc k] @ [(Suc k)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]

goal (1 subgoal):
 1. Gram_Schmidt_upt_k A (Suc k) = Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gram_Schmidt_upt_k A (Suc k) = Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl Gram_Schmidt_column_k A [0..<Suc (Suc k)] = Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) (Suc k)
[PROOF STEP]
unfolding rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl Gram_Schmidt_column_k A ([0..<Suc k] @ [Suc k]) = Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) (Suc k)
[PROOF STEP]
unfolding foldl_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) [Suc k] = Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) (Suc k)
[PROOF STEP]
unfolding foldl.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) (Suc k) = Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) (Suc k)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Gram_Schmidt_upt_k A (Suc k) = Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma at_right_to_0: "at_right a = filtermap (\<lambda>x. x + a) (at_right 0)"
  for a :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_right a = filtermap (\<lambda>x. x + a) (at_right 0)
[PROOF STEP]
using filtermap_at_right_shift[of "-a" 0]
[PROOF STATE]
proof (prove)
using this:
filtermap (\<lambda>x. x - - a) (at_right 0) = at_right (0 - - a)

goal (1 subgoal):
 1. at_right a = filtermap (\<lambda>x. x + a) (at_right 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma E_inV: "\<And>e. e\<in>E \<Longrightarrow> vertices e \<subseteq> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. e \<in> E \<Longrightarrow> vertices e \<subseteq> V
[PROOF STEP]
using edgesinvertices
[PROOF STATE]
proof (prove)
using this:
\<Union> (vertices ` E) \<subseteq> V

goal (1 subgoal):
 1. \<And>e. e \<in> E \<Longrightarrow> vertices e \<subseteq> V
[PROOF STEP]
by auto


[STATEMENT]
lemma harm_less_ln:
  fixes m :: nat
  assumes "m > 0"
  shows   "harm m < ln (2 * m + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm m < ln (real (2 * m + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (1 subgoal):
 1. harm m < ln (real (2 * m + 1))
[PROOF STEP]
proof (induct m rule: nat_0_1_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < 0 \<Longrightarrow> harm 0 < ln (real (2 * 0 + 1))
 2. 0 < 1 \<Longrightarrow> harm 1 < ln (real (2 * 1 + 1))
 3. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < 0

goal (3 subgoals):
 1. 0 < 0 \<Longrightarrow> harm 0 < ln (real (2 * 0 + 1))
 2. 0 < 1 \<Longrightarrow> harm 1 < ln (real (2 * 1 + 1))
 3. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < 0

goal (1 subgoal):
 1. harm 0 < ln (real (2 * 0 + 1))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
harm 0 < ln (real (2 * 0 + 1))

goal (2 subgoals):
 1. 0 < 1 \<Longrightarrow> harm 1 < ln (real (2 * 1 + 1))
 2. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < 1 \<Longrightarrow> harm 1 < ln (real (2 * 1 + 1))
 2. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
0 < 1

goal (2 subgoals):
 1. 0 < 1 \<Longrightarrow> harm 1 < ln (real (2 * 1 + 1))
 2. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
have "harm 1 = (1::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm 1 = 1
[PROOF STEP]
unfolding harm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..1. inverse (real k)) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
harm 1 = 1

goal (2 subgoals):
 1. 0 < 1 \<Longrightarrow> harm 1 < ln (real (2 * 1 + 1))
 2. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
have "harm 1 < ln (3::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm 1 < ln 3
[PROOF STEP]
by (subst \<open>harm 1 = 1\<close>,subst ln3_gt_1,simp)
[PROOF STATE]
proof (state)
this:
harm 1 < ln 3

goal (2 subgoals):
 1. 0 < 1 \<Longrightarrow> harm 1 < ln (real (2 * 1 + 1))
 2. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
harm 1 < ln 3
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
harm 1 < ln 3

goal (1 subgoal):
 1. harm 1 < ln (real (2 * 1 + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
harm 1 < ln (real (2 * 1 + 1))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
case (step n)
[PROOF STATE]
proof (state)
this:
1 \<le> n
0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1))
0 < Suc n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
have "harm (n+1) = harm n + 1/(n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm (n + 1) = harm n + 1 / real (n + 1)
[PROOF STEP]
by ((subst Suc_eq_plus1[symmetric])+,subst harm_Suc,subst inverse_eq_divide,blast)
[PROOF STATE]
proof (state)
this:
harm (n + 1) = harm n + 1 / real (n + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
harm (n + 1) = harm n + 1 / real (n + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
have "\<dots> < ln (real (2 * n + 1)) + 1/(n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm n + 1 / real (n + 1) < ln (real (2 * n + 1)) + 1 / real (n + 1)
[PROOF STEP]
using step(1-2)
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1))

goal (1 subgoal):
 1. harm n + 1 / real (n + 1) < ln (real (2 * n + 1)) + 1 / real (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
harm n + 1 / real (n + 1) < ln (real (2 * n + 1)) + 1 / real (n + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
harm n + 1 / real (n + 1) < ln (real (2 * n + 1)) + 1 / real (n + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
have "\<dots> < ln (real (2 * n + 1)) + ln (1+2/(2*n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (2 * n + 1)) + 1 / real (n + 1) < ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (real (2 * n + 1)) + 1 / real (n + 1) < ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1))
[PROOF STEP]
from step(1)
[PROOF STATE]
proof (chain)
picking this:
1 \<le> n
[PROOF STEP]
have "real n \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

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

goal (1 subgoal):
 1. ln (real (2 * n + 1)) + 1 / real (n + 1) < ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1))
[PROOF STEP]
have "1 / real (n + 1) < ln (1 + 2 / real (2 * n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real (n + 1) < ln (1 + 2 / real (2 * n + 1))
[PROOF STEP]
using harm_aux_ineq_2[OF \<open>1 \<le> (real n)\<close>]
[PROOF STATE]
proof (prove)
using this:
1 / (real n + 1) < ln (1 + 2 / (2 * real n + 1))

goal (1 subgoal):
 1. 1 / real (n + 1) < ln (1 + 2 / real (2 * n + 1))
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
1 / real (n + 1) < ln (1 + 2 / real (2 * n + 1))

goal (1 subgoal):
 1. ln (real (2 * n + 1)) + 1 / real (n + 1) < ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 / real (n + 1) < ln (1 + 2 / real (2 * n + 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / real (n + 1) < ln (1 + 2 / real (2 * n + 1))

goal (1 subgoal):
 1. ln (real (2 * n + 1)) + 1 / real (n + 1) < ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ln (real (2 * n + 1)) + 1 / real (n + 1) < ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ln (real (2 * n + 1)) + 1 / real (n + 1) < ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real (2 * n + 1)) + 1 / real (n + 1) < ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
have "\<dots> = ln ((2 * n + 1) * (1+2/(2*n+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1)) = ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1)))
[PROOF STEP]
by (rule ln_mult[symmetric],simp,simp add: field_simps)
[PROOF STATE]
proof (state)
this:
ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1)) = ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real (2 * n + 1)) + ln (1 + 2 / real (2 * n + 1)) = ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
have "\<dots> = ln (2*(n+1)+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1))) = ln (real (2 * (n + 1) + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1))) = ln (real (2 * (n + 1) + 1))
[PROOF STEP]
have "(2 * n + 1) * (1+2/(2*n+1)) = 2*(n+1)+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (2 * n + 1) * (1 + 2 / real (2 * n + 1)) = real (2 * (n + 1) + 1)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
real (2 * n + 1) * (1 + 2 / real (2 * n + 1)) = real (2 * (n + 1) + 1)

goal (1 subgoal):
 1. ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1))) = ln (real (2 * (n + 1) + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (2 * n + 1) * (1 + 2 / real (2 * n + 1)) = real (2 * (n + 1) + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (2 * n + 1) * (1 + 2 / real (2 * n + 1)) = real (2 * (n + 1) + 1)

goal (1 subgoal):
 1. ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1))) = ln (real (2 * (n + 1) + 1))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1))) = ln (real (2 * (n + 1) + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ln (real (2 * n + 1) * (1 + 2 / real (2 * n + 1))) = ln (real (2 * (n + 1) + 1))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; 0 < n \<Longrightarrow> harm n < ln (real (2 * n + 1)); 0 < Suc n\<rbrakk> \<Longrightarrow> harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
harm (n + 1) < ln (real (2 * (n + 1) + 1))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
harm (n + 1) < ln (real (2 * (n + 1) + 1))

goal (1 subgoal):
 1. harm (Suc n) < ln (real (2 * Suc n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
harm (Suc n) < ln (real (2 * Suc n + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sylvester_mat_0[simp]: "sylvester_mat 0 q = 0\<^sub>m (degree q) (degree q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sylvester_mat 0 q = 0\<^sub>m (degree q) (degree q)
[PROOF STEP]
unfolding sylvester_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sylvester_mat_sub (degree 0) (degree q) 0 q = 0\<^sub>m (degree q) (degree q)
[PROOF STEP]
by simp


[STATEMENT]
lemma bounded_imp_convergent_prod:
  fixes a :: "nat \<Rightarrow> real"
  assumes 1: "\<And>n. a n \<ge> 1" and bounded: "\<And>n. (\<Prod>i\<le>n. a i) \<le> B"
  shows "convergent_prod a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_prod a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent_prod a
[PROOF STEP]
have "bdd_above (range(\<lambda>n. \<Prod>i\<le>n. a i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (range (\<lambda>n. prod a {..n}))
[PROOF STEP]
by (meson bdd_aboveI2 bounded)
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>n. prod a {..n}))

goal (1 subgoal):
 1. convergent_prod a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>n. prod a {..n}))

goal (1 subgoal):
 1. convergent_prod a
[PROOF STEP]
have "incseq (\<lambda>n. \<Prod>i\<le>n. a i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>n. prod a {..n})
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> prod a {..x} \<le> prod a {..y}
[PROOF STEP]
by (metis 1 prod_mono2 atMost_subset_iff dual_order.trans finite_atMost zero_le_one)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>n. prod a {..n})

goal (1 subgoal):
 1. convergent_prod a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bdd_above (range (\<lambda>n. prod a {..n}))
incseq (\<lambda>n. prod a {..n})
[PROOF STEP]
obtain p where p: "(\<lambda>n. \<Prod>i\<le>n. a i) \<longlonglongrightarrow> p"
[PROOF STATE]
proof (prove)
using this:
bdd_above (range (\<lambda>n. prod a {..n}))
incseq (\<lambda>n. prod a {..n})

goal (1 subgoal):
 1. (\<And>p. (\<lambda>n. prod a {..n}) \<longlonglongrightarrow> p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using LIMSEQ_incseq_SUP
[PROOF STATE]
proof (prove)
using this:
bdd_above (range (\<lambda>n. prod a {..n}))
incseq (\<lambda>n. prod a {..n})
\<lbrakk>bdd_above (range ?X); incseq ?X\<rbrakk> \<Longrightarrow> ?X \<longlonglongrightarrow> Sup (range ?X)

goal (1 subgoal):
 1. (\<And>p. (\<lambda>n. prod a {..n}) \<longlonglongrightarrow> p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>n. prod a {..n}) \<longlonglongrightarrow> p

goal (1 subgoal):
 1. convergent_prod a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. prod a {..n}) \<longlonglongrightarrow> p
[PROOF STEP]
have "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. prod a {..n}) \<longlonglongrightarrow> p

goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
by (metis "1" not_one_le_zero prod_ge_1 LIMSEQ_le_const)
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. convergent_prod a
[PROOF STEP]
with 1 p
[PROOF STATE]
proof (chain)
picking this:
1 \<le> a ?n
(\<lambda>n. prod a {..n}) \<longlonglongrightarrow> p
p \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<le> a ?n
(\<lambda>n. prod a {..n}) \<longlonglongrightarrow> p
p \<noteq> 0

goal (1 subgoal):
 1. convergent_prod a
[PROOF STEP]
by (metis convergent_prod_iff_nz_lim not_one_le_zero)
[PROOF STATE]
proof (state)
this:
convergent_prod a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma polyfun_eq_const: (*COMPLEX_POLYFUN_EQ_CONST in HOL Light*)
  fixes c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
  shows "(\<forall>x. (\<Sum>i\<le>n. c i * x^i) = k) \<longleftrightarrow> c 0 = k \<and> (\<forall>i \<in> {1..n}. c i = 0)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k) = (c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k) = (c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)))
[PROOF STEP]
have *: "\<forall>x. (\<Sum>i\<le>n. (if i=0 then k else 0) * x^i) = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (\<Sum>i\<le>n. (if i = 0 then k else (0::'a)) * x ^ i) = k
[PROOF STEP]
by (induct n) auto
[PROOF STATE]
proof (state)
this:
\<forall>x. (\<Sum>i\<le>n. (if i = 0 then k else (0::'a)) * x ^ i) = k

goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k) = (c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k) = (c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k \<Longrightarrow> c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a))
 2. c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)) \<Longrightarrow> \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k

goal (2 subgoals):
 1. \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k \<Longrightarrow> c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a))
 2. c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)) \<Longrightarrow> \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. (\<Sum>i\<le>n. (if i = 0 then k else (0::'a)) * x ^ i) = k
\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k
[PROOF STEP]
have "(\<forall>i\<le>n. c i = (if i=0 then k else 0))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (\<Sum>i\<le>n. (if i = 0 then k else (0::'a)) * x ^ i) = k
\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k

goal (1 subgoal):
 1. \<forall>i\<le>n. c i = (if i = 0 then k else (0::'a))
[PROOF STEP]
by (simp add: polyfun_eq_coeffs [symmetric])
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. c i = (if i = 0 then k else (0::'a))

goal (2 subgoals):
 1. \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k \<Longrightarrow> c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a))
 2. c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)) \<Longrightarrow> \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i\<le>n. c i = (if i = 0 then k else (0::'a))
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. c i = (if i = 0 then k else (0::'a))

goal (1 subgoal):
 1. c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a))

goal (1 subgoal):
 1. c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)) \<Longrightarrow> \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)) \<Longrightarrow> \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a))

goal (1 subgoal):
 1. c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)) \<Longrightarrow> \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a))
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a))

goal (1 subgoal):
 1. \<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k
[PROOF STEP]
by (induct n) auto
[PROOF STATE]
proof (state)
this:
\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = k) = (c 0 = k \<and> (\<forall>i\<in>{1..n}. c i = (0::'a)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_one_over_log_squared_bigo:
  "(\<lambda>x::real. integral {2..x} (\<lambda>t. 1 / ln t ^ 2)) \<in> O(\<lambda>x. x / ln x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
define ub where "ub = (\<lambda>x::real. sqrt x / ln 2 ^ 2 + 4 * x / ln x ^ 2)"
[PROOF STATE]
proof (state)
this:
ub = (\<lambda>x. sqrt x / (ln 2)\<^sup>2 + 4 * x / (ln x)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
have "eventually (\<lambda>x. \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
using eventually_ge_at_top[of 4]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) (4::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 4 \<le> x \<Longrightarrow> \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
4 \<le> x

goal (1 subgoal):
 1. \<And>x. 4 \<le> x \<Longrightarrow> \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
hence "\<bar>integral {2..x} (\<lambda>t. 1 / ln t ^ 2)\<bar> = integral {2..x} (\<lambda>t. 1 / ln t ^ 2)"
[PROOF STATE]
proof (prove)
using this:
4 \<le> x

goal (1 subgoal):
 1. \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> = integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)
[PROOF STEP]
by (intro abs_of_nonneg integral_nonneg integrable_continuous_real continuous_intros) auto
[PROOF STATE]
proof (state)
this:
\<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> = integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)

goal (1 subgoal):
 1. \<And>x. 4 \<le> x \<Longrightarrow> \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> = integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)

goal (1 subgoal):
 1. \<And>x. 4 \<le> x \<Longrightarrow> \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
have "\<dots> \<le> \<bar>ub x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2) \<le> \<bar>ub x\<bar>
[PROOF STEP]
using integral_one_over_log_squared_bound[of x] elim
[PROOF STATE]
proof (prove)
using this:
4 \<le> x \<Longrightarrow> integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2) \<le> sqrt x / (ln 2)\<^sup>2 + 4 * x / (ln x)\<^sup>2
4 \<le> x

goal (1 subgoal):
 1. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2) \<le> \<bar>ub x\<bar>
[PROOF STEP]
by (simp add: ub_def)
[PROOF STATE]
proof (state)
this:
integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2) \<le> \<bar>ub x\<bar>

goal (1 subgoal):
 1. \<And>x. 4 \<le> x \<Longrightarrow> \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>

goal (1 subgoal):
 1. \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
hence "(\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(ub)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. \<bar>integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)\<bar> \<le> \<bar>ub x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(ub)
[PROOF STEP]
by (intro landau_o.bigI[of 1]) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(ub)

goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(ub)

goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
have "ub \<in> O(\<lambda>x. x / ln x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ub \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
unfolding ub_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sqrt x / (ln 2)\<^sup>2 + 4 * x / (ln x)\<^sup>2) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
ub \<in> O(\<lambda>x. x / (ln x)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. integral {2..x} (\<lambda>t. 1 / (ln t)\<^sup>2)) \<in> O(\<lambda>x. x / (ln x)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiple_orig_sub_des:
  assumes "n > 0"
  shows "sub_design \<V> \<B> \<V> (multiple_blocks n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_design \<V> \<B> \<V> (multiple_blocks n)
[PROOF STEP]
using multiple_is_design assms multiple_orig_sub_system
[PROOF STATE]
proof (prove)
using this:
design \<V> (multiple_blocks ?n)
0 < n
0 < ?n \<Longrightarrow> sub_incidence_system \<V> \<B> \<V> (multiple_blocks ?n)

goal (1 subgoal):
 1. sub_design \<V> \<B> \<V> (multiple_blocks n)
[PROOF STEP]
by (simp add: sub_design.intro)


[STATEMENT]
lemma distance_witness:
  assumes xs: "v \<leadsto>xs\<leadsto> w"
      and xs_min: "\<And>xs'. v \<leadsto>xs'\<leadsto> w \<Longrightarrow> length xs \<le> length xs'"
  shows "distance v w = length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distance v w = length xs
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distance v w = length xs
[PROOF STEP]
have "\<And>d. d \<in> {length xs | xs. v \<leadsto>xs\<leadsto> w} \<Longrightarrow> length xs \<le> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>d. d \<in> {length xs |xs. v \<leadsto>xs\<leadsto> w} \<Longrightarrow> length xs \<le> d
[PROOF STEP]
using xs_min
[PROOF STATE]
proof (prove)
using this:
v \<leadsto>?xs'\<leadsto> w \<Longrightarrow> length xs \<le> length ?xs'

goal (1 subgoal):
 1. \<And>d. d \<in> {length xs |xs. v \<leadsto>xs\<leadsto> w} \<Longrightarrow> length xs \<le> d
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?d \<in> {length xs |xs. v \<leadsto>xs\<leadsto> w} \<Longrightarrow> length xs \<le> ?d

goal (1 subgoal):
 1. distance v w = length xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?d \<in> {length xs |xs. v \<leadsto>xs\<leadsto> w} \<Longrightarrow> length xs \<le> ?d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?d \<in> {length xs |xs. v \<leadsto>xs\<leadsto> w} \<Longrightarrow> length xs \<le> ?d

goal (1 subgoal):
 1. distance v w = length xs
[PROOF STEP]
unfolding distance_def
[PROOF STATE]
proof (prove)
using this:
?d \<in> {length xs |xs. v \<leadsto>xs\<leadsto> w} \<Longrightarrow> length xs \<le> ?d

goal (1 subgoal):
 1. Min {length xs |xs. v \<leadsto>xs\<leadsto> w} = length xs
[PROOF STEP]
using Min_eqI
[PROOF STATE]
proof (prove)
using this:
?d \<in> {length xs |xs. v \<leadsto>xs\<leadsto> w} \<Longrightarrow> length xs \<le> ?d
\<lbrakk>finite ?A; \<And>y. y \<in> ?A \<Longrightarrow> ?x \<le> y; ?x \<in> ?A\<rbrakk> \<Longrightarrow> Min ?A = ?x

goal (1 subgoal):
 1. Min {length xs |xs. v \<leadsto>xs\<leadsto> w} = length xs
[PROOF STEP]
by (metis (mono_tags, lifting) distance_lengths_finite xs mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
distance v w = length xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_altdef_nat':
  "[a = b] (mod m) \<longleftrightarrow> m dvd nat \<bar>int a - int b\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a = b] (mod m) = (m dvd nat \<bar>int a - int b\<bar>)
[PROOF STEP]
using cong_diff_iff_cong_0_nat' [of a b m]
[PROOF STATE]
proof (prove)
using this:
[nat \<bar>int a - int b\<bar> = 0] (mod m) = [a = b] (mod m)

goal (1 subgoal):
 1. [a = b] (mod m) = (m dvd nat \<bar>int a - int b\<bar>)
[PROOF STEP]
by (simp only: cong_0_iff [symmetric])


[STATEMENT]
lemma sgn_less_eq_1_rat: fixes a b :: rat
  shows "sgn a = 1 \<Longrightarrow> a \<le> b \<Longrightarrow> sgn b = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sgn a = 1; a \<le> b\<rbrakk> \<Longrightarrow> sgn b = 1
[PROOF STEP]
by (metis (no_types, opaque_lifting) not_less one_neq_neg_one one_neq_zero order_trans sgn_rat_def)


[STATEMENT]
lemma finite_real_of_nat_less_real: "finite {n::nat. real n < u}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {n. real n < u}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {n. real n < u}
[PROOF STEP]
obtain m where "u < real m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. u < real m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using reals_Archimedean2
[PROOF STATE]
proof (prove)
using this:
\<exists>n. ?x < of_nat n

goal (1 subgoal):
 1. (\<And>m. u < real m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u < real m

goal (1 subgoal):
 1. finite {n. real n < u}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u < real m
[PROOF STEP]
have "{n. real n < u} \<subseteq> {..<m}"
[PROOF STATE]
proof (prove)
using this:
u < real m

goal (1 subgoal):
 1. {n. real n < u} \<subseteq> {..<m}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{n. real n < u} \<subseteq> {..<m}

goal (1 subgoal):
 1. finite {n. real n < u}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{n. real n < u} \<subseteq> {..<m}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{n. real n < u} \<subseteq> {..<m}

goal (1 subgoal):
 1. finite {n. real n < u}
[PROOF STEP]
using finite_nat_iff_bounded
[PROOF STATE]
proof (prove)
using this:
{n. real n < u} \<subseteq> {..<m}
finite ?S = (\<exists>k. ?S \<subseteq> {..<k})

goal (1 subgoal):
 1. finite {n. real n < u}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite {n. real n < u}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subterm_inj_on_imp_inj_on: "subterm_inj_on f A \<Longrightarrow> inj_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subterm_inj_on f A \<Longrightarrow> inj_on f A
[PROOF STEP]
unfolding subterm_inj_on_def inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>A. (\<exists>v. v \<sqsubseteq> f x \<and> v \<sqsubseteq> f y) \<longrightarrow> x = y \<Longrightarrow> \<forall>x\<in>A. \<forall>y\<in>A. f x = f y \<longrightarrow> x = y
[PROOF STEP]
by fastforce


[STATEMENT]
lemma mod_partition_Union: "
  0 < m \<Longrightarrow> (\<Union>k. A \<inter> [k * m\<dots>,m - Suc 0]) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> (\<Union>k. A \<inter> [k * m\<dots>,m - Suc 0]) = A
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> A \<inter> (\<Union>x. [x * m\<dots>,m - Suc 0]) = A
[PROOF STEP]
apply (rule subst[where s=UNIV and P="\<lambda>x. A \<inter> x = A"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < m \<Longrightarrow> UNIV = (\<Union>x. [x * m\<dots>,m - Suc 0])
 2. 0 < m \<Longrightarrow> A \<inter> UNIV = A
[PROOF STEP]
apply (rule set_eqI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. 0 < m \<Longrightarrow> (x \<in> UNIV) = (x \<in> (\<Union>x. [x * m\<dots>,m - Suc 0]))
 2. 0 < m \<Longrightarrow> A \<inter> UNIV = A
[PROOF STEP]
apply (simp add: iT_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. 0 < m \<Longrightarrow> \<exists>xa. xa * m \<le> x \<and> x \<le> xa * m + m - Suc 0
 2. 0 < m \<Longrightarrow> A \<inter> UNIV = A
[PROOF STEP]
apply (rule_tac x="x div m" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. 0 < m \<Longrightarrow> x div m * m \<le> x \<and> x \<le> x div m * m + m - Suc 0
 2. 0 < m \<Longrightarrow> A \<inter> UNIV = A
[PROOF STEP]
apply (simp add: div_mult_cancel)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. 0 < m \<Longrightarrow> x \<le> x + m - Suc (x mod m)
 2. 0 < m \<Longrightarrow> A \<inter> UNIV = A
[PROOF STEP]
apply (subst add.commute)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. 0 < m \<Longrightarrow> x \<le> m + x - Suc (x mod m)
 2. 0 < m \<Longrightarrow> A \<inter> UNIV = A
[PROOF STEP]
apply (rule le_add_diff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. 0 < m \<Longrightarrow> Suc (x mod m) \<le> m
 2. 0 < m \<Longrightarrow> A \<inter> UNIV = A
[PROOF STEP]
apply (simp add: Suc_mod_le_divisor)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> A \<inter> UNIV = A
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma degree_fps_poly_swap2_le:
  assumes "\<And>n. degree (fps_nth p n) \<le> d"
  shows   "degree (fps_poly_swap2 p) \<le> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (fps_poly_swap2 p) \<le> d
[PROOF STEP]
proof (safe intro!: degree_le)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. d < i \<Longrightarrow> coeff (fps_poly_swap2 p) i = 0
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. d < i \<Longrightarrow> coeff (fps_poly_swap2 p) i = 0
[PROOF STEP]
assume "n > d"
[PROOF STATE]
proof (state)
this:
d < n

goal (1 subgoal):
 1. \<And>i. d < i \<Longrightarrow> coeff (fps_poly_swap2 p) i = 0
[PROOF STEP]
show "poly.coeff (fps_poly_swap2 p) n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (fps_poly_swap2 p) n = 0
[PROOF STEP]
proof (rule fps_ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. coeff (fps_poly_swap2 p) n $ na = 0 $ na
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. coeff (fps_poly_swap2 p) n $ na = 0 $ na
[PROOF STEP]
have "poly.coeff (fps_poly_swap2 p) n $ m = poly.coeff (p $ m) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (fps_poly_swap2 p) n $ m = coeff (p $ m) n
[PROOF STEP]
by (subst fps_nth_coeff_fps_poly_swap2[OF assms]) auto
[PROOF STATE]
proof (state)
this:
coeff (fps_poly_swap2 p) n $ m = coeff (p $ m) n

goal (1 subgoal):
 1. \<And>na. coeff (fps_poly_swap2 p) n $ na = 0 $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (fps_poly_swap2 p) n $ m = coeff (p $ m) n

goal (1 subgoal):
 1. \<And>na. coeff (fps_poly_swap2 p) n $ na = 0 $ na
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p $ m) n = (0::'a)
[PROOF STEP]
by (intro coeff_eq_0 le_less_trans[OF assms \<open>n > d\<close>])
[PROOF STATE]
proof (state)
this:
coeff (p $ m) n = (0::'a)

goal (1 subgoal):
 1. \<And>na. coeff (fps_poly_swap2 p) n $ na = 0 $ na
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff (fps_poly_swap2 p) n $ m = (0::'a)
[PROOF STEP]
show "poly.coeff (fps_poly_swap2 p) n $ m = 0 $ m"
[PROOF STATE]
proof (prove)
using this:
coeff (fps_poly_swap2 p) n $ m = (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coeff (fps_poly_swap2 p) n = 0

goal:
No subgoals!
[PROOF STEP]
qed