[STATEMENT]
theorem totient_lower_bound:
  fixes \<epsilon> :: real
  assumes "\<epsilon> > 0"
  defines "C \<equiv> third_mertens_const"
  shows "eventually (\<lambda>n. totient n > (1 - \<epsilon>) * C * n / ln (ln n)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
include prime_counting_notation
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
define f :: "nat \<Rightarrow> nat" where "f = (\<lambda>n. card {p\<in>prime_factors n. p > ln n})"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>n. card {p. p \<in># prime_factorization n \<and> ln (real n) < real p})

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
define lb1 where "lb1 = (\<lambda>n::nat. (\<Prod>p | prime p \<and> real p \<le> ln n. 1 - 1 / p))"
[PROOF STATE]
proof (state)
this:
lb1 = (\<lambda>n. \<Prod>p\<in>{p. prime p \<and> real p \<le> ln (real n)}. 1 - 1 / real p)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
define lb2 where "lb2 = (\<lambda>n::nat. (1 - 1 / ln n) powr (ln n / ln (ln n)))"
[PROOF STATE]
proof (state)
this:
lb2 = (\<lambda>n. (1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))))

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
define lb1' where "lb1' = (\<lambda>n::nat. C / ln (ln n) - 10 * C / ln (ln n) ^ 2)"
[PROOF STATE]
proof (state)
this:
lb1' = (\<lambda>x. C / ln (ln (real x)) - 10 * C / (ln (ln (real x)))\<^sup>2)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
have "eventually (\<lambda>n::nat. 1 + log 2 n \<le> ln n ^ 2) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. 1 + log 2 (real x) \<le> (ln (real x))\<^sup>2
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in sequentially. 1 + log 2 (real x) \<le> (ln (real x))\<^sup>2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
hence "eventually (\<lambda>n. totient n / n \<ge> lb1 n * lb2 n) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in sequentially. 1 + log 2 (real x) \<le> (ln (real x))\<^sup>2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
using eventually_gt_at_top[of 2]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in sequentially. 1 + log 2 (real x) \<le> (ln (real x))\<^sup>2
eventually ((<) (2::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
assume n: "n > 2" and "1 + log 2 n \<le> ln n ^ 2"
[PROOF STATE]
proof (state)
this:
2 < n
1 + log 2 (real n) \<le> (ln (real n))\<^sup>2

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
define Pr where [simp]: "Pr = prime_factors n"
[PROOF STATE]
proof (state)
this:
Pr = prime_factors n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
define Pr1 where [simp]: "Pr1 = {p\<in>Pr. p \<le> ln n}"
[PROOF STATE]
proof (state)
this:
Pr1 = {p \<in> Pr. real p \<le> ln (real n)}

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
define Pr2 where [simp]: "Pr2 = {p\<in>Pr. p > ln n}"
[PROOF STATE]
proof (state)
this:
Pr2 = {p \<in> Pr. ln (real n) < real p}

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "exp 1 < real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp 1 < real n
[PROOF STEP]
using e_less_272 \<open>n > 2\<close>
[PROOF STATE]
proof (prove)
using this:
exp 1 < 272 / 100
2 < n

goal (1 subgoal):
 1. exp 1 < real n
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
exp 1 < real n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
hence "ln (exp 1) < ln (real n)"
[PROOF STATE]
proof (prove)
using this:
exp 1 < real n

goal (1 subgoal):
 1. ln (exp 1) < ln (real n)
[PROOF STEP]
using \<open>n > 2\<close>
[PROOF STATE]
proof (prove)
using this:
exp 1 < real n
2 < n

goal (1 subgoal):
 1. ln (exp 1) < ln (real n)
[PROOF STEP]
by (subst ln_less_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln (exp 1) < ln (real n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
hence "1 < ln n"
[PROOF STATE]
proof (prove)
using this:
ln (exp 1) < ln (real n)

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
hence "ln (ln n) > ln (ln (exp 1))"
[PROOF STATE]
proof (prove)
using this:
1 < ln (real n)

goal (1 subgoal):
 1. ln (ln (exp 1)) < ln (ln (real n))
[PROOF STEP]
by (subst ln_less_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln (ln (exp 1)) < ln (ln (real n))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
hence "ln (ln n) > 0"
[PROOF STATE]
proof (prove)
using this:
ln (ln (exp 1)) < ln (ln (real n))

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "ln n ^ f n \<le> (\<Prod>p\<in>Pr2. ln n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real n) ^ f n \<le> (\<Prod>p\<in>Pr2. ln (real n))
[PROOF STEP]
by (simp add: f_def)
[PROOF STATE]
proof (state)
this:
ln (real n) ^ f n \<le> (\<Prod>p\<in>Pr2. ln (real n))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real n) ^ f n \<le> (\<Prod>p\<in>Pr2. ln (real n))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "\<dots> \<le> real (\<Prod>p\<in>Pr2. p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>Pr2. ln (real n)) \<le> real (\<Prod>Pr2)
[PROOF STEP]
unfolding of_nat_prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>Pr2. ln (real n)) \<le> prod real Pr2
[PROOF STEP]
by (intro prod_mono) (auto dest: prime_gt_1_nat simp: in_prime_factors_iff)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr2. ln (real n)) \<le> real (\<Prod>Pr2)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr2. ln (real n)) \<le> real (\<Prod>Pr2)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr2. ln (real n)) \<le> real (\<Prod>Pr2)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "(\<Prod>p\<in>Pr2. p) dvd (\<Prod>p\<in>Pr2. p ^ multiplicity p n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>Pr2 dvd (\<Prod>p\<in>Pr2. p ^ multiplicity p n)
[PROOF STEP]
by (intro prod_dvd_prod dvd_power) (auto simp: prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
\<Prod>Pr2 dvd (\<Prod>p\<in>Pr2. p ^ multiplicity p n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Prod>Pr2 dvd (\<Prod>p\<in>Pr2. p ^ multiplicity p n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "\<dots> dvd (\<Prod>p\<in>Pr. p ^ multiplicity p n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>Pr2. p ^ multiplicity p n) dvd (\<Prod>p\<in>Pr. p ^ multiplicity p n)
[PROOF STEP]
by (intro prod_dvd_prod_subset2) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr2. p ^ multiplicity p n) dvd (\<Prod>p\<in>Pr. p ^ multiplicity p n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr2. p ^ multiplicity p n) dvd (\<Prod>p\<in>Pr. p ^ multiplicity p n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "\<dots> = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>Pr. p ^ multiplicity p n) = n
[PROOF STEP]
using \<open>n > 2\<close>
[PROOF STATE]
proof (prove)
using this:
2 < n

goal (1 subgoal):
 1. (\<Prod>p\<in>Pr. p ^ multiplicity p n) = n
[PROOF STEP]
by (subst (2) prime_factorization_nat[of n]) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr. p ^ multiplicity p n) = n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Prod>Pr2 dvd n
[PROOF STEP]
have "(\<Prod>p\<in>Pr2. p) \<le> n"
[PROOF STATE]
proof (prove)
using this:
\<Prod>Pr2 dvd n

goal (1 subgoal):
 1. \<Prod>Pr2 \<le> n
[PROOF STEP]
using \<open>n > 2\<close>
[PROOF STATE]
proof (prove)
using this:
\<Prod>Pr2 dvd n
2 < n

goal (1 subgoal):
 1. \<Prod>Pr2 \<le> n
[PROOF STEP]
by (intro dvd_imp_le) auto
[PROOF STATE]
proof (state)
this:
\<Prod>Pr2 \<le> n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<Prod>Pr2 \<le> n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> ln (real n) ^ f n \<le> real n
[PROOF STEP]
have "ln (ln n ^ f n) \<le> ln n"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> ln (real n) ^ f n \<le> real n

goal (1 subgoal):
 1. ln (ln (real n) ^ f n) \<le> ln (real n)
[PROOF STEP]
using \<open>n > 2\<close>
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> ln (real n) ^ f n \<le> real n
2 < n

goal (1 subgoal):
 1. ln (ln (real n) ^ f n) \<le> ln (real n)
[PROOF STEP]
by (subst ln_le_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln (ln (real n) ^ f n) \<le> ln (real n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (ln (real n) ^ f n) \<le> ln (real n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "ln (ln n ^ f n) = f n * ln (ln n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (ln (real n) ^ f n) = real (f n) * ln (ln (real n))
[PROOF STEP]
using \<open>n > 2\<close>
[PROOF STATE]
proof (prove)
using this:
2 < n

goal (1 subgoal):
 1. ln (ln (real n) ^ f n) = real (f n) * ln (ln (real n))
[PROOF STEP]
by (subst ln_realpow) auto
[PROOF STATE]
proof (state)
this:
ln (ln (real n) ^ f n) = real (f n) * ln (ln (real n))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (f n) * ln (ln (real n)) \<le> ln (real n)
[PROOF STEP]
have f_le: "f n \<le> ln n / ln (ln n)"
[PROOF STATE]
proof (prove)
using this:
real (f n) * ln (ln (real n)) \<le> ln (real n)

goal (1 subgoal):
 1. real (f n) \<le> ln (real n) / ln (ln (real n))
[PROOF STEP]
using \<open>ln (ln n) > 0\<close>
[PROOF STATE]
proof (prove)
using this:
real (f n) * ln (ln (real n)) \<le> ln (real n)
0 < ln (ln (real n))

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "(1 - 1 / ln n) powr (ln n / ln (ln n)) \<le> (1 - 1 / ln n) powr (real (f n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))) \<le> (1 - 1 / ln (real n)) powr real (f n)
[PROOF STEP]
using \<open>n > 2\<close> and \<open>ln n > 1\<close>
[PROOF STATE]
proof (prove)
using this:
2 < n
1 < ln (real n)

goal (1 subgoal):
 1. (1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))) \<le> (1 - 1 / ln (real n)) powr real (f n)
[PROOF STEP]
by (intro powr_mono' f_le) auto
[PROOF STATE]
proof (state)
this:
(1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))) \<le> (1 - 1 / ln (real n)) powr real (f n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))) \<le> (1 - 1 / ln (real n)) powr real (f n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>Pr2. 1 - 1 / ln n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - 1 / ln (real n)) powr real (f n) = (\<Prod>p\<in>Pr2. 1 - 1 / ln (real n))
[PROOF STEP]
using \<open>n > 2\<close> and \<open>ln n > 1\<close>
[PROOF STATE]
proof (prove)
using this:
2 < n
1 < ln (real n)

