[STATEMENT]
lemma poly_ge_trans[trans]: "\<lbrakk>p1 \<ge>p p2; p2 \<ge>p p3\<rbrakk> \<Longrightarrow> p1 \<ge>p p3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p1 \<ge>p p2; p2 \<ge>p p3\<rbrakk> \<Longrightarrow> p1 \<ge>p p3
[PROOF STEP]
unfolding poly_ge_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p2 \<le> eval_poly \<alpha> p1; \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p3 \<le> eval_poly \<alpha> p2\<rbrakk> \<Longrightarrow> \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p3 \<le> eval_poly \<alpha> p1
[PROOF STEP]
using ge_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<le> ?x; ?z \<le> ?y\<rbrakk> \<Longrightarrow> ?z \<le> ?x

goal (1 subgoal):
 1. \<lbrakk>\<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p2 \<le> eval_poly \<alpha> p1; \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p3 \<le> eval_poly \<alpha> p2\<rbrakk> \<Longrightarrow> \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p3 \<le> eval_poly \<alpha> p1
[PROOF STEP]
by blast


[STATEMENT]
lemma fv_map_fv_set: "\<Union>(set (map fv L)) = fv\<^sub>s\<^sub>e\<^sub>t (set L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (set (map fv L)) = fv\<^sub>s\<^sub>e\<^sub>t (set L)
[PROOF STEP]
by (induct L) auto


[STATEMENT]
lemma ereal_mult_mono':
  fixes a b c d::ereal
  assumes "a \<ge> 0" "c \<ge> 0" "a \<le> b" "c \<le> d"
  shows "a * c \<le> b * d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * c \<le> b * d
[PROOF STEP]
by (metis ereal_mult_right_mono mult.commute order_trans assms)


[STATEMENT]
lemma DERIV_ln_divide: "0 < x \<Longrightarrow> DERIV ln x :> 1 / x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> (ln has_real_derivative 1 / x) (at x)
[PROOF STEP]
by (rule DERIV_ln[THEN DERIV_cong]) (simp_all add: divide_inverse)


[STATEMENT]
lemma improper_iff:
  "~(proper f) \<longleftrightarrow> ((\<exists>x. f x = -\<infinity>) | (\<forall>x. f x = \<infinity>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> proper f) = ((\<exists>x. f x = - \<infinity>) \<or> (\<forall>x. f x = \<infinity>))
[PROOF STEP]
by (simp add: proper_iff)


[STATEMENT]
lemma butterfly_scaleC_left[simp]: "butterfly (c *\<^sub>C \<psi>) \<phi> = c *\<^sub>C butterfly \<psi> \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butterfly (c *\<^sub>C \<psi>) \<phi> = c *\<^sub>C butterfly \<psi> \<phi>
[PROOF STEP]
unfolding butterfly_def vector_to_cblinfun_scaleC scaleC_adj
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c *\<^sub>C vector_to_cblinfun \<psi> o\<^sub>C\<^sub>L vector_to_cblinfun \<phi>* = c *\<^sub>C (vector_to_cblinfun \<psi> o\<^sub>C\<^sub>L vector_to_cblinfun \<phi>*)
[PROOF STEP]
by (simp add: cnj_x_x)


[STATEMENT]
lemma closure_involutive':
  "Z \<subseteq> Closure\<^sub>\<alpha> W \<Longrightarrow> Closure\<^sub>\<alpha> Z \<subseteq> Closure\<^sub>\<alpha> W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Z \<subseteq> Closure\<^sub>\<alpha> W \<Longrightarrow> Closure\<^sub>\<alpha> Z \<subseteq> Closure\<^sub>\<alpha> W
[PROOF STEP]
unfolding cla_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Z \<subseteq> \<Union> {R \<in> \<R>. R \<inter> W \<noteq> {}} \<Longrightarrow> \<Union> {R \<in> \<R>. R \<inter> Z \<noteq> {}} \<subseteq> \<Union> {R \<in> \<R>. R \<inter> W \<noteq> {}}
[PROOF STEP]
using valid_regions_distinct_spec
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?R \<in> \<R>; ?R' \<in> \<R>; ?v \<in> ?R; ?v \<in> ?R'\<rbrakk> \<Longrightarrow> ?R = ?R'

goal (1 subgoal):
 1. Z \<subseteq> \<Union> {R \<in> \<R>. R \<inter> W \<noteq> {}} \<Longrightarrow> \<Union> {R \<in> \<R>. R \<inter> Z \<noteq> {}} \<subseteq> \<Union> {R \<in> \<R>. R \<inter> W \<noteq> {}}
[PROOF STEP]
by fast


[STATEMENT]
lemma Schwarz2:
 "\<lbrakk>f holomorphic_on ball 0 r;
    0 < s; ball w s \<subseteq> ball 0 r;
    \<And>z. norm (w-z) < s \<Longrightarrow> norm(f z) \<le> norm(f w)\<rbrakk>
    \<Longrightarrow> f constant_on ball 0 r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f holomorphic_on ball 0 r; 0 < s; ball w s \<subseteq> ball 0 r; \<And>z. cmod (w - z) < s \<Longrightarrow> cmod (f z) \<le> cmod (f w)\<rbrakk> \<Longrightarrow> f constant_on ball 0 r
[PROOF STEP]
by (rule maximum_modulus_principle [where U = "ball w s" and \<xi> = w]) (simp_all add: dist_norm)


[STATEMENT]
lemma cofinite_interior_infinite:
  fixes X :: "'a cofinite set"
  assumes "infinite X"
  assumes "infinite (-X)"
  shows "interior X = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior X = {}
[PROOF STEP]
using assms cofinite_closure_infinite[where X="-X"]
[PROOF STATE]
proof (prove)
using this:
infinite X
infinite (- X)
infinite (- X) \<Longrightarrow> closure (- X) = UNIV

goal (1 subgoal):
 1. interior X = {}
[PROOF STEP]
by (simp add: interior_closure)


[STATEMENT]
lemma zip_path_last : "length xs = length ys \<Longrightarrow> (zip_path (xs @ [x]) (ys @ [y])) = (zip_path xs ys)@(zip_path [x] [y])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys \<Longrightarrow> zip_path (xs @ [x]) (ys @ [y]) = zip_path xs ys @ zip_path [x] [y]
[PROOF STEP]
by (induction xs ys rule: list_induct2; simp)


[STATEMENT]
lemma C_merge_all: "\<lbrakk> \<forall>xs \<in> set xss. length xs = m; length xss = 2^k \<rbrakk>
  \<Longrightarrow> C_merge_all xss \<le> m * k * 2^k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>xs\<in>set xss. length xs = m; length xss = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all xss \<le> m * k * 2 ^ k
