[STATEMENT]
theorem f2_asymptotic_space_complexity:
  "f2_space_usage \<in> O[at_top \<times>\<^sub>F at_top \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda> (n, m, \<epsilon>, \<delta>).
  (ln (1 / of_rat \<epsilon>)) / (of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))"
  (is "_ \<in> O[?F](?rhs)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
define n_of :: "nat \<times> nat \<times> rat \<times> rat \<Rightarrow> nat" where "n_of = (\<lambda>(n, m, \<epsilon>, \<delta>). n)"
[PROOF STATE]
proof (state)
this:
n_of = (\<lambda>(n, m, \<epsilon>, \<delta>). n)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
define m_of :: "nat \<times> nat \<times> rat \<times> rat \<Rightarrow> nat" where "m_of = (\<lambda>(n, m, \<epsilon>, \<delta>). m)"
[PROOF STATE]
proof (state)
this:
m_of = (\<lambda>(n, m, \<epsilon>, \<delta>). m)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
define \<epsilon>_of :: "nat \<times> nat \<times> rat \<times> rat \<Rightarrow> rat" where "\<epsilon>_of = (\<lambda>(n, m, \<epsilon>, \<delta>). \<epsilon>)"
[PROOF STATE]
proof (state)
this:
\<epsilon>_of = (\<lambda>(n, m, \<epsilon>, \<delta>). \<epsilon>)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
define \<delta>_of :: "nat \<times> nat \<times> rat \<times> rat \<Rightarrow> rat" where "\<delta>_of = (\<lambda>(n, m, \<epsilon>, \<delta>). \<delta>)"
[PROOF STATE]
proof (state)
this:
\<delta>_of = (\<lambda>(n, m, \<epsilon>, \<delta>). \<delta>)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
define g where "g = (\<lambda>x. (1/ (of_rat (\<delta>_of x))\<^sup>2) * (ln (1 / of_rat (\<epsilon>_of x))) * (ln (real (n_of x)) + ln (real (m_of x))))"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2 * ln (1 / real_of_rat (\<epsilon>_of x)) * (ln (real (n_of x)) + ln (real (m_of x))))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have evt: "(\<And>x.
    0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and>
    1/real_of_rat (\<delta>_of x) \<ge> \<delta> \<and> 1/real_of_rat (\<epsilon>_of x) \<ge> \<epsilon> \<and>
    real (n_of x) \<ge> n \<and> real (m_of x) \<ge> m\<Longrightarrow> P x)
    \<Longrightarrow> eventually P ?F"  (is "(\<And>x. ?prem x \<Longrightarrow> _) \<Longrightarrow> _")
    for \<delta> \<epsilon> n m P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> \<delta> \<le> 1 / real_of_rat (\<delta>_of x) \<and> \<epsilon> \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> n \<le> real (n_of x) \<and> m \<le> real (m_of x) \<Longrightarrow> P x) \<Longrightarrow> eventually P (sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0)