goal (1 subgoal):
 1. (1 - 1 / ln (real n)) powr real (f n) = (\<Prod>p\<in>Pr2. 1 - 1 / ln (real n))
[PROOF STEP]
by (subst powr_realpow) (auto simp: f_def)
[PROOF STATE]
proof (state)
this:
(1 - 1 / ln (real n)) powr real (f n) = (\<Prod>p\<in>Pr2. 1 - 1 / ln (real n))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - 1 / ln (real n)) powr real (f n) = (\<Prod>p\<in>Pr2. 1 - 1 / ln (real n))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "\<dots> \<le> (\<Prod>p\<in>Pr2. 1 - 1 / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>Pr2. 1 - 1 / ln (real n)) \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)
[PROOF STEP]
using \<open>n > 2\<close> and \<open>ln n > 1\<close>
[PROOF STATE]
proof (prove)
using this:
2 < n
1 < ln (real n)

goal (1 subgoal):
 1. (\<Prod>p\<in>Pr2. 1 - 1 / ln (real n)) \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)
[PROOF STEP]
by (intro prod_mono conjI diff_mono divide_left_mono) (auto dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr2. 1 - 1 / ln (real n)) \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))) \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)
[PROOF STEP]
have bound2: "(\<Prod>p\<in>Pr2. 1 - 1 / p) \<ge> lb2 n"
[PROOF STATE]
proof (prove)
using this:
(1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))) \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)

goal (1 subgoal):
 1. lb2 n \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)
[PROOF STEP]
unfolding lb2_def
[PROOF STATE]
proof (prove)
using this:
(1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))) \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)

goal (1 subgoal):
 1. (1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n))) \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lb2 n \<le> (\<Prod>p\<in>Pr2. 1 - 1 / real p)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "(\<Prod>p | prime p \<and> real p \<le> ln n. inverse (1 - 1 / p)) \<ge> (\<Prod>p\<in>Pr1. inverse (1 - 1 / p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>Pr1. inverse (1 - 1 / real p)) \<le> (\<Prod>x\<in>{p. prime p \<and> real p \<le> ln (real n)}. inverse (1 - 1 / real x))
[PROOF STEP]
using \<open>n > 2\<close>
[PROOF STATE]
proof (prove)
using this:
2 < n

goal (1 subgoal):
 1. (\<Prod>p\<in>Pr1. inverse (1 - 1 / real p)) \<le> (\<Prod>x\<in>{p. prime p \<and> real p \<le> ln (real n)}. inverse (1 - 1 / real x))
[PROOF STEP]
by (intro prod_mono2) (auto intro: finite_primes_le  dest: prime_gt_1_nat                                                simp: in_prime_factors_iff field_simps)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr1. inverse (1 - 1 / real p)) \<le> (\<Prod>x\<in>{p. prime p \<and> real p \<le> ln (real n)}. inverse (1 - 1 / real x))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
hence "inverse (\<Prod>p | prime p \<and> real p \<le> ln n. 1 - 1 / p) \<ge> inverse (\<Prod>p\<in>Pr1. 1 - 1 / p)"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>p\<in>Pr1. inverse (1 - 1 / real p)) \<le> (\<Prod>x\<in>{p. prime p \<and> real p \<le> ln (real n)}. inverse (1 - 1 / real x))

goal (1 subgoal):
 1. inverse (\<Prod>p\<in>Pr1. 1 - 1 / real p) \<le> inverse (\<Prod>x\<in>{p. prime p \<and> real p \<le> ln (real n)}. 1 - 1 / real x)
[PROOF STEP]
by (subst (1 2) prod_inversef [symmetric]) auto
[PROOF STATE]
proof (state)
this:
inverse (\<Prod>p\<in>Pr1. 1 - 1 / real p) \<le> inverse (\<Prod>x\<in>{p. prime p \<and> real p \<le> ln (real n)}. 1 - 1 / real x)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
hence bound1: "(\<Prod>p\<in>Pr1. 1 - 1 / p) \<ge> lb1 n"
[PROOF STATE]
proof (prove)
using this:
inverse (\<Prod>p\<in>Pr1. 1 - 1 / real p) \<le> inverse (\<Prod>x\<in>{p. prime p \<and> real p \<le> ln (real n)}. 1 - 1 / real x)

goal (1 subgoal):
 1. lb1 n \<le> (\<Prod>p\<in>Pr1. 1 - 1 / real p)
[PROOF STEP]
unfolding lb1_def
[PROOF STATE]
proof (prove)
using this:
inverse (\<Prod>p\<in>Pr1. 1 - 1 / real p) \<le> inverse (\<Prod>x\<in>{p. prime p \<and> real p \<le> ln (real n)}. 1 - 1 / real x)