[PROOF STEP]
proof (induction xss arbitrary: k m rule: C_merge_all.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>k m. \<lbrakk>\<forall>xs\<in>set []. length xs = m; length [] = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all [] \<le> m * k * 2 ^ k
 2. \<And>xs k m. \<lbrakk>\<forall>xs\<in>set [xs]. length xs = m; length [xs] = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all [xs] \<le> m * k * 2 ^ k
 3. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
\<forall>xs\<in>set []. length xs = m
length [] = 2 ^ k

goal (3 subgoals):
 1. \<And>k m. \<lbrakk>\<forall>xs\<in>set []. length xs = m; length [] = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all [] \<le> m * k * 2 ^ k
 2. \<And>xs k m. \<lbrakk>\<forall>xs\<in>set [xs]. length xs = m; length [xs] = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all [xs] \<le> m * k * 2 ^ k
 3. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>xs\<in>set []. length xs = m
length [] = 2 ^ k

goal (1 subgoal):
 1. C_merge_all [] \<le> m * k * 2 ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C_merge_all [] \<le> m * k * 2 ^ k

goal (2 subgoals):
 1. \<And>xs k m. \<lbrakk>\<forall>xs\<in>set [xs]. length xs = m; length [xs] = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all [xs] \<le> m * k * 2 ^ k
 2. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs k m. \<lbrakk>\<forall>xs\<in>set [xs]. length xs = m; length [xs] = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all [xs] \<le> m * k * 2 ^ k
 2. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
\<forall>xs\<in>set [xs_]. length xs = m
length [xs_] = 2 ^ k

goal (2 subgoals):
 1. \<And>xs k m. \<lbrakk>\<forall>xs\<in>set [xs]. length xs = m; length [xs] = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all [xs] \<le> m * k * 2 ^ k
 2. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>xs\<in>set [xs_]. length xs = m
length [xs_] = 2 ^ k

goal (1 subgoal):
 1. C_merge_all [xs_] \<le> m * k * 2 ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C_merge_all [xs_] \<le> m * k * 2 ^ k

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
case (3 xs ys xss)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>xs\<in>set (merge_adj (xs # ys # xss)). length xs = ?m; length (merge_adj (xs # ys # xss)) = 2 ^ ?k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (xs # ys # xss)) \<le> ?m * ?k * 2 ^ ?k
\<forall>xs\<in>set (xs # ys # xss). length xs = m
length (xs # ys # xss) = 2 ^ k

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
let ?xss = "xs # ys # xss"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
let ?xss2 = "merge_adj ?xss"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
obtain k' where k': "k = Suc k'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k'. k = Suc k' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using "3.prems"(2)
[PROOF STATE]
proof (prove)
using this:
length (xs # ys # xss) = 2 ^ k

goal (1 subgoal):
 1. (\<And>k'. k = Suc k' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis length_Cons nat.inject nat_power_eq_Suc_0_iff nat.exhaust)
[PROOF STATE]
proof (state)
this:
k = Suc k'

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
have "even (length ?xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (length (xs # ys # xss))
[PROOF STEP]
using "3.prems"(2) k'
[PROOF STATE]
proof (prove)
using this:
length (xs # ys # xss) = 2 ^ k
k = Suc k'

goal (1 subgoal):
 1. even (length (xs # ys # xss))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
even (length (xs # ys # xss))

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
from length_merge_adj[OF this "3.prems"(1)]
[PROOF STATE]
proof (chain)
picking this:
\<forall>xs\<in>set (merge_adj (xs # ys # xss)). length xs = 2 * m
[PROOF STEP]
have *: "\<forall>x \<in> set(merge_adj ?xss). length x = 2*m"
[PROOF STATE]
proof (prove)
using this:
\<forall>xs\<in>set (merge_adj (xs # ys # xss)). length xs = 2 * m

goal (1 subgoal):
 1. \<forall>x\<in>set (merge_adj (xs # ys # xss)). length x = 2 * m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (merge_adj (xs # ys # xss)). length x = 2 * m

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
have **: "length ?xss2 = 2 ^ k'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (merge_adj (xs # ys # xss)) = 2 ^ k'
[PROOF STEP]
using "3.prems"(2) k'
[PROOF STATE]
proof (prove)
using this:
length (xs # ys # xss) = 2 ^ k
k = Suc k'

goal (1 subgoal):
 1. length (merge_adj (xs # ys # xss)) = 2 ^ k'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (merge_adj (xs # ys # xss)) = 2 ^ k'

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
have "C_merge_all ?xss = C_merge_adj ?xss + C_merge_all ?xss2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C_merge_all (xs # ys # xss) = C_merge_adj (xs # ys # xss) + C_merge_all (merge_adj (xs # ys # xss))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C_merge_all (xs # ys # xss) = C_merge_adj (xs # ys # xss) + C_merge_all (merge_adj (xs # ys # xss))

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C_merge_all (xs # ys # xss) = C_merge_adj (xs # ys # xss) + C_merge_all (merge_adj (xs # ys # xss))

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
have "\<dots> \<le> m * 2^k + C_merge_all ?xss2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C_merge_adj (xs # ys # xss) + C_merge_all (merge_adj (xs # ys # xss)) \<le> m * 2 ^ k + C_merge_all (merge_adj (xs # ys # xss))
[PROOF STEP]
using "3.prems"(2) C_merge_adj[OF "3.prems"(1)]
[PROOF STATE]
proof (prove)
using this:
length (xs # ys # xss) = 2 ^ k
C_merge_adj (xs # ys # xss) \<le> m * length (xs # ys # xss)

goal (1 subgoal):
 1. C_merge_adj (xs # ys # xss) + C_merge_all (merge_adj (xs # ys # xss)) \<le> m * 2 ^ k + C_merge_all (merge_adj (xs # ys # xss))
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
C_merge_adj (xs # ys # xss) + C_merge_all (merge_adj (xs # ys # xss)) \<le> m * 2 ^ k + C_merge_all (merge_adj (xs # ys # xss))

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C_merge_adj (xs # ys # xss) + C_merge_all (merge_adj (xs # ys # xss)) \<le> m * 2 ^ k + C_merge_all (merge_adj (xs # ys # xss))

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
have "\<dots> \<le> m * 2^k + (2*m) * k' * 2^k'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * 2 ^ k + C_merge_all (merge_adj (xs # ys # xss)) \<le> m * 2 ^ k + 2 * m * k' * 2 ^ k'
[PROOF STEP]
using "3.IH"[OF * **]
[PROOF STATE]
proof (prove)
using this:
C_merge_all (merge_adj (xs # ys # xss)) \<le> 2 * m * k' * 2 ^ k'

goal (1 subgoal):
 1. m * 2 ^ k + C_merge_all (merge_adj (xs # ys # xss)) \<le> m * 2 ^ k + 2 * m * k' * 2 ^ k'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m * 2 ^ k + C_merge_all (merge_adj (xs # ys # xss)) \<le> m * 2 ^ k + 2 * m * k' * 2 ^ k'

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
m * 2 ^ k + C_merge_all (merge_adj (xs # ys # xss)) \<le> m * 2 ^ k + 2 * m * k' * 2 ^ k'

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
have "\<dots> = m * k * 2^k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * 2 ^ k + 2 * m * k' * 2 ^ k' = m * k * 2 ^ k
[PROOF STEP]
using k'
[PROOF STATE]
proof (prove)
using this:
k = Suc k'

goal (1 subgoal):
 1. m * 2 ^ k + 2 * m * k' * 2 ^ k' = m * k * 2 ^ k
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
m * 2 ^ k + 2 * m * k' * 2 ^ k' = m * k * 2 ^ k

goal (1 subgoal):
 1. \<And>v vb vc k m. \<lbrakk>\<And>k m. \<lbrakk>\<forall>xs\<in>set (merge_adj (v # vb # vc)). length xs = m; length (merge_adj (v # vb # vc)) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (merge_adj (v # vb # vc)) \<le> m * k * 2 ^ k; \<forall>xs\<in>set (v # vb # vc). length xs = m; length (v # vb # vc) = 2 ^ k\<rbrakk> \<Longrightarrow> C_merge_all (v # vb # vc) \<le> m * k * 2 ^ k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
C_merge_all (xs # ys # xss) \<le> m * k * 2 ^ k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
C_merge_all (xs # ys # xss) \<le> m * k * 2 ^ k

goal (1 subgoal):
 1. C_merge_all (xs # ys # xss) \<le> m * k * 2 ^ k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
C_merge_all (xs # ys # xss) \<le> m * k * 2 ^ k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosh_dist_swap:
  assumes "a \<in> hyp2" and "b \<in> hyp2"
  shows "cosh_dist a b = cosh_dist b a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh_dist a b = cosh_dist b a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cosh_dist a b = cosh_dist b a
[PROOF STEP]
from assms and K2_isometry_swap
[PROOF STATE]
proof (chain)
picking this:
a \<in> hyp2
b \<in> hyp2
\<lbrakk>?a \<in> hyp2; ?b \<in> hyp2\<rbrakk> \<Longrightarrow> \<exists>J. is_K2_isometry J \<and> apply_cltn2 ?a J = ?b \<and> apply_cltn2 ?b J = ?a
[PROOF STEP]
obtain J where "is_K2_isometry J" and "apply_cltn2 a J = b"
    and "apply_cltn2 b J = a"
[PROOF STATE]
proof (prove)
using this:
a \<in> hyp2
b \<in> hyp2
\<lbrakk>?a \<in> hyp2; ?b \<in> hyp2\<rbrakk> \<Longrightarrow> \<exists>J. is_K2_isometry J \<and> apply_cltn2 ?a J = ?b \<and> apply_cltn2 ?b J = ?a

goal (1 subgoal):
 1. (\<And>J. \<lbrakk>is_K2_isometry J; apply_cltn2 a J = b; apply_cltn2 b J = a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_K2_isometry J
apply_cltn2 a J = b
apply_cltn2 b J = a

goal (1 subgoal):
 1. cosh_dist a b = cosh_dist b a
[PROOF STEP]
from \<open>b \<in> hyp2\<close> and \<open>a \<in> hyp2\<close> and \<open>is_K2_isometry J\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<in> hyp2
a \<in> hyp2
is_K2_isometry J
[PROOF STEP]
have "cosh_dist (apply_cltn2 b J) (apply_cltn2 a J) = cosh_dist b a"
[PROOF STATE]
proof (prove)
using this:
b \<in> hyp2
a \<in> hyp2
is_K2_isometry J

goal (1 subgoal):
 1. cosh_dist (apply_cltn2 b J) (apply_cltn2 a J) = cosh_dist b a
[PROOF STEP]
by (rule K2_isometry_cosh_dist)
[PROOF STATE]
proof (state)
this:
cosh_dist (apply_cltn2 b J) (apply_cltn2 a J) = cosh_dist b a

goal (1 subgoal):
 1. cosh_dist a b = cosh_dist b a
[PROOF STEP]
with \<open>apply_cltn2 a J = b\<close> and \<open>apply_cltn2 b J = a\<close>
[PROOF STATE]
proof (chain)
picking this:
apply_cltn2 a J = b
apply_cltn2 b J = a
cosh_dist (apply_cltn2 b J) (apply_cltn2 a J) = cosh_dist b a
[PROOF STEP]
show "cosh_dist a b = cosh_dist b a"
[PROOF STATE]
proof (prove)
using this:
apply_cltn2 a J = b
apply_cltn2 b J = a
cosh_dist (apply_cltn2 b J) (apply_cltn2 a J) = cosh_dist b a

goal (1 subgoal):
 1. cosh_dist a b = cosh_dist b a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cosh_dist a b = cosh_dist b a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Inf_eq_MInfty:
  fixes S :: "ereal set"
  shows "-\<infinity> \<in> S \<Longrightarrow> Inf S = -\<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<infinity> \<in> S \<Longrightarrow> Inf S = - \<infinity>
[PROOF STEP]
unfolding bot_ereal_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bot \<in> S \<Longrightarrow> Inf S = bot
[PROOF STEP]
by auto


[STATEMENT]
lemma less_le_not_le_basic_type:
  "\<tau> < \<sigma> \<longleftrightarrow> \<tau> \<le> \<sigma> \<and> \<not> \<sigma> \<le> \<tau>"
  for \<tau> \<sigma> :: "'a basic_type"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<tau> < \<sigma>) = (\<tau> \<le> \<sigma> \<and> \<not> \<sigma> \<le> \<tau>)
[PROOF STEP]
unfolding less_basic_type_def less_eq_basic_type_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<sqsubset>\<^sub>B)\<^sup>+\<^sup>+ \<tau> \<sigma> = ((\<sqsubset>\<^sub>B)\<^sup>*\<^sup>* \<tau> \<sigma> \<and> \<not> (\<sqsubset>\<^sub>B)\<^sup>*\<^sup>* \<sigma> \<tau>)
[PROOF STEP]
apply (rule iffI; auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(\<sqsubset>\<^sub>B)\<^sup>+\<^sup>+ \<tau> \<sigma>; (\<sqsubset>\<^sub>B)\<^sup>*\<^sup>* \<sigma> \<tau>\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>(\<sqsubset>\<^sub>B)\<^sup>*\<^sup>* \<tau> \<sigma>; \<not> (\<sqsubset>\<^sub>B)\<^sup>*\<^sup>* \<sigma> \<tau>\<rbrakk> \<Longrightarrow> (\<sqsubset>\<^sub>B)\<^sup>+\<^sup>+ \<tau> \<sigma>
[PROOF STEP]
apply (metis (mono_tags) basic_subtype_irrefl
      less_basic_type_def tranclp_rtranclp_tranclp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<sqsubset>\<^sub>B)\<^sup>*\<^sup>* \<tau> \<sigma>; \<not> (\<sqsubset>\<^sub>B)\<^sup>*\<^sup>* \<sigma> \<tau>\<rbrakk> \<Longrightarrow> (\<sqsubset>\<^sub>B)\<^sup>+\<^sup>+ \<tau> \<sigma>
[PROOF STEP]
by (drule rtranclpD; auto)


[STATEMENT]
theorem ln_Gamma_bounds:
  assumes "x \<ge> 1"
  shows   "ln_Gamma x \<ge> ln (2*pi/x) / 2 + x * ln x - x" (is ?th1)
          "ln_Gamma x \<le> ln (2*pi/x) / 2 + x * ln x - x + 1/(12*x)" (is ?th2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (2 * pi / x) / 2 + x * ln x - x \<le> ln_Gamma x &&& ln_Gamma x \<le> ln (2 * pi / x) / 2 + x * ln x - x + 1 / (12 * x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ln (2 * pi / x) / 2 + x * ln x - x \<le> ln_Gamma x
 2. ln_Gamma x \<le> ln (2 * pi / x) / 2 + x * ln x - x + 1 / (12 * x)
[PROOF STEP]
from ln_Gamma_bounds_aux[OF assms] assms
[PROOF STATE]
proof (chain)
picking this:
c + (x - 1 / 2) * ln x - x \<le> ln_Gamma x
ln_Gamma x \<le> c + (x - 1 / 2) * ln x - x + 1 / (12 * x)
1 \<le> x
[PROOF STEP]
show ?th1 ?th2
[PROOF STATE]
proof (prove)
using this:
c + (x - 1 / 2) * ln x - x \<le> ln_Gamma x
ln_Gamma x \<le> c + (x - 1 / 2) * ln x - x + 1 / (12 * x)
1 \<le> x

goal (1 subgoal):
 1. ln (2 * pi / x) / 2 + x * ln x - x \<le> ln_Gamma x &&& ln_Gamma x \<le> ln (2 * pi / x) / 2 + x * ln x - x + 1 / (12 * x)
[PROOF STEP]
by (simp_all add: c field_simps ln_div)
[PROOF STATE]
proof (state)
this:
ln (2 * pi / x) / 2 + x * ln x - x \<le> ln_Gamma x
ln_Gamma x \<le> ln (2 * pi / x) / 2 + x * ln x - x + 1 / (12 * x)

goal:
No subgoals!
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 \<le> x
[PROOF STEP]
have "exp c * x powr (x - 1/2) / exp x = sqrt (2*pi/x) * (x / exp 1) powr x"
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. exp c * x powr (x - 1 / 2) / exp x = sqrt (2 * pi / x) * (x / exp 1) powr x
[PROOF STEP]
by (subst powr_diff)
       (simp add: exp_c real_sqrt_divide powr_divide powr_half_sqrt field_simps)
[PROOF STATE]
proof (state)
this:
exp c * x powr (x - 1 / 2) / exp x = sqrt (2 * pi / x) * (x / exp 1) powr x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cons_in_nlists_Suc [iff]: "(x#xs \<in> nlists (Suc n) A) \<longleftrightarrow> (x\<in>A \<and> xs \<in> nlists n A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x # xs \<in> nlists (Suc n) A) = (x \<in> A \<and> xs \<in> nlists n A)
[PROOF STEP]
unfolding nlists_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x # xs \<in> {xs. length xs = Suc n \<and> set xs \<subseteq> A}) = (x \<in> A \<and> xs \<in> {xs. length xs = n \<and> set xs \<subseteq> A})
[PROOF STEP]
by (auto)


[STATEMENT]
lemma ldropWhile_repeat: "ldropWhile P (repeat x) = (if P x then LNil else repeat x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldropWhile P (repeat x) = (if P x then LNil else repeat x)
[PROOF STEP]
by(simp add: ldropWhile_eq_ldrop ltakeWhile_repeat)


[STATEMENT]
lemma pathstart_rec_join_2:
  "pathstart (rec_join ((-1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
 2. \<not> ?P \<Longrightarrow> pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
assume "l = []"
[PROOF STATE]
proof (state)
this:
l = []

goal (2 subgoals):
 1. ?P \<Longrightarrow> pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
 2. \<not> ?P \<Longrightarrow> pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l = []
[PROOF STEP]
show "pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)"
[PROOF STATE]
proof (prove)
using this:
l = []

goal (1 subgoal):
 1. pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
assume "l \<noteq> [] "
[PROOF STATE]
proof (state)
this:
l \<noteq> []

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l \<noteq> []
[PROOF STEP]
obtain h l' where "l = h#l'"
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []

goal (1 subgoal):
 1. (\<And>h l'. l = h # l' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson rec_join.elims)
[PROOF STATE]
proof (state)
this:
l = h # l'

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l = h # l'
[PROOF STEP]
show "pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)"
[PROOF STATE]
proof (prove)
using this:
l = h # l'

goal (1 subgoal):
 1. pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pathstart (rec_join ((- 1, \<gamma>) # l)) = pathstart (reversepath \<gamma>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_of_minimal_eq:
   "\<lbrakk>S \<subseteq> topspace X; closedin X T\<rbrakk> \<Longrightarrow> (X closure_of S) \<subseteq> T \<longleftrightarrow> S \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> topspace X; closedin X T\<rbrakk> \<Longrightarrow> (X closure_of S \<subseteq> T) = (S \<subseteq> T)
[PROOF STEP]
by (meson closure_of_minimal closure_of_subset subset_trans)


[STATEMENT]
lemma [simp, nitpick_simp]:
  shows llength_LNil: "llength LNil = 0"
  and llength_LCons: "llength (LCons x xs) = eSuc (llength xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength LNil = 0 &&& llength (LCons x xs) = eSuc (llength xs)
[PROOF STEP]
by(simp_all add: llength_def enat_unfold)


[STATEMENT]
lemma real_interval_uminus: "real_interval (- b) = - real_interval b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_interval (- b) = - real_interval b
[PROOF STEP]
by (simp add: interval_eqI)


[STATEMENT]
lemma one_plus_x_powr_Taylor2_bigo:
  assumes lim: "(f \<longlongrightarrow> 0) F"
  shows   "(\<lambda>x. (1 + f x) powr (p::real) - 1 - p * f x) \<in> O[F](\<lambda>x. f x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (1 + f x) powr p - 1 - p * f x) \<in> O[F](\<lambda>x. (f x)\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. (1 + f x) powr p - 1 - p * f x) \<in> O[F](\<lambda>x. (f x)\<^sup>2)
[PROOF STEP]
from one_plus_x_powr_Taylor2[of p]
[PROOF STATE]
proof (chain)
picking this:
(\<And>k. (\<And>x. \<bar>x\<bar> \<le> 1 / 2 \<Longrightarrow> \<bar>(1 + x) powr p - 1 - p * x\<bar> \<le> k * x\<^sup>2) \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
guess k
[PROOF STATE]
proof (prove)
using this:
(\<And>k. (\<And>x. \<bar>x\<bar> \<le> 1 / 2 \<Longrightarrow> \<bar>(1 + x) powr p - 1 - p * x\<bar> \<le> k * x\<^sup>2) \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. thesis
goal instantiation:
PROP ?guess \<leadsto> thesis
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>?x\<bar> \<le> 1 / 2 \<Longrightarrow> \<bar>(1 + ?x) powr p - 1 - p * ?x\<bar> \<le> k * ?x\<^sup>2

goal (1 subgoal):
 1. (\<lambda>x. (1 + f x) powr p - 1 - p * f x) \<in> O[F](\<lambda>x. (f x)\<^sup>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<bar>?x\<bar> \<le> 1 / 2 \<Longrightarrow> \<bar>(1 + ?x) powr p - 1 - p * ?x\<bar> \<le> k * ?x\<^sup>2

goal (1 subgoal):
 1. (\<lambda>x. (1 + f x) powr p - 1 - p * f x) \<in> O[F](\<lambda>x. (f x)\<^sup>2)
[PROOF STEP]
from tendstoD[OF lim, of "1/2"]
[PROOF STATE]
proof (chain)
picking this:
0 < 1 / 2 \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) 0 < 1 / 2
[PROOF STEP]
have "eventually (\<lambda>x. abs (f x) < 1/2) F"
[PROOF STATE]
proof (prove)
using this:
0 < 1 / 2 \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) 0 < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<bar>f x\<bar> < 1 / 2
[PROOF STEP]
by (simp add: dist_real_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. \<bar>f x\<bar> < 1 / 2

goal (1 subgoal):
 1. (\<lambda>x. (1 + f x) powr p - 1 - p * f x) \<in> O[F](\<lambda>x. (f x)\<^sup>2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<bar>?x\<bar> \<le> 1 / 2 \<Longrightarrow> \<bar>(1 + ?x) powr p - 1 - p * ?x\<bar> \<le> k * ?x\<^sup>2
\<forall>\<^sub>F x in F. \<bar>f x\<bar> < 1 / 2
[PROOF STEP]
have "eventually (\<lambda>x. norm ((1 + f x) powr p - 1 - p * f x) \<le> k * norm (f x ^ 2)) F"
[PROOF STATE]
proof (prove)
using this:
\<bar>?x\<bar> \<le> 1 / 2 \<Longrightarrow> \<bar>(1 + ?x) powr p - 1 - p * ?x\<bar> \<le> k * ?x\<^sup>2
\<forall>\<^sub>F x in F. \<bar>f x\<bar> < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm ((1 + f x) powr p - 1 - p * f x) \<le> k * norm ((f x)\<^sup>2)
[PROOF STEP]
by (auto elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. norm ((1 + f x) powr p - 1 - p * f x) \<le> k * norm ((f x)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>x. (1 + f x) powr p - 1 - p * f x) \<in> O[F](\<lambda>x. (f x)\<^sup>2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. norm ((1 + f x) powr p - 1 - p * f x) \<le> k * norm ((f x)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>x. (1 + f x) powr p - 1 - p * f x) \<in> O[F](\<lambda>x. (f x)\<^sup>2)
[PROOF STEP]
by (rule bigoI)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1 + f x) powr p - 1 - p * f x) \<in> O[F](\<lambda>x. (f x)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma range_compress:
  assumes "x\<in>{0..q-1}" "of_nat d < \<lceil>(log 2 q)::real\<rceil>"
  shows "compress d x \<in> {0..2^d - 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compress d x \<in> {0..2 ^ d - 1}
[PROOF STEP]
using compress_def
[PROOF STATE]
proof (prove)
using this:
compress ?d ?x = round (real_of_int (2 ^ ?d * ?x) / real_of_int q) mod 2 ^ ?d

goal (1 subgoal):
 1. compress d x \<in> {0..2 ^ d - 1}
[PROOF STEP]
by auto


[STATEMENT]
theorem map_is_rbt [simp]: "is_rbt (map f t) = is_rbt t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_rbt (RBT_Impl.map f t) = is_rbt t
[PROOF STEP]
unfolding is_rbt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inv1 (RBT_Impl.map f t) \<and> inv2 (RBT_Impl.map f t) \<and> color_of (RBT_Impl.map f t) = B \<and> rbt_sorted (RBT_Impl.map f t)) = (inv1 t \<and> inv2 t \<and> color_of t = B \<and> rbt_sorted t)
[PROOF STEP]
by (simp add: map_inv1 map_inv2 map_rbt_sorted map_color_of)


[STATEMENT]
lemma birkhoff_sum_add:
  "birkhoff_sum (\<lambda>x. f x + g x) n x = birkhoff_sum f n x + birkhoff_sum g n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum (\<lambda>x. f x + g x) n x = birkhoff_sum f n x + birkhoff_sum g n x
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. f ((T ^^ i) x) + g ((T ^^ i) x)) = (\<Sum>i<n. f ((T ^^ i) x)) + (\<Sum>i<n. g ((T ^^ i) x))
[PROOF STEP]
by (simp add: sum.distrib)


[STATEMENT]
lemma finite_sets_supp:
  fixes S::"('a::fs set)"
  assumes "finite S"
  shows "finite (supp S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (supp S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. finite (supp S)
[PROOF STEP]
by (simp only: supp_of_finite_sets Union_of_finite_supp_sets)


[STATEMENT]
lemma unwrapExist' : "eval (ExN (j + 1) A) L =  eval (ExN j (ExQ A)) L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (ExN (j + 1) A) L = eval (ExN j (ExQ A)) L
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>l. length l = Suc j \<and> eval A (l @ L)) = (\<exists>l. length l = j \<and> (\<exists>x. eval A (x # l @ L)))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>l. \<lbrakk>length l = Suc j; eval A (l @ L)\<rbrakk> \<Longrightarrow> \<exists>l. length l = j \<and> (\<exists>x. eval A (x # l @ L))
 2. \<And>l x. \<lbrakk>j = length l; eval A (x # l @ L)\<rbrakk> \<Longrightarrow> \<exists>la. length la = Suc (length l) \<and> eval A (la @ L)
[PROOF STEP]
subgoal for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = Suc j; eval A (l @ L)\<rbrakk> \<Longrightarrow> \<exists>l. length l = j \<and> (\<exists>x. eval A (x # l @ L))
[PROOF STEP]
apply(rule exI[where x="drop 1 l"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = Suc j; eval A (l @ L)\<rbrakk> \<Longrightarrow> length (drop 1 l) = j \<and> (\<exists>x. eval A (x # drop 1 l @ L))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = Suc j; eval A (l @ L)\<rbrakk> \<Longrightarrow> \<exists>x. eval A (x # drop (Suc 0) l @ L)
[PROOF STEP]
apply(rule exI[where x="nth l 0"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = Suc j; eval A (l @ L)\<rbrakk> \<Longrightarrow> eval A (l ! 0 # drop (Suc 0) l @ L)
[PROOF STEP]
by (metis Cons_nth_drop_Suc append_Cons drop0 zero_less_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l x. \<lbrakk>j = length l; eval A (x # l @ L)\<rbrakk> \<Longrightarrow> \<exists>la. length la = Suc (length l) \<and> eval A (la @ L)
[PROOF STEP]
subgoal for l x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j = length l; eval A (x # l @ L)\<rbrakk> \<Longrightarrow> \<exists>la. length la = Suc (length l) \<and> eval A (la @ L)
[PROOF STEP]
apply(rule exI[where x="x#l"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j = length l; eval A (x # l @ L)\<rbrakk> \<Longrightarrow> length (x # l) = Suc (length l) \<and> eval A ((x # l) @ L)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ennreal_approx_SUP:
  fixes x::ennreal
  assumes f_bound: "\<And>i. i \<in> A \<Longrightarrow> f i \<le> x"
  assumes approx: "\<And>e. (e::real) > 0 \<Longrightarrow> \<exists>i \<in> A. x \<le> f i + e"
  shows "x = (SUP i \<in> A. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = Sup (f ` A)
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<le> Sup (f ` A)
 2. Sup (f ` A) \<le> x
[PROOF STEP]
show "x \<le> (SUP i\<in>A. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> Sup (f ` A)
[PROOF STEP]
proof (rule ennreal_le_epsilon)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>Sup (f ` A) < top; 0 < e\<rbrakk> \<Longrightarrow> x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
fix e :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>Sup (f ` A) < top; 0 < e\<rbrakk> \<Longrightarrow> x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
assume "0 < e"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>Sup (f ` A) < top; 0 < e\<rbrakk> \<Longrightarrow> x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
from approx[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>i\<in>A. x \<le> f i + ennreal e
[PROOF STEP]
obtain i where "i \<in> A" and *: "x \<le> f i + ennreal e"
[PROOF STATE]
proof (prove)
using this:
\<exists>i\<in>A. x \<le> f i + ennreal e

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i \<in> A; x \<le> f i + ennreal e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i \<in> A
x \<le> f i + ennreal e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>Sup (f ` A) < top; 0 < e\<rbrakk> \<Longrightarrow> x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
x \<le> f i + ennreal e
[PROOF STEP]
have "x \<le> f i + e"
[PROOF STATE]
proof (prove)
using this:
x \<le> f i + ennreal e

goal (1 subgoal):
 1. x \<le> f i + ennreal e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<le> f i + ennreal e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>Sup (f ` A) < top; 0 < e\<rbrakk> \<Longrightarrow> x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<le> f i + ennreal e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>Sup (f ` A) < top; 0 < e\<rbrakk> \<Longrightarrow> x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
have "\<dots> \<le> (SUP i\<in>A. f i) + e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i + ennreal e \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
by (intro add_mono \<open>i \<in> A\<close> SUP_upper order_refl)
[PROOF STATE]
proof (state)
this:
f i + ennreal e \<le> Sup (f ` A) + ennreal e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>Sup (f ` A) < top; 0 < e\<rbrakk> \<Longrightarrow> x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
show "x \<le> (SUP i\<in>A. f i) + e"
[PROOF STATE]
proof (prove)
using this:
x \<le> Sup (f ` A) + ennreal e

goal (1 subgoal):
 1. x \<le> Sup (f ` A) + ennreal e
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x \<le> Sup (f ` A) + ennreal e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<le> Sup (f ` A)

goal (1 subgoal):
 1. Sup (f ` A) \<le> x
[PROOF STEP]
qed (intro SUP_least f_bound)


[STATEMENT]
lemma p_intpow_add:
  fixes n::int
  fixes m::int
  shows "\<pp> [^] (n + m) = (\<pp> [^] n) \<otimes> (\<pp> [^] m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pp> [^] (n + m) = \<pp> [^] n \<otimes> \<pp> [^] m
[PROOF STEP]
using Qp_int_pow_add p_nonzero
[PROOF STATE]
proof (prove)
using this:
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> ?a [^] (?n + ?m) = ?a [^] ?n \<otimes> ?a [^] ?m
\<pp> \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. \<pp> [^] (n + m) = \<pp> [^] n \<otimes> \<pp> [^] m
[PROOF STEP]
by blast


[STATEMENT]
lemma is_gcd_is_bezout:
  assumes "is_bezout bezout"
  shows "is_gcd (\<lambda>a b. (case bezout a b of (_, _, gcd') \<Rightarrow> (gcd')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_gcd (\<lambda>a b. case bezout a b of (x, xa, gcd') \<Rightarrow> gcd')
[PROOF STEP]
unfolding is_gcd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a b. (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd') dvd a \<and> (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd') dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd'))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_bezout bezout

goal (1 subgoal):
 1. \<forall>a b. (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd') dvd a \<and> (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd') dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd'))
[PROOF STEP]
unfolding is_bezout_def Let_def
[PROOF STATE]
proof (prove)
using this:
\<forall>a b. case bezout a b of (p, q, gcd_a_b) \<Rightarrow> p * a + q * b = gcd_a_b \<and> gcd_a_b dvd a \<and> gcd_a_b dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd gcd_a_b)

goal (1 subgoal):
 1. \<forall>a b. (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd') dvd a \<and> (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd') dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd (case bezout a b of (x, xaa, gcd') \<Rightarrow> gcd'))
[PROOF STEP]
by (simp add: split_beta)


[STATEMENT]
lemma identity_telescopic:
  fixes x :: \<open>_ \<Rightarrow> 'a::real_normed_vector\<close>
  assumes \<open>x \<longlonglongrightarrow> l\<close>
  shows \<open>(\<lambda> N. sum (\<lambda> k. x (Suc k) - x k) {n..N}) \<longlonglongrightarrow> l - x n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
text\<open>
  Expression of a limit as a telescopic series.
  Explanation: If \<^term>\<open>x\<close> converges to \<^term>\<open>l\<close> then the sum \<^term>\<open>sum (\<lambda> k. x (Suc k) - x k) {n..N}\<close>
  converges to \<^term>\<open>l - x n\<close> as \<^term>\<open>N\<close> goes to infinity.
\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
have \<open>(\<lambda> p. x (p + Suc n)) \<longlonglongrightarrow> l\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. x (p + Suc n)) \<longlonglongrightarrow> l
[PROOF STEP]
using \<open>x \<longlonglongrightarrow> l\<close>
[PROOF STATE]
proof (prove)
using this:
x \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>p. x (p + Suc n)) \<longlonglongrightarrow> l
[PROOF STEP]
by (rule LIMSEQ_ignore_initial_segment)
[PROOF STATE]
proof (state)
this:
(\<lambda>p. x (p + Suc n)) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
hence \<open>(\<lambda> p. x (Suc n + p)) \<longlonglongrightarrow> l\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. x (p + Suc n)) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>p. x (Suc n + p)) \<longlonglongrightarrow> l
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
(\<lambda>p. x (Suc n + p)) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
hence \<open>(\<lambda> p. x (Suc (n + p))) \<longlonglongrightarrow> l\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. x (Suc n + p)) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>p. x (Suc (n + p))) \<longlonglongrightarrow> l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>p. x (Suc (n + p))) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
hence \<open>(\<lambda> t. (- (x n)) + (\<lambda> p.  x (Suc (n + p))) t ) \<longlonglongrightarrow> (- (x n))  + l\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. x (Suc (n + p))) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>t. - x n + x (Suc (n + t))) \<longlonglongrightarrow> - x n + l
[PROOF STEP]
using tendsto_add_const_iff
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. x (Suc (n + p))) \<longlonglongrightarrow> l
((\<lambda>x. ?c + ?f x) \<longlongrightarrow> ?c + ?d) ?F = (?f \<longlongrightarrow> ?d) ?F

goal (1 subgoal):
 1. (\<lambda>t. - x n + x (Suc (n + t))) \<longlonglongrightarrow> - x n + l
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<lambda>t. - x n + x (Suc (n + t))) \<longlonglongrightarrow> - x n + l

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
hence f1: \<open>(\<lambda> p. x (Suc (n + p)) - x n)\<longlonglongrightarrow> l - x n\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>t. - x n + x (Suc (n + t))) \<longlonglongrightarrow> - x n + l

goal (1 subgoal):
 1. (\<lambda>p. x (Suc (n + p)) - x n) \<longlonglongrightarrow> l - x n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>p. x (Suc (n + p)) - x n) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
have \<open>sum (\<lambda> k. x (Suc k) - x k) {n..n+p} = x (Suc (n+p)) - x n\<close> for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = n..n + p. x (Suc k) - x k) = x (Suc (n + p)) - x n
[PROOF STEP]
by (simp add: sum_Suc_diff)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = n..n + ?p. x (Suc k) - x k) = x (Suc (n + ?p)) - x n

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>k = n..n + ?p. x (Suc k) - x k) = x (Suc (n + ?p)) - x n

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
have \<open>(\<lambda> N. sum (\<lambda> k. x (Suc k) - x k) {n..N}) (n + t)
               = (\<lambda> p. sum (\<lambda> k. x (Suc k) - x k) {n..n+p}) t\<close> for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = n..n + t. x (Suc k) - x k) = (\<Sum>k = n..n + t. x (Suc k) - x k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>k = n..n + ?t. x (Suc k) - x k) = (\<Sum>k = n..n + ?t. x (Suc k) - x k)

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = n..n + ?p. x (Suc k) - x k) = x (Suc (n + ?p)) - x n
(\<Sum>k = n..n + ?t. x (Suc k) - x k) = (\<Sum>k = n..n + ?t. x (Suc k) - x k)
[PROOF STEP]
have  \<open>(\<lambda> p. (\<lambda> N. sum (\<lambda> k. x (Suc k) - x k) {n..N}) (n + p)) \<longlonglongrightarrow> l - x n\<close>
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = n..n + ?p. x (Suc k) - x k) = x (Suc (n + ?p)) - x n
(\<Sum>k = n..n + ?t. x (Suc k) - x k) = (\<Sum>k = n..n + ?t. x (Suc k) - x k)

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>k = n..n + p. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = n..n + ?p. x (Suc k) - x k) = x (Suc (n + ?p)) - x n
(\<Sum>k = n..n + ?t. x (Suc k) - x k) = (\<Sum>k = n..n + ?t. x (Suc k) - x k)
(\<lambda>p. x (Suc (n + p)) - x n) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>k = n..n + p. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>p. \<Sum>k = n..n + p. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
hence \<open>(\<lambda> p. (\<lambda> N. sum (\<lambda> k. x (Suc k) - x k) {n..N}) (p + n)) \<longlonglongrightarrow> l - x n\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. \<Sum>k = n..n + p. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>k = n..p + n. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
(\<lambda>p. \<Sum>k = n..p + n. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
hence  \<open>(\<lambda> p. (\<lambda> N. sum (\<lambda> k. x (Suc k) - x k) {n..N}) p) \<longlonglongrightarrow> l - x n\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. \<Sum>k = n..p + n. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>k = n..p. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
using Topological_Spaces.LIMSEQ_offset[where f = "(\<lambda> N. sum (\<lambda> k. x (Suc k) - x k) {n..N})"
        and a = "l - x n" and k = n]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. \<Sum>k = n..p + n. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
(\<lambda>na. \<Sum>k = n..na + n. x (Suc k) - x k) \<longlonglongrightarrow> l - x n \<Longrightarrow> (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>p. \<Sum>k = n..p. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>p. \<Sum>k = n..p. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
hence  \<open>(\<lambda> M. (\<lambda> N. sum (\<lambda> k. x (Suc k) - x k) {n..N}) M) \<longlonglongrightarrow> l - x n\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. \<Sum>k = n..p. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>M. \<Sum>k = n..M. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>M. \<Sum>k = n..M. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>M. \<Sum>k = n..M. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal (1 subgoal):
 1. (\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>N. \<Sum>k = n..N. x (Suc k) - x k) \<longlonglongrightarrow> l - x n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rapprox_posrat_less1:
  "0 \<le> x \<Longrightarrow> 0 < y \<Longrightarrow> 2 * x < y \<Longrightarrow> real_of_float (rapprox_posrat n x y) < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 < y; 2 * x < y\<rbrakk> \<Longrightarrow> real_of_float (rapprox_posrat n x y) < 1
[PROOF STEP]
by transfer (simp add: rat_precision_pos round_up_less1 truncate_up_rat_precision)


[STATEMENT]
lemma constant_on_subset: "\<lbrakk>f constant_on A; B \<subseteq> A\<rbrakk> \<Longrightarrow> f constant_on B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f constant_on A; B \<subseteq> A\<rbrakk> \<Longrightarrow> f constant_on B
[PROOF STEP]
unfolding constant_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>y. \<forall>x\<in>A. f x = y; B \<subseteq> A\<rbrakk> \<Longrightarrow> \<exists>y. \<forall>x\<in>B. f x = y
[PROOF STEP]
by blast


[STATEMENT]
lemma card_face_cycle_sets: "card GM.face_cycle_sets = card H.face_cycle_sets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card GM.face_cycle_sets = card H.face_cycle_sets
[PROOF STEP]
unfolding face_cycle_sets
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((`) proj_arcs_H ` H.face_cycle_sets) = card H.face_cycle_sets
[PROOF STEP]
using inj_on_proj_arcs_H
[PROOF STATE]
proof (prove)
using this:
inj_on ((`) proj_arcs_H) H.face_cycle_sets

goal (1 subgoal):
 1. card ((`) proj_arcs_H ` H.face_cycle_sets) = card H.face_cycle_sets
[PROOF STEP]
by (rule card_image)


[STATEMENT]
lemma convex_halfspace_Im_ge: "convex {x. Im x \<ge> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. b \<le> Im x}
[PROOF STEP]
using convex_halfspace_ge[of b \<i>]
[PROOF STATE]
proof (prove)
using this:
convex {x. b \<le> \<i> \<bullet> x}

goal (1 subgoal):
 1. convex {x. b \<le> Im x}
[PROOF STEP]
by simp


[STATEMENT]
lemma fmrestrict_fset_twice[simp]: "fmrestrict_fset S (fmrestrict_fset T m) = fmrestrict_fset (S |\<inter>| T) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmrestrict_fset S (fmrestrict_fset T m) = fmrestrict_fset (S |\<inter>| T) m
[PROOF STEP]
unfolding fmfilter_alt_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmfilter (\<lambda>a. a |\<in>| S) (fmfilter (\<lambda>a. a |\<in>| T) m) = fmfilter (\<lambda>a. a |\<in>| S |\<inter>| T) m
[PROOF STEP]
by auto


[STATEMENT]
lemma Inj_eq_lemma [simp]:
  "(\<forall>T. (\<exists>T'. T = Inj T' \<and> P T') \<longrightarrow> Q T) = (\<forall>T'. P T' \<longrightarrow> Q (Inj T'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>T. (\<exists>T'. T = Inj T' \<and> P T') \<longrightarrow> Q T) = (\<forall>T'. P T' \<longrightarrow> Q (Inj T'))
[PROOF STEP]
by auto


[STATEMENT]
lemma fg_start_round_smallest:
  assumes "round (rho k) p = r"
  shows "fg_start_round rho p r \<le> (k::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fg_start_round rho p r \<le> k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
round (rho k) p = r

goal (1 subgoal):
 1. fg_start_round rho p r \<le> k
[PROOF STEP]
unfolding fg_start_round_def
[PROOF STATE]
proof (prove)
using this:
round (rho k) p = r

goal (1 subgoal):
 1. (LEAST n. round (rho n) p = r) \<le> k
[PROOF STEP]
by (rule Least_le)


[STATEMENT]
lemma interval_cart:
  fixes a :: "real^'n"
  shows "box a b = {x::real^'n. \<forall>i. a$i < x$i \<and> x$i < b$i}"
    and "cbox a b = {x::real^'n. \<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. box a b = {x. \<forall>i. a $ i < x $ i \<and> x $ i < b $ i} &&& cbox a b = {x. \<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i}
[PROOF STEP]
by (auto simp add: set_eq_iff less_vec_def less_eq_vec_def mem_box Basis_vec_def inner_axis)


[STATEMENT]
lemma mult_ket_vec_is_ket_vec_of_mult:
  fixes A::"complex mat" and v::"complex vec"
  assumes "dim_col A = dim_vec v"
  shows "|A * |v\<rangle> \<rangle> = A * |v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |col_fst (A * |v\<rangle>)\<rangle> = A * |v\<rangle>
[PROOF STEP]
using assms ket_vec_def
[PROOF STATE]
proof (prove)
using this:
dim_col A = dim_vec v
|?v\<rangle> \<equiv> mat (dim_vec ?v) 1 (\<lambda>(i, j). ?v $ i)

goal (1 subgoal):
 1. |col_fst (A * |v\<rangle>)\<rangle> = A * |v\<rangle>
[PROOF STEP]
by (metis One_nat_def col_fst_is_col dim_col dim_col_mat(1) index_mult_mat(3) ket_vec_col less_Suc0
mat_col_eqI)


[STATEMENT]
lemma add_mult_distrib_mat_vec[algebra_simps]: assumes m: "A \<in> carrier_mat nr nc"
  "B \<in> carrier_mat nr nc" "v \<in> carrier_vec nc"
  shows "(A + B) *\<^sub>v v = A *\<^sub>v v + B *\<^sub>v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + B) *\<^sub>v v = A *\<^sub>v v + B *\<^sub>v v
[PROOF STEP]
using m
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
B \<in> carrier_mat nr nc
v \<in> carrier_vec nc

goal (1 subgoal):
 1. (A + B) *\<^sub>v v = A *\<^sub>v v + B *\<^sub>v v
[PROOF STEP]
by (intro eq_vecI, auto intro!: add_scalar_prod_distrib)


[STATEMENT]
lemma psums_replicate_0_append:
  "psums (replicate n (0 :: 'a :: monoid_add) @ xs) =
     replicate n 0 @ psums xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. psums (replicate n (0::'a) @ xs) = replicate n (0::'a) @ psums xs
[PROOF STEP]
by (induction n) (simp_all add: psums_Cons op_plus_0)


[STATEMENT]
lemma cmod_diff_squared:
  fixes r1 r2::real
  assumes "r1 \<ge> 0" "r2 \<ge> 0"
  shows "(cmod (r1 * exp (\<i> * \<theta>1) - r2 * exp (\<i> * \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2*r1*r2*cos (\<theta>1 - \<theta>2)" (is "(cmod (?z1 - ?z2))\<^sup>2 = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
have "exp (\<i> * (\<theta>2 + pi)) = - exp (\<i> * \<theta>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (\<i> * complex_of_real (\<theta>2 + pi)) = - exp (\<i> * complex_of_real \<theta>2)
[PROOF STEP]
by (simp add: exp_Euler cos_plus_pi sin_plus_pi)
[PROOF STATE]
proof (state)
this:
exp (\<i> * complex_of_real (\<theta>2 + pi)) = - exp (\<i> * complex_of_real \<theta>2)

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exp (\<i> * complex_of_real (\<theta>2 + pi)) = - exp (\<i> * complex_of_real \<theta>2)
[PROOF STEP]
have "(cmod (?z1 - ?z2))\<^sup>2 = cmod (?z1 + r2 * exp (\<i> * (\<theta>2 + pi))) ^2"
[PROOF STATE]
proof (prove)
using this:
exp (\<i> * complex_of_real (\<theta>2 + pi)) = - exp (\<i> * complex_of_real \<theta>2)

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real (\<theta>2 + pi))))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real (\<theta>2 + pi))))\<^sup>2

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real (\<theta>2 + pi))))\<^sup>2

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
have "\<dots> = r1\<^sup>2 + r2\<^sup>2 + 2*r1*r2*cos (\<theta>1 - (\<theta>2 + pi))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real (\<theta>2 + pi))))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - (\<theta>2 + pi))
[PROOF STEP]
using assms cmod_add_squared
[PROOF STATE]
proof (prove)
using this:
0 \<le> r1
0 \<le> r2
\<lbrakk>0 \<le> ?r1.0; 0 \<le> ?r2.0\<rbrakk> \<Longrightarrow> (cmod (complex_of_real ?r1.0 * exp (\<i> * complex_of_real ?\<theta>1.0) + complex_of_real ?r2.0 * exp (\<i> * complex_of_real ?\<theta>2.0)))\<^sup>2 = ?r1.0\<^sup>2 + ?r2.0\<^sup>2 + 2 * ?r1.0 * ?r2.0 * cos (?\<theta>1.0 - ?\<theta>2.0)

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real (\<theta>2 + pi))))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - (\<theta>2 + pi))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real (\<theta>2 + pi))))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - (\<theta>2 + pi))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) + complex_of_real r2 * exp (\<i> * complex_of_real (\<theta>2 + pi))))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - (\<theta>2 + pi))

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - (\<theta>2 + pi)) = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
by (simp add: add.commute diff_add_eq_diff_diff_swap)
[PROOF STATE]
proof (state)
this:
r1\<^sup>2 + r2\<^sup>2 + 2 * r1 * r2 * cos (\<theta>1 - (\<theta>2 + pi)) = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)

goal (1 subgoal):
 1. (cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real r1 * exp (\<i> * complex_of_real \<theta>1) - complex_of_real r2 * exp (\<i> * complex_of_real \<theta>2)))\<^sup>2 = r1\<^sup>2 + r2\<^sup>2 - 2 * r1 * r2 * cos (\<theta>1 - \<theta>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inorder_node21: "height r > 0 \<Longrightarrow>
  inorder (treeD (node21 l' a r)) = inorder (treeD l') @ a # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height r \<Longrightarrow> inorder (treeD (node21 l' a r)) = inorder (treeD l') @ a # inorder r
[PROOF STEP]
by(induct l' a r rule: node21.induct) auto


[STATEMENT]
lemma is_monomial_set_subset: "is_monomial_set B \<Longrightarrow> A \<subseteq> B \<Longrightarrow> is_monomial_set A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_monomial_set B; A \<subseteq> B\<rbrakk> \<Longrightarrow> is_monomial_set A
[PROOF STEP]
by (auto simp: is_monomial_set_def)


[STATEMENT]
lemma (in abelian_group) a_coset_add_inv1:
     "[| M +> (x \<oplus> (\<ominus> y)) = M;  x \<in> carrier G ; y \<in> carrier G;
         M \<subseteq> carrier G |] ==> M +> x = M +> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M +> x \<oplus> \<ominus> y = M; x \<in> carrier G; y \<in> carrier G; M \<subseteq> carrier G\<rbrakk> \<Longrightarrow> M +> x = M +> y
[PROOF STEP]
by (rule group.coset_mult_inv1 [OF a_group,
    folded a_r_coset_def a_inv_def, simplified monoid_record_simps])


[STATEMENT]
lemma openin_closedin: "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> topspace U \<Longrightarrow> openin U S = closedin U (topspace U - S)
[PROOF STEP]
by (simp add: openin_closedin_eq)


[STATEMENT]
lemma matrix_vector_mult_mono: "(0::real^_^_) \<le> X \<Longrightarrow> 0 \<le> v \<Longrightarrow> X \<le> Y \<Longrightarrow> X *v v \<le> Y *v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> X; 0 \<le> v; X \<le> Y\<rbrakk> \<Longrightarrow> X *v v \<le> Y *v v
[PROOF STEP]
by (metis diff_ge_0_iff_ge matrix_vector_mult_diff_rdistrib nonneg_mat_iff)


[STATEMENT]
lemma count_vec_alt_list: "count_vec v a = length (filter (\<lambda>y. a = y) (list_of_vec v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_vec v a = length (filter ((=) a) (list_of_vec v))
[PROOF STEP]
by (simp add: mset_vec_eq_mset_list) (metis count_mset)


[STATEMENT]
lemma in_mset_imp_in_array:
  "x \<in># (arr_mset arr l r) \<longleftrightarrow> (\<exists>i. bounded l r i \<and> arr i = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in># arr_mset arr l r) = (\<exists>i. bounded l r i \<and> arr i = x)
[PROOF STEP]
unfolding mset_ran_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in># image_mset arr (mset_set {l..<r})) = (\<exists>i. bounded l r i \<and> arr i = x)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma Gcd_abs_eq [simp]:
  "(GCD k\<in>K. \<bar>k\<bar>) = Gcd K"
  for K :: "int set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd (abs ` K) = Gcd K
[PROOF STEP]
by (simp only: Gcd_int_def image_image) simp


[STATEMENT]
lemma zmult_div_plus_abs_ge: "
  \<lbrakk> (0::int) \<le> b; b \<le> b'; 0 \<le> a; 0 < c \<rbrakk> \<Longrightarrow>
  \<bar>a * b div c + a\<bar> \<le> \<bar>a * b' div c + a\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> b; b \<le> b'; 0 \<le> a; 0 < c\<rbrakk> \<Longrightarrow> \<bar>a * b div c + a\<bar> \<le> \<bar>a * b' div c + a\<bar>
[PROOF STEP]
apply (insert zmult_div_plus_ge_0[of b a a c] zmult_div_plus_ge_0[of "b'" a a c], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> b; b \<le> b'; 0 \<le> a; 0 < c; 0 \<le> a * b div c + a; 0 \<le> a * b' div c + a\<rbrakk> \<Longrightarrow> a * b div c \<le> a * b' div c
[PROOF STEP]
by (metis zmult_div_leq_mono)


[STATEMENT]
lemma l2product_rmult:
   "\<lbrakk>f square_integrable S; g square_integrable S\<rbrakk>
    \<Longrightarrow> l2product S f(\<lambda>x. c * g x) = c * l2product S f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f square_integrable S; g square_integrable S\<rbrakk> \<Longrightarrow> l2product S f (\<lambda>x. c * g x) = c * l2product S f g
[PROOF STEP]
by (simp add: l2product_def algebra_simps)


[STATEMENT]
lemma Gamma_of_int: "Gamma (of_int n) = (if n > 0 then fact (nat (n - 1)) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
[PROOF STEP]
proof (cases "n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
 2. \<not> 0 < n \<Longrightarrow> Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
 2. \<not> 0 < n \<Longrightarrow> Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
[PROOF STEP]
hence "Gamma (of_int n) = Gamma (of_nat (Suc (nat (n - 1))))"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. Gamma (of_int n) = Gamma (of_nat (Suc (nat (n - 1))))
[PROOF STEP]
by (subst of_nat_Suc) simp_all
[PROOF STATE]
proof (state)
this:
Gamma (of_int n) = Gamma (of_nat (Suc (nat (n - 1))))

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
 2. \<not> 0 < n \<Longrightarrow> Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
0 < n
Gamma (of_int n) = Gamma (of_nat (Suc (nat (n - 1))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n
Gamma (of_int n) = Gamma (of_nat (Suc (nat (n - 1))))

goal (1 subgoal):
 1. Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
[PROOF STEP]
by (subst (asm) of_nat_Suc, subst (asm) Gamma_fact) simp
[PROOF STATE]
proof (state)
this:
Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> Gamma (of_int n) = (if 0 < n then fact (nat (n - 1)) else (0::'a))
[PROOF STEP]
qed (simp_all add: Gamma_eq_zero_iff nonpos_Ints_of_int)


[STATEMENT]
lemma complex_In_mult_cnj_zero [simp]: "Im (z * cnj z) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (z * cnj z) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma bit_minus_numeral_int [simp]:
  \<open>bit (- numeral (num.Bit0 w) :: int) (numeral n) \<longleftrightarrow> bit (- numeral w :: int) (pred_numeral n)\<close>
  \<open>bit (- numeral (num.Bit1 w) :: int) (numeral n) \<longleftrightarrow> \<not> bit (numeral w :: int) (pred_numeral n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit (- numeral (num.Bit0 w)) (numeral n) = bit (- numeral w) (pred_numeral n) &&& bit (- numeral (num.Bit1 w)) (numeral n) = (\<not> bit (numeral w) (pred_numeral n))
[PROOF STEP]
by (simp_all add: bit_minus_iff bit_not_iff numeral_eq_Suc bit_Suc add_One sub_inc_One_eq)


[STATEMENT]
lemma Lim_cong_within:
  assumes "a = b"
    and "x = y"
    and "S = T"
    and "\<And>x. x \<noteq> b \<Longrightarrow> x \<in> T \<Longrightarrow> f x = g x"
  shows "(f \<longlongrightarrow> x) (at a within S) \<longleftrightarrow> (g \<longlongrightarrow> y) (at b within T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> x) (at a within S) = (g \<longlongrightarrow> y) (at b within T)
[PROOF STEP]
unfolding tendsto_def eventually_at_topological
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>Sa. open Sa \<longrightarrow> x \<in> Sa \<longrightarrow> (\<exists>Sb. open Sb \<and> a \<in> Sb \<and> (\<forall>x\<in>Sb. x \<noteq> a \<longrightarrow> x \<in> S \<longrightarrow> f x \<in> Sa))) = (\<forall>S. open S \<longrightarrow> y \<in> S \<longrightarrow> (\<exists>Sa. open Sa \<and> b \<in> Sa \<and> (\<forall>x\<in>Sa. x \<noteq> b \<longrightarrow> x \<in> T \<longrightarrow> g x \<in> S)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a = b
x = y
S = T
\<lbrakk>?x \<noteq> b; ?x \<in> T\<rbrakk> \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. (\<forall>Sa. open Sa \<longrightarrow> x \<in> Sa \<longrightarrow> (\<exists>Sb. open Sb \<and> a \<in> Sb \<and> (\<forall>x\<in>Sb. x \<noteq> a \<longrightarrow> x \<in> S \<longrightarrow> f x \<in> Sa))) = (\<forall>S. open S \<longrightarrow> y \<in> S \<longrightarrow> (\<exists>Sa. open Sa \<and> b \<in> Sa \<and> (\<forall>x\<in>Sa. x \<noteq> b \<longrightarrow> x \<in> T \<longrightarrow> g x \<in> S)))
[PROOF STEP]
by simp