[PROOF STEP]
apply (rule eventually_mono[where P="?prem" and Q="P"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>x. 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> \<delta> \<le> 1 / real_of_rat (\<delta>_of x) \<and> \<epsilon> \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> n \<le> real (n_of x) \<and> m \<le> real (m_of x) \<Longrightarrow> P x) \<Longrightarrow> \<forall>\<^sub>F x in sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0. 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> \<delta> \<le> 1 / real_of_rat (\<delta>_of x) \<and> \<epsilon> \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> n \<le> real (n_of x) \<and> m \<le> real (m_of x)
 2. \<And>x. \<lbrakk>\<And>x. 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> \<delta> \<le> 1 / real_of_rat (\<delta>_of x) \<and> \<epsilon> \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> n \<le> real (n_of x) \<and> m \<le> real (m_of x) \<Longrightarrow> P x; 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> \<delta> \<le> 1 / real_of_rat (\<delta>_of x) \<and> \<epsilon> \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> n \<le> real (n_of x) \<and> m \<le> real (m_of x)\<rbrakk> \<Longrightarrow> P x
[PROOF STEP]
apply (simp add:\<epsilon>_of_def case_prod_beta' \<delta>_of_def n_of_def m_of_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> \<forall>\<^sub>F x in sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x))
 2. \<And>x. \<lbrakk>\<And>x. 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> \<delta> \<le> 1 / real_of_rat (\<delta>_of x) \<and> \<epsilon> \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> n \<le> real (n_of x) \<and> m \<le> real (m_of x) \<Longrightarrow> P x; 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> \<delta> \<le> 1 / real_of_rat (\<delta>_of x) \<and> \<epsilon> \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> n \<le> real (n_of x) \<and> m \<le> real (m_of x)\<rbrakk> \<Longrightarrow> P x
[PROOF STEP]
apply (intro eventually_conj eventually_prod1' eventually_prod2'
        sequentially_inf eventually_at_right_less inv_at_right_0_inf)
[PROOF STATE]
proof (prove)
goal (16 subgoals):
 1. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> sequentially \<noteq> bot
 2. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> sequentially \<noteq> bot
 3. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> at_right 0 \<noteq> bot
 4. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> sequentially \<noteq> bot
 5. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> sequentially \<noteq> bot
 6. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> at_right 0 \<noteq> bot
 7. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> sequentially \<noteq> bot
 8. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> sequentially \<noteq> bot
 9. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> at_right 0 \<noteq> bot
 10. (\<And>x. 0 < snd (snd (snd x)) \<and> 0 < fst (snd (snd x)) \<and> \<delta> \<le> 1 / real_of_rat (snd (snd (snd x))) \<and> \<epsilon> \<le> 1 / real_of_rat (fst (snd (snd x))) \<and> n \<le> real (fst x) \<and> m \<le> real (fst (snd x)) \<Longrightarrow> P x) \<Longrightarrow> sequentially \<noteq> bot
A total of 16 subgoals...
[PROOF STEP]
by (auto simp add:prod_filter_eq_bot)
[PROOF STATE]
proof (state)
this:
(\<And>x. 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> ?\<delta> \<le> 1 / real_of_rat (\<delta>_of x) \<and> ?\<epsilon> \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> ?n \<le> real (n_of x) \<and> ?m \<le> real (m_of x) \<Longrightarrow> ?P x) \<Longrightarrow> eventually ?P (sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_1: "(\<lambda>_. 1) \<in> O[?F](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)
[PROOF STEP]
using one_le_power
[PROOF STATE]
proof (prove)
using this:
(1::?'a) \<le> ?a \<Longrightarrow> (1::?'a) \<le> ?a ^ ?n

goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)
[PROOF STEP]
by (intro landau_o.big_mono evt[where \<delta>="1"], auto simp add:power_one_over[symmetric])
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_2: "(\<lambda>_. 1) \<in> O[?F](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))
[PROOF STEP]
by (intro landau_o.big_mono  evt[where \<epsilon>="exp 1"])
     (auto intro!:iffD2[OF ln_ge_iff] simp add:abs_ge_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_3: "(\<lambda>_. 1) \<in> O[?F](\<lambda>x. real (n_of x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x))
[PROOF STEP]
by (intro landau_o.big_mono evt, auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_4: "(\<lambda>_. 1) \<in> O[?F](\<lambda>x. real (m_of x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (m_of x))
[PROOF STEP]
by (intro landau_o.big_mono evt, auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (m_of x))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_5: "(\<lambda>_. 1) \<in> O[?F](\<lambda>x. ln (real (n_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)))
[PROOF STEP]
by (auto intro!: landau_o.big_mono evt[where n="exp 1"])
      (metis abs_ge_self linorder_not_le ln_ge_iff not_exp_le_zero order.trans)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_6: "(\<lambda>_. 1) \<in> O[?F](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
[PROOF STEP]
by (intro landau_sum_1 evt unit_5 iffD2[OF ln_ge_iff], auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_7: "(\<lambda>_. 1) \<in> O[?F](\<lambda>x. 1 / real_of_rat (\<epsilon>_of x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / real_of_rat (\<epsilon>_of x))
[PROOF STEP]
by (intro landau_o.big_mono  evt[where \<epsilon>="1"], auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / real_of_rat (\<epsilon>_of x))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_8: "(\<lambda>_. 1) \<in> O[?F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2 * ln (1 / real_of_rat (\<epsilon>_of x)) * (ln (real (n_of x)) + ln (real (m_of x))))
[PROOF STEP]
by (intro landau_o.big_mult_1 unit_1 unit_2 unit_6)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have unit_9: "(\<lambda>_. 1) \<in> O[?F](\<lambda>x. real (n_of x) * real (m_of x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))
[PROOF STEP]
by (intro landau_o.big_mult_1 unit_3 unit_4)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have " (\<lambda>x. 6 * (1 / (real_of_rat (\<delta>_of x))\<^sup>2)) \<in> O[?F](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. 6 * (1 / (real_of_rat (\<delta>_of x))\<^sup>2)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)
[PROOF STEP]
by (subst landau_o.big.cmult_in_iff, simp_all)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. 6 * (1 / (real_of_rat (\<delta>_of x))\<^sup>2)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
hence l1: "(\<lambda>x. real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>)) \<in> O[?F](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. 6 * (1 / (real_of_rat (\<delta>_of x))\<^sup>2)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>x. real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)
[PROOF STEP]
by (intro landau_real_nat  landau_rat_ceil[OF unit_1]) (simp_all add:of_rat_divide of_rat_power)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have "(\<lambda>x. - ( ln (real_of_rat (\<epsilon>_of x)))) \<in> O[?F](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. - ln (real_of_rat (\<epsilon>_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))
[PROOF STEP]
by (intro landau_o.big_mono evt) (subst ln_div, auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - ln (real_of_rat (\<epsilon>_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
hence l2: "(\<lambda>x. real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>)) \<in> O[?F](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. - ln (real_of_rat (\<epsilon>_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))

goal (1 subgoal):
 1. (\<lambda>x. real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))
[PROOF STEP]
by (intro landau_real_nat landau_ceil[OF unit_2], simp)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (1 / real_of_rat (\<epsilon>_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have l3_aux: " (\<lambda>x. real (m_of x) * (18 + 4 * real (n_of x)) + 1) \<in> O[?F](\<lambda>x. real (n_of x) * real (m_of x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (m_of x) * (18 + 4 * real (n_of x)) + 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))
[PROOF STEP]
by (rule sum_in_bigo[OF _unit_9], subst mult.commute)
      (intro landau_o.mult sum_in_bigo, auto simp:unit_3)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (m_of x) * (18 + 4 * real (n_of x)) + 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have "(\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[?F](\<lambda>x. ln (real (n_of x) * real (m_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x) * real (m_of x)))
[PROOF STEP]
apply (rule landau_ln_2[where a="2"], simp, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0. 2 \<le> real (n_of x) * real (m_of x)
 2. (\<lambda>x. real (m_of x) * (18 + 4 * real (n_of x)) + 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))
[PROOF STEP]
apply (rule evt[where m="2" and n="1"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. 0 < real_of_rat (\<delta>_of x) \<and> 0 < real_of_rat (\<epsilon>_of x) \<and> ?\<delta>5 \<le> 1 / real_of_rat (\<delta>_of x) \<and> ?\<epsilon>5 \<le> 1 / real_of_rat (\<epsilon>_of x) \<and> 1 \<le> real (n_of x) \<and> 2 \<le> real (m_of x) \<Longrightarrow> 2 \<le> real (n_of x) * real (m_of x)
 2. (\<lambda>x. real (m_of x) * (18 + 4 * real (n_of x)) + 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))
[PROOF STEP]
apply (metis dual_order.trans mult_left_mono mult_of_nat_commute of_nat_0_le_iff verit_prod_simplify(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (m_of x) * (18 + 4 * real (n_of x)) + 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))
[PROOF STEP]
using l3_aux
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. real (m_of x) * (18 + 4 * real (n_of x)) + 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))

goal (1 subgoal):
 1. (\<lambda>x. real (m_of x) * (18 + 4 * real (n_of x)) + 1) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. real (n_of x) * real (m_of x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x) * real (m_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x) * real (m_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have "(\<lambda>x. ln (real (n_of x) * real (m_of x))) \<in> O[?F](\<lambda>x. ln (real (n_of x)) + ln(real (m_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (real (n_of x) * real (m_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
[PROOF STEP]
by (intro landau_o.big_mono evt[where m="1" and n="1"], auto simp add:ln_mult)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (real (n_of x) * real (m_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
[PROOF STEP]
have l3: "(\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[?F](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))

goal (1 subgoal):
 1. (\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
[PROOF STEP]
using  landau_o.big_trans
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
\<lbrakk>?f \<in> O[?F](?g); ?g \<in> O[?F](?h)\<rbrakk> \<Longrightarrow> ?f \<in> O[?F](?h)

goal (1 subgoal):
 1. (\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have l4: "(\<lambda>x. ln (8 + 2 * real (n_of x))) \<in> O[?F](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (8 + 2 * real (n_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
[PROOF STEP]
by (intro landau_sum_1  evt[where n="2"] landau_ln_2[where a="2"] iffD2[OF ln_ge_iff])
     (auto intro!: sum_in_bigo simp add:unit_3)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (8 + 2 * real (n_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have l5: "(\<lambda>x. ln (9 + 2 * real (n_of x))) \<in> O[?F](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (9 + 2 * real (n_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
[PROOF STEP]
by (intro landau_sum_1  evt[where n="2"] landau_ln_2[where a="2"] iffD2[OF ln_ge_iff])
     (auto intro!: sum_in_bigo simp add:unit_3)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (9 + 2 * real (n_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have l6: "(\<lambda>x. ln (real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>) + 1)) \<in> O[?F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2 * ln (1 / real_of_rat (\<epsilon>_of x)) * (ln (real (n_of x)) + ln (real (m_of x))))
[PROOF STEP]
by (intro landau_o.big_mult_1 landau_ln_3 sum_in_bigo unit_6 unit_2 l1 unit_1, simp)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have l7: "(\<lambda>x. ln (9 + 2 * real (n_of x))) \<in> O[?F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (9 + 2 * real (n_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (9 + 2 * real (n_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2 * ln (1 / real_of_rat (\<epsilon>_of x)) * (ln (real (n_of x)) + ln (real (m_of x))))
[PROOF STEP]
by (intro landau_o.big_mult_1' unit_1 unit_2 l5)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (9 + 2 * real (n_of x))) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have l8: "(\<lambda>x. ln (real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>) + 1) ) \<in> O[?F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2 * ln (1 / real_of_rat (\<epsilon>_of x)) * (ln (real (n_of x)) + ln (real (m_of x))))
[PROOF STEP]
by (intro landau_o.big_mult_1 unit_6 landau_o.big_mult_1' unit_1 landau_ln_3  sum_in_bigo l2 unit_2) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>) + 1)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have l9: "(\<lambda>x. 5 + 4 * ln (8 + 2 * real (n_of x)) / ln 2 + 2 * ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1) / ln 2)
      \<in> O[?F](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. 5 + 4 * ln (8 + 2 * real (n_of x)) / ln 2 + 2 * ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1) / ln 2) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))
[PROOF STEP]
by (intro sum_in_bigo, auto simp: l3 l4 unit_6)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. 5 + 4 * ln (8 + 2 * real (n_of x)) / ln 2 + 2 * ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1) / ln 2) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. ln (real (n_of x)) + ln (real (m_of x)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have l10: "(\<lambda>x. real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>) * real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>) *
      (5 + 4 * ln (8 + 2 * real (n_of x)) / ln 2 + 2 * ln(real (m_of x) * (18 + 4 * real (n_of x)) + 1) / ln 2))
      \<in> O[?F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>) * real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>) * (5 + 4 * ln (8 + 2 * real (n_of x)) / ln 2 + 2 * ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1) / ln 2)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>) * real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>) * (5 + 4 * ln (8 + 2 * real (n_of x)) / ln 2 + 2 * ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1) / ln 2)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>x. 1 / (real_of_rat (\<delta>_of x))\<^sup>2 * ln (1 / real_of_rat (\<epsilon>_of x)) * (ln (real (n_of x)) + ln (real (m_of x))))
[PROOF STEP]
by (intro landau_o.mult, auto simp: l1 l2 l9)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (nat \<lceil>6 / (\<delta>_of x)\<^sup>2\<rceil>) * real (nat \<lceil>- (18 * ln (real_of_rat (\<epsilon>_of x)))\<rceil>) * (5 + 4 * ln (8 + 2 * real (n_of x)) / ln 2 + 2 * ln (real (m_of x) * (18 + 4 * real (n_of x)) + 1) / ln 2)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have "f2_space_usage = (\<lambda>x. f2_space_usage (n_of x, m_of x, \<epsilon>_of x, \<delta>_of x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f2_space_usage = (\<lambda>x. f2_space_usage (n_of x, m_of x, \<epsilon>_of x, \<delta>_of x))
[PROOF STEP]
by (simp add:case_prod_beta' n_of_def \<epsilon>_of_def \<delta>_of_def m_of_def)
[PROOF STATE]
proof (state)
this:
f2_space_usage = (\<lambda>x. f2_space_usage (n_of x, m_of x, \<epsilon>_of x, \<delta>_of x))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f2_space_usage = (\<lambda>x. f2_space_usage (n_of x, m_of x, \<epsilon>_of x, \<delta>_of x))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have "... \<in> O[?F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f2_space_usage (n_of x, m_of x, \<epsilon>_of x, \<delta>_of x)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)
[PROOF STEP]
by (auto intro!:sum_in_bigo simp:Let_def log_def l6 l7 l8 l10 unit_8)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f2_space_usage (n_of x, m_of x, \<epsilon>_of x, \<delta>_of x)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f2_space_usage (n_of x, m_of x, \<epsilon>_of x, \<delta>_of x)) \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g)

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
have "... = O[?F](?rhs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g) = O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
by (simp add:case_prod_beta' g_def n_of_def \<epsilon>_of_def \<delta>_of_def m_of_def)
[PROOF STATE]
proof (state)
this:
O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](g) = O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))

goal (1 subgoal):
 1. f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f2_space_usage \<in> O[sequentially \<times>\<^sub>F sequentially \<times>\<^sub>F at_right 0 \<times>\<^sub>F at_right 0](\<lambda>(n, m, \<epsilon>, \<delta>). ln (1 / real_of_rat \<epsilon>) / (real_of_rat \<delta>)\<^sup>2 * (ln (real n) + ln (real m)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem summatory_totient_asymptotics'':
  "sum_upto (\<lambda>n. real (totient n)) \<sim>[at_top] (\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (totient n)) \<sim>[at_top] (\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (totient n)) \<sim>[at_top] (\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)
[PROOF STEP]
have "(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
by (rule summatory_totient_asymptotics)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (totient n)) \<sim>[at_top] (\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (totient n)) \<sim>[at_top] (\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)
[PROOF STEP]
have "(\<lambda>x. x * ln x) \<in> o(\<lambda>x. 3 / pi ^ 2 * x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x * ln x) \<in> o(\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x * ln x) \<in> o(\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (totient n)) \<sim>[at_top] (\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> o(\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> o(\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (totient n)) \<sim>[at_top] (\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)
[PROOF STEP]
by (simp add: asymp_equiv_altdef)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (totient n)) \<sim>[at_top] (\<lambda>x. 3 / pi\<^sup>2 * x\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floorlog_ge_SucI:
  "Suc w \<le> floorlog b x" if "b ^ w \<le> x" "b > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc w \<le> floorlog b x
[PROOF STEP]
using that le_log_of_power[of b w x] power_not_zero
[PROOF STATE]
proof (prove)
using this:
b ^ w \<le> x
1 < b
\<lbrakk>real b ^ w \<le> real x; 1 < real b\<rbrakk> \<Longrightarrow> real w \<le> log (real b) (real x)
?a \<noteq> (0::?'a) \<Longrightarrow> ?a ^ ?n \<noteq> (0::?'a)

goal (1 subgoal):
 1. Suc w \<le> floorlog b x
[PROOF STEP]
by (force simp: floorlog_def Suc_le_eq powr_realpow not_less Suc_nat_eq_nat_zadd1
      zless_nat_eq_int_zless int_add_floor less_floor_iff
      simp del: floor_add2)


[STATEMENT]
lemma distinct_sorted_intersection[simp]:
  "\<lbrakk> distinct xs; distinct ys; sorted xs; sorted ys \<rbrakk>
     \<Longrightarrow> distinct (intersection xs ys) \<and> sorted (intersection xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; distinct ys; sorted xs; sorted ys\<rbrakk> \<Longrightarrow> distinct (intersection xs ys) \<and> sorted (intersection xs ys)
[PROOF STEP]
by (induct xs ys rule: intersection.induct) (auto)


[STATEMENT]
lemma bij_betw_prime_power_divisors:
  assumes "prime (p :: nat)"
  shows   "bij_betw ((^) p) {..k} {d. d dvd p ^ k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((^) p) {..k} {d. d dvd p ^ k}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((^) p) {..k} \<and> (^) p ` {..k} = {d. d dvd p ^ k}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on ((^) p) {..k}
 2. (^) p ` {..k} = {d. d dvd p ^ k}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have *: "p > 1"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. 1 < p
[PROOF STEP]
by (simp add: prime_gt_Suc_0_nat)
[PROOF STATE]
proof (state)
this:
1 < p

goal (2 subgoals):
 1. inj_on ((^) p) {..k}
 2. (^) p ` {..k} = {d. d dvd p ^ k}
[PROOF STEP]
show "inj_on ((^) p) {..k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((^) p) {..k}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. inj_on ((^) p) {..k}
[PROOF STEP]
by (auto simp: inj_on_def prime_gt_Suc_0_nat power_inject_exp[OF *])
[PROOF STATE]
proof (state)
this:
inj_on ((^) p) {..k}

goal (1 subgoal):
 1. (^) p ` {..k} = {d. d dvd p ^ k}
[PROOF STEP]
show "(^) p ` {..k} = {d. d dvd p ^ k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (^) p ` {..k} = {d. d dvd p ^ k}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. (^) p ` {..k} = {d. d dvd p ^ k}
[PROOF STEP]
by (auto simp: le_imp_power_dvd divides_primepow_nat)
[PROOF STATE]
proof (state)
this:
(^) p ` {..k} = {d. d dvd p ^ k}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Limsup_obtain:
  fixes u::"_ \<Rightarrow> 'a :: complete_linorder"
  assumes "Limsup F u > c"
  shows "\<exists>i. u i > c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. c < u i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i. c < u i
[PROOF STEP]
have "(INF P\<in>{P. eventually P F}. SUP x\<in>{x. P x}. u x) > c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < (INF P\<in>{P. eventually P F}. Sup (u ` {x. P x}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c < Limsup F u

goal (1 subgoal):
 1. c < (INF P\<in>{P. eventually P F}. Sup (u ` {x. P x}))
[PROOF STEP]
by (simp add: Limsup_def)
[PROOF STATE]
proof (state)
this:
c < (INF P\<in>{P. eventually P F}. Sup (u ` {x. P x}))

goal (1 subgoal):
 1. \<exists>i. c < u i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c < (INF P\<in>{P. eventually P F}. Sup (u ` {x. P x}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c < (INF P\<in>{P. eventually P F}. Sup (u ` {x. P x}))

goal (1 subgoal):
 1. \<exists>i. c < u i
[PROOF STEP]
by (metis eventually_True mem_Collect_eq less_INF_D less_SUP_iff)
[PROOF STATE]
proof (state)
this:
\<exists>i. c < u i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_prod_distrib_left:
  assumes "dim_vec a = dim_vec b"
  shows "\<langle>c \<cdot>\<^sub>v a|b\<rangle> = cnj(c) * \<langle>a|b\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>c \<cdot>\<^sub>v a|b\<rangle> = cnj c * \<langle>a|b\<rangle>
[PROOF STEP]
using assms inner_prod_def
[PROOF STATE]
proof (prove)
using this:
dim_vec a = dim_vec b
\<langle>?u|?v\<rangle> \<equiv> \<Sum>i = 0..<dim_vec ?v. cnj (?u $ i) * ?v $ i

goal (1 subgoal):
 1. \<langle>c \<cdot>\<^sub>v a|b\<rangle> = cnj c * \<langle>a|b\<rangle>
[PROOF STEP]
by (simp add: algebra_simps mult_hom.hom_sum)


[STATEMENT]
lemma bilinear_form_hermitean_commute:
  assumes "hermitean H"
  shows "bilinear_form v1 v2 H = cnj (bilinear_form v2 v1 H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bilinear_form v1 v2 H = cnj (bilinear_form v2 v1 H)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bilinear_form v1 v2 H = cnj (bilinear_form v2 v1 H)
[PROOF STEP]
have "v2 *\<^sub>v\<^sub>m mat_cnj H *\<^sub>v\<^sub>v vec_cnj v1 = vec_cnj v1 *\<^sub>v\<^sub>v (mat_adj H *\<^sub>m\<^sub>v v2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v2 *\<^sub>v\<^sub>m mat_cnj H *\<^sub>v\<^sub>v vec_cnj v1 = vec_cnj v1 *\<^sub>v\<^sub>v (mat_adj H *\<^sub>m\<^sub>v v2)
[PROOF STEP]
by (subst mult_vv_commute, subst mult_mv_mult_vm, simp add: mat_adj_def mat_transpose_mat_cnj)
[PROOF STATE]
proof (state)
this:
v2 *\<^sub>v\<^sub>m mat_cnj H *\<^sub>v\<^sub>v vec_cnj v1 = vec_cnj v1 *\<^sub>v\<^sub>v (mat_adj H *\<^sub>m\<^sub>v v2)

goal (1 subgoal):
 1. bilinear_form v1 v2 H = cnj (bilinear_form v2 v1 H)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v2 *\<^sub>v\<^sub>m mat_cnj H *\<^sub>v\<^sub>v vec_cnj v1 = vec_cnj v1 *\<^sub>v\<^sub>v (mat_adj H *\<^sub>m\<^sub>v v2)

goal (1 subgoal):
 1. bilinear_form v1 v2 H = cnj (bilinear_form v2 v1 H)
[PROOF STEP]
have "\<dots> = bilinear_form v1 v2 H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_cnj v1 *\<^sub>v\<^sub>v (mat_adj H *\<^sub>m\<^sub>v v2) = bilinear_form v1 v2 H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitean H

goal (1 subgoal):
 1. vec_cnj v1 *\<^sub>v\<^sub>v (mat_adj H *\<^sub>m\<^sub>v v2) = bilinear_form v1 v2 H
[PROOF STEP]
by (simp add: mult_vv_mv hermitean_def)
[PROOF STATE]
proof (state)
this:
vec_cnj v1 *\<^sub>v\<^sub>v (mat_adj H *\<^sub>m\<^sub>v v2) = bilinear_form v1 v2 H

goal (1 subgoal):
 1. bilinear_form v1 v2 H = cnj (bilinear_form v2 v1 H)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
v2 *\<^sub>v\<^sub>m mat_cnj H *\<^sub>v\<^sub>v vec_cnj v1 = bilinear_form v1 v2 H
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
v2 *\<^sub>v\<^sub>m mat_cnj H *\<^sub>v\<^sub>v vec_cnj v1 = bilinear_form v1 v2 H

goal (1 subgoal):
 1. bilinear_form v1 v2 H = cnj (bilinear_form v2 v1 H)
[PROOF STEP]
by (simp add: cnj_mult_vv vec_cnj_mult_vm)
[PROOF STATE]
proof (state)
this:
bilinear_form v1 v2 H = cnj (bilinear_form v2 v1 H)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_convex_sets_le:
  assumes "convex S" "S homeomorphic T"
  shows "aff_dim S \<le> aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
obtain h k where homhk: "homeomorphism S T h k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h k. homeomorphism S T h k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using homeomorphic_def assms
[PROOF STATE]
proof (prove)
using this:
?s homeomorphic ?t \<equiv> \<exists>f g. homeomorphism ?s ?t f g
convex S
S homeomorphic T

goal (1 subgoal):
 1. (\<And>h k. homeomorphism S T h k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
homeomorphism S T h k

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
proof (rule invariance_of_dimension_convex_domain [OF \<open>convex S\<close>])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. continuous_on S ?f
 2. ?f ` S \<subseteq> affine hull T
 3. inj_on ?f S
[PROOF STEP]
show "continuous_on S h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S h
[PROOF STEP]
using homeomorphism_def homhk
[PROOF STATE]
proof (prove)
using this:
homeomorphism ?s ?t ?f ?g = ((\<forall>x\<in>?s. ?g (?f x) = x) \<and> ?f ` ?s = ?t \<and> continuous_on ?s ?f \<and> (\<forall>y\<in>?t. ?f (?g y) = y) \<and> ?g ` ?t = ?s \<and> continuous_on ?t ?g)
homeomorphism S T h k

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

goal (2 subgoals):
 1. h ` S \<subseteq> affine hull T
 2. inj_on h S
[PROOF STEP]
show "h ` S \<subseteq> affine hull T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h ` S \<subseteq> affine hull T
[PROOF STEP]
by (metis homeomorphism_def homhk hull_subset)
[PROOF STATE]
proof (state)
this:
h ` S \<subseteq> affine hull T

goal (1 subgoal):
 1. inj_on h S
[PROOF STEP]
show "inj_on h S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on h S
[PROOF STEP]
by (meson homeomorphism_apply1 homhk inj_on_inverseI)
[PROOF STATE]
proof (state)
this:
inj_on h S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
aff_dim S \<le> aff_dim T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_less_hnorm_iff [simp]: "\<And>x::'a::real_normed_vector star. 0 < hnorm x \<longleftrightarrow> x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (0 < hnorm x) = (x \<noteq> 0)
[PROOF STEP]
by transfer (rule zero_less_norm_iff)


[STATEMENT]
lemma sin_60: "sin (pi / 3) = sqrt 3/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (pi / 3) = sqrt 3 / 2
[PROOF STEP]
by (simp add: sin_cos_eq cos_30)


[STATEMENT]
lemma proots_upper_card_code[code]:
  "proots_upper_card p = (if p=0 then 0 else
      (let
            pf = p div (gcd p (pderiv p));
            pp = smult (inverse (lead_coeff pf)) pf;
            pI = map_poly Im pp;
            pR = map_poly Re pp;
            g = gcd pR pI
        in
            nat ((degree pf - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)
      ))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
proof (cases "p=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
 2. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
 2. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
unfolding proots_upper_card_def
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. card (proots_within p {x. 0 < Im x}) = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
using infinite_halfspace_Im_gt
[PROOF STATE]
proof (prove)
using this:
p = 0
infinite {x. ?b < Im x}

goal (1 subgoal):
 1. card (proots_within p {x. 0 < Im x}) = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
define pf pp pI pR g where
        "pf = p div (gcd p (pderiv p))"
    and "pp = smult (inverse (lead_coeff pf)) pf"
    and "pI = map_poly Im pp"
    and "pR = map_poly Re pp"
    and "g = gcd pR pI"
[PROOF STATE]
proof (state)
this:
pf = p div gcd p (pderiv p)
pp = smult (inverse (lead_coeff pf)) pf
pI = map_poly Im pp
pR = map_poly Re pp
g = gcd pR pI

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
have "proots_upper_card p = proots_upper_card pf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_upper_card p = proots_upper_card pf
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_upper_card p = proots_upper_card pf
[PROOF STEP]
have "proots_within p {x. 0 < Im x} = proots_within pf {x. 0 < Im x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within p {x. 0 < Im x} = proots_within pf {x. 0 < Im x}
[PROOF STEP]
unfolding proots_within_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> {x. 0 < Im x}. poly p x = 0} = {x \<in> {x. 0 < Im x}. poly pf x = 0}
[PROOF STEP]
using poly_gcd_pderiv_iff[of p,folded pf_def]
[PROOF STATE]
proof (prove)
using this:
(poly pf ?x = 0) = (poly p ?x = 0)

goal (1 subgoal):
 1. {x \<in> {x. 0 < Im x}. poly p x = 0} = {x \<in> {x. 0 < Im x}. poly pf x = 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within p {x. 0 < Im x} = proots_within pf {x. 0 < Im x}

goal (1 subgoal):
 1. proots_upper_card p = proots_upper_card pf
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proots_within p {x. 0 < Im x} = proots_within pf {x. 0 < Im x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_within p {x. 0 < Im x} = proots_within pf {x. 0 < Im x}

goal (1 subgoal):
 1. proots_upper_card p = proots_upper_card pf
[PROOF STEP]
unfolding proots_upper_card_def
[PROOF STATE]
proof (prove)
using this:
proots_within p {x. 0 < Im x} = proots_within pf {x. 0 < Im x}

goal (1 subgoal):
 1. card (proots_within p {x. 0 < Im x}) = card (proots_within pf {x. 0 < Im x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_upper_card p = proots_upper_card pf

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proots_upper_card p = proots_upper_card pf

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_upper_card p = proots_upper_card pf

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
have "... = nat ((degree pf - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_upper_card pf = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)
[PROOF STEP]
using proots_within_upper_squarefree[OF rsquarefree_gcd_pderiv[OF \<open>p\<noteq>0\<close>]
        ,unfolded Let_def,folded pf_def,folded pp_def pI_def pR_def g_def]
[PROOF STATE]
proof (prove)
using this:
card (proots_within pf {x. 0 < Im x}) = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)

goal (1 subgoal):
 1. proots_upper_card pf = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)
[PROOF STEP]
unfolding proots_upper_card_def
[PROOF STATE]
proof (prove)
using this:
card (proots_within pf {x. 0 < Im x}) = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)

goal (1 subgoal):
 1. card (proots_within pf {x. 0 < Im x}) = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
proots_upper_card pf = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
proots_upper_card p = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_upper_card p = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)

goal (1 subgoal):
 1. proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
using this:
proots_upper_card p = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)

goal (1 subgoal):
 1. proots_upper_card p = (if p = 0 then 0 else nat ((int (degree (p div gcd p (pderiv p))) - changes_R_smods (gcd (map_poly Re (smult (inverse (lead_coeff (p div gcd p (pderiv p)))) (p div gcd p (pderiv p)))) (map_poly Im (smult (inverse (lead_coeff (p div gcd p (pderiv p)))) (p div gcd p (pderiv p))))) (pderiv (gcd (map_poly Re (smult (inverse (lead_coeff (p div gcd p (pderiv p)))) (p div gcd p (pderiv p)))) (map_poly Im (smult (inverse (lead_coeff (p div gcd p (pderiv p)))) (p div gcd p (pderiv p)))))) - changes_R_smods (map_poly Re (smult (inverse (lead_coeff (p div gcd p (pderiv p)))) (p div gcd p (pderiv p)))) (map_poly Im (smult (inverse (lead_coeff (p div gcd p (pderiv p)))) (p div gcd p (pderiv p))))) div 2))
[PROOF STEP]
apply (fold pf_def,fold pp_def pI_def pR_def g_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>proots_upper_card p = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2); proots_upper_card p = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)\<rbrakk> \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>proots_upper_card p = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2); proots_upper_card p = nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2)\<rbrakk> \<Longrightarrow> proots_upper_card p = (if p = 0 then 0 else nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_upper_card p = (if p = 0 then 0 else let pf = p div gcd p (pderiv p); pp = smult (inverse (lead_coeff pf)) pf; pI = map_poly Im pp; pR = map_poly Re pp; g = gcd pR pI in nat ((int (degree pf) - changes_R_smods g (pderiv g) - changes_R_smods pR pI) div 2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem dual_Inf [iff?]:
    "is_Inf (dual ` A) (dual sup) = is_Sup A sup"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Inf (dual ` A) (dual sup) = is_Sup A sup
[PROOF STEP]
by (simp add: is_Inf_def is_Sup_def dual_all [symmetric] dual_leq)


[STATEMENT]
lemma local_flow_mtx_hOsc:
  fixes a b
  defines "\<iota>\<^sub>1 \<equiv> (b - sqrt (b^2+4*a))/2" and "\<iota>\<^sub>2 \<equiv> (b + sqrt (b^2+4*a))/2"
  defines "\<Phi> t \<equiv> mtx (
   [\<iota>\<^sub>2*exp(t*\<iota>\<^sub>1) - \<iota>\<^sub>1*exp(t*\<iota>\<^sub>2),     exp(t*\<iota>\<^sub>2)-exp(t*\<iota>\<^sub>1)]#
   [a*exp(t*\<iota>\<^sub>2) - a*exp(t*\<iota>\<^sub>1), \<iota>\<^sub>2*exp(t*\<iota>\<^sub>2)-\<iota>\<^sub>1*exp(t*\<iota>\<^sub>1)]#[])"
  assumes "b\<^sup>2 + a * 4 > 0" and "a \<noteq> 0"
  shows "local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) ((1/sqrt (b\<^sup>2 + a * 4)) *\<^sub>R \<Phi> t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) ((1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R \<Phi> t))
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) ((1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)), exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))], [a * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - a * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)), (b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))]]))
[PROOF STEP]
using local_flow_sq_mtx_linear[of "A a b"] assms
[PROOF STATE]
proof (prove)
using this:
local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) (exp (t *\<^sub>R A a b)))
\<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2
\<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2
\<Phi> ?t \<equiv> mtx [[\<iota>\<^sub>2 * exp (?t * \<iota>\<^sub>1) - \<iota>\<^sub>1 * exp (?t * \<iota>\<^sub>2), exp (?t * \<iota>\<^sub>2) - exp (?t * \<iota>\<^sub>1)], [a * exp (?t * \<iota>\<^sub>2) - a * exp (?t * \<iota>\<^sub>1), \<iota>\<^sub>2 * exp (?t * \<iota>\<^sub>2) - \<iota>\<^sub>1 * exp (?t * \<iota>\<^sub>1)]]
0 < b\<^sup>2 + a * 4
a \<noteq> 0

