[STATEMENT]
lemma height_bal_subtrees_merge: "\<lbrakk>height (Node as a) = height (Node bs b); bal (Node as a); bal (Node bs b)\<rbrakk>
 \<Longrightarrow> \<forall>x \<in> set (subtrees as) \<union> {a}. height x = height b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>height (Node as a) = height (Node bs b); bal (Node as a); bal (Node bs b)\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (subtrees as) \<union> {a}. height x = height b
[PROOF STEP]
by (metis Suc_inject Un_iff bal.simps(2) height_bal_tree singletonD)


[STATEMENT]
lemma prod_list_eval:
  fixes f :: "'a \<Rightarrow> 'b::{ring,semiring_1,comm_monoid_mult}"
  shows "prod_list (map f xs) = (\<Prod>x \<in> set xs. (f x)^(count_list xs x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map f xs) = (\<Prod>x\<in>set xs. f x ^ count_list xs x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod_list (map f xs) = (\<Prod>x\<in>set xs. f x ^ count_list xs x)
[PROOF STEP]
define M where "M = mset xs"
[PROOF STATE]
proof (state)
this:
M = mset xs

goal (1 subgoal):
 1. prod_list (map f xs) = (\<Prod>x\<in>set xs. f x ^ count_list xs x)
[PROOF STEP]
have "prod_mset (image_mset f M) = (\<Prod>x \<in> set_mset M. f x ^ (count M x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x)
[PROOF STEP]
proof (induction "M" rule:disj_induct_mset)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Prod>\<^sub># (image_mset f {#}) = (\<Prod>x\<in>set_mset {#}. f x ^ count {#} x)
 2. \<And>n M x. \<lbrakk>\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x); x \<notin># M; 0 < n\<rbrakk> \<Longrightarrow> \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<Prod>\<^sub># (image_mset f {#}) = (\<Prod>x\<in>set_mset {#}. f x ^ count {#} x)
 2. \<And>n M x. \<lbrakk>\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x); x \<notin># M; 0 < n\<rbrakk> \<Longrightarrow> \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>\<^sub># (image_mset f {#}) = (\<Prod>x\<in>set_mset {#}. f x ^ count {#} x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Prod>\<^sub># (image_mset f {#}) = (\<Prod>x\<in>set_mset {#}. f x ^ count {#} x)

goal (1 subgoal):
 1. \<And>n M x. \<lbrakk>\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x); x \<notin># M; 0 < n\<rbrakk> \<Longrightarrow> \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n M x. \<lbrakk>\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x); x \<notin># M; 0 < n\<rbrakk> \<Longrightarrow> \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
case (2 n M x)
[PROOF STATE]
proof (state)
this:
\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x)
x \<notin># M
0 < n

goal (1 subgoal):
 1. \<And>n M x. \<lbrakk>\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x); x \<notin># M; 0 < n\<rbrakk> \<Longrightarrow> \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
have a:"\<And>y. y \<in> set_mset M \<Longrightarrow> y \<noteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in># M \<Longrightarrow> y \<noteq> x
[PROOF STEP]
using 2(2)
[PROOF STATE]
proof (prove)
using this:
x \<notin># M

goal (1 subgoal):
 1. \<And>y. y \<in># M \<Longrightarrow> y \<noteq> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?y \<in># M \<Longrightarrow> ?y \<noteq> x

goal (1 subgoal):
 1. \<And>n M x. \<lbrakk>\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x); x \<notin># M; 0 < n\<rbrakk> \<Longrightarrow> \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
have b:"count M x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count M x = 0
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x)
x \<notin># M
0 < n

goal (1 subgoal):
 1. count M x = 0
[PROOF STEP]
by (subst  count_eq_zero_iff) blast
[PROOF STATE]
proof (state)
this:
count M x = 0

goal (1 subgoal):
 1. \<And>n M x. \<lbrakk>\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x); x \<notin># M; 0 < n\<rbrakk> \<Longrightarrow> \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x)
x \<notin># M
0 < n

goal (1 subgoal):
 1. \<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)
[PROOF STEP]
by (simp add:a b mult.commute)
[PROOF STATE]
proof (state)
this:
\<Prod>\<^sub># (image_mset f (M + replicate_mset n x)) = (\<Prod>xa\<in>set_mset (M + replicate_mset n x). f xa ^ count (M + replicate_mset n x) xa)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x)

goal (1 subgoal):
 1. prod_list (map f xs) = (\<Prod>x\<in>set xs. f x ^ count_list xs x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x)

goal (1 subgoal):
 1. prod_list (map f xs) = (\<Prod>x\<in>set xs. f x ^ count_list xs x)
[PROOF STEP]
have "\<And>x. count_list xs x = count (mset xs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. count_list xs x = count (mset xs) x
[PROOF STEP]
by (induction xs, simp, simp)
[PROOF STATE]
proof (state)
this:
count_list xs ?x = count (mset xs) ?x

goal (1 subgoal):
 1. prod_list (map f xs) = (\<Prod>x\<in>set xs. f x ^ count_list xs x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x)
count_list xs ?x = count (mset xs) ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Prod>\<^sub># (image_mset f M) = (\<Prod>x\<in>set_mset M. f x ^ count M x)
count_list xs ?x = count (mset xs) ?x

goal (1 subgoal):
 1. prod_list (map f xs) = (\<Prod>x\<in>set xs. f x ^ count_list xs x)