goal (1 subgoal):
 1. (\<Prod>p\<in>{p. prime p \<and> real p \<le> ln (real n)}. 1 - 1 / real p) \<le> (\<Prod>p\<in>Pr1. 1 - 1 / real p)
[PROOF STEP]
by (rule inverse_le_imp_le)
         (auto intro!: prod_pos simp: in_prime_factors_iff dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
lb1 n \<le> (\<Prod>p\<in>Pr1. 1 - 1 / real p)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "lb1 n * lb2 n \<le> (\<Prod>p\<in>Pr1. 1 - 1 / p) * (\<Prod>p\<in>Pr2. 1 - 1 / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lb1 n * lb2 n \<le> (\<Prod>p\<in>Pr1. 1 - 1 / real p) * (\<Prod>p\<in>Pr2. 1 - 1 / real p)
[PROOF STEP]
by (intro mult_mono bound1 bound2 prod_nonneg ballI)
         (auto simp: in_prime_factors_iff lb1_def lb2_def dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
lb1 n * lb2 n \<le> (\<Prod>p\<in>Pr1. 1 - 1 / real p) * (\<Prod>p\<in>Pr2. 1 - 1 / real p)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lb1 n * lb2 n \<le> (\<Prod>p\<in>Pr1. 1 - 1 / real p) * (\<Prod>p\<in>Pr2. 1 - 1 / real p)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>Pr1 \<union> Pr2. 1 - 1 / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>Pr1. 1 - 1 / real p) * (\<Prod>p\<in>Pr2. 1 - 1 / real p) = (\<Prod>p\<in>Pr1 \<union> Pr2. 1 - 1 / real p)
[PROOF STEP]
by (subst prod.union_disjoint) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr1. 1 - 1 / real p) * (\<Prod>p\<in>Pr2. 1 - 1 / real p) = (\<Prod>p\<in>Pr1 \<union> Pr2. 1 - 1 / real p)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr1. 1 - 1 / real p) * (\<Prod>p\<in>Pr2. 1 - 1 / real p) = (\<Prod>p\<in>Pr1 \<union> Pr2. 1 - 1 / real p)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "Pr1 \<union> Pr2 = Pr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pr1 \<union> Pr2 = Pr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Pr1 \<union> Pr2 = Pr

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Pr1 \<union> Pr2 = Pr

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
have "(\<Prod>p\<in>Pr. 1 - 1 / p) = totient n / n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>Pr. 1 - 1 / real p) = real (totient n) / real n
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
2 < n

goal (1 subgoal):
 1. (\<Prod>p\<in>Pr. 1 - 1 / real p) = real (totient n) / real n
[PROOF STEP]
by (subst totient_formula2) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>Pr. 1 - 1 / real p) = real (totient n) / real n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 + log 2 (real n) \<le> (ln (real n))\<^sup>2; 2 < n\<rbrakk> \<Longrightarrow> lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
show "real (totient n) / real n \<ge> lb1 n * lb2 n"
[PROOF STATE]
proof (prove)
using this:
lb1 n * lb2 n \<le> real (totient n) / real n

goal (1 subgoal):
 1. lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