goal (1 subgoal):
 1. local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) ((1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)), exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))], [a * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - a * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)), (b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))]]))
[PROOF STEP]
apply(subst (asm) exp_scaleR_diagonal2[OF invertible_mtx_chB_hOsc mtx_hOsc_diagonalizable])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>\<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[\<iota>\<^sub>2 * exp (t * \<iota>\<^sub>1) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>2), exp (t * \<iota>\<^sub>2) - exp (t * \<iota>\<^sub>1)], [a * exp (t * \<iota>\<^sub>2) - a * exp (t * \<iota>\<^sub>1), \<iota>\<^sub>2 * exp (t * \<iota>\<^sub>2) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>1)]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a \<noteq> - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a
 2. \<lbrakk>\<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[\<iota>\<^sub>2 * exp (t * \<iota>\<^sub>1) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>2), exp (t * \<iota>\<^sub>2) - exp (t * \<iota>\<^sub>1)], [a * exp (t * \<iota>\<^sub>2) - a * exp (t * \<iota>\<^sub>1), \<iota>\<^sub>2 * exp (t * \<iota>\<^sub>2) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>1)]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> 0 < b\<^sup>2 + a * 4
 3. \<lbrakk>\<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[\<iota>\<^sub>2 * exp (t * \<iota>\<^sub>1) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>2), exp (t * \<iota>\<^sub>2) - exp (t * \<iota>\<^sub>1)], [a * exp (t * \<iota>\<^sub>2) - a * exp (t * \<iota>\<^sub>1), \<iota>\<^sub>2 * exp (t * \<iota>\<^sub>2) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>1)]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> a \<noteq> 0
 4. \<lbrakk>local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) (P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a) * (\<d>\<i>\<a>\<g> i. exp (t * (if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2))) * P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)\<^sup>-\<^sup>1)); \<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[\<iota>\<^sub>2 * exp (t * \<iota>\<^sub>1) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>2), exp (t * \<iota>\<^sub>2) - exp (t * \<iota>\<^sub>1)], [a * exp (t * \<iota>\<^sub>2) - a * exp (t * \<iota>\<^sub>1), \<iota>\<^sub>2 * exp (t * \<iota>\<^sub>2) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>1)]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) ((1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)), exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))], [a * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - a * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)), (b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))]]))