[PROOF STEP]
by (simp add:M_def prod_mset_prod_list[symmetric])
[PROOF STATE]
proof (state)
this:
prod_list (map f xs) = (\<Prod>x\<in>set xs. f x ^ count_list xs x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size1_height: "size1 t \<le> 2 ^ height (t::'a tree)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 t \<le> 2 ^ height t
[PROOF STEP]
proof(induction t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. size1 \<langle>\<rangle> \<le> 2 ^ height \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>size1 t1 \<le> 2 ^ height t1; size1 t2 \<le> 2 ^ height t2\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> \<le> 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
case (Node l a r)
[PROOF STATE]
proof (state)
this:
size1 l \<le> 2 ^ height l
size1 r \<le> 2 ^ height r

goal (2 subgoals):
 1. size1 \<langle>\<rangle> \<le> 2 ^ height \<langle>\<rangle>
 2. \<And>t1 x2 t2. \<lbrakk>size1 t1 \<le> 2 ^ height t1; size1 t2 \<le> 2 ^ height t2\<rbrakk> \<Longrightarrow> size1 \<langle>t1, x2, t2\<rangle> \<le> 2 ^ height \<langle>t1, x2, t2\<rangle>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
proof (cases "height l \<le> height r")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
height l \<le> height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
have "size1(Node l a r) = size1 l + size1 r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 \<langle>l, a, r\<rangle> = size1 l + size1 r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size1 \<langle>l, a, r\<rangle> = size1 l + size1 r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size1 \<langle>l, a, r\<rangle> = size1 l + size1 r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
have "\<dots> \<le> 2 ^ height l + 2 ^ height r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 l + size1 r \<le> 2 ^ height l + 2 ^ height r
[PROOF STEP]
using Node.IH
[PROOF STATE]
proof (prove)
using this:
size1 l \<le> 2 ^ height l
size1 r \<le> 2 ^ height r

goal (1 subgoal):
 1. size1 l + size1 r \<le> 2 ^ height l + 2 ^ height r
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
size1 l + size1 r \<le> 2 ^ height l + 2 ^ height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size1 l + size1 r \<le> 2 ^ height l + 2 ^ height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
have "\<dots> \<le> 2 ^ height r + 2 ^ height r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ height l + 2 ^ height r \<le> 2 ^ height r + 2 ^ height r
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
height l \<le> height r

goal (1 subgoal):
 1. 2 ^ height l + 2 ^ height r \<le> 2 ^ height r + 2 ^ height r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ height l + 2 ^ height r \<le> 2 ^ height r + 2 ^ height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ height l + 2 ^ height r \<le> 2 ^ height r + 2 ^ height r

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
have "\<dots> = 2 ^ height (Node l a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ height r + 2 ^ height r = 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
height l \<le> height r

goal (1 subgoal):
 1. 2 ^ height r + 2 ^ height r = 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
by (auto simp: max_def mult_2)
[PROOF STATE]
proof (state)
this:
2 ^ height r + 2 ^ height r = 2 ^ height \<langle>l, a, r\<rangle>

goal (2 subgoals):
 1. height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
 2. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>

goal (1 subgoal):
 1. size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> height l \<le> height r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
have "size1(Node l a r) = size1 l + size1 r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 \<langle>l, a, r\<rangle> = size1 l + size1 r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size1 \<langle>l, a, r\<rangle> = size1 l + size1 r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size1 \<langle>l, a, r\<rangle> = size1 l + size1 r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
have "\<dots> \<le> 2 ^ height l + 2 ^ height r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size1 l + size1 r \<le> 2 ^ height l + 2 ^ height r
[PROOF STEP]
using Node.IH
[PROOF STATE]
proof (prove)
using this:
size1 l \<le> 2 ^ height l
size1 r \<le> 2 ^ height r

goal (1 subgoal):
 1. size1 l + size1 r \<le> 2 ^ height l + 2 ^ height r
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
size1 l + size1 r \<le> 2 ^ height l + 2 ^ height r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size1 l + size1 r \<le> 2 ^ height l + 2 ^ height r

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
have "\<dots> \<le> 2 ^ height l + 2 ^ height l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ height l + 2 ^ height r \<le> 2 ^ height l + 2 ^ height l
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> height l \<le> height r

goal (1 subgoal):
 1. 2 ^ height l + 2 ^ height r \<le> 2 ^ height l + 2 ^ height l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ height l + 2 ^ height r \<le> 2 ^ height l + 2 ^ height l

goal (1 subgoal):
 1. \<not> height l \<le> height r \<Longrightarrow> size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height l + 2 ^ height l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height l + 2 ^ height l

goal (1 subgoal):
 1. size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height l + 2 ^ height l
\<not> height l \<le> height r

goal (1 subgoal):
 1. size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>
[PROOF STEP]
by (auto simp: max_def mult_2)
[PROOF STATE]
proof (state)
this:
size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
size1 \<langle>l, a, r\<rangle> \<le> 2 ^ height \<langle>l, a, r\<rangle>

goal (1 subgoal):
 1. size1 \<langle>\<rangle> \<le> 2 ^ height \<langle>\<rangle>
[PROOF STEP]
qed simp


[STATEMENT]
lemma index_states_uint64_language :
  assumes "size M < 2^64"
 shows  "L (index_states_uint64 M) = L M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (index_states_uint64 M) = L M
[PROOF STEP]
using rename_states_isomorphism_language[of "uint64_of_nat \<circ> assign_indices (states M)" M, OF assign_indices_uint64_bij_betw[OF assms]]
[PROOF STATE]
proof (prove)
using this:
L (FSM.rename_states M (uint64_of_nat \<circ> assign_indices (FSM.states M))) = L M

goal (1 subgoal):
 1. L (index_states_uint64 M) = L M
[PROOF STEP]
by auto


[STATEMENT]
lemma icard_insert: "icard (insert x A) = eSuc (icard (A - {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard (insert x A) = eSuc (icard (A - {x}))
[PROOF STEP]
by (metis icard_Diff_singleton_if icard_Suc_Diff1 icard_insert_disjoint insert_absorb)


[STATEMENT]
lemma is_interval_connected_1:
  fixes S :: "real set"
  shows "is_interval S \<longleftrightarrow> connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_interval S = connected S
[PROOF STEP]
by (meson connected_iff_interval is_interval_1)


[STATEMENT]
lemma arctan_eq_iff: "arctan x = arctan y \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arctan x = arctan y) = (x = y)
[PROOF STEP]
by (simp only: eq_iff [where 'a=real] arctan_le_iff)


[STATEMENT]
lemma scaleR_mtx_vec_assoc: "(c *\<^sub>R A) *\<^sub>V x = c *\<^sub>R (A *\<^sub>V x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c *\<^sub>R A) *\<^sub>V x = c *\<^sub>R A *\<^sub>V x
[PROOF STEP]
unfolding scaleR_sq_mtx_def sq_mtx_vec_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_fun to_vec id (*v) (map_fun id (map_fun to_vec to_mtx) (*\<^sub>R) c A) x = c *\<^sub>R map_fun to_vec id (*v) A x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c *\<^sub>R to_vec A *v x = c *\<^sub>R (to_vec A *v x)
[PROOF STEP]
by (simp add: scaleR_matrix_vector_assoc)


[STATEMENT]
lemma ennreal_SUP_eq_top:
  fixes f :: "'a \<Rightarrow> ennreal"
  assumes "\<And>n. \<exists>i\<in>I. of_nat n \<le> f i"
  shows "(SUP i \<in> I. f i) = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (f ` I) = top
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup (f ` I) = top
[PROOF STEP]
have "(SUP x. of_nat x :: ennreal) \<le> (SUP i \<in> I. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (range of_nat) \<le> Sup (f ` I)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>i\<in>I. of_nat ?n \<le> f i

goal (1 subgoal):
 1. Sup (range of_nat) \<le> Sup (f ` I)
[PROOF STEP]
by (auto intro!: SUP_least intro: SUP_upper2)
[PROOF STATE]
proof (state)
this:
Sup (range of_nat) \<le> Sup (f ` I)

goal (1 subgoal):
 1. Sup (f ` I) = top
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup (range of_nat) \<le> Sup (f ` I)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sup (range of_nat) \<le> Sup (f ` I)

goal (1 subgoal):
 1. Sup (f ` I) = top
[PROOF STEP]
by (auto simp: ennreal_SUP_of_nat_eq_top top_unique)
[PROOF STATE]
proof (state)
this:
Sup (f ` I) = top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "(P \<longrightarrow> Q)  =  (\<not>Q \<longrightarrow> \<not>P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<longrightarrow> Q) = (\<not> Q \<longrightarrow> \<not> P)
[PROOF STEP]
by blast


[STATEMENT]
lemma NSLIMSEQ_abs_realpow_zero: "\<bar>c\<bar> < 1 \<Longrightarrow> (\<lambda>n. \<bar>c\<bar> ^ n) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0"
  for c :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>c\<bar> < 1 \<Longrightarrow> (^) \<bar>c\<bar> \<longlonglongrightarrow>\<^sub>N\<^sub>S 0
[PROOF STEP]
by (simp add: LIMSEQ_abs_realpow_zero LIMSEQ_NSLIMSEQ_iff [symmetric])


[STATEMENT]
lemma yun_wrel_minus: assumes "yun_wrel F c f" "yun_wrel G c g"
  shows "yun_wrel (F - G) c (f - g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. yun_wrel (F - G) c (f - g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
yun_wrel F c f
yun_wrel G c g

goal (1 subgoal):
 1. yun_wrel (F - G) c (f - g)
[PROOF STEP]
unfolding yun_wrel_def
[PROOF STATE]
proof (prove)
using this:
of_int_poly F = Polynomial.smult c f
of_int_poly G = Polynomial.smult c g

goal (1 subgoal):
 1. of_int_poly (F - G) = Polynomial.smult c (f - g)
[PROOF STEP]
by (auto simp: smult_diff_right hom_distribs)


[STATEMENT]
lemma two_div_sqr_of_cmd_sqrt_two [simp]:
  shows "2 * (cmod (1 / complex_of_real (sqrt 2)))\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (cmod (1 / complex_of_real (sqrt 2)))\<^sup>2 = 1
[PROOF STEP]
using cmod_def
[PROOF STATE]
proof (prove)
using this:
cmod ?z = sqrt ((Re ?z)\<^sup>2 + (Im ?z)\<^sup>2)

goal (1 subgoal):
 1. 2 * (cmod (1 / complex_of_real (sqrt 2)))\<^sup>2 = 1
[PROOF STEP]
by (simp add: power_divide)


[STATEMENT]
lemma subdegree_div:
  fixes     p q :: "'a :: field fps"
  assumes   "q dvd p"
  shows     "subdegree (p div q) = subdegree p - subdegree q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subdegree (p / q) = subdegree p - subdegree q
[PROOF STEP]
using     assms
[PROOF STATE]
proof (prove)
using this:
q dvd p

goal (1 subgoal):
 1. subdegree (p / q) = subdegree p - subdegree q
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. p = q * k

goal (1 subgoal):
 1. subdegree (p / q) = subdegree p - subdegree q
[PROOF STEP]
by        (auto intro: subdegree_div')


[STATEMENT]
lemma Imam_calc_i_0: "$(I^{m}a)^{m}_n = (n*m+1)*n / (2*m)" if "i = 0" "m \<noteq> 0" for n m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
have "$(I^{m}a)^{m}_n = (\<Sum>k<n*m. $v.^((k+1)/m) * (k+1) / m^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real (k + 1) / real (m\<^sup>2))
[PROOF STEP]
by (subst Imam_calc_aux, simp_all add: that)
[PROOF STATE]
proof (state)
this:
$(I^{m}a)^{m}_n = (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real (k + 1) / real (m\<^sup>2))

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
$(I^{m}a)^{m}_n = (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real (k + 1) / real (m\<^sup>2))

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
have "\<dots> = (\<Sum>k<n*m. k+1) / m^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real (k + 1) / real (m\<^sup>2)) = real (\<Sum>k<n * m. k + 1) / real (m\<^sup>2)
[PROOF STEP]
apply (subst v_1_iff_i_0[THEN iffD2], simp_all add: that)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + real k) / (real m)\<^sup>2) = (\<Sum>x<n * m. 1 + real x) / (real m)\<^sup>2
[PROOF STEP]
by (subst sum_divide_distrib[THEN sym], simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real (k + 1) / real (m\<^sup>2)) = real (\<Sum>k<n * m. k + 1) / real (m\<^sup>2)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n * m. $v .^ (real (k + 1) / real m) * real (k + 1) / real (m\<^sup>2)) = real (\<Sum>k<n * m. k + 1) / real (m\<^sup>2)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
have "\<dots> = (n*m*(n*m+1) div 2) / m^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum>k<n * m. k + 1) / real (m\<^sup>2) = real (n * m * (n * m + 1) div 2) / real (m\<^sup>2)
[PROOF STEP]
apply (subst Suc_eq_plus1[THEN sym], subst sum_bounds_lt_plus1[of id, simplified])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Sum> {Suc 0..n * m}) / real (m\<^sup>2) = real (n * m * (n * m + 1) div 2) / real (m\<^sup>2)
[PROOF STEP]
by (subst Sum_Icc_nat, simp)
[PROOF STATE]
proof (state)
this:
real (\<Sum>k<n * m. k + 1) / real (m\<^sup>2) = real (n * m * (n * m + 1) div 2) / real (m\<^sup>2)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (\<Sum>k<n * m. k + 1) / real (m\<^sup>2) = real (n * m * (n * m + 1) div 2) / real (m\<^sup>2)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
have "\<dots> = (n*m+1)*n / (2*m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (n * m * (n * m + 1) div 2) / real (m\<^sup>2) = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
apply (subst real_of_nat_div, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (n * m * (n * m + 1)) / real 2 / real (m\<^sup>2) = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i = 0
m \<noteq> 0

goal (1 subgoal):
 1. real (n * m * (n * m + 1)) / real 2 / real (m\<^sup>2) = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
by (subst power2_eq_square, simp add: field_simps)
[PROOF STATE]
proof (state)
this:
real (n * m * (n * m + 1) div 2) / real (m\<^sup>2) = real ((n * m + 1) * n) / real (2 * m)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
$(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
$(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
$(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wilson_theorem:
  assumes "prime p"
  shows "[fact (p - 1) = - 1] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
proof (cases "p = 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 2 \<Longrightarrow> [fact (p - 1) = - 1] (mod int p)
 2. p \<noteq> 2 \<Longrightarrow> [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 2

goal (2 subgoals):
 1. p = 2 \<Longrightarrow> [fact (p - 1) = - 1] (mod int p)
 2. p \<noteq> 2 \<Longrightarrow> [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 2

goal (1 subgoal):
 1. [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
by (simp add: cong_def fact_prod)
[PROOF STATE]
proof (state)
this:
[fact (p - 1) = - 1] (mod int p)

goal (1 subgoal):
 1. p \<noteq> 2 \<Longrightarrow> [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 2 \<Longrightarrow> [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 2

goal (1 subgoal):
 1. p \<noteq> 2 \<Longrightarrow> [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 2

goal (1 subgoal):
 1. [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
using assms prime_ge_2_nat
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 2
prime p
prime ?p \<Longrightarrow> 2 \<le> ?p

goal (1 subgoal):
 1. [fact (p - 1) = - 1] (mod int p)
[PROOF STEP]
by (metis residues_prime.wilson_theorem1 residues_prime.intro le_eq_less_or_eq)
[PROOF STATE]
proof (state)
this:
[fact (p - 1) = - 1] (mod int p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_wrt_dist_take_drop:
  assumes "sorted_wrt_dist p ps"
  shows "\<forall>p\<^sub>0 \<in> set (take n ps). \<forall>p\<^sub>1 \<in> set (drop n ps). dist p\<^sub>0 p \<le> dist p\<^sub>1 p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<^sub>0\<in>set (take n ps). \<forall>p\<^sub>1\<in>set (drop n ps). dist p\<^sub>0 p \<le> dist p\<^sub>1 p
[PROOF STEP]
using assms sorted_wrt_append[of _ "take n ps" "drop n ps"]
[PROOF STATE]
proof (prove)
using this:
sorted_wrt_dist p ps
sorted_wrt ?P (take n ps @ drop n ps) = (sorted_wrt ?P (take n ps) \<and> sorted_wrt ?P (drop n ps) \<and> (\<forall>x\<in>set (take n ps). \<forall>y\<in>set (drop n ps). ?P x y))

goal (1 subgoal):
 1. \<forall>p\<^sub>0\<in>set (take n ps). \<forall>p\<^sub>1\<in>set (drop n ps). dist p\<^sub>0 p \<le> dist p\<^sub>1 p
[PROOF STEP]
by (simp add: sorted_wrt_dist_def)


[STATEMENT]
lemma adjoint_eval:
  assumes "i < dim_col A" "j < dim_row A"
  shows "(adjoint A) $$ (i,j) = conjugate (A $$ (j,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint A $$ (i, j) = conjugate (A $$ (j, i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_col A
j < dim_row A

goal (1 subgoal):
 1. adjoint A $$ (i, j) = conjugate (A $$ (j, i))
[PROOF STEP]
by (simp add: adjoint_def)


[STATEMENT]
lemma div_is_floor_divide_real: "n div y = \<lfloor>real_of_int n / of_int y\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div y = \<lfloor>real_of_int n / real_of_int y\<rfloor>
[PROOF STEP]
unfolding div_is_floor_divide_rat[of n y]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>rat_of_int n / rat_of_int y\<rfloor> = \<lfloor>real_of_int n / real_of_int y\<rfloor>
[PROOF STEP]
by (metis Ratreal_def of_rat_divide of_rat_of_int_eq real_floor_code)


[STATEMENT]
lemma eventually_le_abs_nonpos:
  "eventually (\<lambda>x. u x \<le> 0) at_top \<Longrightarrow> eventually (\<lambda>x. f x \<le> u x) at_top \<Longrightarrow>
     eventually (\<lambda>x::real. -u x \<le> (\<bar>f x\<bar> :: real)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in at_top. u x \<le> 0; \<forall>\<^sub>F x in at_top. f x \<le> u x\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. - u x \<le> \<bar>f x\<bar>
[PROOF STEP]
by (auto elim: eventually_elim2)


[STATEMENT]
lemma signof_compose:
  assumes "p permutes {0..<(n :: nat)}"
  and "q permutes {0 ..<(m :: nat)}"
  shows "signof (p o q) = signof p * signof q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (p \<circ> q)) = of_int (sign p) * of_int (sign q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (sign (p \<circ> q)) = of_int (sign p) * of_int (sign q)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p permutes {0..<n}
q permutes {0..<m}
[PROOF STEP]
have pp: "permutation p" "permutation q"
[PROOF STATE]
proof (prove)
using this:
p permutes {0..<n}
q permutes {0..<m}

goal (1 subgoal):
 1. permutation p &&& permutation q
[PROOF STEP]
by (auto simp: permutation_permutes)
[PROOF STATE]
proof (state)
this:
permutation p
permutation q

goal (1 subgoal):
 1. of_int (sign (p \<circ> q)) = of_int (sign p) * of_int (sign q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
permutation p
permutation q
[PROOF STEP]
show "signof (p o q) = signof p * signof q"
[PROOF STATE]
proof (prove)
using this:
permutation p
permutation q

goal (1 subgoal):
 1. of_int (sign (p \<circ> q)) = of_int (sign p) * of_int (sign q)
[PROOF STEP]
by (simp add: sign_compose)
[PROOF STATE]
proof (state)
this:
of_int (sign (p \<circ> q)) = of_int (sign p) * of_int (sign q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma content_ff_smult: "content_ff (smult (a::'a::ufd fract) p) =dff a * content_ff p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content_ff (smult a p) =dff a * content_ff p
[PROOF STEP]
proof (cases "a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
 2. a \<noteq> 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
 2. a \<noteq> 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
[PROOF STEP]
note a = this
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
 2. a \<noteq> 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
[PROOF STEP]
have id: "coeffs (smult a p) = map ((*) a) (coeffs p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeffs (smult a p) = map ((*) a) (coeffs p)
[PROOF STEP]
unfolding coeffs_smult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if a = 0 then [] else map ((*) a) (coeffs p)) = map ((*) a) (coeffs p)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. (if a = 0 then [] else map ((*) a) (coeffs p)) = map ((*) a) (coeffs p)
[PROOF STEP]
by (simp add: Polynomial.coeffs_smult)
[PROOF STATE]
proof (state)
this:
coeffs (smult a p) = map ((*) a) (coeffs p)

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
 2. a \<noteq> 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content_ff (smult a p) =dff a * content_ff p
[PROOF STEP]
unfolding content_ff_def id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. some_gcd_ff_list (map ((*) a) (coeffs p)) =dff a * some_gcd_ff_list (coeffs p)
[PROOF STEP]
using some_gcd_ff_list_smult[OF a]
[PROOF STATE]
proof (prove)
using this:
some_gcd_ff_list (map ((*) a) ?xs) =dff a * some_gcd_ff_list ?xs

goal (1 subgoal):
 1. some_gcd_ff_list (map ((*) a) (coeffs p)) =dff a * some_gcd_ff_list (coeffs p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
content_ff (smult a p) =dff a * content_ff p

goal (1 subgoal):
 1. a = 0 \<Longrightarrow> content_ff (smult a p) =dff a * content_ff p
[PROOF STEP]
qed simp


[STATEMENT]
theorem Pluennecke_Ruzsa_ineq:
  assumes K:  "card (sumset A B) \<le> K * real (card A)"
    and   A: "finite A" "A \<subseteq> G" "A \<noteq> {}"
    and   B: "finite B" "B \<subseteq> G"
    and "0 < r" "0 < s"
  shows "card (differenceset (sumset_iterated B r) (sumset_iterated B s)) \<le> K^(r+s) * real(card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
have "card A > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card A
[PROOF STEP]
by (simp add: A card_gt_0_iff)
[PROOF STATE]
proof (state)
this:
0 < card A

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
with K
[PROOF STATE]
proof (chain)
picking this:
real (card (sumset A B)) \<le> K * real (card A)
0 < card A
[PROOF STEP]
have "K \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
real (card (sumset A B)) \<le> K * real (card A)
0 < card A

goal (1 subgoal):
 1. 0 \<le> K
[PROOF STEP]
by (smt (verit, del_insts) of_nat_0_less_iff of_nat_less_0_iff zero_le_mult_iff)
[PROOF STATE]
proof (state)
this:
0 \<le> K

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
obtain A' where A': "A' \<subseteq> A" "A' \<noteq> {}"
    and A'_le: "\<And>r. card (sumset A' (sumset_iterated B r)) \<le> K^r * real (card A')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; A' \<noteq> {}; \<And>r. real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using  Cor_Plu_2_3 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>real (card (sumset ?A ?B)) \<le> ?K * real (card ?A); finite ?A; ?A \<subseteq> G; ?A \<noteq> {}; finite ?B; ?B \<subseteq> G; \<And>A'. \<lbrakk>A' \<subseteq> ?A; A' \<noteq> {}; \<And>r. real (card (sumset A' (sumset_iterated ?B r))) \<le> ?K ^ r * real (card A')\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
real (card (sumset A B)) \<le> K * real (card A)
finite A
A \<subseteq> G
A \<noteq> {}
finite B
B \<subseteq> G
0 < r
0 < s

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; A' \<noteq> {}; \<And>r. real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
A' \<subseteq> A
A' \<noteq> {}
real (card (sumset A' (sumset_iterated B ?r))) \<le> K ^ ?r * real (card A')

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
define C where "C \<equiv> minusset A'"
[PROOF STATE]
proof (state)
this:
C \<equiv> minusset A'

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
have "minusset C = A'" and "C \<noteq>{}" and cardA: "card A' \<le> card A" and cardC: "card C = card A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (minusset C = A' &&& C \<noteq> {}) &&& card A' \<le> card A &&& card C = card A'
[PROOF STEP]
using A' A card_mono
[PROOF STATE]
proof (prove)
using this:
A' \<subseteq> A
A' \<noteq> {}
finite A
A \<subseteq> G
A \<noteq> {}
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B

goal (1 subgoal):
 1. (minusset C = A' &&& C \<noteq> {}) &&& card A' \<le> card A &&& card C = card A'
[PROOF STEP]
by (auto simp: C_def card_minusset' Int_absorb2)
[PROOF STATE]
proof (state)
this:
minusset C = A'
C \<noteq> {}
card A' \<le> card A
card C = card A'

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
minusset C = A'
C \<noteq> {}
card A' \<le> card A
card C = card A'
[PROOF STEP]
have cardCA: "card C \<le> card A"
[PROOF STATE]
proof (prove)
using this:
minusset C = A'
C \<noteq> {}
card A' \<le> card A
card C = card A'

goal (1 subgoal):
 1. card C \<le> card A
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
card C \<le> card A

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
have "\<And>r. card (differenceset C (sumset_iterated B r)) \<le> K^r * real (card A')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r. real (card (differenceset C (sumset_iterated B r))) \<le> K ^ r * real (card A')
[PROOF STEP]
using A'_le C_def card_minusset' diff_minus_set sumset_subset_carrier
[PROOF STATE]
proof (prove)
using this:
real (card (sumset A' (sumset_iterated B ?r))) \<le> K ^ ?r * real (card A')
C \<equiv> minusset A'
?A \<subseteq> G \<Longrightarrow> card (minusset ?A) = card ?A
differenceset (minusset ?A) ?B = minusset (sumset ?A ?B)
sumset ?A ?B \<subseteq> G

goal (1 subgoal):
 1. \<And>r. real (card (differenceset C (sumset_iterated B r))) \<le> K ^ r * real (card A')
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
real (card (differenceset C (sumset_iterated B ?r))) \<le> K ^ ?r * real (card A')

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card (differenceset C (sumset_iterated B ?r))) \<le> K ^ ?r * real (card A')
[PROOF STEP]
have r: "card (differenceset C (sumset_iterated B r)) \<le> K^r * real (card C)"
    and  s: "card (differenceset C (sumset_iterated B s)) \<le> K^s * real (card C)"
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset C (sumset_iterated B ?r))) \<le> K ^ ?r * real (card A')

goal (1 subgoal):
 1. real (card (differenceset C (sumset_iterated B r))) \<le> K ^ r * real (card C) &&& real (card (differenceset C (sumset_iterated B s))) \<le> K ^ s * real (card C)
[PROOF STEP]
using cardC
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset C (sumset_iterated B ?r))) \<le> K ^ ?r * real (card A')
card C = card A'

goal (1 subgoal):
 1. real (card (differenceset C (sumset_iterated B r))) \<le> K ^ r * real (card C) &&& real (card (differenceset C (sumset_iterated B s))) \<le> K ^ s * real (card C)
[PROOF STEP]
by presburger+
[PROOF STATE]
proof (state)
this:
real (card (differenceset C (sumset_iterated B r))) \<le> K ^ r * real (card C)
real (card (differenceset C (sumset_iterated B s))) \<le> K ^ s * real (card C)

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
have "card C > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card C
[PROOF STEP]
by (metis A' \<open>finite A\<close> cardC card_gt_0_iff finite_subset)
[PROOF STATE]
proof (state)
this:
0 < card C

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < card C

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
have "C \<subseteq> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<subseteq> G
[PROOF STEP]
by (simp add: C_def minusset_subset_carrier)
[PROOF STATE]
proof (state)
this:
C \<subseteq> G

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < card C
C \<subseteq> G
[PROOF STEP]
have "card C * card (differenceset (sumset_iterated B r) (sumset_iterated B s))
        \<le> card (differenceset C (sumset_iterated B r)) *
           card (differenceset C (sumset_iterated B s))"
[PROOF STATE]
proof (prove)
using this:
0 < card C
C \<subseteq> G

goal (1 subgoal):
 1. card C * card (differenceset (sumset_iterated B r) (sumset_iterated B s)) \<le> card (differenceset C (sumset_iterated B r)) * card (differenceset C (sumset_iterated B s))
[PROOF STEP]
by (meson Ruzsa_triangle_ineq1 B card_gt_0_iff finite_sumset_iterated sumset_iterated_subset_carrier)
[PROOF STATE]
proof (state)
this:
card C * card (differenceset (sumset_iterated B r) (sumset_iterated B s)) \<le> card (differenceset C (sumset_iterated B r)) * card (differenceset C (sumset_iterated B s))

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card C * card (differenceset (sumset_iterated B r) (sumset_iterated B s)) \<le> card (differenceset C (sumset_iterated B r)) * card (differenceset C (sumset_iterated B s))

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
have "\<dots> \<le> K^(r+s) * card C * card C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (differenceset C (sumset_iterated B r)) * card (differenceset C (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C) * real (card C)
[PROOF STEP]
using mult_mono [OF r s] \<open>0 \<le> K\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> K ^ r * real (card C); 0 \<le> real (card (differenceset C (sumset_iterated B s)))\<rbrakk> \<Longrightarrow> real (card (differenceset C (sumset_iterated B r))) * real (card (differenceset C (sumset_iterated B s))) \<le> K ^ r * real (card C) * (K ^ s * real (card C))
0 \<le> K

goal (1 subgoal):
 1. real (card (differenceset C (sumset_iterated B r)) * card (differenceset C (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C) * real (card C)
[PROOF STEP]
by (simp add: power_add field_simps)
[PROOF STATE]
proof (state)
this:
real (card (differenceset C (sumset_iterated B r)) * card (differenceset C (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C) * real (card C)

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card C * card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C) * real (card C)
[PROOF STEP]
have "card (differenceset (sumset_iterated B r) (sumset_iterated B s)) \<le> K^(r+s) * card C"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card C * card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C) * real (card C)

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C)
[PROOF STEP]
using \<open>card C > 0\<close>
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (card C * card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C) * real (card C)
0 < card C

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C)

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card C)

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
by (smt (verit, ccfv_SIG) \<open>0 \<le> K\<close> cardA cardC mult_left_mono of_nat_mono zero_le_power)
[PROOF STATE]
proof (state)
this:
real (card (differenceset (sumset_iterated B r) (sumset_iterated B s))) \<le> K ^ (r + s) * real (card A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hnorm_minus_commute: "\<And>a b::'a::real_normed_vector star. hnorm (a - b) = hnorm (b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. hnorm (a - b) = hnorm (b - a)
[PROOF STEP]
by transfer (rule norm_minus_commute)


[STATEMENT]
lemma iT_Div_icard_inj_on: "inj_on (\<lambda>n. n div k) I \<Longrightarrow> icard (I \<oslash> k) = icard I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>n. n div k) I \<Longrightarrow> icard (I \<oslash> k) = icard I
[PROOF STEP]
by (simp add: iT_Div_def icard_image)


[STATEMENT]
lemma linorder_linorder_of_list [intro, simp]:
  assumes "distinct xs"
  shows   "linorder_on (set xs) (linorder_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_on (set xs) (linorder_of_list xs)
[PROOF STEP]
unfolding linorder_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. refl_on (set xs) (linorder_of_list xs) \<and> antisym (linorder_of_list xs) \<and> trans (linorder_of_list xs) \<and> total_on (set xs) (linorder_of_list xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. refl_on (set xs) (linorder_of_list xs) \<and> antisym (linorder_of_list xs) \<and> trans (linorder_of_list xs) \<and> total_on (set xs) (linorder_of_list xs)
[PROOF STEP]
by (auto simp: refl_on_def antisym_def trans_def total_on_def linorder_of_list_def)


[STATEMENT]
lemma setsum_add_nat_ivl2: "n \<le> p  \<Longrightarrow>
  sum f {..<n} + sum f {n..p} = sum f {..p::nat}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> p \<Longrightarrow> sum f {..<n} + sum f {n..p} = sum f {..p}
[PROOF STEP]
apply(subst sum.union_disjoint[symmetric])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. n \<le> p \<Longrightarrow> finite {..<n}
 2. n \<le> p \<Longrightarrow> finite {n..p}
 3. n \<le> p \<Longrightarrow> {..<n} \<inter> {n..p} = {}
 4. n \<le> p \<Longrightarrow> sum f ({..<n} \<union> {n..p}) = sum f {..p}
[PROOF STEP]
apply(auto simp add: ivl_disj_un_one)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma summable_hurwitz_zeta_real:
  assumes "x > 1" "a > 0"
  shows   "summable (\<lambda>n. (real n + a) powr -x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. (real n + a) powr - x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>n. (real n + a) powr - x)
[PROOF STEP]
have "summable (\<lambda>n. (of_nat n + of_real a) powr -complex_of_real x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. (of_nat n + complex_of_real a) powr - complex_of_real x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < x
0 < a

goal (1 subgoal):
 1. summable (\<lambda>n. (of_nat n + complex_of_real a) powr - complex_of_real x)
[PROOF STEP]
by (intro summable_hurwitz_zeta) simp_all
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. (of_nat n + complex_of_real a) powr - complex_of_real x)

goal (1 subgoal):
 1. summable (\<lambda>n. (real n + a) powr - x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. (of_nat n + complex_of_real a) powr - complex_of_real x)

goal (1 subgoal):
 1. summable (\<lambda>n. (real n + a) powr - x)
[PROOF STEP]
have "(\<lambda>n. (of_nat n + of_real a) powr -complex_of_real x) =
               (\<lambda>n. of_real ((real n + a) powr -x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (of_nat n + complex_of_real a) powr - complex_of_real x) = (\<lambda>n. complex_of_real ((real n + a) powr - x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < x
0 < a

goal (1 subgoal):
 1. (\<lambda>n. (of_nat n + complex_of_real a) powr - complex_of_real x) = (\<lambda>n. complex_of_real ((real n + a) powr - x))
[PROOF STEP]
by (subst powr_Reals_eq) simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (of_nat n + complex_of_real a) powr - complex_of_real x) = (\<lambda>n. complex_of_real ((real n + a) powr - x))

goal (1 subgoal):
 1. summable (\<lambda>n. (real n + a) powr - x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. complex_of_real ((real n + a) powr - x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. complex_of_real ((real n + a) powr - x))

goal (1 subgoal):
 1. summable (\<lambda>n. (real n + a) powr - x)
[PROOF STEP]
by (subst (asm) summable_complex_of_real)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. (real n + a) powr - x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exists_weight_for_equality:
  assumes "a > c" and "a \<ge> b" and "b \<ge> c"
  shows   "\<exists>(e::real) \<in> {0..1}. (1-e) * a + e * c = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e\<in>{0..1}. (1 - e) * a + e * c = b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>e\<in>{0..1}. (1 - e) * a + e * c = b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
c < a
b \<le> a
c \<le> b
[PROOF STEP]
have "b \<in> closed_segment a c"
[PROOF STATE]
proof (prove)
using this:
c < a
b \<le> a
c \<le> b

goal (1 subgoal):
 1. b \<in> closed_segment a c
[PROOF STEP]
by (simp add: closed_segment_eq_real_ivl)
[PROOF STATE]
proof (state)
this:
b \<in> closed_segment a c

goal (1 subgoal):
 1. \<exists>e\<in>{0..1}. (1 - e) * a + e * c = b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<in> closed_segment a c

goal (1 subgoal):
 1. \<exists>e\<in>{0..1}. (1 - e) * a + e * c = b
[PROOF STEP]
by (auto simp: closed_segment_def)
[PROOF STATE]
proof (state)
this:
\<exists>e\<in>{0..1}. (1 - e) * a + e * c = b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_axis:
  fixes x :: real
  shows "norm (axis i x) = abs x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (axis i x) = \<bar>x\<bar>
[PROOF STEP]
by (simp add: norm_eq_sqrt_inner inner_axis_axis)


[STATEMENT]
lemma middle:
  "dist x (middle x y) = (dist x y)/2"
  "dist (middle x y) y = (dist x y)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (middle x y) = dist x y / 2 &&& dist (middle x y) y = dist x y / 2
[PROOF STEP]
unfolding middle_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (SOME z. dist x z = dist x y / 2 \<and> dist z y = dist x y / 2) = dist x y / 2 &&& dist (SOME z. dist x z = dist x y / 2 \<and> dist z y = dist x y / 2) y = dist x y / 2
[PROOF STEP]
using middles[of x y]
[PROOF STATE]
proof (prove)
using this:
\<exists>z. dist x z = dist x y / 2 \<and> dist z y = dist x y / 2

goal (1 subgoal):
 1. dist x (SOME z. dist x z = dist x y / 2 \<and> dist z y = dist x y / 2) = dist x y / 2 &&& dist (SOME z. dist x z = dist x y / 2 \<and> dist z y = dist x y / 2) y = dist x y / 2
[PROOF STEP]
by (metis (mono_tags, lifting) someI_ex)+


[STATEMENT]
lemma quasinorm_intersection_minimum:
  assumes "N \<subseteq>\<^sub>N N1" "N \<subseteq>\<^sub>N N2"
  shows "N \<subseteq>\<^sub>N N1 \<inter>\<^sub>N N2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N \<subseteq>\<^sub>N N1 \<inter>\<^sub>N N2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. N \<subseteq>\<^sub>N N1 \<inter>\<^sub>N N2
[PROOF STEP]
obtain C1 C2::real where *: "\<And>f. eNorm N1 f \<le> C1 * eNorm N f"
                              "\<And>f. eNorm N2 f \<le> C2 * eNorm N f"
                              "C1 \<ge> 0" "C2 \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C1 C2. \<lbrakk>\<And>f. eNorm N1 f \<le> ennreal C1 * eNorm N f; \<And>f. eNorm N2 f \<le> ennreal C2 * eNorm N f; 0 \<le> C1; 0 \<le> C2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using quasinorm_subsetD[OF assms(1)] quasinorm_subsetD[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
\<exists>C\<ge>0. \<forall>f. eNorm N1 f \<le> ennreal C * eNorm N f
\<exists>C\<ge>0. \<forall>f. eNorm N2 f \<le> ennreal C * eNorm N f

goal (1 subgoal):
 1. (\<And>C1 C2. \<lbrakk>\<And>f. eNorm N1 f \<le> ennreal C1 * eNorm N f; \<And>f. eNorm N2 f \<le> ennreal C2 * eNorm N f; 0 \<le> C1; 0 \<le> C2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
eNorm N1 ?f \<le> ennreal C1 * eNorm N ?f
eNorm N2 ?f \<le> ennreal C2 * eNorm N ?f
0 \<le> C1
0 \<le> C2

goal (1 subgoal):
 1. N \<subseteq>\<^sub>N N1 \<inter>\<^sub>N N2
[PROOF STEP]
have **: "eNorm (N1 \<inter>\<^sub>N N2) f \<le> (C1 + C2) * eNorm N f" for f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eNorm (N1 \<inter>\<^sub>N N2) f \<le> ennreal (C1 + C2) * eNorm N f
[PROOF STEP]
unfolding quasinorm_intersection(1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eNorm N1 f + eNorm N2 f \<le> ennreal (C1 + C2) * eNorm N f
[PROOF STEP]
using add_mono[OF *(1) *(2)]
[PROOF STATE]
proof (prove)
using this:
eNorm N1 ?f2 + eNorm N2 ?f1 \<le> ennreal C1 * eNorm N ?f2 + ennreal C2 * eNorm N ?f1

goal (1 subgoal):
 1. eNorm N1 f + eNorm N2 f \<le> ennreal (C1 + C2) * eNorm N f
[PROOF STEP]
by (simp add: distrib_right *)
[PROOF STATE]
proof (state)
this:
eNorm (N1 \<inter>\<^sub>N N2) ?f \<le> ennreal (C1 + C2) * eNorm N ?f

goal (1 subgoal):
 1. N \<subseteq>\<^sub>N N1 \<inter>\<^sub>N N2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N \<subseteq>\<^sub>N N1 \<inter>\<^sub>N N2
[PROOF STEP]
apply (rule quasinorm_subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. f \<in> space\<^sub>N N \<Longrightarrow> eNorm (N1 \<inter>\<^sub>N N2) f \<le> ennreal ?C * eNorm N f
[PROOF STEP]
using **
[PROOF STATE]
proof (prove)
using this:
eNorm (N1 \<inter>\<^sub>N N2) ?f \<le> ennreal (C1 + C2) * eNorm N ?f

goal (1 subgoal):
 1. \<And>f. f \<in> space\<^sub>N N \<Longrightarrow> eNorm (N1 \<inter>\<^sub>N N2) f \<le> ennreal ?C * eNorm N f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<subseteq>\<^sub>N N1 \<inter>\<^sub>N N2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_bt:
  fixes b q :: nat
  assumes "b > 2"
  shows "(\<Sum>t = 0..q. b^t) < b ^ (Suc q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) b) {0..q} < b ^ Suc q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < b

goal (1 subgoal):
 1. sum ((^) b) {0..q} < b ^ Suc q
[PROOF STEP]
proof (induction q, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>q. \<lbrakk>sum ((^) b) {0..q} < b * b ^ q; 2 < b\<rbrakk> \<Longrightarrow> sum ((^) b) {0..q} + b * b ^ q < b * (b * b ^ q)
[PROOF STEP]
fix qb :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>q. \<lbrakk>sum ((^) b) {0..q} < b * b ^ q; 2 < b\<rbrakk> \<Longrightarrow> sum ((^) b) {0..q} + b * b ^ q < b * (b * b ^ q)
[PROOF STEP]
assume "sum ((^) b) {0..qb} < b * b ^ qb"
[PROOF STATE]
proof (state)
this:
sum ((^) b) {0..qb} < b * b ^ qb

goal (1 subgoal):
 1. \<And>q. \<lbrakk>sum ((^) b) {0..q} < b * b ^ q; 2 < b\<rbrakk> \<Longrightarrow> sum ((^) b) {0..q} + b * b ^ q < b * (b * b ^ q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum ((^) b) {0..qb} < b * b ^ qb
[PROOF STEP]
have f1: "sum ((^) b) {0..qb} < b ^ Suc qb"
[PROOF STATE]
proof (prove)
using this:
sum ((^) b) {0..qb} < b * b ^ qb

goal (1 subgoal):
 1. sum ((^) b) {0..qb} < b ^ Suc qb
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
sum ((^) b) {0..qb} < b ^ Suc qb

goal (1 subgoal):
 1. \<And>q. \<lbrakk>sum ((^) b) {0..q} < b * b ^ q; 2 < b\<rbrakk> \<Longrightarrow> sum ((^) b) {0..q} + b * b ^ q < b * (b * b ^ q)
[PROOF STEP]
have "b ^ Suc qb * 2 < b ^ Suc (Suc qb)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b ^ Suc qb * 2 < b ^ Suc (Suc qb)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < b

goal (1 subgoal):
 1. b ^ Suc qb * 2 < b ^ Suc (Suc qb)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
b ^ Suc qb * 2 < b ^ Suc (Suc qb)

goal (1 subgoal):
 1. \<And>q. \<lbrakk>sum ((^) b) {0..q} < b * b ^ q; 2 < b\<rbrakk> \<Longrightarrow> sum ((^) b) {0..q} + b * b ^ q < b * (b * b ^ q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b ^ Suc qb * 2 < b ^ Suc (Suc qb)
[PROOF STEP]
have "2 * b ^ Suc qb < b ^ Suc (Suc qb)"
[PROOF STATE]
proof (prove)
using this:
b ^ Suc qb * 2 < b ^ Suc (Suc qb)

goal (1 subgoal):
 1. 2 * b ^ Suc qb < b ^ Suc (Suc qb)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * b ^ Suc qb < b ^ Suc (Suc qb)

goal (1 subgoal):
 1. \<And>q. \<lbrakk>sum ((^) b) {0..q} < b * b ^ q; 2 < b\<rbrakk> \<Longrightarrow> sum ((^) b) {0..q} + b * b ^ q < b * (b * b ^ q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * b ^ Suc qb < b ^ Suc (Suc qb)
[PROOF STEP]
have "b ^ Suc qb + sum ((^) b) {0..qb} < b ^ Suc (Suc qb)"
[PROOF STATE]
proof (prove)
using this:
2 * b ^ Suc qb < b ^ Suc (Suc qb)

goal (1 subgoal):
 1. b ^ Suc qb + sum ((^) b) {0..qb} < b ^ Suc (Suc qb)
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
2 * b ^ Suc qb < b ^ Suc (Suc qb)
sum ((^) b) {0..qb} < b ^ Suc qb

goal (1 subgoal):
 1. b ^ Suc qb + sum ((^) b) {0..qb} < b ^ Suc (Suc qb)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
b ^ Suc qb + sum ((^) b) {0..qb} < b ^ Suc (Suc qb)

goal (1 subgoal):
 1. \<And>q. \<lbrakk>sum ((^) b) {0..q} < b * b ^ q; 2 < b\<rbrakk> \<Longrightarrow> sum ((^) b) {0..q} + b * b ^ q < b * (b * b ^ q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b ^ Suc qb + sum ((^) b) {0..qb} < b ^ Suc (Suc qb)
[PROOF STEP]
show "sum ((^) b) {0..qb} + b * b ^ qb < b * (b * b ^ qb)"
[PROOF STATE]
proof (prove)
using this:
b ^ Suc qb + sum ((^) b) {0..qb} < b ^ Suc (Suc qb)

goal (1 subgoal):
 1. sum ((^) b) {0..qb} + b * b ^ qb < b * (b * b ^ qb)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((^) b) {0..qb} + b * b ^ qb < b * (b * b ^ qb)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_x_axis_poincare_distance_negative':
  fixes d :: real
  assumes "d \<ge> 0"
  shows "let z = (1 - exp d) / (1 + exp d)
          in is_real z \<and> Re z \<le> 0 \<and> Re z > -1 \<and>
              of_complex z \<in> unit_disc \<and> of_complex z \<in> circline_set x_axis \<and>
              poincare_distance 0\<^sub>h (of_complex z) = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
have "exp d \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> exp d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> d

goal (1 subgoal):
 1. 1 \<le> exp d
[PROOF STEP]
using one_le_exp_iff[of d, symmetric]
[PROOF STATE]
proof (prove)
using this:
0 \<le> d
(0 \<le> d) = (1 \<le> exp d)

goal (1 subgoal):
 1. 1 \<le> exp d
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
1 \<le> exp d

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
hence "1 + exp d \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
1 \<le> exp d

goal (1 subgoal):
 1. 1 + exp d \<noteq> 0
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
1 + exp d \<noteq> 0

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
let ?z = "(1 - exp d) / (1 + exp d)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
have "?z \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - exp d) / (1 + exp d) \<le> 0
[PROOF STEP]
using \<open>exp d \<ge> 1\<close>
[PROOF STATE]
proof (prove)
using this:
1 \<le> exp d

goal (1 subgoal):
 1. (1 - exp d) / (1 + exp d) \<le> 0
[PROOF STEP]
by (simp add: divide_nonpos_nonneg)
[PROOF STATE]
proof (state)
this:
(1 - exp d) / (1 + exp d) \<le> 0

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 - exp d) / (1 + exp d) \<le> 0

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
have "?z > -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 < (1 - exp d) / (1 + exp d)
[PROOF STEP]
using exp_gt_zero[of d]
[PROOF STATE]
proof (prove)
using this:
0 < exp d

goal (1 subgoal):
 1. - 1 < (1 - exp d) / (1 + exp d)
[PROOF STEP]
by (smt divide_less_eq_1_neg nonzero_minus_divide_right)
[PROOF STATE]
proof (state)
this:
- 1 < (1 - exp d) / (1 + exp d)

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
- 1 < (1 - exp d) / (1 + exp d)

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
hence "abs ?z < 1"
[PROOF STATE]
proof (prove)
using this:
- 1 < (1 - exp d) / (1 + exp d)

goal (1 subgoal):
 1. \<bar>(1 - exp d) / (1 + exp d)\<bar> < 1
[PROOF STEP]
using \<open>?z \<le> 0\<close>
[PROOF STATE]
proof (prove)
using this:
- 1 < (1 - exp d) / (1 + exp d)
(1 - exp d) / (1 + exp d) \<le> 0

goal (1 subgoal):
 1. \<bar>(1 - exp d) / (1 + exp d)\<bar> < 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>(1 - exp d) / (1 + exp d)\<bar> < 1

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
hence "cmod ?z < 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>(1 - exp d) / (1 + exp d)\<bar> < 1

goal (1 subgoal):
 1. cmod (cor ((1 - exp d) / (1 + exp d))) < 1
[PROOF STEP]
by (metis norm_of_real)
[PROOF STATE]
proof (state)
this:
cmod (cor ((1 - exp d) / (1 + exp d))) < 1

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
hence "of_complex ?z \<in> unit_disc"
[PROOF STATE]
proof (prove)
using this:
cmod (cor ((1 - exp d) / (1 + exp d))) < 1

goal (1 subgoal):
 1. of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
have "of_complex ?z \<in> circline_set x_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis
[PROOF STEP]
unfolding circline_set_x_axis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> of_complex ` {x. is_real x} \<union> {\<infinity>\<^sub>h}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
have "(1 - ?z) / (1 + ?z) = exp d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
[PROOF STEP]
have "1 + ?z = 2 / (1 + exp d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (1 - exp d) / (1 + exp d) = 2 / (1 + exp d)
[PROOF STEP]
using \<open>1 + exp d \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
1 + exp d \<noteq> 0

goal (1 subgoal):
 1. 1 + (1 - exp d) / (1 + exp d) = 2 / (1 + exp d)
[PROOF STEP]
by (subst add_divide_eq_iff, auto)
[PROOF STATE]
proof (state)
this:
1 + (1 - exp d) / (1 + exp d) = 2 / (1 + exp d)

goal (1 subgoal):
 1. (1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 + (1 - exp d) / (1 + exp d) = 2 / (1 + exp d)

goal (1 subgoal):
 1. (1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
[PROOF STEP]
have "1 - ?z = 2 * exp d / (1 + exp d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (1 - exp d) / (1 + exp d) = 2 * exp d / (1 + exp d)
[PROOF STEP]
using \<open>1 + exp d \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
1 + exp d \<noteq> 0

goal (1 subgoal):
 1. 1 - (1 - exp d) / (1 + exp d) = 2 * exp d / (1 + exp d)
[PROOF STEP]
by (subst diff_divide_eq_iff, auto)
[PROOF STATE]
proof (state)
this:
1 - (1 - exp d) / (1 + exp d) = 2 * exp d / (1 + exp d)

goal (1 subgoal):
 1. (1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 + (1 - exp d) / (1 + exp d) = 2 / (1 + exp d)
1 - (1 - exp d) / (1 + exp d) = 2 * exp d / (1 + exp d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 + (1 - exp d) / (1 + exp d) = 2 / (1 + exp d)
1 - (1 - exp d) / (1 + exp d) = 2 * exp d / (1 + exp d)

goal (1 subgoal):
 1. (1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
[PROOF STEP]
using \<open>1 + exp d \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
1 + (1 - exp d) / (1 + exp d) = 2 / (1 + exp d)
1 - (1 - exp d) / (1 + exp d) = 2 * exp d / (1 + exp d)
1 + exp d \<noteq> 0

goal (1 subgoal):
 1. (1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 - exp d) / (1 + exp d) \<le> 0
- 1 < (1 - exp d) / (1 + exp d)
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis
(1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(1 - exp d) / (1 + exp d) \<le> 0
- 1 < (1 - exp d) / (1 + exp d)
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis
(1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
using poincare_distance_zero_x_axis[of "of_complex ?z"]
[PROOF STATE]
proof (prove)
using this:
(1 - exp d) / (1 + exp d) \<le> 0
- 1 < (1 - exp d) / (1 + exp d)
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis
(1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
\<lbrakk>of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc; of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis\<rbrakk> \<Longrightarrow> poincare_distance 0\<^sub>h (of_complex (cor ((1 - exp d) / (1 + exp d)))) = (let x' = to_complex (of_complex (cor ((1 - exp d) / (1 + exp d)))) in \<bar>ln (Re ((1 - x') / (1 + x')))\<bar>)

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
using \<open>d \<ge> 0\<close> \<open>exp d \<ge> 1\<close>
[PROOF STATE]
proof (prove)
using this:
(1 - exp d) / (1 + exp d) \<le> 0
- 1 < (1 - exp d) / (1 + exp d)
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc
of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis
(1 - (1 - exp d) / (1 + exp d)) / (1 + (1 - exp d) / (1 + exp d)) = exp d
\<lbrakk>of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc; of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis\<rbrakk> \<Longrightarrow> poincare_distance 0\<^sub>h (of_complex (cor ((1 - exp d) / (1 + exp d)))) = (let x' = to_complex (of_complex (cor ((1 - exp d) / (1 + exp d)))) in \<bar>ln (Re ((1 - x') / (1 + x')))\<bar>)
0 \<le> d
1 \<le> exp d

goal (1 subgoal):
 1. let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d
[PROOF STEP]
by simp (simp add: cmod_eq_Re)
[PROOF STATE]
proof (state)
this:
let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma total_order_nsets_2_eq:
  assumes tot: "total_on A r" and irr: "irrefl r"
  shows "nsets A 2 = {{x,y} | x y. x \<in> A \<and> y \<in> A \<and> (x,y) \<in> r}"
     (is "_ = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [A]\<^bsup>2\<^esup> = {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [A]\<^bsup>2\<^esup> \<subseteq> {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}
 2. {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> [A]\<^bsup>2\<^esup>
[PROOF STEP]
show "nsets A 2 \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [A]\<^bsup>2\<^esup> \<subseteq> {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}
[PROOF STEP]
using tot
[PROOF STATE]
proof (prove)
using this:
total_on A r

goal (1 subgoal):
 1. [A]\<^bsup>2\<^esup> \<subseteq> {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}
[PROOF STEP]
unfolding numeral_nat total_on_def nsets_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>A. \<forall>y\<in>A. x \<noteq> y \<longrightarrow> (x, y) \<in> r \<or> (y, x) \<in> r

goal (1 subgoal):
 1. {N. N \<subseteq> A \<and> finite N \<and> card N = Suc (Suc 0)} \<subseteq> {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}
[PROOF STEP]
by (fastforce simp: card_Suc_eq Set.doubleton_eq_iff not_less)
[PROOF STATE]
proof (state)
this:
[A]\<^bsup>2\<^esup> \<subseteq> {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}

goal (1 subgoal):
 1. {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> [A]\<^bsup>2\<^esup>
[PROOF STEP]
show "?rhs \<subseteq> nsets A 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> [A]\<^bsup>2\<^esup>
[PROOF STEP]
using irr
[PROOF STATE]
proof (prove)
using this:
irrefl r

goal (1 subgoal):
 1. {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> [A]\<^bsup>2\<^esup>
[PROOF STEP]
unfolding numeral_nat
[PROOF STATE]
proof (prove)
using this:
irrefl r

goal (1 subgoal):
 1. {{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> [A]\<^bsup>Suc (Suc 0)\<^esup>
[PROOF STEP]
by (force simp: nsets_def card_Suc_eq irrefl_def)
[PROOF STATE]
proof (state)
this:
{{x, y} |x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> [A]\<^bsup>2\<^esup>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ldropn_iterates: "ldropn n (iterates f x) = iterates f ((f ^^ n) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldropn n (iterates f x) = iterates f ((f ^^ n) x)
[PROOF STEP]
proof(induct n arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. ldropn 0 (iterates f x) = iterates f ((f ^^ 0) x)
 2. \<And>n x. (\<And>x. ldropn n (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x. ldropn 0 (iterates f x) = iterates f ((f ^^ 0) x)
 2. \<And>n x. (\<And>x. ldropn n (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldropn 0 (iterates f x) = iterates f ((f ^^ 0) x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ldropn 0 (iterates f x) = iterates f ((f ^^ 0) x)

goal (1 subgoal):
 1. \<And>n x. (\<And>x. ldropn n (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n x. (\<And>x. ldropn n (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
ldropn n (iterates f ?x) = iterates f ((f ^^ n) ?x)

goal (1 subgoal):
 1. \<And>n x. (\<And>x. ldropn n (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
have "ldropn (Suc n) (iterates f x) = ldropn n (iterates f (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldropn (Suc n) (iterates f x) = ldropn n (iterates f (f x))
[PROOF STEP]
by(subst iterates)simp
[PROOF STATE]
proof (state)
this:
ldropn (Suc n) (iterates f x) = ldropn n (iterates f (f x))

goal (1 subgoal):
 1. \<And>n x. (\<And>x. ldropn n (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ldropn (Suc n) (iterates f x) = ldropn n (iterates f (f x))

goal (1 subgoal):
 1. \<And>n x. (\<And>x. ldropn n (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
have "\<dots> = iterates f ((f ^^ n) (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldropn n (iterates f (f x)) = iterates f ((f ^^ n) (f x))
[PROOF STEP]
by(rule Suc)
[PROOF STATE]
proof (state)
this:
ldropn n (iterates f (f x)) = iterates f ((f ^^ n) (f x))

goal (1 subgoal):
 1. \<And>n x. (\<And>x. ldropn n (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ldropn (Suc n) (iterates f x) = iterates f ((f ^^ n) (f x))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
ldropn (Suc n) (iterates f x) = iterates f ((f ^^ n) (f x))

goal (1 subgoal):
 1. ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
by(simp add: funpow_swap1)
[PROOF STATE]
proof (state)
this:
ldropn (Suc n) (iterates f x) = iterates f ((f ^^ Suc n) x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma parallel_is_affine:
  fixes S T :: "'a::real_vector set"
  assumes "affine S" "affine_parallel S T"
  shows "affine T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine T
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
affine S
affine_parallel S T
[PROOF STEP]
obtain a where "T = (\<lambda>x. a + x) ` S"
[PROOF STATE]
proof (prove)
using this:
affine S
affine_parallel S T

goal (1 subgoal):
 1. (\<And>a. T = (+) a ` S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding affine_parallel_def
[PROOF STATE]
proof (prove)
using this:
affine S
\<exists>a. T = (+) a ` S

goal (1 subgoal):
 1. (\<And>a. T = (+) a ` S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T = (+) a ` S

goal (1 subgoal):
 1. affine T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T = (+) a ` S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
T = (+) a ` S

goal (1 subgoal):
 1. affine T
[PROOF STEP]
using affine_translation assms
[PROOF STATE]
proof (prove)
using this:
T = (+) a ` S
affine ?S = affine ((+) ?a ` ?S)
affine S
affine_parallel S T

goal (1 subgoal):
 1. affine T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_mult_floor:
  assumes "0 \<le> a" and "0 \<le> b"
  shows "\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
have "of_int \<lfloor>a\<rfloor> \<le> a" and "of_int \<lfloor>b\<rfloor> \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int \<lfloor>a\<rfloor> \<le> a &&& of_int \<lfloor>b\<rfloor> \<le> b
[PROOF STEP]
by (auto intro: of_int_floor_le)
[PROOF STATE]
proof (state)
this:
of_int \<lfloor>a\<rfloor> \<le> a
of_int \<lfloor>b\<rfloor> \<le> b

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_int \<lfloor>a\<rfloor> \<le> a
of_int \<lfloor>b\<rfloor> \<le> b
[PROOF STEP]
have "of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b"
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>a\<rfloor> \<le> a
of_int \<lfloor>b\<rfloor> \<le> b

goal (1 subgoal):
 1. of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>a\<rfloor> \<le> a
of_int \<lfloor>b\<rfloor> \<le> b
(0::'a) \<le> a
(0::'a) \<le> b

goal (1 subgoal):
 1. of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b
[PROOF STEP]
by (auto intro!: mult_mono)
[PROOF STATE]
proof (state)
this:
of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) \<le> a * b

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
have "a * b < of_int (\<lfloor>a * b\<rfloor> + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * b < of_int (\<lfloor>a * b\<rfloor> + 1)
[PROOF STEP]
using floor_correct[of "a * b"]
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>a * b\<rfloor> \<le> a * b \<and> a * b < of_int (\<lfloor>a * b\<rfloor> + 1)

goal (1 subgoal):
 1. a * b < of_int (\<lfloor>a * b\<rfloor> + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * b < of_int (\<lfloor>a * b\<rfloor> + 1)

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) < of_int (\<lfloor>a * b\<rfloor> + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
of_int (\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor>) < of_int (\<lfloor>a * b\<rfloor> + 1)

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
unfolding of_int_less_iff
[PROOF STATE]
proof (prove)
using this:
\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> < \<lfloor>a * b\<rfloor> + 1

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lfloor>a\<rfloor> * \<lfloor>b\<rfloor> \<le> \<lfloor>a * b\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsum_cong_neutral:
  fixes f g :: \<open>'a \<Rightarrow> 'b::{comm_monoid_add, t2_space}\<close>
  assumes \<open>\<And>x. x\<in>T-S \<Longrightarrow> g x = 0\<close>
  assumes \<open>\<And>x. x\<in>S-T \<Longrightarrow> f x = 0\<close>
  assumes \<open>\<And>x. x\<in>S\<inter>T \<Longrightarrow> f x = g x\<close>
  shows \<open>infsum f S = infsum g T\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsum f S = infsum g T
[PROOF STEP]
apply (rule infsum_eqI')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. has_sum f S x = has_sum g T x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> T - S \<Longrightarrow> g ?x = (0::'b)
?x \<in> S - T \<Longrightarrow> f ?x = (0::'b)
?x \<in> S \<inter> T \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. \<And>x. has_sum f S x = has_sum g T x
[PROOF STEP]
by (rule has_sum_cong_neutral)


[STATEMENT]
lemma zeta_partial_sum_le_pos_bigo:
  assumes "s > 0" "s \<noteq> 1"
  shows   "(\<lambda>x. sum_upto (\<lambda>n. n powr -s) x) \<in> O(\<lambda>x. x powr max 0 (1 - s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> O(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> O(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
from zeta_partial_sum_le_pos''[OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>c>0. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>n. real n powr - s) x\<bar> \<le> c * x powr max 0 (1 - s)
[PROOF STEP]
obtain c
    where "\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>n. n powr -s) x\<bar> \<le> c * x powr max 0 (1 - s)"
[PROOF STATE]
proof (prove)
using this:
\<exists>c>0. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>n. real n powr - s) x\<bar> \<le> c * x powr max 0 (1 - s)

goal (1 subgoal):
 1. (\<And>c. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - s) x\<bar> \<le> c * x powr max 0 (1 - s) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - s) x\<bar> \<le> c * x powr max 0 (1 - s)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> O(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - s) x\<bar> \<le> c * x powr max 0 (1 - s)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr - s) \<in> O(\<lambda>x. x powr max 0 (1 - s))
[PROOF STEP]
by (intro bigoI[of _ c] eventually_mono[OF eventually_ge_at_top[of 1]]) auto
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real n powr - s) \<in> O(\<lambda>x. x powr max 0 (1 - s))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hd_list_of:
  assumes "finite A" "A \<noteq> {}"
  shows "hd (sorted_list_of_set A) = Min A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (sorted_list_of_set A) = Min A
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. hd (sorted_list_of_set A) \<le> Min A
 2. Min A \<le> hd (sorted_list_of_set A)
[PROOF STEP]
have "Min A \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min A \<in> A
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
Min A \<in> A

goal (2 subgoals):
 1. hd (sorted_list_of_set A) \<le> Min A
 2. Min A \<le> hd (sorted_list_of_set A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Min A \<in> A
[PROOF STEP]
show "hd (sorted_list_of_set A) \<le> Min A"
[PROOF STATE]
proof (prove)
using this:
Min A \<in> A

goal (1 subgoal):
 1. hd (sorted_list_of_set A) \<le> Min A
[PROOF STEP]
by (simp add: sorted_hd_le \<open>finite A\<close>)
[PROOF STATE]
proof (state)
this:
hd (sorted_list_of_set A) \<le> Min A

goal (1 subgoal):
 1. Min A \<le> hd (sorted_list_of_set A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Min A \<le> hd (sorted_list_of_set A)
[PROOF STEP]
show "Min A \<le> hd (sorted_list_of_set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min A \<le> hd (sorted_list_of_set A)
[PROOF STEP]
by (metis Min_le assms hd_in_set set_sorted_list_of_set sorted_list_of_set_eq_Nil_iff)
[PROOF STATE]
proof (state)
this:
Min A \<le> hd (sorted_list_of_set A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inc_mat_row_list_map: "i < length Vs \<Longrightarrow>
    row (inc_mat_of Vs Bs) i = map_vec (\<lambda> bl . if ((Vs ! i) \<in> bl) then 1 else 0) (vec_of_list Bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length Vs \<Longrightarrow> row (inc_mat_of Vs Bs) i = map_vec (\<lambda>bl. if Vs ! i \<in> bl then 1::'b else (0::'b)) (vec_of_list Bs)
[PROOF STEP]
by (intro eq_vecI)
    (simp_all add: inc_mat_dim_row inc_mat_dim_col inc_mat_row_list_map_elem index_vec_of_list)


[STATEMENT]
lemma cInf_mono:
  fixes A::"'a::conditionally_complete_lattice set"
  assumes lower: "\<And>b. b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<le> b"
      and bounded: "\<And>a. a \<in> A \<Longrightarrow> c \<le> a"
      and ne: "B \<noteq> {}"
  shows "Inf A \<le> Inf B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf A \<le> Inf B
[PROOF STEP]
proof(rule cInf_greatest[OF ne])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
assume bin: "b \<in> B"
[PROOF STATE]
proof (state)
this:
b \<in> B

goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
with lower
[PROOF STATE]
proof (chain)
picking this:
?b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<le> ?b
b \<in> B
[PROOF STEP]
obtain a where ain: "a \<in> A" and le: "a \<le> b"
[PROOF STATE]
proof (prove)
using this:
?b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<le> ?b
b \<in> B

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

goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
from ain bounded
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
?a \<in> A \<Longrightarrow> c \<le> ?a
[PROOF STEP]
have "Inf A \<le> a"
[PROOF STATE]
proof (prove)
using this:
a \<in> A
?a \<in> A \<Longrightarrow> c \<le> ?a

goal (1 subgoal):
 1. Inf A \<le> a
[PROOF STEP]
by(intro cInf_lower bdd_belowI, auto)
[PROOF STATE]
proof (state)
this:
Inf A \<le> a

goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Inf A \<le> a

goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
note le
[PROOF STATE]
proof (state)
this:
a \<le> b

goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> Inf A \<le> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Inf A \<le> b
[PROOF STEP]
show "Inf A \<le> b"
[PROOF STATE]
proof (prove)
using this:
Inf A \<le> b

goal (1 subgoal):
 1. Inf A \<le> b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Inf A \<le> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_quad_gt: "2 * (a \<bullet> b) < a \<bullet> a + b \<bullet> b"
  if "a \<noteq> b"
  for a b::"'a::euclidean_space"\<comment> \<open>generalize?\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (a \<bullet> b) < a \<bullet> a + b \<bullet> b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * (a \<bullet> b) < a \<bullet> a + b \<bullet> b
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> b
[PROOF STEP]
obtain i where "i \<in> Basis" "a \<bullet> i \<noteq> b \<bullet> i"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i \<in> Basis; a \<bullet> i \<noteq> b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: euclidean_eq_iff[where 'a='a])
[PROOF STATE]
proof (state)
this:
i \<in> Basis
a \<bullet> i \<noteq> b \<bullet> i

goal (1 subgoal):
 1. 2 * (a \<bullet> b) < a \<bullet> a + b \<bullet> b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> Basis
a \<bullet> i \<noteq> b \<bullet> i
[PROOF STEP]
have "2 * (a \<bullet> i * (b \<bullet> i)) < a \<bullet> i * (a \<bullet> i) + b \<bullet> i * (b \<bullet> i)"
[PROOF STATE]
proof (prove)
using this:
i \<in> Basis
a \<bullet> i \<noteq> b \<bullet> i

goal (1 subgoal):
 1. 2 * (a \<bullet> i * (b \<bullet> i)) < a \<bullet> i * (a \<bullet> i) + b \<bullet> i * (b \<bullet> i)
[PROOF STEP]
using sum_sqs_eq[of "a\<bullet>i" "b\<bullet>i"]
[PROOF STATE]
proof (prove)
using this:
i \<in> Basis
a \<bullet> i \<noteq> b \<bullet> i
a \<bullet> i * (a \<bullet> i) + b \<bullet> i * (b \<bullet> i) = a \<bullet> i * (b \<bullet> i * 2) \<Longrightarrow> b \<bullet> i = a \<bullet> i

goal (1 subgoal):
 1. 2 * (a \<bullet> i * (b \<bullet> i)) < a \<bullet> i * (a \<bullet> i) + b \<bullet> i * (b \<bullet> i)
[PROOF STEP]
by (auto intro!: le_neq_trans real_quad_ge)
[PROOF STATE]
proof (state)
this:
2 * (a \<bullet> i * (b \<bullet> i)) < a \<bullet> i * (a \<bullet> i) + b \<bullet> i * (b \<bullet> i)

goal (1 subgoal):
 1. 2 * (a \<bullet> b) < a \<bullet> a + b \<bullet> b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * (a \<bullet> i * (b \<bullet> i)) < a \<bullet> i * (a \<bullet> i) + b \<bullet> i * (b \<bullet> i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * (a \<bullet> i * (b \<bullet> i)) < a \<bullet> i * (a \<bullet> i) + b \<bullet> i * (b \<bullet> i)

goal (1 subgoal):
 1. 2 * (a \<bullet> b) < a \<bullet> a + b \<bullet> b
[PROOF STEP]
by (subst (1 2 3) euclidean_inner)
      (auto simp add: \<open>i \<in> Basis\<close> sum.distrib[symmetric] sum_distrib_left
        intro!: sum_strict_mono_ex1 real_quad_ge)
[PROOF STATE]
proof (state)
this:
2 * (a \<bullet> b) < a \<bullet> a + b \<bullet> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem p20: "\<forall>x y. \<exists>z. \<forall>w. P(x) \<and> Q(y) \<longrightarrow> R(z) \<and> S(w) \<Longrightarrow>
  \<exists>x y. P(x) \<and> Q(y) \<Longrightarrow> \<exists>z. R(z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. \<exists>z. \<forall>w. P x \<and> Q y \<longrightarrow> R z \<and> S w; \<exists>x y. P x \<and> Q y\<rbrakk> \<Longrightarrow> \<exists>z. R z
[PROOF STEP]
@proof
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. \<exists>z. \<forall>w. P x \<and> Q y \<longrightarrow> R z \<and> S w; \<exists>x y. P x \<and> Q y\<rbrakk> \<Longrightarrow> \<exists>z. R z
[PROOF STEP]
@obtain x y where "P(x)" "Q(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. \<exists>z. \<forall>w. P x \<and> Q y \<longrightarrow> R z \<and> S w; \<exists>x y. P x \<and> Q y\<rbrakk> \<Longrightarrow> \<exists>z. R z
[PROOF STEP]
@obtain z where "\<forall>w. P(x) \<and> Q(y) \<longrightarrow> R(z) \<and> S(w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. \<exists>z. \<forall>w. P x \<and> Q y \<longrightarrow> R z \<and> S w; \<exists>x y. P x \<and> Q y\<rbrakk> \<Longrightarrow> \<exists>z. R z
[PROOF STEP]
@qed