by (simp add: lb1_def lb2_def)
[PROOF STATE]
proof (state)
this:
lb1 n * lb2 n \<le> real (totient n) / real n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. lb1 n * lb2 n \<le> real (totient n) / real n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. lb1 n * lb2 n \<le> real (totient n) / real n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
have "eventually (\<lambda>n. \<bar>lb1 n - C / ln (ln n)\<bar> \<le> 10 * C / ln (ln n) ^ 2) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2
[PROOF STEP]
unfolding lb1_def C_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. \<bar>(\<Prod>p\<in>{p. prime p \<and> real p \<le> ln (real n)}. 1 - 1 / real p) - third_mertens_const / ln (ln (real n))\<bar> \<le> 10 * third_mertens_const / (ln (ln (real n)))\<^sup>2
[PROOF STEP]
using mertens_third_theorem_strong
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. \<bar>(\<Prod>p\<in>{p. prime p \<and> real p \<le> x}. 1 - 1 / real p) - third_mertens_const / ln x\<bar> \<le> 10 * third_mertens_const / (ln x)\<^sup>2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. \<bar>(\<Prod>p\<in>{p. prime p \<and> real p \<le> ln (real n)}. 1 - 1 / real p) - third_mertens_const / ln (ln (real n))\<bar> \<le> 10 * third_mertens_const / (ln (ln (real n)))\<^sup>2
[PROOF STEP]
by (rule eventually_compose_filterlim) real_asymp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
have "eventually (\<lambda>n. (1 - \<epsilon>) * C / ln (ln n) < lb1' n * lb2 n) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n
[PROOF STEP]
unfolding lb1'_def lb2_def C_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * third_mertens_const / ln (ln (real n)) < (third_mertens_const / ln (ln (real n)) - 10 * third_mertens_const / (ln (ln (real n)))\<^sup>2) * (1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n)))
[PROOF STEP]
using third_mertens_const_pos \<open>\<epsilon> > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < third_mertens_const
0 < \<epsilon>

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * third_mertens_const / ln (ln (real n)) < (third_mertens_const / ln (ln (real n)) - 10 * third_mertens_const / (ln (ln (real n)))\<^sup>2) * (1 - 1 / ln (real n)) powr (ln (real n) / ln (ln (real n)))
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. lb1 n * lb2 n \<le> real (totient n) / real n
\<forall>\<^sub>F n in sequentially. \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2
\<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n
[PROOF STEP]
show "eventually (\<lambda>n. totient n > (1 - \<epsilon>) * C * n / ln (ln n)) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. lb1 n * lb2 n \<le> real (totient n) / real n
\<forall>\<^sub>F n in sequentially. \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2
\<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
using eventually_gt_at_top[of 0]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. lb1 n * lb2 n \<le> real (totient n) / real n
\<forall>\<^sub>F n in sequentially. \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2
\<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n
eventually ((<) (0::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>lb1 n * lb2 n \<le> real (totient n) / real n; \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2; (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n; 0 < n\<rbrakk> \<Longrightarrow> (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
case (elim n)
[PROOF STATE]
proof (state)
this:
lb1 n * lb2 n \<le> real (totient n) / real n
\<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2
(1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n
0 < n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>lb1 n * lb2 n \<le> real (totient n) / real n; \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2; (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n; 0 < n\<rbrakk> \<Longrightarrow> (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
have "(1 - \<epsilon>) * C / ln (ln n) < lb1' n * lb2 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
(1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>lb1 n * lb2 n \<le> real (totient n) / real n; \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2; (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n; 0 < n\<rbrakk> \<Longrightarrow> (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>lb1 n * lb2 n \<le> real (totient n) / real n; \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2; (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n; 0 < n\<rbrakk> \<Longrightarrow> (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
have "lb1' n \<le> lb1 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lb1' n \<le> lb1 n
[PROOF STEP]
unfolding lb1'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C / ln (ln (real n)) - 10 * C / (ln (ln (real n)))\<^sup>2 \<le> lb1 n
[PROOF STEP]
using elim
[PROOF STATE]
proof (prove)
using this:
lb1 n * lb2 n \<le> real (totient n) / real n
\<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2
(1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n
0 < n

goal (1 subgoal):
 1. C / ln (ln (real n)) - 10 * C / (ln (ln (real n)))\<^sup>2 \<le> lb1 n
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
lb1' n \<le> lb1 n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>lb1 n * lb2 n \<le> real (totient n) / real n; \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2; (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n; 0 < n\<rbrakk> \<Longrightarrow> (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
hence "lb1' n * lb2 n \<le> lb1 n * lb2 n"
[PROOF STATE]
proof (prove)
using this:
lb1' n \<le> lb1 n

goal (1 subgoal):
 1. lb1' n * lb2 n \<le> lb1 n * lb2 n
[PROOF STEP]
by (intro mult_right_mono) (auto simp: lb2_def)
[PROOF STATE]
proof (state)
this:
lb1' n * lb2 n \<le> lb1 n * lb2 n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>lb1 n * lb2 n \<le> real (totient n) / real n; \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2; (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n; 0 < n\<rbrakk> \<Longrightarrow> (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lb1' n * lb2 n \<le> lb1 n * lb2 n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>lb1 n * lb2 n \<le> real (totient n) / real n; \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2; (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n; 0 < n\<rbrakk> \<Longrightarrow> (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
have "\<dots> \<le> totient n / n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lb1 n * lb2 n \<le> real (totient n) / real n
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
lb1 n * lb2 n \<le> real (totient n) / real n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>lb1 n * lb2 n \<le> real (totient n) / real n; \<bar>lb1 n - C / ln (ln (real n))\<bar> \<le> 10 * C / (ln (ln (real n)))\<^sup>2; (1 - \<epsilon>) * C / ln (ln (real n)) < lb1' n * lb2 n; 0 < n\<rbrakk> \<Longrightarrow> (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1 - \<epsilon>) * C / ln (ln (real n)) < real (totient n) / real n
[PROOF STEP]
show "totient n > (1 - \<epsilon>) * C * n / (ln (ln n))"
[PROOF STATE]
proof (prove)
using this:
(1 - \<epsilon>) * C / ln (ln (real n)) < real (totient n) / real n

goal (1 subgoal):
 1. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
(1 - \<epsilon>) * C / ln (ln (real n)) < real (totient n) / real n
0 < n

goal (1 subgoal):
 1. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. (1 - \<epsilon>) * C * real n / ln (ln (real n)) < real (totient n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem quasi_isometric_equiv_rel:
  "quasi_isometric X X"
  "quasi_isometric X Y \<Longrightarrow> quasi_isometric Y Z \<Longrightarrow> quasi_isometric X Z"
  "quasi_isometric X Y \<Longrightarrow> quasi_isometric Y X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quasi_isometric X X &&& (\<lbrakk>quasi_isometric X Y; quasi_isometric Y Z\<rbrakk> \<Longrightarrow> quasi_isometric X Z) &&& (quasi_isometric X Y \<Longrightarrow> quasi_isometric Y X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. quasi_isometric X X
 2. \<lbrakk>quasi_isometric X Y; quasi_isometric Y Z\<rbrakk> \<Longrightarrow> quasi_isometric X Z
 3. quasi_isometric X Y \<Longrightarrow> quasi_isometric Y X
[PROOF STEP]
show "quasi_isometric X X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quasi_isometric X X
[PROOF STEP]
unfolding quasi_isometric_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>lambda C. Ex (lambda C -quasi_isometry_between X X)
[PROOF STEP]
using quasi_isometry_subset[of X X 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>X \<subseteq> X; \<And>y. y \<in> X \<Longrightarrow> \<exists>x\<in>X. dist x y \<le> 0; 0 \<le> 0\<rbrakk> \<Longrightarrow> 1 0 -quasi_isometry_between X X (\<lambda>x. x)

goal (1 subgoal):
 1. \<exists>lambda C. Ex (lambda C -quasi_isometry_between X X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
quasi_isometric X X

goal (2 subgoals):
 1. \<lbrakk>quasi_isometric X Y; quasi_isometric Y Z\<rbrakk> \<Longrightarrow> quasi_isometric X Z
 2. quasi_isometric X Y \<Longrightarrow> quasi_isometric Y X
[PROOF STEP]
assume H: "quasi_isometric X Y"
[PROOF STATE]
proof (state)
this:
quasi_isometric X Y

goal (2 subgoals):
 1. \<lbrakk>quasi_isometric X Y; quasi_isometric Y Z\<rbrakk> \<Longrightarrow> quasi_isometric X Z
 2. quasi_isometric X Y \<Longrightarrow> quasi_isometric Y X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
quasi_isometric X Y
[PROOF STEP]
show "quasi_isometric Y X"
[PROOF STATE]
proof (prove)
using this:
quasi_isometric X Y

goal (1 subgoal):
 1. quasi_isometric Y X
[PROOF STEP]
unfolding quasi_isometric_def
[PROOF STATE]
proof (prove)
using this:
\<exists>lambda C. Ex (lambda C -quasi_isometry_between X Y)

goal (1 subgoal):
 1. \<exists>lambda C. Ex (lambda C -quasi_isometry_between Y X)
[PROOF STEP]
using quasi_isometry_inverse
[PROOF STATE]
proof (prove)
using this:
\<exists>lambda C. Ex (lambda C -quasi_isometry_between X Y)
?lambda ?C -quasi_isometry_between ?X ?Y ?f \<Longrightarrow> \<exists>g. ?lambda (3 * ?C * ?lambda) -quasi_isometry_between ?Y ?X g \<and> (\<forall>x\<in>?X. dist x (g (?f x)) \<le> 3 * ?C * ?lambda) \<and> (\<forall>y\<in>?Y. dist y (?f (g y)) \<le> 3 * ?C * ?lambda)

goal (1 subgoal):
 1. \<exists>lambda C. Ex (lambda C -quasi_isometry_between Y X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
quasi_isometric Y X

goal (1 subgoal):
 1. \<lbrakk>quasi_isometric X Y; quasi_isometric Y Z\<rbrakk> \<Longrightarrow> quasi_isometric X Z
[PROOF STEP]
assume "quasi_isometric Y Z"
[PROOF STATE]
proof (state)
this:
quasi_isometric Y Z

goal (1 subgoal):
 1. \<lbrakk>quasi_isometric X Y; quasi_isometric Y Z\<rbrakk> \<Longrightarrow> quasi_isometric X Z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
quasi_isometric Y Z
[PROOF STEP]
show "quasi_isometric X Z"
[PROOF STATE]
proof (prove)
using this:
quasi_isometric Y Z

goal (1 subgoal):
 1. quasi_isometric X Z
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
quasi_isometric Y Z
quasi_isometric X Y

goal (1 subgoal):
 1. quasi_isometric X Z
[PROOF STEP]
unfolding quasi_isometric_def
[PROOF STATE]
proof (prove)
using this:
\<exists>lambda C. Ex (lambda C -quasi_isometry_between Y Z)
\<exists>lambda C. Ex (lambda C -quasi_isometry_between X Y)

goal (1 subgoal):
 1. \<exists>lambda C. Ex (lambda C -quasi_isometry_between X Z)
[PROOF STEP]
using quasi_isometry_compose
[PROOF STATE]
proof (prove)
using this:
\<exists>lambda C. Ex (lambda C -quasi_isometry_between Y Z)
\<exists>lambda C. Ex (lambda C -quasi_isometry_between X Y)
\<lbrakk>?lambda ?C -quasi_isometry_between ?X ?Y ?f; ?mu ?D -quasi_isometry_between ?Y ?Z ?g\<rbrakk> \<Longrightarrow> (?lambda * ?mu) (?C * ?mu + 2 * ?D) -quasi_isometry_between ?X ?Z (?g \<circ> ?f)

goal (1 subgoal):
 1. \<exists>lambda C. Ex (lambda C -quasi_isometry_between X Z)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
quasi_isometric X Z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_sadd_commutative: "(\<Sum>t=0..(q::nat). \<Sum>S+ p l (\<lambda>k. f k t)) = (\<Sum>S+ p l (\<lambda>k. \<Sum>t=0..q. f k t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..q. \<Sum>S+ p l (\<lambda>k. f k t) ) = \<Sum>S+ p l (\<lambda>k. sum (f k) {0..q})
[PROOF STEP]
by (rule sum_commutative sum_sadd.simps) +


[STATEMENT]
lemma T_filter_eq: "T_filter T_p xs = (\<Sum>x\<leftarrow>xs. T_p x) + length xs + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_filter T_p xs = sum_list (map T_p xs) + length xs + 1
[PROOF STEP]
by (induction xs) auto


[STATEMENT]
lemma poly_mult_append_zero:
  assumes "set p \<subseteq> carrier R" "set q \<subseteq> carrier R"
  shows "poly_mult (p @ [ \<zero> ]) q = normalize ((poly_mult p q) @ [ \<zero> ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>])
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
set p \<subseteq> carrier R

goal (1 subgoal):
 1. poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>])
[PROOF STEP]
proof (induct p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set [] \<subseteq> carrier R \<Longrightarrow> poly_mult ([] @ [\<zero>]) q = local.normalize (poly_mult [] q @ [\<zero>])
 2. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
set [] \<subseteq> carrier R

goal (2 subgoals):
 1. set [] \<subseteq> carrier R \<Longrightarrow> poly_mult ([] @ [\<zero>]) q = local.normalize (poly_mult [] q @ [\<zero>])
 2. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set [] \<subseteq> carrier R

goal (1 subgoal):
 1. poly_mult ([] @ [\<zero>]) q = local.normalize (poly_mult [] q @ [\<zero>])
[PROOF STEP]
using poly_mult_normalize[OF _ assms(2), of "[] @ [ \<zero> ]"]
          poly_mult_zero(1) poly_mult_zero(1)[of "q @ [ \<zero> ]"] assms(2)
[PROOF STATE]
proof (prove)
using this:
set [] \<subseteq> carrier R
set ([] @ [\<zero>]) \<subseteq> carrier R \<Longrightarrow> poly_mult ([] @ [\<zero>]) q = poly_mult (local.normalize ([] @ [\<zero>])) q
set ?p \<subseteq> carrier R \<Longrightarrow> poly_mult [] ?p = []
set (q @ [\<zero>]) \<subseteq> carrier R \<Longrightarrow> poly_mult [] (q @ [\<zero>]) = []
set q \<subseteq> carrier R

goal (1 subgoal):
 1. poly_mult ([] @ [\<zero>]) q = local.normalize (poly_mult [] q @ [\<zero>])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mult ([] @ [\<zero>]) q = local.normalize (poly_mult [] q @ [\<zero>])

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
case (Cons a p)
[PROOF STATE]
proof (state)
this:
set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>])
set (a # p) \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
let ?q_a = "\<lambda>n. (map ((\<otimes>) a) q) @ (replicate n \<zero>)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
have set_q_a: "\<And>n. set (?q_a n) \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. set (map ((\<otimes>) a) q @ replicate n \<zero>) \<subseteq> carrier R
[PROOF STEP]
using Cons(2) assms(2)
[PROOF STATE]
proof (prove)
using this:
set (a # p) \<subseteq> carrier R
set q \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>n. set (map ((\<otimes>) a) q @ replicate n \<zero>) \<subseteq> carrier R
[PROOF STEP]
by (induct q) (auto)
[PROOF STATE]
proof (state)
this:
set (map ((\<otimes>) a) q @ replicate ?n \<zero>) \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
have set_poly_mult: "set ((poly_mult p q) @ [ \<zero> ]) \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (poly_mult p q @ [\<zero>]) \<subseteq> carrier R
[PROOF STEP]
using poly_mult_in_carrier[OF _ assms(2)] Cons(2)
[PROOF STATE]
proof (prove)
using this:
set ?p1.0 \<subseteq> carrier R \<Longrightarrow> set (poly_mult ?p1.0 q) \<subseteq> carrier R
set (a # p) \<subseteq> carrier R

goal (1 subgoal):
 1. set (poly_mult p q @ [\<zero>]) \<subseteq> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (poly_mult p q @ [\<zero>]) \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
have "poly_mult ((a # p) @ [\<zero>]) q = poly_add (?q_a (Suc (length p))) (poly_mult (p @ [\<zero>]) q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult ((a # p) @ [\<zero>]) q = poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (poly_mult (p @ [\<zero>]) q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mult ((a # p) @ [\<zero>]) q = poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (poly_mult (p @ [\<zero>]) q)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_mult ((a # p) @ [\<zero>]) q = poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (poly_mult (p @ [\<zero>]) q)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
have " ... = poly_add (?q_a (Suc (length p))) (normalize ((poly_mult p q) @ [ \<zero> ]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (poly_mult (p @ [\<zero>]) q) = poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>]))
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>])
set (a # p) \<subseteq> carrier R

goal (1 subgoal):
 1. poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (poly_mult (p @ [\<zero>]) q) = poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (poly_mult (p @ [\<zero>]) q) = poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>]))

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (poly_mult (p @ [\<zero>]) q) = poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>]))

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
have " ... = poly_add ((?q_a (length p)) @ [ \<zero> ]) ((poly_mult p q) @ [ \<zero> ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>])) = poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult p q @ [\<zero>])
[PROOF STEP]
using poly_add_normalize(2)[OF set_q_a[of "Suc (length p)"] set_poly_mult]
[PROOF STATE]
proof (prove)
using this:
poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (poly_mult p q @ [\<zero>]) = poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>]))

goal (1 subgoal):
 1. poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>])) = poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult p q @ [\<zero>])
[PROOF STEP]
by (simp add: replicate_append_same)
[PROOF STATE]
proof (state)
this:
poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>])) = poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult p q @ [\<zero>])

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_add (map ((\<otimes>) a) q @ replicate (Suc (length p)) \<zero>) (local.normalize (poly_mult p q @ [\<zero>])) = poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult p q @ [\<zero>])

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
have " ... = normalize ((poly_add (?q_a (length p)) (poly_mult p q)) @ [ \<zero> ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult p q @ [\<zero>]) = local.normalize (poly_add (map ((\<otimes>) a) q @ replicate (length p) \<zero>) (poly_mult p q) @ [\<zero>])
[PROOF STEP]
using poly_add_append_zero[OF set_q_a[of "length p"] poly_mult_in_carrier[OF _ assms(2)]] Cons(2)
[PROOF STATE]
proof (prove)
using this:
set ?p1.1 \<subseteq> carrier R \<Longrightarrow> poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult ?p1.1 q @ [\<zero>]) = local.normalize (poly_add (map ((\<otimes>) a) q @ replicate (length p) \<zero>) (poly_mult ?p1.1 q) @ [\<zero>])
set (a # p) \<subseteq> carrier R

goal (1 subgoal):
 1. poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult p q @ [\<zero>]) = local.normalize (poly_add (map ((\<otimes>) a) q @ replicate (length p) \<zero>) (poly_mult p q) @ [\<zero>])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult p q @ [\<zero>]) = local.normalize (poly_add (map ((\<otimes>) a) q @ replicate (length p) \<zero>) (poly_mult p q) @ [\<zero>])

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_add ((map ((\<otimes>) a) q @ replicate (length p) \<zero>) @ [\<zero>]) (poly_mult p q @ [\<zero>]) = local.normalize (poly_add (map ((\<otimes>) a) q @ replicate (length p) \<zero>) (poly_mult p q) @ [\<zero>])

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
have " ... = normalize ((poly_mult (a # p) q) @ [ \<zero> ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.normalize (poly_add (map ((\<otimes>) a) q @ replicate (length p) \<zero>) (poly_mult p q) @ [\<zero>]) = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.normalize (poly_add (map ((\<otimes>) a) q @ replicate (length p) \<zero>) (poly_mult p q) @ [\<zero>]) = local.normalize (poly_mult (a # p) q @ [\<zero>])

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>set p \<subseteq> carrier R \<Longrightarrow> poly_mult (p @ [\<zero>]) q = local.normalize (poly_mult p q @ [\<zero>]); set (a # p) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])

goal (1 subgoal):
 1. poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly_mult ((a # p) @ [\<zero>]) q = local.normalize (poly_mult (a # p) q @ [\<zero>])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma assoc_simps [simp]:
    assumes "ide a" and "ide b" and "ide c"
    shows "arr \<a>[a, b, c]"
    and "dom \<a>[a, b, c] = (a \<otimes> b) \<otimes> c"
    and "cod \<a>[a, b, c] = a \<otimes> (b \<otimes> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr \<a>[a, b, c] &&& local.dom \<a>[a, b, c] = (a \<otimes> b) \<otimes> c &&& cod \<a>[a, b, c] = a \<otimes> b \<otimes> c
[PROOF STEP]
using assms assoc_in_hom
[PROOF STATE]
proof (prove)
using this:
ide a
ide b
ide c
\<lbrakk>ide ?a; ide ?b; ide ?c\<rbrakk> \<Longrightarrow> \<guillemotleft>\<a>[?a, ?b, ?c] : (?a \<otimes> ?b) \<otimes> ?c \<rightarrow> ?a \<otimes> ?b \<otimes> ?c\<guillemotright>

goal (1 subgoal):
 1. arr \<a>[a, b, c] &&& local.dom \<a>[a, b, c] = (a \<otimes> b) \<otimes> c &&& cod \<a>[a, b, c] = a \<otimes> b \<otimes> c
[PROOF STEP]
by auto


[STATEMENT]
lemma ordinal_oSuc_minus [simp]: "y \<le> x \<Longrightarrow> oSuc x - y = oSuc (x - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> x \<Longrightarrow> oSuc x - y = oSuc (x - y)
[PROOF STEP]
by (simp add: minus_ordinal_def)


[STATEMENT]
lemma [code]:
  \<open>bit m n \<longleftrightarrow> odd (drop_bit n m)\<close>
  \<open>mask n = 2 ^ n - (1 :: integer)\<close>
  \<open>set_bit n m = m OR push_bit n 1\<close>
  \<open>flip_bit n m = m XOR push_bit n 1\<close>
  \<open>push_bit n m = m * 2 ^ n\<close>
  \<open>drop_bit n m = m div 2 ^ n\<close>
  \<open>take_bit n m = m mod 2 ^ n\<close> for m :: natural
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bit m n = odd (drop_bit n m) &&& mask n = 2 ^ n - 1 &&& set_bit n m = m OR push_bit n 1) &&& (flip_bit n m = m XOR push_bit n 1 &&& push_bit n m = m * 2 ^ n) &&& drop_bit n m = m div 2 ^ n &&& take_bit n m = m mod 2 ^ n
[PROOF STEP]
by (fact bit_iff_odd_drop_bit mask_eq_exp_minus_1
    set_bit_eq_or flip_bit_eq_xor push_bit_eq_mult drop_bit_eq_div take_bit_eq_mod)+


[STATEMENT]
lemma list_all_butlast_not_nthD: "list_all P (butlast xs) \<Longrightarrow> \<not> P (xs ! n) \<Longrightarrow> length xs \<le> Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all P (butlast xs); \<not> P (xs ! n)\<rbrakk> \<Longrightarrow> length xs \<le> Suc n
[PROOF STEP]
using list_all_not_nthD[of _ "butlast xs" for xs, simplified]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>list_all ?P (butlast ?xsa4); \<not> ?P (butlast ?xsa4 ! ?n)\<rbrakk> \<Longrightarrow> length ?xsa4 - Suc 0 \<le> ?n

goal (1 subgoal):
 1. \<lbrakk>list_all P (butlast xs); \<not> P (xs ! n)\<rbrakk> \<Longrightarrow> length xs \<le> Suc n
[PROOF STEP]
by (smt (z3) One_nat_def Suc_pred le_Suc_eq length_butlast length_greater_0_conv less_Suc_eq list.pred_inject(1) list_all_not_nthD not_le nth_butlast)


[STATEMENT]
lemma at_disj_dist:"\<Turnstile>(\<^bold>@c (\<phi> \<^bold>\<or> \<psi>)) \<^bold>\<leftrightarrow> ((\<^bold>@c \<phi> )  \<^bold>\<or> ( \<^bold>@c \<psi> ))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ts v. (\<forall>v'. v = c > v' \<longrightarrow> \<phi> ts v' \<or> \<psi> ts v') = ((\<forall>v'. v = c > v' \<longrightarrow> \<phi> ts v') \<or> (\<forall>v'. v = c > v' \<longrightarrow> \<psi> ts v'))
[PROOF STEP]
using switch_unique
[PROOF STATE]
proof (prove)
using this:
?v = ?c > ?u \<and> ?v = ?c > ?w \<longrightarrow> ?u = ?w

goal (1 subgoal):
 1. \<forall>ts v. (\<forall>v'. v = c > v' \<longrightarrow> \<phi> ts v' \<or> \<psi> ts v') = ((\<forall>v'. v = c > v' \<longrightarrow> \<phi> ts v') \<or> (\<forall>v'. v = c > v' \<longrightarrow> \<psi> ts v'))
[PROOF STEP]
by fastforce


[STATEMENT]
lemma  measurable_pair_swap:
  assumes f: "f \<in> measurable (M1 \<Otimes>\<^sub>M M2) M" shows "(\<lambda>(x,y). f (y, x)) \<in> measurable (M2 \<Otimes>\<^sub>M M1) M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) \<in> M2 \<Otimes>\<^sub>M M1 \<rightarrow>\<^sub>M M
[PROOF STEP]
using measurable_comp[OF measurable_Pair f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f1 \<in> ?M \<rightarrow>\<^sub>M M1; ?g1 \<in> ?M \<rightarrow>\<^sub>M M2\<rbrakk> \<Longrightarrow> f \<circ> (\<lambda>x. (?f1 x, ?g1 x)) \<in> ?M \<rightarrow>\<^sub>M M

goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) \<in> M2 \<Otimes>\<^sub>M M1 \<rightarrow>\<^sub>M M
[PROOF STEP]
by (auto simp: measurable_split_conv comp_def)


[STATEMENT]
lemma less_pow2: "x < 2 ^ a \<Longrightarrow> int x < 2 ^ a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < 2 ^ a \<Longrightarrow> int x < 2 ^ a
[PROOF STEP]
by (metis of_nat_less_iff of_nat_numeral of_nat_power [symmetric])


[STATEMENT]
lemma poly_compose_add:
  assumes "is_poly_tuple m fs"
  assumes "length fs = n"
  assumes "f \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>])"
  assumes "g \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>])"
  shows "Qp_poly_comp m fs (f \<oplus>\<^bsub>Q\<^sub>p[\<X>\<^bsub>n\<^esub>]\<^esub> g) = (Qp_poly_comp m fs f) \<oplus>\<^bsub>Q\<^sub>p[\<X>\<^bsub>m\<^esub>]\<^esub>  (Qp_poly_comp m fs g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Qp_poly_comp m fs (f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> g) = Qp_poly_comp m fs f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>m\<^esub>]\<^esub> Qp_poly_comp m fs g
[PROOF STEP]
using Qp.cring_axioms assms poly_compose_add
[PROOF STATE]
proof (prove)
using this:
cring Q\<^sub>p
is_poly_tuple m fs
length fs = n
f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n; ?f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?n\<^esub>]); ?g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?n\<^esub>])\<rbrakk> \<Longrightarrow> poly_compose ?n ?m ?fs (?f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>?n\<^esub>]\<^esub> ?g) = poly_compose ?n ?m ?fs ?f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>?m\<^esub>]\<^esub> poly_compose ?n ?m ?fs ?g