[PROOF STEP]
apply(simp, simp, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) (P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a) * (\<d>\<i>\<a>\<g> i. exp (t * (if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2))) * P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)\<^sup>-\<^sup>1)); \<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[\<iota>\<^sub>2 * exp (t * \<iota>\<^sub>1) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>2), exp (t * \<iota>\<^sub>2) - exp (t * \<iota>\<^sub>1)], [a * exp (t * \<iota>\<^sub>2) - a * exp (t * \<iota>\<^sub>1), \<iota>\<^sub>2 * exp (t * \<iota>\<^sub>2) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>1)]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> local_flow ((*\<^sub>V) (A a b)) UNIV UNIV (\<lambda>t. (*\<^sub>V) ((1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)), exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))], [a * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - a * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)), (b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))]]))
[PROOF STEP]
by (subst (asm) mtx_hOsc_solution_eq) simp_all


[STATEMENT]
lemma log_of_power_le: "\<lbrakk> m \<le> b ^ n; b > 1; m > 0 \<rbrakk> \<Longrightarrow> log b (real m) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>real m \<le> b ^ n; 1 < b; 0 < m\<rbrakk> \<Longrightarrow> log b (real m) \<le> real n
[PROOF STEP]
by (simp add: log_le_iff powr_realpow)


[STATEMENT]
lemma open_Collect_ex: "(\<And>i. open {x. P i x}) \<Longrightarrow> open {x. \<exists>i. P i x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. open {x. P i x}) \<Longrightarrow> open {x. \<exists>i. P i x}
[PROOF STEP]
using open_UN[of UNIV "\<lambda>i. {x. P i x}"]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. open {xa. P x xa} \<Longrightarrow> open (\<Union>x. {xa. P x xa})

goal (1 subgoal):
 1. (\<And>i. open {x. P i x}) \<Longrightarrow> open {x. \<exists>i. P i x}
[PROOF STEP]
unfolding Collect_ex_eq
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. open {xa. P x xa} \<Longrightarrow> open (\<Union>x. {xa. P x xa})

goal (1 subgoal):
 1. (\<And>i. open {x. P i x}) \<Longrightarrow> open (\<Union>y. {x. P y x})
[PROOF STEP]
by simp


[STATEMENT]
lemma integrable_on_1_iff:
  fixes f :: "'a::euclidean_space \<Rightarrow> real^1"
  shows "f integrable_on S \<longleftrightarrow> (\<lambda>x. f x $ 1) integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f integrable_on S) = ((\<lambda>x. f x $ 1) integrable_on S)
[PROOF STEP]
by (auto simp: integrable_componentwise_iff [of f] Basis_vec_def cart_eq_inner_axis)


[STATEMENT]
lemma Re_winding_number_half_lower:
  assumes pimage:"\<forall>p\<in>path_image \<gamma>. Im p \<le> Im z" and "valid_path \<gamma>" and "z\<notin>path_image \<gamma>"
  shows "Re(winding_number \<gamma> z) =
             (Im (Ln ( \<i>*pathfinish \<gamma> - \<i>*z)) - Im (Ln (\<i>*pathstart \<gamma> - \<i>*z)))/(2*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
define \<gamma>' where "\<gamma>'=(\<lambda>t. \<i> * (\<gamma> t - z) + z)"
[PROOF STATE]
proof (state)
this:
\<gamma>' = (\<lambda>t. \<i> * (\<gamma> t - z) + z)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
have "Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)
[PROOF STEP]
unfolding \<gamma>'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (winding_number (\<lambda>t. \<i> * (\<gamma> t - z) + z) z) = (Im (Ln (pathfinish (\<lambda>t. \<i> * (\<gamma> t - z) + z) - z)) - Im (Ln (pathstart (\<lambda>t. \<i> * (\<gamma> t - z) + z) - z))) / (2 * pi)
[PROOF STEP]
apply (rule Re_winding_number_half_right)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>p\<in>path_image (\<lambda>t. \<i> * (\<gamma> t - z) + z). Re z \<le> Re p
 2. valid_path (\<lambda>t. \<i> * (\<gamma> t - z) + z)
 3. z \<notin> path_image (\<lambda>t. \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>path_image (\<lambda>t. \<i> * (\<gamma> t - z) + z). Re z \<le> Re p
[PROOF STEP]
using pimage
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>path_image \<gamma>. Im p \<le> Im z

goal (1 subgoal):
 1. \<forall>p\<in>path_image (\<lambda>t. \<i> * (\<gamma> t - z) + z). Re z \<le> Re p
[PROOF STEP]
unfolding path_image_def
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>\<gamma> ` {0..1}. Im p \<le> Im z

goal (1 subgoal):
 1. \<forall>p\<in>(\<lambda>t. \<i> * (\<gamma> t - z) + z) ` {0..1}. Re z \<le> Re p
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. valid_path (\<lambda>t. \<i> * (\<gamma> t - z) + z)
 2. z \<notin> path_image (\<lambda>t. \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path (\<lambda>t. \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
apply (rule valid_path_compose_holomorphic[OF \<open>valid_path \<gamma>\<close>,of "\<lambda>x. \<i> * (x-z) + z" UNIV
            , unfolded comp_def])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>t. \<i> * (t - z) + z) holomorphic_on UNIV
 2. open UNIV
 3. path_image \<gamma> \<subseteq> UNIV
[PROOF STEP]
by (auto intro!:holomorphic_intros)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> path_image (\<lambda>t. \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> path_image (\<lambda>t. \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
using \<open>z\<notin>path_image \<gamma>\<close>
[PROOF STATE]
proof (prove)
using this:
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. z \<notin> path_image (\<lambda>t. \<i> * (\<gamma> t - z) + z)
[PROOF STEP]
unfolding path_image_def
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<gamma> ` {0..1}

goal (1 subgoal):
 1. z \<notin> (\<lambda>t. \<i> * (\<gamma> t - z) + z) ` {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
have "winding_number \<gamma>' z = winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
define f where "f=(\<lambda>x. \<i> * (x-z) + z)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. \<i> * (x - z) + z)

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
define c where "c= 1 / (complex_of_real (2 * pi) * \<i>)"
[PROOF STATE]
proof (state)
this:
c = 1 / (complex_of_real (2 * pi) * \<i>)

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
have "winding_number \<gamma>' z = winding_number (f o \<gamma>) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number (f \<circ> \<gamma>) z
[PROOF STEP]
unfolding \<gamma>'_def comp_def f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (\<lambda>t. \<i> * (\<gamma> t - z) + z) z = winding_number (\<lambda>x. \<i> * (\<gamma> x - z) + z) z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number (f \<circ> \<gamma>) z

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number (f \<circ> \<gamma>) z

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
have "... = c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
proof (rule winding_number_comp[of UNIV])
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. open UNIV
 2. f holomorphic_on UNIV
 3. path_image \<gamma> \<subseteq> UNIV
 4. valid_path \<gamma>
 5. z \<notin> path_image (f \<circ> \<gamma>)
[PROOF STEP]
show "z \<notin> path_image (f \<circ> \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> path_image (f \<circ> \<gamma>)
[PROOF STEP]
using \<open>z\<notin>path_image \<gamma>\<close>
[PROOF STATE]
proof (prove)
using this:
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. z \<notin> path_image (f \<circ> \<gamma>)
[PROOF STEP]
unfolding f_def path_image_def
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<gamma> ` {0..1}

goal (1 subgoal):
 1. z \<notin> ((\<lambda>x. \<i> * (x - z) + z) \<circ> \<gamma>) ` {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<notin> path_image (f \<circ> \<gamma>)

goal (4 subgoals):
 1. open UNIV
 2. f holomorphic_on UNIV
 3. path_image \<gamma> \<subseteq> UNIV
 4. valid_path \<gamma>
[PROOF STEP]
qed (auto simp add:f_def \<open>valid_path \<gamma>\<close> intro!:holomorphic_intros)
[PROOF STATE]
proof (state)
this:
winding_number (f \<circ> \<gamma>) z = c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
winding_number (f \<circ> \<gamma>) z = c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
have "... = c * contour_integral \<gamma> (\<lambda>w.  1 / (w - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
have "deriv f x = \<i>" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv f x = \<i>
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. \<i> * (x - z) + z) x = \<i>
[PROOF STEP]
by (auto intro!:derivative_eq_intros DERIV_imp_deriv)
[PROOF STATE]
proof (state)
this:
deriv f ?x = \<i>

goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deriv f ?x = \<i>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deriv f ?x = \<i>

goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
unfolding f_def c_def
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. \<i> * (x - z) + z) ?x = \<i>

goal (1 subgoal):
 1. 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv (\<lambda>x. \<i> * (x - z) + z) w / (\<i> * (w - z) + z - z)) = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))
[PROOF STEP]
by (auto simp add:field_simps divide_simps intro!:arg_cong2[where f=contour_integral])
[PROOF STATE]
proof (state)
this:
c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)) = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
have "... = winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z)) = winding_number \<gamma> z
[PROOF STEP]
using winding_number_valid_path[OF \<open>valid_path \<gamma>\<close> \<open>z\<notin>path_image \<gamma>\<close>,folded c_def]
[PROOF STATE]
proof (prove)
using this:
winding_number \<gamma> z = c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z))