goal (1 subgoal):
 1. Qp_poly_comp m fs (f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> g) = Qp_poly_comp m fs f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>m\<^esub>]\<^esub> Qp_poly_comp m fs g
[PROOF STEP]
unfolding is_poly_tuple_def Qp_poly_comp_def
[PROOF STATE]
proof (prove)
using this:
cring Q\<^sub>p
set fs \<subseteq> carrier (Q\<^sub>p [\<X>\<^bsub>m\<^esub>])
length fs = n
f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
\<lbrakk>set ?fs \<subseteq> carrier (Q\<^sub>p [\<X>\<^bsub>?m\<^esub>]); length ?fs = ?n; ?f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?n\<^esub>]); ?g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?n\<^esub>])\<rbrakk> \<Longrightarrow> poly_compose ?n ?m ?fs (?f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>?n\<^esub>]\<^esub> ?g) = poly_compose ?n ?m ?fs ?f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>?m\<^esub>]\<^esub> poly_compose ?n ?m ?fs ?g

goal (1 subgoal):
 1. poly_compose (length fs) m fs (f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> g) = poly_compose (length fs) m fs f \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>m\<^esub>]\<^esub> poly_compose (length fs) m fs g
[PROOF STEP]
by blast


[STATEMENT]
lemma sums_fds_perzeta:
  assumes "Re s > 1"
  shows   "(\<lambda>m. exp (2 * pi * \<i> * Suc m * q) / of_nat (Suc m) powr s) sums
             eval_fds (fds_perzeta q) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