goal (1 subgoal):
 1. c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z)) = winding_number \<gamma> z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * contour_integral \<gamma> (\<lambda>w. 1 / (w - z)) = winding_number \<gamma> z

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
winding_number \<gamma>' z = winding_number \<gamma> z

goal (1 subgoal):
 1. winding_number \<gamma>' z = winding_number \<gamma> z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number \<gamma> z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number \<gamma> z

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
winding_number \<gamma>' z = winding_number \<gamma> z

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
have "pathfinish \<gamma>' = z+ \<i>* pathfinish \<gamma> - \<i>*z" "pathstart \<gamma>' = z+ \<i>*pathstart \<gamma> - \<i>*z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pathfinish \<gamma>' = z + \<i> * pathfinish \<gamma> - \<i> * z &&& pathstart \<gamma>' = z + \<i> * pathstart \<gamma> - \<i> * z
[PROOF STEP]
unfolding \<gamma>'_def path_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> * (\<gamma> 1 - z) + z = z + \<i> * \<gamma> 1 - \<i> * z &&& \<i> * (\<gamma> 0 - z) + z = z + \<i> * \<gamma> 0 - \<i> * z
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
pathfinish \<gamma>' = z + \<i> * pathfinish \<gamma> - \<i> * z
pathstart \<gamma>' = z + \<i> * pathstart \<gamma> - \<i> * z

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)
winding_number \<gamma>' z = winding_number \<gamma> z
pathfinish \<gamma>' = z + \<i> * pathfinish \<gamma> - \<i> * z
pathstart \<gamma>' = z + \<i> * pathstart \<gamma> - \<i> * z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re (winding_number \<gamma>' z) = (Im (Ln (pathfinish \<gamma>' - z)) - Im (Ln (pathstart \<gamma>' - z))) / (2 * pi)
winding_number \<gamma>' z = winding_number \<gamma> z
pathfinish \<gamma>' = z + \<i> * pathfinish \<gamma> - \<i> * z
pathstart \<gamma>' = z + \<i> * pathstart \<gamma> - \<i> * z

goal (1 subgoal):
 1. Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re (winding_number \<gamma> z) = (Im (Ln (\<i> * pathfinish \<gamma> - \<i> * z)) - Im (Ln (\<i> * pathstart \<gamma> - \<i> * z))) / (2 * pi)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma test_theorem:
  fixes x :: nat
  shows "x \<le> y \<Longrightarrow> x \<ge> y \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
by (rule Orderings.order_antisym)


[STATEMENT]
theorem inorder_delete:
  "\<lbrakk> avl t; sorted(inorder t) \<rbrakk>  \<Longrightarrow> inorder (delete x t) = del_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>avl t; Sorted_Less.sorted (Tree2.inorder t)\<rbrakk> \<Longrightarrow> Tree2.inorder (delete x t) = del_list x (Tree2.inorder t)
[PROOF STEP]
apply(induction t rule: tree2_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>avl \<langle>\<rangle>; Sorted_Less.sorted (Tree2.inorder \<langle>\<rangle>)\<rbrakk> \<Longrightarrow> Tree2.inorder (delete x \<langle>\<rangle>) = del_list x (Tree2.inorder \<langle>\<rangle>)
 2. \<And>x1 a b x3. \<lbrakk>\<lbrakk>avl x1; Sorted_Less.sorted (Tree2.inorder x1)\<rbrakk> \<Longrightarrow> Tree2.inorder (delete x x1) = del_list x (Tree2.inorder x1); \<lbrakk>avl x3; Sorted_Less.sorted (Tree2.inorder x3)\<rbrakk> \<Longrightarrow> Tree2.inorder (delete x x3) = del_list x (Tree2.inorder x3); avl \<langle>x1, (a, b), x3\<rangle>; Sorted_Less.sorted (Tree2.inorder \<langle>x1, (a, b), x3\<rangle>)\<rbrakk> \<Longrightarrow> Tree2.inorder (delete x \<langle>x1, (a, b), x3\<rangle>) = del_list x (Tree2.inorder \<langle>x1, (a, b), x3\<rangle>)
[PROOF STEP]
apply(auto simp: del_list_simps inorder_balR inorder_balL avl_delete inorder_split_maxD
                 split_max_Leaf neq_Leaf_if_height_neq_0
           simp del: balL.simps balR.simps split!: splits prod.splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Union_segment_image: "\<Union> (segment n ` {..<k}) = (if k=0 then {} else {0..real k/real n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (segment n ` {..<k}) = (if k = 0 then {} else {0..real k / real n})
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Union> (segment n ` {..<0}) = (if 0 = 0 then {} else {0..real 0 / real n})
 2. \<And>k. \<Union> (segment n ` {..<k}) = (if k = 0 then {} else {0..real k / real n}) \<Longrightarrow> \<Union> (segment n ` {..<Suc k}) = (if Suc k = 0 then {} else {0..real (Suc k) / real n})
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<Union> (segment n ` {..<k}) = (if k = 0 then {} else {0..real k / real n})

goal (2 subgoals):
 1. \<Union> (segment n ` {..<0}) = (if 0 = 0 then {} else {0..real 0 / real n})
 2. \<And>k. \<Union> (segment n ` {..<k}) = (if k = 0 then {} else {0..real k / real n}) \<Longrightarrow> \<Union> (segment n ` {..<Suc k}) = (if Suc k = 0 then {} else {0..real (Suc k) / real n})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> (segment n ` {..<k}) = (if k = 0 then {} else {0..real k / real n})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<Union> (segment n ` {..<k}) = (if k = 0 then {} else {0..real k / real n})

goal (1 subgoal):
 1. \<Union> (segment n ` {..<Suc k}) = (if Suc k = 0 then {} else {0..real (Suc k) / real n})
[PROOF STEP]
by (simp add: divide_simps segment_Suc Un_commute ivl_disj_un_two_touch split: if_split_asm)
[PROOF STATE]
proof (state)
this:
\<Union> (segment n ` {..<Suc k}) = (if Suc k = 0 then {} else {0..real (Suc k) / real n})

goal (1 subgoal):
 1. \<Union> (segment n ` {..<0}) = (if 0 = 0 then {} else {0..real 0 / real n})
[PROOF STEP]
qed (auto simp: segment_def)