have "conv_abscissa (fds_perzeta q) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_abscissa (fds_perzeta q) \<le> 1
[PROOF STEP]
by (rule conv_abscissa_perzeta)
[PROOF STATE]
proof (state)
this:
conv_abscissa (fds_perzeta q) \<le> 1

goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conv_abscissa (fds_perzeta q) \<le> 1

goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
have "\<dots> < ereal (Re s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < ereal (Re s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < Re s

goal (1 subgoal):
 1. 1 < ereal (Re s)
[PROOF STEP]
by (simp add: one_ereal_def)
[PROOF STATE]
proof (state)
this:
1 < ereal (Re s)

goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
conv_abscissa (fds_perzeta q) < ereal (Re s)
[PROOF STEP]
have "fds_converges (fds_perzeta q) s"
[PROOF STATE]
proof (prove)
using this:
conv_abscissa (fds_perzeta q) < ereal (Re s)

goal (1 subgoal):
 1. fds_converges (fds_perzeta q) s
[PROOF STEP]
by (intro fds_converges) auto
[PROOF STATE]
proof (state)
this:
fds_converges (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
hence "(\<lambda>n. fds_nth (fds_perzeta q) (Suc n) / nat_power (Suc n) s) sums
           eval_fds (fds_perzeta q) s"
[PROOF STATE]
proof (prove)
using this:
fds_converges (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>n. fds_nth (fds_perzeta q) (Suc n) / nat_power (Suc n) s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
by (subst sums_Suc_iff) (auto simp: fds_converges_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. fds_nth (fds_perzeta q) (Suc n) / nat_power (Suc n) s) sums eval_fds (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. fds_nth (fds_perzeta q) (Suc n) / nat_power (Suc n) s) sums eval_fds (fds_perzeta q) s

goal (1 subgoal):
 1. (\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s
[PROOF STEP]
by (simp add: fds_perzeta_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. exp (complex_of_real (2 * pi) * \<i> * of_nat (Suc m) * complex_of_real q) / of_nat (Suc m) powr s) sums eval_fds (fds_perzeta q) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_sqrt_ge_one: "1 \<le> x \<Longrightarrow> 1 \<le> sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> x \<Longrightarrow> 1 \<le> sqrt x
[PROOF STEP]
by simp


[STATEMENT]
lemma min_eds_eq_Nil_iff: "min_eds xs ys = [] \<longleftrightarrow> xs = [] \<and> ys = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (min_eds xs ys = []) = (xs = [] \<and> ys = [])
[PROOF STEP]
by (induction xs ys rule: min_eds.induct) auto


[STATEMENT]
lemma bigo_useful_const_mult: "(c::'a::linordered_field) ~= 0 \<Longrightarrow>
    (\<lambda>x. c) * f =o O(h) \<Longrightarrow> f =o O(h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> f \<in> O(h)
[PROOF STEP]
apply (rule subsetD)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> ?A \<subseteq> O(h)
 2. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> f \<in> ?A
[PROOF STEP]
apply (subgoal_tac "(\<lambda>x. 1 / c) *o O(h) <= O(h)")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h); (\<lambda>x. (1::'a) / c) *o O(h) \<subseteq> O(h)\<rbrakk> \<Longrightarrow> ?A \<subseteq> O(h)
 2. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> (\<lambda>x. (1::'a) / c) *o O(h) \<subseteq> O(h)
 3. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> f \<in> ?A
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> (\<lambda>x. (1::'a) / c) *o O(h) \<subseteq> O(h)
 2. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> f \<in> (\<lambda>x. (1::'a) / c) *o O(h)
[PROOF STEP]
apply (rule bigo_const_mult6)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> f \<in> (\<lambda>x. (1::'a) / c) *o O(h)
[PROOF STEP]
apply (subgoal_tac "f = (\<lambda>x. 1 / c) * ((\<lambda>x. c) * f)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h); f = (\<lambda>x. (1::'a) / c) * ((\<lambda>x. c) * f)\<rbrakk> \<Longrightarrow> f \<in> (\<lambda>x. (1::'a) / c) *o O(h)
 2. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> f = (\<lambda>x. (1::'a) / c) * ((\<lambda>x. c) * f)
[PROOF STEP]
apply (erule ssubst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> (\<lambda>x. (1::'a) / c) * ((\<lambda>x. c) * f) \<in> (\<lambda>x. (1::'a) / c) *o O(h)
 2. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> f = (\<lambda>x. (1::'a) / c) * ((\<lambda>x. c) * f)
[PROOF STEP]
apply (erule set_times_intro2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> (0::'a); (\<lambda>x. c) * f \<in> O(h)\<rbrakk> \<Longrightarrow> f = (\<lambda>x. (1::'a) / c) * ((\<lambda>x. c) * f)
[PROOF STEP]
apply (simp add: func_times)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma radius_max_prop: "(\<forall>s \<in> S. distance C s \<le> r) \<Longrightarrow> (radius C \<le> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s\<in>S. distance C s \<le> r \<Longrightarrow> radius C \<le> r
[PROOF STEP]
by (metis image_iff radius_contained)


[STATEMENT]
lemma mod_ring_normalize_integer: "(mod_ring_rel_integer ===> mod_ring_rel_integer) (\<lambda>x. if x = 0 then 0 else 1) normalize"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mod_ring_rel_integer ===> mod_ring_rel_integer) (\<lambda>x. if x = 0 then 0 else 1) normalize
[PROOF STEP]
using urel_integer_normalize[OF *] mod_ring_normalize
[PROOF STATE]
proof (prove)
using this:
urel_integer ?x ?y \<Longrightarrow> urel_integer (if ?x = 0 then 0 else 1) (if ?y = 0 then 0 else 1)
(mod_ring_rel ===> mod_ring_rel) (\<lambda>x. if x = 0 then 0 else 1) normalize

goal (1 subgoal):
 1. (mod_ring_rel_integer ===> mod_ring_rel_integer) (\<lambda>x. if x = 0 then 0 else 1) normalize
[PROOF STEP]
unfolding mod_ring_rel_integer_def[OF *] rel_fun_def
[PROOF STATE]
proof (prove)
using this:
urel_integer ?x ?y \<Longrightarrow> urel_integer (if ?x = 0 then 0 else 1) (if ?y = 0 then 0 else 1)
\<forall>x y. mod_ring_rel x y \<longrightarrow> mod_ring_rel (if x = 0 then 0 else 1) (normalize y)

goal (1 subgoal):
 1. \<forall>x y. (\<exists>z. urel_integer x z \<and> mod_ring_rel z y) \<longrightarrow> (\<exists>z. urel_integer (if x = 0 then 0 else 1) z \<and> mod_ring_rel z (normalize y))
[PROOF STEP]
by blast


[STATEMENT]
lemma kpower_inv: "I \<le> {s. \<forall>y. y \<in> F s \<longrightarrow> y \<in> I} \<Longrightarrow> I \<le> {s. \<forall>y. y \<in> (kpower F n s) \<longrightarrow> y \<in> I}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<subseteq> {s. \<forall>y. s2p (F s) y \<longrightarrow> s2p I y} \<Longrightarrow> I \<subseteq> {s. \<forall>y. s2p (kpower F n s) y \<longrightarrow> s2p I y}
[PROOF STEP]
apply(induct n, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>I \<subseteq> {s. \<forall>y. s2p (F s) y \<longrightarrow> s2p I y} \<Longrightarrow> I \<subseteq> {s. \<forall>y. s2p (kpower F n s) y \<longrightarrow> s2p I y}; I \<subseteq> {s. \<forall>y. s2p (F s) y \<longrightarrow> s2p I y}\<rbrakk> \<Longrightarrow> I \<subseteq> {s. \<forall>y. s2p (kpower F (Suc n) s) y \<longrightarrow> s2p I y}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>I \<subseteq> {s. \<forall>y. s2p (kpower F n s) y \<longrightarrow> s2p I y}; I \<subseteq> {s. \<forall>y. s2p (F s) y \<longrightarrow> s2p I y}\<rbrakk> \<Longrightarrow> I \<subseteq> {s. \<forall>y. s2p ((F ; kpower F n) s) y \<longrightarrow> s2p I y}
[PROOF STEP]
by(auto simp: kcomp_prop)


[STATEMENT]
lemma float_minus:
  "- (float (a,b)) = float (-a, b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - float (a, b) = float (- a, b)
[PROOF STEP]
by (simp add: float_def)


[STATEMENT]
lemma scaleC_image_atLeastAtMost: "c > 0 \<Longrightarrow> scaleC c ` {x..y} = {c *\<^sub>C x..c *\<^sub>C y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < c \<Longrightarrow> (*\<^sub>C) c ` {x..y} = {c *\<^sub>C x..c *\<^sub>C y}
[PROOF STEP]
apply (auto intro!: scaleC_left_mono simp: image_iff Bex_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>0 < c; c *\<^sub>C x \<le> xa; xa \<le> c *\<^sub>C y\<rbrakk> \<Longrightarrow> \<exists>xb\<ge>x. xb \<le> y \<and> xa = c *\<^sub>C xb
[PROOF STEP]
by (meson order.eq_iff local.order.refl pos_divideC_le_eq pos_le_divideC_eq)


[STATEMENT]
lemma l12_18_b:
  assumes "Cong A B C D" and
    "Cong B C D A" and
    "\<not> Col A B C" and
    "B \<noteq> D" and
    "Col A P C" and
    "Col B P D"
  shows "B C Par D A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B C Par D A
[PROOF STEP]
by (smt assms(1) assms(2) assms(3) assms(4) assms(5) assms(6) cong_symmetry inter_uniqueness_not_par l12_18_a l6_21 not_col_distincts)


[STATEMENT]
lemma hnorm_less_Infinitesimal: "e \<in> Infinitesimal \<Longrightarrow> hnorm x < e \<Longrightarrow> x \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>e \<in> Infinitesimal; hnorm x < e\<rbrakk> \<Longrightarrow> x \<in> Infinitesimal
[PROOF STEP]
by (erule hnorm_le_Infinitesimal, erule order_less_imp_le)


[STATEMENT]
lemma atLeastAtMost_subset_contains_Inf:
  fixes A :: "real set" and a b :: real
  shows "A \<noteq> {} \<Longrightarrow> a \<le> b \<Longrightarrow> A \<subseteq> {a..b} \<Longrightarrow> Inf A \<in> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; a \<le> b; A \<subseteq> {a..b}\<rbrakk> \<Longrightarrow> Inf A \<in> {a..b}
[PROOF STEP]
by (rule closed_subset_contains_Inf)
     (auto intro: closed_real_atLeastAtMost intro!: bdd_belowI[of A a])


[STATEMENT]
lemma measurable_bounded_lemma:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes f: "f \<in> borel_measurable lebesgue" and g: "g integrable_on cbox a b"
    and normf: "\<And>x. x \<in> cbox a b \<Longrightarrow> norm(f x) \<le> g x"
  shows "f integrable_on cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on cbox a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f integrable_on cbox a b
[PROOF STEP]
have "g absolutely_integrable_on cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g absolutely_integrable_on cbox a b
[PROOF STEP]
by (metis (full_types) add_increasing g le_add_same_cancel1 nonnegative_absolutely_integrable_1 norm_ge_zero normf)
[PROOF STATE]
proof (state)
this:
g absolutely_integrable_on cbox a b

goal (1 subgoal):
 1. f integrable_on cbox a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g absolutely_integrable_on cbox a b
[PROOF STEP]
have "integrable (lebesgue_on (cbox a b)) g"
[PROOF STATE]
proof (prove)
using this:
g absolutely_integrable_on cbox a b

goal (1 subgoal):
 1. integrable (lebesgue_on (cbox a b)) g
[PROOF STEP]
by (simp add: integrable_restrict_space set_integrable_def)
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on (cbox a b)) g

goal (1 subgoal):
 1. f integrable_on cbox a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable (lebesgue_on (cbox a b)) g
[PROOF STEP]
have "integrable (lebesgue_on (cbox a b)) f"
[PROOF STATE]
proof (prove)
using this:
integrable (lebesgue_on (cbox a b)) g

goal (1 subgoal):
 1. integrable (lebesgue_on (cbox a b)) f
[PROOF STEP]
proof (rule Bochner_Integration.integrable_bound)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f \<in> borel_measurable (lebesgue_on (cbox a b))
 2. AE x in lebesgue_on (cbox a b). norm (f x) \<le> norm (g x)
[PROOF STEP]
show "AE x in lebesgue_on (cbox a b). norm (f x) \<le> norm (g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in lebesgue_on (cbox a b). norm (f x) \<le> norm (g x)
[PROOF STEP]
by (rule AE_I2) (auto intro: normf order_trans)
[PROOF STATE]
proof (state)
this:
AE x in lebesgue_on (cbox a b). norm (f x) \<le> norm (g x)

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on (cbox a b))
[PROOF STEP]
qed (simp add: f measurable_restrict_space1)
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on (cbox a b)) f

goal (1 subgoal):
 1. f integrable_on cbox a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable (lebesgue_on (cbox a b)) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable (lebesgue_on (cbox a b)) f

goal (1 subgoal):
 1. f integrable_on cbox a b
[PROOF STEP]
by (simp add: integrable_on_lebesgue_on)
[PROOF STATE]
proof (state)
this:
f integrable_on cbox a b

goal:
No subgoals!
[PROOF STEP]
qed