[STATEMENT]
lemma pos_zcount_image_zmset[simp]: "(\<And>t. 0 \<le> zcount M t) \<Longrightarrow> 0 < zcount M t \<Longrightarrow> 0 < zcount (image_zmset f M) (f t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>t. 0 \<le> zcount M t; 0 < zcount M t\<rbrakk> \<Longrightarrow> 0 < zcount (Auxiliary.image_zmset f M) (f t)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M t f. \<lbrakk>\<And>t. 0 \<le> (case M of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) t; 0 < (case M of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) t\<rbrakk> \<Longrightarrow> 0 < (case case M of (M, N) \<Rightarrow> (image_mset f M, image_mset f N) of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) (f t)
[PROOF STEP]
subgoal for M t f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>t. 0 \<le> (case M of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) t; 0 < (case M of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) t\<rbrakk> \<Longrightarrow> 0 < (case case M of (M, N) \<Rightarrow> (image_mset f M, image_mset f N) of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) (f t)
[PROOF STEP]
apply (induct M)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>\<And>t. 0 \<le> (case (a, b) of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) t; 0 < (case (a, b) of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) t\<rbrakk> \<Longrightarrow> 0 < (case case (a, b) of (M, N) \<Rightarrow> (image_mset f M, image_mset f N) of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) (f t)
[PROOF STEP]
subgoal for Mp Mn
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>t. 0 \<le> (case (Mp, Mn) of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) t; 0 < (case (Mp, Mn) of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) t\<rbrakk> \<Longrightarrow> 0 < (case case (Mp, Mn) of (M, N) \<Rightarrow> (image_mset f M, image_mset f N) of (Mp, Mn) \<Rightarrow> \<lambda>x. int (count Mp x) - int (count Mn x)) (f t)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>t. count Mn t \<le> count Mp t; count Mn t < count Mp t\<rbrakk> \<Longrightarrow> count (image_mset f Mn) (f t) < count (image_mset f Mp) (f t)
[PROOF STEP]
apply (metis count_diff count_image_mset_ge_count image_mset_Diff less_le_trans subseteq_mset_def zero_less_diff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma compact_nest:
  fixes F :: "'a::linorder \<Rightarrow> 'b::heine_borel set"
  assumes F: "\<And>n. compact(F n)" "\<And>n. F n \<noteq> {}" and mono: "\<And>m n. m \<le> n \<Longrightarrow> F n \<subseteq> F m"
  shows "\<Inter>(range F) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (range F) \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> (range F) \<noteq> {}
[PROOF STEP]
have *: "\<And>S T. S \<in> range F \<and> T \<in> range F \<Longrightarrow> S \<subseteq> T \<or> T \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S T. S \<in> range F \<and> T \<in> range F \<Longrightarrow> S \<subseteq> T \<or> T \<subseteq> S
[PROOF STEP]
by (metis mono image_iff le_cases)
[PROOF STATE]
proof (state)
this:
?S \<in> range F \<and> ?T \<in> range F \<Longrightarrow> ?S \<subseteq> ?T \<or> ?T \<subseteq> ?S

goal (1 subgoal):
 1. \<Inter> (range F) \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (range F) \<noteq> {}
[PROOF STEP]
using F
[PROOF STATE]
proof (prove)
using this:
compact (F ?n)
F ?n \<noteq> {}

goal (1 subgoal):
 1. \<Inter> (range F) \<noteq> {}
[PROOF STEP]
by (intro compact_chain [OF _ _ *]; blast dest: *)
[PROOF STATE]
proof (state)
this:
\<Inter> (range F) \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_hyperplane_eq_trivial:
  fixes a :: "'a::euclidean_space"
  shows "bounded {x. a \<bullet> x = r} \<longleftrightarrow> (if a = 0 then r \<noteq> 0 else DIM('a) = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded {x. a \<bullet> x = r} = (if a = (0::'a) then r \<noteq> 0 else DIM('a) = 1)
[PROOF STEP]
proof (simp add: bounded_hyperplane_eq_trivial_0, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>r \<noteq> 0; a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> bounded {x. a \<bullet> x = r} = (DIM('a) = Suc 0)
[PROOF STEP]
assume "r \<noteq> 0" "a \<noteq> 0"
[PROOF STATE]
proof (state)
this:
r \<noteq> 0
a \<noteq> (0::'a)

goal (1 subgoal):
 1. \<lbrakk>r \<noteq> 0; a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> bounded {x. a \<bullet> x = r} = (DIM('a) = Suc 0)
[PROOF STEP]
have "aff_dim {x. y \<bullet> x = 0} = aff_dim {x. a \<bullet> x = r}" if "y \<noteq> 0" for y::'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim {x. y \<bullet> x = 0} = aff_dim {x. a \<bullet> x = r}
[PROOF STEP]
by (metis that \<open>a \<noteq> 0\<close> aff_dim_hyperplane)
[PROOF STATE]
proof (state)
this:
?y \<noteq> (0::'a) \<Longrightarrow> aff_dim {x. ?y \<bullet> x = 0} = aff_dim {x. a \<bullet> x = r}

goal (1 subgoal):
 1. \<lbrakk>r \<noteq> 0; a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> bounded {x. a \<bullet> x = r} = (DIM('a) = Suc 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y \<noteq> (0::'a) \<Longrightarrow> aff_dim {x. ?y \<bullet> x = 0} = aff_dim {x. a \<bullet> x = r}
[PROOF STEP]
show "bounded {x. a \<bullet> x = r} = (DIM('a) = Suc 0)"
[PROOF STATE]
proof (prove)
using this:
?y \<noteq> (0::'a) \<Longrightarrow> aff_dim {x. ?y \<bullet> x = 0} = aff_dim {x. a \<bullet> x = r}

goal (1 subgoal):
 1. bounded {x. a \<bullet> x = r} = (DIM('a) = Suc 0)
[PROOF STEP]
by (metis One_nat_def \<open>a \<noteq> 0\<close> affine_bounded_eq_lowdim affine_hyperplane bounded_hyperplane_eq_trivial_0)
[PROOF STATE]
proof (state)
this:
bounded {x. a \<bullet> x = r} = (DIM('a) = Suc 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldr_mono: "length xs = length ys  \<Longrightarrow>\<forall> i < length xs. xs ! i < ys ! i \<Longrightarrow> c \<le> d \<Longrightarrow>
       foldr (\<lambda> a b. a+b) xs c  + length ys \<le> foldr (\<lambda> a b. a+b) ys (d::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d
[PROOF STEP]
proof(induction xs arbitrary: d c ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>d c ys. \<lbrakk>length [] = length ys; \<forall>i<length []. [] ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) [] c + length ys \<le> foldr (+) ys d
 2. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
length [] = length ys
\<forall>i<length []. [] ! i < ys ! i
c \<le> d

goal (2 subgoals):
 1. \<And>d c ys. \<lbrakk>length [] = length ys; \<forall>i<length []. [] ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) [] c + length ys \<le> foldr (+) ys d
 2. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length [] = length ys
\<forall>i<length []. [] ! i < ys ! i
c \<le> d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length [] = length ys
\<forall>i<length []. [] ! i < ys ! i
c \<le> d

goal (1 subgoal):
 1. foldr (+) [] c + length ys \<le> foldr (+) ys d
[PROOF STEP]
using length_0_conv list.size(3)  foldr_one
[PROOF STATE]
proof (prove)
using this:
length [] = length ys
\<forall>i<length []. [] ! i < ys ! i
c \<le> d
(length ?xs = 0) = (?xs = [])
length [] = 0
?d \<le> foldr (+) ?ys ?d

goal (1 subgoal):
 1. foldr (+) [] c + length ys \<le> foldr (+) ys d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldr (+) [] c + length ys \<le> foldr (+) ys d

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>length xs = length ?ys; \<forall>i<length xs. xs ! i < ?ys ! i; ?c \<le> ?d\<rbrakk> \<Longrightarrow> foldr (+) xs ?c + length ?ys \<le> foldr (+) ?ys ?d
length (a # xs) = length ys
\<forall>i<length (a # xs). (a # xs) ! i < ys ! i
c \<le> d

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length xs = length ?ys; \<forall>i<length xs. xs ! i < ?ys ! i; ?c \<le> ?d\<rbrakk> \<Longrightarrow> foldr (+) xs ?c + length ?ys \<le> foldr (+) ?ys ?d
length (a # xs) = length ys
\<forall>i<length (a # xs). (a # xs) ! i < ys ! i
c \<le> d
[PROOF STEP]
obtain y ys1 where "ys = y #ys1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length xs = length ?ys; \<forall>i<length xs. xs ! i < ?ys ! i; ?c \<le> ?d\<rbrakk> \<Longrightarrow> foldr (+) xs ?c + length ?ys \<le> foldr (+) ?ys ?d
length (a # xs) = length ys
\<forall>i<length (a # xs). (a # xs) ! i < ys ! i
c \<le> d

goal (1 subgoal):
 1. (\<And>y ys1. ys = y # ys1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis Suc_leI Suc_le_length_iff nth_equalityI)
[PROOF STATE]
proof (state)
this:
ys = y # ys1

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
hence 0:"length xs = length ys1"
[PROOF STATE]
proof (prove)
using this:
ys = y # ys1

goal (1 subgoal):
 1. length xs = length ys1
[PROOF STEP]
using Cons.prems(1)
[PROOF STATE]
proof (prove)
using this:
ys = y # ys1
length (a # xs) = length ys

goal (1 subgoal):
 1. length xs = length ys1
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
length xs = length ys1

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
hence 1:"\<forall>i<length xs. xs ! i < ys1 ! i"
[PROOF STATE]
proof (prove)
using this:
length xs = length ys1

goal (1 subgoal):
 1. \<forall>i<length xs. xs ! i < ys1 ! i
[PROOF STEP]
using Cons.prems(2)
[PROOF STATE]
proof (prove)
using this:
length xs = length ys1
\<forall>i<length (a # xs). (a # xs) ! i < ys ! i

goal (1 subgoal):
 1. \<forall>i<length xs. xs ! i < ys1 ! i
[PROOF STEP]
using \<open>ys = y # ys1\<close>
[PROOF STATE]
proof (prove)
using this:
length xs = length ys1
\<forall>i<length (a # xs). (a # xs) ! i < ys ! i
ys = y # ys1

goal (1 subgoal):
 1. \<forall>i<length xs. xs ! i < ys1 ! i
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<forall>i<length xs. xs ! i < ys1 ! i

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
hence 3: "\<forall>i<length ys1. ys1 ! i > 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length xs. xs ! i < ys1 ! i

goal (1 subgoal):
 1. \<forall>i<length ys1. 0 < ys1 ! i
[PROOF STEP]
by (metis "0" less_nat_zero_code neq0_conv)
[PROOF STATE]
proof (state)
this:
\<forall>i<length ys1. 0 < ys1 ! i

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
have "foldr (+) (a # xs)c = a +foldr (+) xs (c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (+) (a # xs) c = a + foldr (+) xs c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldr (+) (a # xs) c = a + foldr (+) xs c

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
have "foldr (+) (ys) d = y +foldr (+) ys1 (d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (+) ys d = y + foldr (+) ys1 d
[PROOF STEP]
by (simp add: \<open>ys = y # ys1\<close>)
[PROOF STATE]
proof (state)
this:
foldr (+) ys d = y + foldr (+) ys1 d

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
have 2:"a < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < y
[PROOF STEP]
using Cons.prems(2) \<open>ys = y # ys1\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length (a # xs). (a # xs) ! i < ys ! i
ys = y # ys1

goal (1 subgoal):
 1. a < y
[PROOF STEP]
by (metis length_Cons nth_Cons_0 zero_less_Suc)
[PROOF STATE]
proof (state)
this:
a < y

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
have 4:"foldr (+) xs c \<le> foldr (+) ys1 d - length ys1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (+) xs c \<le> foldr (+) ys1 d - length ys1
[PROOF STEP]
using Cons.IH[of ys1 c d] 0 1 Cons.prems(3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length xs = length ys1; \<forall>i<length xs. xs ! i < ys1 ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys1 \<le> foldr (+) ys1 d
length xs = length ys1
\<forall>i<length xs. xs ! i < ys1 ! i
c \<le> d

goal (1 subgoal):
 1. foldr (+) xs c \<le> foldr (+) ys1 d - length ys1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldr (+) xs c \<le> foldr (+) ys1 d - length ys1

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
have "foldr (+) ys1 d \<ge> length ys1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys1 \<le> foldr (+) ys1 d
[PROOF STEP]
using foldr_zero[of ys1 d]  3
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length ys1. 0 < ys1 ! i \<Longrightarrow> length ys1 \<le> foldr (+) ys1 d - d
\<forall>i<length ys1. 0 < ys1 ! i

goal (1 subgoal):
 1. length ys1 \<le> foldr (+) ys1 d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length ys1 \<le> foldr (+) ys1 d

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
hence "a + foldr (+) xs c < y + foldr (+) ys1 d - length ys1 "
[PROOF STATE]
proof (prove)
using this:
length ys1 \<le> foldr (+) ys1 d

goal (1 subgoal):
 1. a + foldr (+) xs c < y + foldr (+) ys1 d - length ys1
[PROOF STEP]
using 2 foldr_zero[of ys1 d] 4
[PROOF STATE]
proof (prove)
using this:
length ys1 \<le> foldr (+) ys1 d
a < y
\<forall>i<length ys1. 0 < ys1 ! i \<Longrightarrow> length ys1 \<le> foldr (+) ys1 d - d
foldr (+) xs c \<le> foldr (+) ys1 d - length ys1

goal (1 subgoal):
 1. a + foldr (+) xs c < y + foldr (+) ys1 d - length ys1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a + foldr (+) xs c < y + foldr (+) ys1 d - length ys1

goal (1 subgoal):
 1. \<And>a xs d c ys. \<lbrakk>\<And>d c ys. \<lbrakk>length xs = length ys; \<forall>i<length xs. xs ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) xs c + length ys \<le> foldr (+) ys d; length (a # xs) = length ys; \<forall>i<length (a # xs). (a # xs) ! i < ys ! i; c \<le> d\<rbrakk> \<Longrightarrow> foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a + foldr (+) xs c < y + foldr (+) ys1 d - length ys1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a + foldr (+) xs c < y + foldr (+) ys1 d - length ys1

goal (1 subgoal):
 1. foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
using \<open>ys = y # ys1\<close>
[PROOF STATE]
proof (prove)
using this:
a + foldr (+) xs c < y + foldr (+) ys1 d - length ys1
ys = y # ys1

goal (1 subgoal):
 1. foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
foldr (+) (a # xs) c + length ys \<le> foldr (+) ys d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_minus_subset:
  "bij_betw f A B \<Longrightarrow> C \<subseteq> A \<Longrightarrow> (f ` A) - (f ` C) = f ` (A - C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij_betw f A B; C \<subseteq> A\<rbrakk> \<Longrightarrow> f ` A - f ` C = f ` (A - C)
[PROOF STEP]
by (metis Diff_subset bij_betw_imp_inj_on bij_betw_imp_surj_on inj_on_image_set_diff)


[STATEMENT]
lemma cot_pfd_funeq_real:
  fixes x :: real
  assumes "x \<notin> \<int>"
  shows   "2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "complex_of_real (2 * cot_pfd x) = 2 * cot_pfd (complex_of_real x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (2 * cot_pfd x) = 2 * cot_pfd (complex_of_real x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * cot_pfd x) = 2 * cot_pfd (complex_of_real x)

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * cot_pfd x) = 2 * cot_pfd (complex_of_real x)

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "\<dots> = complex_of_real (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * cot_pfd (complex_of_real x) = complex_of_real (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<notin> \<int>

goal (1 subgoal):
 1. 2 * cot_pfd (complex_of_real x) = complex_of_real (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1))
[PROOF STEP]
by (subst cot_pfd_funeq_complex) (auto simp flip: cot_pfd_complex_of_real)
[PROOF STATE]
proof (state)
this:
2 * cot_pfd (complex_of_real x) = complex_of_real (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
complex_of_real (2 * cot_pfd x) = complex_of_real (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
complex_of_real (2 * cot_pfd x) = complex_of_real (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
by (simp only: of_real_eq_iff)
[PROOF STATE]
proof (state)
this:
2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma divide_less_eq_1_neg [simp]:
  "a < 0 \<Longrightarrow> b/a < 1 \<longleftrightarrow> a < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < (0::'a) \<Longrightarrow> (b / a < (1::'a)) = (a < b)
[PROOF STEP]
using local.dual_order.strict_iff_order
[PROOF STATE]
proof (prove)
using this:
(?b < ?a) = (?b \<le> ?a \<and> ?a \<noteq> ?b)

goal (1 subgoal):
 1. a < (0::'a) \<Longrightarrow> (b / a < (1::'a)) = (a < b)
[PROOF STEP]
by auto


[STATEMENT]
lemma comparables_iff: "T \<in> comparables S M \<longleftrightarrow> finite T \<and> (init_segment T S \<or> init_segment S T \<and> T \<subseteq> S \<union> M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (T \<in> comparables S M) = (finite T \<and> (init_segment T S \<or> init_segment S T \<and> T \<subseteq> S \<union> M))
[PROOF STEP]
by (auto simp: comparables_def init_segment_def)


[STATEMENT]
lemma range_inter:
  "({a..b} \<inter> {c..d} = {}) = (\<forall>x. \<not>(a \<le> x \<and> x \<le> b \<and> c \<le> x \<and> x \<le> d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a..b} \<inter> {c..d} = {}) = (\<forall>x. \<not> (a \<le> x \<and> x \<le> b \<and> c \<le> x \<and> x \<le> d))
[PROOF STEP]
by auto


[STATEMENT]
lemma net_asset_value_zero [simp]: "net_asset_value 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. net_asset_value 0 = 0
[PROOF STEP]
unfolding net_asset_value_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (\<pi> 0) {..shortest_period 0} = 0
[PROOF STEP]
using zero_account_def
[PROOF STATE]
proof (prove)
using this:
0 = \<iota> (\<lambda>_. 0)

goal (1 subgoal):
 1. sum (\<pi> 0) {..shortest_period 0} = 0
[PROOF STEP]
by force


[STATEMENT]
lemma card_all_edges_betw_neighbor:
  assumes "finite X" "finite Y" "uwellformed G"
  shows "card (all_edges_between X Y G) = (\<Sum>x\<in>X. card (neighbors_ss x Y G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges_between X Y G) = (\<Sum>x\<in>X. card (neighbors_ss x Y G))
[PROOF STEP]
using all_edges_betw_sigma_neighbor assms
[PROOF STATE]
proof (prove)
using this:
uwellformed ?G \<Longrightarrow> all_edges_between ?X ?Y ?G = (SIGMA x:?X. neighbors_ss x ?Y ?G)
finite X
finite Y
uwellformed G

goal (1 subgoal):
 1. card (all_edges_between X Y G) = (\<Sum>x\<in>X. card (neighbors_ss x Y G))
[PROOF STEP]
by (simp add: neighbors_ss_def)


[STATEMENT]
lemma croots3: assumes deg: "degree p = 3"
  shows "set (croots3 p) = { x. poly p x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (croots3 p) = {x. poly p x = 0}
[PROOF STEP]
unfolding croots3_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (roots3_generic solve_depressed_cubic_complex p) = {x. poly p x = 0}
[PROOF STEP]
by (rule roots3_generic[OF deg solve_depressed_cubic_complex])


[STATEMENT]
lemma poly_mod_diff_left: "(x - y) mod z = x mod z - y mod z"
  for x y z :: "'a::field poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y) mod z = x mod z - y mod z
[PROOF STEP]
by (simp only: diff_conv_add_uminus poly_mod_add_left poly_mod_minus_left)


[STATEMENT]
lemma sums_confine_divide_iff:
  fixes f :: "nat \<Rightarrow> 'a::real_normed_field"
  assumes "c \<noteq> 0"
  shows "confine (\<lambda>n. f n / c) N sums (a/c) \<longleftrightarrow> confine f N sums a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confine (\<lambda>n. f n / c) N sums (a / c) = confine f N sums a
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. confine (\<lambda>n. f n / c) N sums (a / c) \<Longrightarrow> confine f N sums a
 2. confine f N sums a \<Longrightarrow> confine (\<lambda>n. f n / c) N sums (a / c)
[PROOF STEP]
show "confine f N sums a"
    if "confine (\<lambda>n. f n / c) N sums (a / c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confine f N sums a
[PROOF STEP]
using sums_confine_mult [OF that, of c] assms
[PROOF STATE]
proof (prove)
using this:
confine (\<lambda>n. c * (f n / c)) N sums (c * (a / c))
c \<noteq> (0::'a)

goal (1 subgoal):
 1. confine f N sums a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
confine (\<lambda>n. f n / c) N sums (a / c) \<Longrightarrow> confine f N sums a

goal (1 subgoal):
 1. confine f N sums a \<Longrightarrow> confine (\<lambda>n. f n / c) N sums (a / c)
[PROOF STEP]
qed (auto simp: sums_confine_divide)


[STATEMENT]
theorem sup_state_Cons1:
  "(G \<turnstile> (x#xt, a) <=s (yt, b)) =
   (\<exists>y yt'. yt=y#yt' \<and> (G \<turnstile> x \<preceq> y) \<and> (G \<turnstile> (xt,a) <=s (yt',b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<turnstile> (x # xt, a) <=s (yt, b) = (\<exists>y yt'. yt = y # yt' \<and> G \<turnstile> x \<preceq> y \<and> G \<turnstile> (xt, a) <=s (yt', b))
[PROOF STEP]
by (auto simp add: sup_state_def stk_convert lesub_def Product.le_def)


[STATEMENT]
lemma path_connected_path_image: "path p \<Longrightarrow> path_connected(path_image p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path p \<Longrightarrow> path_connected (path_image p)
[PROOF STEP]
unfolding path_connected_component
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path p \<Longrightarrow> \<forall>x\<in>path_image p. Ball (path_image p) (path_component (path_image p) x)
[PROOF STEP]
by (meson path_component_path_image_pathstart path_component_sym path_component_trans)


[STATEMENT]
lemma inner_prod_cnj:
  assumes "dim_vec u = dim_vec v"
  shows "\<langle>v|u\<rangle> = cnj (\<langle>u|v\<rangle>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>v|u\<rangle> = cnj \<langle>u|v\<rangle>
[PROOF STEP]
by (simp add: assms inner_prod_def algebra_simps)


[STATEMENT]
lemma bchoice_finite_set:
  assumes a: "\<forall>x \<in> S. \<exists>y. x = f y"
  and     b: "finite S"
  shows "\<exists>ys. (\<Union> S) = \<Union>(f ` ys) \<and> finite ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ys. \<Union> S = \<Union> (f ` ys) \<and> finite ys
[PROOF STEP]
using bchoice[OF a] b
[PROOF STATE]
proof (prove)
using this:
\<exists>fa. \<forall>x\<in>S. x = f (fa x)
finite S

goal (1 subgoal):
 1. \<exists>ys. \<Union> S = \<Union> (f ` ys) \<and> finite ys
[PROOF STEP]
apply(erule_tac exE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>fa. \<lbrakk>finite S; \<forall>x\<in>S. x = f (fa x)\<rbrakk> \<Longrightarrow> \<exists>ys. \<Union> S = \<Union> (f ` ys) \<and> finite ys
[PROOF STEP]
apply(rule_tac x="fa ` S" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>fa. \<lbrakk>finite S; \<forall>x\<in>S. x = f (fa x)\<rbrakk> \<Longrightarrow> \<Union> S = \<Union> (f ` fa ` S) \<and> finite (fa ` S)
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma matrix_mult_1_right [simp]:
  "(A::('a::{semiring_0,monoid_mult},'m::len,'n::len) matrix) *\<^sub>M 1 = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>M 1 = A
[PROOF STEP]
by (cases A, simp add: one_matrix_def)


[STATEMENT]
lemma def_equiv_divisor_set: "divisor_set (n::nat) = set(divisors_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_set n = set (divisors_nat n)
[PROOF STEP]
using  divisors_nat_def divisors_nat divisor_set divisor_def
[PROOF STATE]
proof (prove)
using this:
divisors_nat ?n \<equiv> if ?n = 0 then [] else remdups_adj (sort (map prod_list (subseqs (prime_factorization_nat ?n))))
?n \<noteq> 0 \<Longrightarrow> set (divisors_nat ?n) = {p. p dvd ?n}
distinct (divisors_nat ?n)
divisors_nat 0 = []
divisor_set ?m = {n. n divisor ?m}
?n divisor ?m \<equiv> 1 \<le> ?n \<and> ?n \<le> ?m \<and> ?n dvd ?m

goal (1 subgoal):
 1. divisor_set n = set (divisors_nat n)
[PROOF STEP]
by auto


[STATEMENT]
lemma powr_convex:
  assumes "p \<ge> 1" shows "convex_on {0<..} (\<lambda>x. x powr p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on {0<..} (\<lambda>x. x powr p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> p

goal (1 subgoal):
 1. convex_on {0<..} (\<lambda>x. x powr p)
[PROOF STEP]
by (intro f''_ge0_imp_convex derivative_eq_intros | simp)+


[STATEMENT]
theorem (in field)
  assumes "finite S"
  assumes "S \<subseteq> carrier R"
  assumes "f ` S \<subseteq> carrier R"
  shows
    interpolate_poly: "interpolate S f \<in> carrier (poly_ring R)" and
    interpolate_degree: "degree (interpolate S f) \<le> card S - 1" and
    interpolate_eval: "\<And>s. s \<in> S \<Longrightarrow> eval (interpolate S f) s = f s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interpolate S f \<in> carrier (poly_ring R) &&& degree (interpolate S f) \<le> card S - 1 &&& (\<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. interpolate S f \<in> carrier (poly_ring R)
 2. degree (interpolate S f) \<le> card S - 1
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
interpret r:cring "poly_ring R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring (poly_ring R)
[PROOF STEP]
using carrier_is_subring domain.univ_poly_is_cring domain_axioms
[PROOF STATE]
proof (prove)
using this:
subring (carrier R) R
\<lbrakk>domain ?R; subring ?K ?R\<rbrakk> \<Longrightarrow> cring (?K [X]\<^bsub>?R\<^esub>)
domain R

goal (1 subgoal):
 1. cring (poly_ring R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. interpolate S f \<in> carrier (poly_ring R)
 2. degree (interpolate S f) \<le> card S - 1
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have a:"\<And>x. x \<in> S \<Longrightarrow> lagrange_basis_polynomial (S - {x}) x \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> lagrange_basis_polynomial (S - {x}) x \<in> carrier (poly_ring R)
[PROOF STEP]
by (meson lagrange_poly assms Diff_iff finite_Diff in_mono insertI1 subset_insertI2 subset_insert_iff)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> lagrange_basis_polynomial (S - {?x}) ?x \<in> carrier (poly_ring R)

goal (3 subgoals):
 1. interpolate S f \<in> carrier (poly_ring R)
 2. degree (interpolate S f) \<le> card S - 1
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have b:"\<And>x. x \<in> S \<Longrightarrow> f x \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> f x \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
S \<subseteq> carrier R
f ` S \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> f x \<in> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> f ?x \<in> carrier R

goal (3 subgoals):
 1. interpolate S f \<in> carrier (poly_ring R)
 2. degree (interpolate S f) \<le> card S - 1
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have c:"\<And>x. x \<in> S \<Longrightarrow> degree (lagrange_basis_polynomial (S - {x}) x) \<le> card S - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> degree (lagrange_basis_polynomial (S - {x}) x) \<le> card S - 1
[PROOF STEP]
by (metis (full_types) lagrange_degree  DiffI Diff_insert_absorb assms(1) assms(2)
        card_Diff_singleton finite_insert insert_subset mk_disjoint_insert)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> degree (lagrange_basis_polynomial (S - {?x}) ?x) \<le> card S - 1

goal (3 subgoals):
 1. interpolate S f \<in> carrier (poly_ring R)
 2. degree (interpolate S f) \<le> card S - 1
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have d: "\<And>x. x \<in> S \<Longrightarrow>
    degree (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) \<le> (card S - 1) + 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> degree (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) \<le> card S - 1 + 0
[PROOF STEP]
using poly_of_const_in_carrier[OF b] poly_mult_degree_le[OF a] c poly_of_const_def
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> S \<Longrightarrow> poly_of_const (f ?x1) \<in> carrier (poly_ring R)
\<lbrakk>?x1 \<in> S; ?y \<in> carrier (poly_ring R); degree (lagrange_basis_polynomial (S - {?x1}) ?x1) \<le> ?n; degree ?y \<le> ?m\<rbrakk> \<Longrightarrow> degree (lagrange_basis_polynomial (S - {?x1}) ?x1 \<otimes>\<^bsub>poly_ring R\<^esub> ?y) \<le> ?n + ?m
?x \<in> S \<Longrightarrow> degree (lagrange_basis_polynomial (S - {?x}) ?x) \<le> card S - 1
poly_of_const = (\<lambda>k. local.normalize [k])

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> degree (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) \<le> card S - 1 + 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> degree (lagrange_basis_polynomial (S - {?x}) ?x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f ?x)) \<le> card S - 1 + 0

goal (3 subgoals):
 1. interpolate S f \<in> carrier (poly_ring R)
 2. degree (interpolate S f) \<le> card S - 1
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
show "interpolate S f \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interpolate S f \<in> carrier (poly_ring R)
[PROOF STEP]
using interpolate_def poly_of_const_in_carrier a b
[PROOF STATE]
proof (prove)
using this:
interpolate ?S ?f = (\<Oplus>\<^bsub>poly_ring R\<^esub>s\<in>?S. lagrange_basis_polynomial (?S - {s}) s \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (?f s))
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)
?x \<in> S \<Longrightarrow> lagrange_basis_polynomial (S - {?x}) ?x \<in> carrier (poly_ring R)
?x \<in> S \<Longrightarrow> f ?x \<in> carrier R

goal (1 subgoal):
 1. interpolate S f \<in> carrier (poly_ring R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
interpolate S f \<in> carrier (poly_ring R)

goal (2 subgoals):
 1. degree (interpolate S f) \<le> card S - 1
 2. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
show "degree (interpolate S f) \<le> card S - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (interpolate S f) \<le> card S - 1
[PROOF STEP]
using poly_sum_degree_le[OF assms(1) d] poly_of_const_in_carrier[OF b] interpolate_def a
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> S \<Longrightarrow> ?x1 x \<in> S; \<And>x. x \<in> S \<Longrightarrow> lagrange_basis_polynomial (S - {?x1 x}) (?x1 x) \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f (?x1 x)) \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> degree (\<Oplus>\<^bsub>poly_ring R\<^esub>x\<in>S. lagrange_basis_polynomial (S - {?x1 x}) (?x1 x) \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f (?x1 x))) \<le> card S - 1 + 0
?x1 \<in> S \<Longrightarrow> poly_of_const (f ?x1) \<in> carrier (poly_ring R)
interpolate ?S ?f = (\<Oplus>\<^bsub>poly_ring R\<^esub>s\<in>?S. lagrange_basis_polynomial (?S - {s}) s \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (?f s))
?x \<in> S \<Longrightarrow> lagrange_basis_polynomial (S - {?x}) ?x \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. degree (interpolate S f) \<le> card S - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (interpolate S f) \<le> card S - 1

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have e:"subring (carrier R) R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subring (carrier R) R
[PROOF STEP]
using carrier_is_subring assms
[PROOF STATE]
proof (prove)
using this:
subring (carrier R) R
finite S
S \<subseteq> carrier R
f ` S \<subseteq> carrier R

goal (1 subgoal):
 1. subring (carrier R) R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
subring (carrier R) R

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
show "\<And>s. s \<in> S \<Longrightarrow> eval (interpolate S f) s = f s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
assume f:"s \<in> S"
[PROOF STATE]
proof (state)
this:
s \<in> S

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
interpret s:ring_hom_cring "poly_ring R" "R" "(\<lambda>p. eval p s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_cring (poly_ring R) R (\<lambda>p. local.eval p s)
[PROOF STEP]
using eval_cring_hom[OF e] assms f
[PROOF STATE]
proof (prove)
using this:
?a \<in> carrier R \<Longrightarrow> ring_hom_cring (poly_ring R) R (\<lambda>p. local.eval p ?a)
finite S
S \<subseteq> carrier R
f ` S \<subseteq> carrier R
s \<in> S

goal (1 subgoal):
 1. ring_hom_cring (poly_ring R) R (\<lambda>p. local.eval p s)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have g:"\<And>i. i \<in> S \<Longrightarrow>
         eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s =
         (if s = i then f s else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
assume i_in_S: "i \<in> S"
[PROOF STATE]
proof (state)
this:
i \<in> S

goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
have "eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s =
        eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = local.eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i
[PROOF STEP]
using b i_in_S poly_of_const_in_carrier
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> f ?x \<in> carrier R
i \<in> S
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = local.eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i
[PROOF STEP]
by (simp add: s.hom_mult[OF a] eval_poly_of_const)
[PROOF STATE]
proof (state)
this:
local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = local.eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i

goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = local.eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i

goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
have "... = (if s = i then f s else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i = (if s = i then f s else \<zero>)
[PROOF STEP]
using b i_in_S poly_of_const_in_carrier assms f
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> f ?x \<in> carrier R
i \<in> S
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)
finite S
S \<subseteq> carrier R
f ` S \<subseteq> carrier R
s \<in> S

goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i = (if s = i then f s else \<zero>)
[PROOF STEP]
apply (cases "s=i", simp, subst lagrange_one, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>s \<noteq> i; \<And>x. x \<in> S \<Longrightarrow> f x \<in> carrier R; i \<in> S; \<And>s. s \<in> carrier R \<Longrightarrow> poly_of_const s \<in> carrier (poly_ring R); finite S; S \<subseteq> carrier R; f ` S \<subseteq> carrier R; s \<in> S\<rbrakk> \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i = \<zero>
[PROOF STEP]
by (subst lagrange_zero, auto)
[PROOF STATE]
proof (state)
this:
local.eval (lagrange_basis_polynomial (S - {i}) i) s \<otimes> f i = (if s = i then f s else \<zero>)

goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
show
        "eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s =
         (if s = i then f s else \<zero>)"
[PROOF STATE]
proof (prove)
using this:
local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)

goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.eval (lagrange_basis_polynomial (S - {i}) i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f i)) s = (if s = i then f s else \<zero>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {?i}) ?i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f ?i)) s = (if s = ?i then f s else \<zero>)

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have "eval (interpolate S f) s =
    (\<Oplus>x\<in>S. eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval (interpolate S f) s = (\<Oplus>x\<in>S. local.eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s)
[PROOF STEP]
using  poly_of_const_in_carrier[OF b] a e
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> S \<Longrightarrow> poly_of_const (f ?x1) \<in> carrier (poly_ring R)
?x \<in> S \<Longrightarrow> lagrange_basis_polynomial (S - {?x}) ?x \<in> carrier (poly_ring R)
subring (carrier R) R

goal (1 subgoal):
 1. local.eval (interpolate S f) s = (\<Oplus>x\<in>S. local.eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s)
[PROOF STEP]
by (simp add: interpolate_def s.hom_finsum[OF Pi_I] comp_def)
[PROOF STATE]
proof (state)
this:
local.eval (interpolate S f) s = (\<Oplus>x\<in>S. local.eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s)

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.eval (interpolate S f) s = (\<Oplus>x\<in>S. local.eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s)

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have "... =  (\<Oplus>x\<in>S. if s = x then f s else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>x\<in>S. local.eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s) = (\<Oplus>x\<in>S. if s = x then f s else \<zero>)
[PROOF STEP]
using b g
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> f ?x \<in> carrier R
?i \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial (S - {?i}) ?i \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f ?i)) s = (if s = ?i then f s else \<zero>)

goal (1 subgoal):
 1. (\<Oplus>x\<in>S. local.eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s) = (\<Oplus>x\<in>S. if s = x then f s else \<zero>)
[PROOF STEP]
by (simp cong: finsum_cong)
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>S. local.eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s) = (\<Oplus>x\<in>S. if s = x then f s else \<zero>)

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>S. local.eval (lagrange_basis_polynomial (S - {x}) x \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (f x)) s) = (\<Oplus>x\<in>S. if s = x then f s else \<zero>)

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
have "... = f s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>x\<in>S. if s = x then f s else \<zero>) = f s
[PROOF STEP]
using finsum_singleton[OF f assms(1)] f assms
[PROOF STATE]
proof (prove)
using this:
?f \<in> S \<rightarrow> carrier R \<Longrightarrow> (\<Oplus>j\<in>S. if s = j then ?f j else \<zero>) = ?f s
s \<in> S
finite S
S \<subseteq> carrier R
f ` S \<subseteq> carrier R

goal (1 subgoal):
 1. (\<Oplus>x\<in>S. if s = x then f s else \<zero>) = f s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>S. if s = x then f s else \<zero>) = f s

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (interpolate S f) s = f s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.eval (interpolate S f) s = f s
[PROOF STEP]
show "eval (interpolate S f) s = f s"
[PROOF STATE]
proof (prove)
using this:
local.eval (interpolate S f) s = f s

goal (1 subgoal):
 1. local.eval (interpolate S f) s = f s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.eval (interpolate S f) s = f s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?s \<in> S \<Longrightarrow> local.eval (interpolate S f) ?s = f ?s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infnorm[code]:
  fixes x::"'a::executable_euclidean_space"
  shows "infnorm x = fold max (map (\<lambda>i. abs (x \<bullet> i)) Basis_list) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infnorm x = fold max (map (\<lambda>i. \<bar>x \<bullet> i\<bar>) Basis_list) 0
[PROOF STEP]
by (auto simp: Max.set_eq_fold[symmetric] infnorm_Max[symmetric] infnorm_pos_le
    intro!: max.absorb2[symmetric])


[STATEMENT]
lemma proots_within_smult:
  fixes a::"'a::{semiring_no_zero_divisors,comm_semiring_0}"
  assumes "a\<noteq>0"
  shows "proots_within (smult a p) s = proots_within p s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within (smult a p) s = proots_within p s
[PROOF STEP]
unfolding proots_within_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> s. poly (smult a p) x = (0::'a)} = {x \<in> s. poly p x = (0::'a)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. {x \<in> s. poly (smult a p) x = (0::'a)} = {x \<in> s. poly p x = (0::'a)}
[PROOF STEP]
by auto


[STATEMENT]
lemma v0_code[code]: "v0_mpi\<^sub>b = vec_to_bfun (\<chi> s. r_min / (1 - l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v0_mpi\<^sub>b = vec_to_bfun (\<chi>s. r_min / (1 - l))
[PROOF STEP]
by (auto simp: v0_mpi\<^sub>b_def v0_mpi_def vec_to_bfun_def )


[STATEMENT]
lemma abs_ln_one_plus_x_minus_x_bound_nonpos:
  fixes x :: real
  assumes a: "-(1 / 2) \<le> x" and b: "x \<le> 0"
  shows "\<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
have *: "- (-x) - 2 * (-x)\<^sup>2 \<le> ln (1 - (- x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (- x) - 2 * (- x)\<^sup>2 \<le> ln (1 - - x)
[PROOF STEP]
by (metis a b diff_zero ln_one_minus_pos_lower_bound minus_diff_eq neg_le_iff_le)
[PROOF STATE]
proof (state)
this:
- (- x) - 2 * (- x)\<^sup>2 \<le> ln (1 - - x)

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
have "\<bar>ln (1 + x) - x\<bar> = x - ln (1 - (- x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> = x - ln (1 - - x)
[PROOF STEP]
using a ln_add_one_self_le_self2 [of x]
[PROOF STATE]
proof (prove)
using this:
- (1 / 2) \<le> x
- 1 < x \<Longrightarrow> ln (1 + x) \<le> x

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> = x - ln (1 - - x)
[PROOF STEP]
by (simp add: abs_if)
[PROOF STATE]
proof (state)
this:
\<bar>ln (1 + x) - x\<bar> = x - ln (1 - - x)

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>ln (1 + x) - x\<bar> = x - ln (1 - - x)

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
have "\<dots> \<le> 2 * x\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - ln (1 - - x) \<le> 2 * x\<^sup>2
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
- (- x) - 2 * (- x)\<^sup>2 \<le> ln (1 - - x)

goal (1 subgoal):
 1. x - ln (1 - - x) \<le> 2 * x\<^sup>2
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
x - ln (1 - - x) \<le> 2 * x\<^sup>2

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2

goal (1 subgoal):
 1. \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_prod: "abs (prod f A :: 'a :: linordered_idom) = prod (\<lambda>x. abs (f x)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>prod f A\<bar> = (\<Prod>x\<in>A. \<bar>f x\<bar>)
[PROOF STEP]
by (cases "finite A", induction A rule: finite_induct) (simp_all add: abs_mult)


[STATEMENT]
lemma sum_delta'':
  fixes s::"'a::real_vector set"
  assumes "finite s"
  shows "(\<Sum>x\<in>s. (if y = x then f x else 0) *\<^sub>R x) = (if y\<in>s then (f y) *\<^sub>R y else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>s. (if y = x then f x else 0) *\<^sub>R x) = (if y \<in> s then f y *\<^sub>R y else (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>s. (if y = x then f x else 0) *\<^sub>R x) = (if y \<in> s then f y *\<^sub>R y else (0::'a))
[PROOF STEP]
have *: "\<And>x y. (if y = x then f x else (0::real)) *\<^sub>R x = (if x=y then (f x) *\<^sub>R x else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (if y = x then f x else 0) *\<^sub>R x = (if x = y then f x *\<^sub>R x else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if ?y = ?x then f ?x else 0) *\<^sub>R ?x = (if ?x = ?y then f ?x *\<^sub>R ?x else (0::'a))

goal (1 subgoal):
 1. (\<Sum>x\<in>s. (if y = x then f x else 0) *\<^sub>R x) = (if y \<in> s then f y *\<^sub>R y else (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>s. (if y = x then f x else 0) *\<^sub>R x) = (if y \<in> s then f y *\<^sub>R y else (0::'a))
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>s. if x = y then f x *\<^sub>R x else (0::'a)) = (if y \<in> s then f y *\<^sub>R y else (0::'a))
[PROOF STEP]
using sum.delta[OF assms, of y "\<lambda>x. f x *\<^sub>R x"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<in>s. if k = y then f k *\<^sub>R k else (0::'a)) = (if y \<in> s then f y *\<^sub>R y else (0::'a))

goal (1 subgoal):
 1. (\<Sum>x\<in>s. if x = y then f x *\<^sub>R x else (0::'a)) = (if y \<in> s then f y *\<^sub>R y else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>s. (if y = x then f x else 0) *\<^sub>R x) = (if y \<in> s then f y *\<^sub>R y else (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pdevs_of_centered_ivl_eq_pdevs_of_ivl[simp]: "pdevs_of_centered_ivl r = pdevs_of_ivl (-r) r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdevs_of_centered_ivl r = pdevs_of_ivl (- r) r
[PROOF STEP]
by (auto simp: pdevs_of_centered_ivl_def pdevs_of_ivl_def algebra_simps intro!: pdevs_eqI)


[STATEMENT]
lemma out_in_arcs_reflexive_uniq: "v \<in> verts G \<Longrightarrow> e \<in> (out_arcs G v) \<Longrightarrow>
    \<exists>! e' . (e' \<in> (in_arcs G v) \<and> tail G e' = head G e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v \<in> verts G; e \<in> out_arcs G v\<rbrakk> \<Longrightarrow> \<exists>!e'. e' \<in> in_arcs G v \<and> tail G e' = head G e
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>e \<in> arcs G; v = tail G e\<rbrakk> \<Longrightarrow> \<exists>e'. e' \<in> arcs G \<and> head G e' = tail G e \<and> tail G e' = head G e
 2. \<And>e' y. \<lbrakk>e \<in> arcs G; v = tail G e; e' \<in> arcs G; y \<in> arcs G; head G e' = tail G e; tail G e' = head G e; head G y = tail G e; tail G y = head G e\<rbrakk> \<Longrightarrow> e' = y
[PROOF STEP]
using symmetric_conv
[PROOF STATE]
proof (prove)
using this:
symmetric ?G = (\<forall>e1\<in>arcs ?G. \<exists>e2\<in>arcs ?G. tail ?G e1 = head ?G e2 \<and> head ?G e1 = tail ?G e2)

goal (2 subgoals):
 1. \<lbrakk>e \<in> arcs G; v = tail G e\<rbrakk> \<Longrightarrow> \<exists>e'. e' \<in> arcs G \<and> head G e' = tail G e \<and> tail G e' = head G e
 2. \<And>e' y. \<lbrakk>e \<in> arcs G; v = tail G e; e' \<in> arcs G; y \<in> arcs G; head G e' = tail G e; tail G e' = head G e; head G y = tail G e; tail G y = head G e\<rbrakk> \<Longrightarrow> e' = y
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e' y. \<lbrakk>e \<in> arcs G; v = tail G e; e' \<in> arcs G; y \<in> arcs G; head G e' = tail G e; tail G e' = head G e; head G y = tail G e; tail G y = head G e\<rbrakk> \<Longrightarrow> e' = y
[PROOF STEP]
using in_arcs_single_per_vert
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> verts G; ?u \<in> verts G; ?e1.0 \<in> in_arcs G ?v; ?e2.0 \<in> in_arcs G ?v; tail G ?e1.0 = ?u; tail G ?e2.0 = ?u\<rbrakk> \<Longrightarrow> ?e1.0 = ?e2.0

goal (1 subgoal):
 1. \<And>e' y. \<lbrakk>e \<in> arcs G; v = tail G e; e' \<in> arcs G; y \<in> arcs G; head G e' = tail G e; tail G e' = head G e; head G y = tail G e; tail G y = head G e\<rbrakk> \<Longrightarrow> e' = y
[PROOF STEP]
by (metis tail_in_verts in_in_arcs_conv)


[STATEMENT]
lemma tensor_gate_unitary1 [simp]:
  assumes "gate m G1" and "gate n G2"
  shows "(G1 \<Otimes> G2)\<^sup>\<dagger> * (G1 \<Otimes> G2) = 1\<^sub>m(dim_col G1 * dim_col G2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2) = 1\<^sub>m (dim_col G1 * dim_col G2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m (dim_col G1 * dim_col G2)); j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))\<rbrakk> \<Longrightarrow> (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m (dim_col G1 * dim_col G2) $$ (i, j)
 2. dim_row (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_row (1\<^sub>m (dim_col G1 * dim_col G2))
 3. dim_col (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_col (1\<^sub>m (dim_col G1 * dim_col G2))
[PROOF STEP]
show "dim_row ((G1 \<Otimes> G2)\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_row (1\<^sub>m(dim_col G1 * dim_col G2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_row (1\<^sub>m (dim_col G1 * dim_col G2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_row (1\<^sub>m (dim_col G1 * dim_col G2))

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m (dim_col G1 * dim_col G2)); j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))\<rbrakk> \<Longrightarrow> (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m (dim_col G1 * dim_col G2) $$ (i, j)
 2. dim_col (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_col (1\<^sub>m (dim_col G1 * dim_col G2))
[PROOF STEP]
show "dim_col ((G1 \<Otimes> G2)\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_col (1\<^sub>m(dim_col G1 * dim_col G2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_col (1\<^sub>m (dim_col G1 * dim_col G2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) = dim_col (1\<^sub>m (dim_col G1 * dim_col G2))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m (dim_col G1 * dim_col G2)); j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))\<rbrakk> \<Longrightarrow> (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m (dim_col G1 * dim_col G2) $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m (dim_col G1 * dim_col G2)); j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))\<rbrakk> \<Longrightarrow> (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m (dim_col G1 * dim_col G2) $$ (i, j)
[PROOF STEP]
assume "i < dim_row (1\<^sub>m(dim_col G1 * dim_col G2))" and "j < dim_col (1\<^sub>m(dim_col G1 * dim_col G2))"
[PROOF STATE]
proof (state)
this:
i < dim_row (1\<^sub>m (dim_col G1 * dim_col G2))
j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m (dim_col G1 * dim_col G2)); j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))\<rbrakk> \<Longrightarrow> (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m (dim_col G1 * dim_col G2) $$ (i, j)
[PROOF STEP]
thus "((G1 \<Otimes> G2)\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m(dim_col G1 * dim_col G2) $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (1\<^sub>m (dim_col G1 * dim_col G2))
j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))

goal (1 subgoal):
 1. (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m (dim_col G1 * dim_col G2) $$ (i, j)
[PROOF STEP]
using assms index_tensor_gate_unitary1
[PROOF STATE]
proof (prove)
using this:
i < dim_row (1\<^sub>m (dim_col G1 * dim_col G2))
j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))
gate m G1
gate n G2
\<lbrakk>gate ?m ?G1.0; gate ?n ?G2.0; ?i < dim_row (1\<^sub>m (dim_col ?G1.0 * dim_col ?G2.0)); ?j < dim_col (1\<^sub>m (dim_col ?G1.0 * dim_col ?G2.0))\<rbrakk> \<Longrightarrow> (?G1.0 \<Otimes> ?G2.0\<^sup>\<dagger> * (?G1.0 \<Otimes> ?G2.0)) $$ (?i, ?j) = 1\<^sub>m (dim_col ?G1.0 * dim_col ?G2.0) $$ (?i, ?j)

goal (1 subgoal):
 1. (G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m (dim_col G1 * dim_col G2) $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(G1 \<Otimes> G2\<^sup>\<dagger> * (G1 \<Otimes> G2)) $$ (i, j) = 1\<^sub>m (dim_col G1 * dim_col G2) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_mm_inv_l:
  assumes "mat_det A \<noteq> 0" and "A *\<^sub>m\<^sub>m B = C"
  shows "B = mat_inv A *\<^sub>m\<^sub>m C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = mat_inv A *\<^sub>m\<^sub>m C
[PROOF STEP]
using assms mat_eye_l[of B]
[PROOF STATE]
proof (prove)
using this:
mat_det A \<noteq> 0
A *\<^sub>m\<^sub>m B = C
eye *\<^sub>m\<^sub>m B = B

goal (1 subgoal):
 1. B = mat_inv A *\<^sub>m\<^sub>m C
[PROOF STEP]
by (auto simp add: mult_mm_assoc mat_inv_l)


[STATEMENT]
lemma fpxs_val_mult [simp]:
  fixes f g :: "'a :: {comm_semiring_1, semiring_no_zero_divisors} fpxs"
  assumes "f \<noteq> 0" "g \<noteq> 0"
  shows "fpxs_val (f * g) = fpxs_val f + fpxs_val g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_val (f * g) = fpxs_val f + fpxs_val g
[PROOF STEP]
proof (intro antisym fpxs_val_leI fpxs_val_geI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. fpxs_nth (f * g) (fpxs_val f + fpxs_val g) \<noteq> (0::'a)
 2. f * g \<noteq> 0
 3. \<And>r. r < fpxs_val f + fpxs_val g \<Longrightarrow> fpxs_nth (f * g) r = (0::'a)
[PROOF STEP]
fix r :: rat
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. fpxs_nth (f * g) (fpxs_val f + fpxs_val g) \<noteq> (0::'a)
 2. f * g \<noteq> 0
 3. \<And>r. r < fpxs_val f + fpxs_val g \<Longrightarrow> fpxs_nth (f * g) r = (0::'a)
[PROOF STEP]
assume r: "r < fpxs_val f + fpxs_val g"
[PROOF STATE]
proof (state)
this:
r < fpxs_val f + fpxs_val g

goal (3 subgoals):
 1. fpxs_nth (f * g) (fpxs_val f + fpxs_val g) \<noteq> (0::'a)
 2. f * g \<noteq> 0
 3. \<And>r. r < fpxs_val f + fpxs_val g \<Longrightarrow> fpxs_nth (f * g) r = (0::'a)
[PROOF STEP]
show "fpxs_nth (f * g) r = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_nth (f * g) r = (0::'a)
[PROOF STEP]
unfolding fpxs_nth_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(y, z)\<in>{(y, z). y \<in> fpxs_supp f \<and> z \<in> fpxs_supp g \<and> r = y + z}. fpxs_nth f y * fpxs_nth g z) = (0::'a)
[PROOF STEP]
using assms fpxs_val_leI[of f] fpxs_val_leI[of g] r
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0
g \<noteq> 0
fpxs_nth f ?r \<noteq> (0::'a) \<Longrightarrow> fpxs_val f \<le> ?r
fpxs_nth g ?r \<noteq> (0::'a) \<Longrightarrow> fpxs_val g \<le> ?r
r < fpxs_val f + fpxs_val g

goal (1 subgoal):
 1. (\<Sum>(y, z)\<in>{(y, z). y \<in> fpxs_supp f \<and> z \<in> fpxs_supp g \<and> r = y + z}. fpxs_nth f y * fpxs_nth g z) = (0::'a)
[PROOF STEP]
by (intro sum.neutral; force)
[PROOF STATE]
proof (state)
this:
fpxs_nth (f * g) r = (0::'a)

goal (2 subgoals):
 1. fpxs_nth (f * g) (fpxs_val f + fpxs_val g) \<noteq> (0::'a)
 2. f * g \<noteq> 0
[PROOF STEP]
qed (use assms in \<open>auto simp: fpxs_nth_mult_val fpxs_nth_val_nonzero\<close>)


[STATEMENT]
lemma root_unity_witness: fixes xs :: "complex list"
  assumes "prod_list (map (\<lambda> x. [:-x,1:]) xs) = monom 1 n - 1"
  shows "x^n = 1 \<longleftrightarrow> x \<in> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x ^ n = 1) = (x \<in> set xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x ^ n = 1) = (x \<in> set xs)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>x\<leftarrow>xs. [:- x, 1:]) = monom 1 n - 1
[PROOF STEP]
have n0: "n \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>x\<leftarrow>xs. [:- x, 1:]) = monom 1 n - 1

goal (1 subgoal):
 1. n \<noteq> 0
[PROOF STEP]
by (cases "n = 0", auto simp: prod_list_zero_iff)
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. (x ^ n = 1) = (x \<in> set xs)
[PROOF STEP]
have "x \<in> set xs \<longleftrightarrow> poly (prod_list (map (\<lambda> x. [:-x,1:]) xs)) x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set xs) = (poly (\<Prod>x\<leftarrow>xs. [:- x, 1:]) x = 0)
[PROOF STEP]
unfolding poly_prod_list prod_list_zero_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set xs) = (0 \<in> set (map (\<lambda>p. poly p x) (map (\<lambda>x. [:- x, 1:]) xs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x \<in> set xs) = (poly (\<Prod>x\<leftarrow>xs. [:- x, 1:]) x = 0)

goal (1 subgoal):
 1. (x ^ n = 1) = (x \<in> set xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<in> set xs) = (poly (\<Prod>x\<leftarrow>xs. [:- x, 1:]) x = 0)

goal (1 subgoal):
 1. (x ^ n = 1) = (x \<in> set xs)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> x^n = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (\<Prod>x\<leftarrow>xs. [:- x, 1:]) x = 0) = (x ^ n = 1)
[PROOF STEP]
using roots_of_unity(2)[OF n0]
[PROOF STATE]
proof (prove)
using this:
{x. poly (root_unity n) x = 0} = {x. x ^ n = 1}

goal (1 subgoal):
 1. (poly (\<Prod>x\<leftarrow>xs. [:- x, 1:]) x = 0) = (x ^ n = 1)
[PROOF STEP]
unfolding assms root_unity_def
[PROOF STATE]
proof (prove)
using this:
{x. poly (monom 1 n - 1) x = 0} = {x. x ^ n = 1}

goal (1 subgoal):
 1. (poly (monom 1 n - 1) x = 0) = (x ^ n = 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(poly (\<Prod>x\<leftarrow>xs. [:- x, 1:]) x = 0) = (x ^ n = 1)

goal (1 subgoal):
 1. (x ^ n = 1) = (x \<in> set xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x \<in> set xs) = (x ^ n = 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x \<in> set xs) = (x ^ n = 1)

goal (1 subgoal):
 1. (x ^ n = 1) = (x \<in> set xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x ^ n = 1) = (x \<in> set xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma div2_plus_div2: "n div 2 + n div 2 = (n :: nat) - n mod 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div 2 + n div 2 = n - n mod 2
[PROOF STEP]
by arith


[STATEMENT]
theorem succ_bound_size_univ: "invar_vebt t n \<Longrightarrow> u =  2^n \<Longrightarrow>   T\<^sub>s\<^sub>u\<^sub>c\<^sub>c t x \<le> 54 + 27 * lb (lb u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>s\<^sub>u\<^sub>c\<^sub>c t x) \<le> 54 + 27 * log 2 (log 2 u)
[PROOF STEP]
using succ_bound_height[of t n x] height_double_log_univ_size[of u n t]
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n \<Longrightarrow> T\<^sub>s\<^sub>u\<^sub>c\<^sub>c t x \<le> (1 + height t) * 27
\<lbrakk>u = 2 ^ n; invar_vebt t n\<rbrakk> \<Longrightarrow> real (height t) \<le> 1 + log 2 (log 2 u)

goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>s\<^sub>u\<^sub>c\<^sub>c t x) \<le> 54 + 27 * log 2 (log 2 u)
[PROOF STEP]
by simp


[STATEMENT]
lemma countably_compact_imp_acc_point:
  assumes "countably_compact s"
    and "countable t"
    and "infinite t"
    and "t \<subseteq> s"
  shows "\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
define C where "C = (\<lambda>F. interior (F \<union> (- t))) ` {F. finite F \<and> F \<subseteq> t }"
[PROOF STATE]
proof (state)
this:
C = (\<lambda>F. interior (F \<union> - t)) ` {F. finite F \<and> F \<subseteq> t}

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
note \<open>countably_compact s\<close>
[PROOF STATE]
proof (state)
this:
countably_compact s

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
countably_compact s

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
have "\<forall>t\<in>C. open t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t\<in>C. open t
[PROOF STEP]
by (auto simp: C_def)
[PROOF STATE]
proof (state)
this:
\<forall>t\<in>C. open t

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>t\<in>C. open t

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t))"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t))

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t))
[PROOF STEP]
have s: "\<And>x. x \<in> s \<Longrightarrow> \<exists>U. x\<in>U \<and> open U \<and> finite (U \<inter> t)"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t))

goal (1 subgoal):
 1. \<And>x. x \<in> s \<Longrightarrow> \<exists>U. x \<in> U \<and> open U \<and> finite (U \<inter> t)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
?x \<in> s \<Longrightarrow> \<exists>U. ?x \<in> U \<and> open U \<and> finite (U \<inter> t)

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
have "s \<subseteq> \<Union>C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<subseteq> \<Union> C
[PROOF STEP]
using \<open>t \<subseteq> s\<close>
[PROOF STATE]
proof (prove)
using this:
t \<subseteq> s

goal (1 subgoal):
 1. s \<subseteq> \<Union> C
[PROOF STEP]
unfolding C_def
[PROOF STATE]
proof (prove)
using this:
t \<subseteq> s

goal (1 subgoal):
 1. s \<subseteq> (\<Union>F\<in>{F. finite F \<and> F \<subseteq> t}. interior (F \<union> - t))
[PROOF STEP]
apply (safe dest!: s)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x U. \<lbrakk>t \<subseteq> s; x \<in> U; open U; finite (U \<inter> t)\<rbrakk> \<Longrightarrow> x \<in> (\<Union>F\<in>{F. finite F \<and> F \<subseteq> t}. interior (F \<union> - t))
[PROOF STEP]
apply (rule_tac a="U \<inter> t" in UN_I)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x U. \<lbrakk>t \<subseteq> s; x \<in> U; open U; finite (U \<inter> t)\<rbrakk> \<Longrightarrow> U \<inter> t \<in> {F. finite F \<and> F \<subseteq> t}
 2. \<And>x U. \<lbrakk>t \<subseteq> s; x \<in> U; open U; finite (U \<inter> t)\<rbrakk> \<Longrightarrow> x \<in> interior (U \<inter> t \<union> - t)
[PROOF STEP]
apply (auto intro!: interiorI simp add: finite_subset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
s \<subseteq> \<Union> C

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
s \<subseteq> \<Union> C

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
from \<open>countable t\<close>
[PROOF STATE]
proof (chain)
picking this:
countable t
[PROOF STEP]
have "countable C"
[PROOF STATE]
proof (prove)
using this:
countable t

goal (1 subgoal):
 1. countable C
[PROOF STEP]
unfolding C_def
[PROOF STATE]
proof (prove)
using this:
countable t

goal (1 subgoal):
 1. countable ((\<lambda>F. interior (F \<union> - t)) ` {F. finite F \<and> F \<subseteq> t})
[PROOF STEP]
by (auto intro: countable_Collect_finite_subset)
[PROOF STATE]
proof (state)
this:
countable C

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
countably_compact s
\<forall>t\<in>C. open t
s \<subseteq> \<Union> C
countable C
[PROOF STEP]
obtain D where "D \<subseteq> C" "finite D" "s \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
countably_compact s
\<forall>t\<in>C. open t
s \<subseteq> \<Union> C
countable C

goal (1 subgoal):
 1. (\<And>D. \<lbrakk>D \<subseteq> C; finite D; s \<subseteq> \<Union> D\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule countably_compactE)
[PROOF STATE]
proof (state)
this:
D \<subseteq> C
finite D
s \<subseteq> \<Union> D

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
D \<subseteq> C
finite D
s \<subseteq> \<Union> D
[PROOF STEP]
obtain E where E: "E \<subseteq> {F. finite F \<and> F \<subseteq> t }" "finite E"
    and s: "s \<subseteq> (\<Union>F\<in>E. interior (F \<union> (- t)))"
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> C
finite D
s \<subseteq> \<Union> D

goal (1 subgoal):
 1. (\<And>E. \<lbrakk>E \<subseteq> {F. finite F \<and> F \<subseteq> t}; finite E; s \<subseteq> (\<Union>F\<in>E. interior (F \<union> - t))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (lifting) finite_subset_image C_def)
[PROOF STATE]
proof (state)
this:
E \<subseteq> {F. finite F \<and> F \<subseteq> t}
finite E
s \<subseteq> (\<Union>F\<in>E. interior (F \<union> - t))

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
from s \<open>t \<subseteq> s\<close>
[PROOF STATE]
proof (chain)
picking this:
s \<subseteq> (\<Union>F\<in>E. interior (F \<union> - t))
t \<subseteq> s
[PROOF STEP]
have "t \<subseteq> \<Union>E"
[PROOF STATE]
proof (prove)
using this:
s \<subseteq> (\<Union>F\<in>E. interior (F \<union> - t))
t \<subseteq> s

goal (1 subgoal):
 1. t \<subseteq> \<Union> E
[PROOF STEP]
using interior_subset
[PROOF STATE]
proof (prove)
using this:
s \<subseteq> (\<Union>F\<in>E. interior (F \<union> - t))
t \<subseteq> s
interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. t \<subseteq> \<Union> E
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
t \<subseteq> \<Union> E

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
t \<subseteq> \<Union> E

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
have "finite (\<Union>E)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union> E)
[PROOF STEP]
using E
[PROOF STATE]
proof (prove)
using this:
E \<subseteq> {F. finite F \<and> F \<subseteq> t}
finite E

goal (1 subgoal):
 1. finite (\<Union> E)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (\<Union> E)

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>s. \<forall>U. x \<in> U \<and> open U \<longrightarrow> infinite (U \<inter> t)) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
t \<subseteq> \<Union> E
finite (\<Union> E)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
t \<subseteq> \<Union> E
finite (\<Union> E)

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>infinite t\<close>
[PROOF STATE]
proof (prove)
using this:
t \<subseteq> \<Union> E
finite (\<Union> E)
infinite t

goal (1 subgoal):
 1. False
[PROOF STEP]
by (auto simp: finite_subset)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem pr_b_least: "f \<in> PrimRec2 \<Longrightarrow> b_least f \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> PrimRec2 \<Longrightarrow> b_least f \<in> PrimRec1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<in> PrimRec2 \<Longrightarrow> b_least f \<in> PrimRec1
[PROOF STEP]
assume "f \<in> PrimRec2"
[PROOF STATE]
proof (state)
this:
f \<in> PrimRec2

goal (1 subgoal):
 1. f \<in> PrimRec2 \<Longrightarrow> b_least f \<in> PrimRec1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<in> PrimRec2
[PROOF STEP]
have "b_least2 f \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
f \<in> PrimRec2

goal (1 subgoal):
 1. b_least2 f \<in> PrimRec2
[PROOF STEP]
by (rule pr_b_least2)
[PROOF STATE]
proof (state)
this:
b_least2 f \<in> PrimRec2

goal (1 subgoal):
 1. f \<in> PrimRec2 \<Longrightarrow> b_least f \<in> PrimRec1
[PROOF STEP]
from this pr_id1_1 pr_id1_1
[PROOF STATE]
proof (chain)
picking this:
b_least2 f \<in> PrimRec2
(\<lambda>x. x) \<in> PrimRec1
(\<lambda>x. x) \<in> PrimRec1
[PROOF STEP]
have "(\<lambda> x. b_least2 f x x) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
b_least2 f \<in> PrimRec2
(\<lambda>x. x) \<in> PrimRec1
(\<lambda>x. x) \<in> PrimRec1

goal (1 subgoal):
 1. (\<lambda>x. b_least2 f x x) \<in> PrimRec1
[PROOF STEP]
by (rule pr_comp2_1)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. b_least2 f x x) \<in> PrimRec1

goal (1 subgoal):
 1. f \<in> PrimRec2 \<Longrightarrow> b_least f \<in> PrimRec1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. b_least2 f x x) \<in> PrimRec1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. b_least2 f x x) \<in> PrimRec1

goal (1 subgoal):
 1. b_least f \<in> PrimRec1
[PROOF STEP]
by (simp add: b_least_def1)
[PROOF STATE]
proof (state)
this:
b_least f \<in> PrimRec1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_eq_append_conv:
  "map f xs = ys @ zs \<longleftrightarrow> (\<exists>us vs. xs = us @ vs \<and> ys = map f us \<and> zs = map f vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map f xs = ys @ zs) = (\<exists>us vs. xs = us @ vs \<and> ys = map f us \<and> zs = map f vs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (map f xs = ys @ zs) = (\<exists>us vs. xs = us @ vs \<and> ys = map f us \<and> zs = map f vs)
[PROOF STEP]
have "map f xs \<noteq> ys @ zs \<and> map f xs \<noteq> ys @ zs \<or> map f xs \<noteq> ys @ zs \<or> map f xs = ys @ zs \<and>
    (\<exists>bs bsa. xs = bs @ bsa \<and> ys = map f bs \<and> zs = map f bsa)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f xs \<noteq> ys @ zs \<and> map f xs \<noteq> ys @ zs \<or> map f xs \<noteq> ys @ zs \<or> map f xs = ys @ zs \<and> (\<exists>bs bsa. xs = bs @ bsa \<and> ys = map f bs \<and> zs = map f bsa)
[PROOF STEP]
by (metis append_eq_conv_conj append_take_drop_id drop_map take_map)
[PROOF STATE]
proof (state)
this:
map f xs \<noteq> ys @ zs \<and> map f xs \<noteq> ys @ zs \<or> map f xs \<noteq> ys @ zs \<or> map f xs = ys @ zs \<and> (\<exists>bs bsa. xs = bs @ bsa \<and> ys = map f bs \<and> zs = map f bsa)

goal (1 subgoal):
 1. (map f xs = ys @ zs) = (\<exists>us vs. xs = us @ vs \<and> ys = map f us \<and> zs = map f vs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
map f xs \<noteq> ys @ zs \<and> map f xs \<noteq> ys @ zs \<or> map f xs \<noteq> ys @ zs \<or> map f xs = ys @ zs \<and> (\<exists>bs bsa. xs = bs @ bsa \<and> ys = map f bs \<and> zs = map f bsa)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
map f xs \<noteq> ys @ zs \<and> map f xs \<noteq> ys @ zs \<or> map f xs \<noteq> ys @ zs \<or> map f xs = ys @ zs \<and> (\<exists>bs bsa. xs = bs @ bsa \<and> ys = map f bs \<and> zs = map f bsa)

goal (1 subgoal):
 1. (map f xs = ys @ zs) = (\<exists>us vs. xs = us @ vs \<and> ys = map f us \<and> zs = map f vs)
[PROOF STEP]
using map_append
[PROOF STATE]
proof (prove)
using this:
map f xs \<noteq> ys @ zs \<and> map f xs \<noteq> ys @ zs \<or> map f xs \<noteq> ys @ zs \<or> map f xs = ys @ zs \<and> (\<exists>bs bsa. xs = bs @ bsa \<and> ys = map f bs \<and> zs = map f bsa)
map ?f (?xs @ ?ys) = map ?f ?xs @ map ?f ?ys

goal (1 subgoal):
 1. (map f xs = ys @ zs) = (\<exists>us vs. xs = us @ vs \<and> ys = map f us \<and> zs = map f vs)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(map f xs = ys @ zs) = (\<exists>us vs. xs = us @ vs \<and> ys = map f us \<and> zs = map f vs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_lnull_conv: "\<not> lnull xs \<longleftrightarrow> (\<exists>x xs'. xs = LCons x xs')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> lnull xs) = (\<exists>x xs'. xs = LCons x xs')
[PROOF STEP]
unfolding lnull_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs \<noteq> LNil) = (\<exists>x xs'. xs = LCons x xs')
[PROOF STEP]
by(simp add: neq_LNil_conv)


[STATEMENT]
lemma arctan_inverse_pos: "x > 0 \<Longrightarrow> arctan x = pi / 2 - arctan (inverse x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> arctan x = pi / 2 - arctan (inverse x)
[PROOF STEP]
using arctan_inverse[of x]
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0 \<Longrightarrow> arctan (1 / x) = sgn x * pi / 2 - arctan x

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> arctan x = pi / 2 - arctan (inverse x)
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma (in dcharacter) even_dcharacter_linear_sum_eq_0 [simp]:
  assumes "\<chi> \<noteq> principal_dchar n" and "\<chi> (n - 1) = 1"
  shows   "(\<Sum>k=Suc 0..<n. of_nat k * \<chi> k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
have "(\<Sum>k=1..<n. of_nat k * \<chi> k) = (\<Sum>k=1..<n. (of_nat n - of_nat k) * \<chi> (n - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..<n. of_nat k * \<chi> k) = (\<Sum>k = 1..<n. (of_nat n - of_nat k) * \<chi> (n - k))
[PROOF STEP]
by (intro sum.reindex_bij_witness[where i = "\<lambda>k. n - k" and j = "\<lambda>k. n - k"])
       (auto simp: of_nat_diff)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..<n. of_nat k * \<chi> k) = (\<Sum>k = 1..<n. (of_nat n - of_nat k) * \<chi> (n - k))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..<n. of_nat k * \<chi> k) = (\<Sum>k = 1..<n. (of_nat n - of_nat k) * \<chi> (n - k))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
have "\<dots> = n * (\<Sum>k=1..<n. \<chi> (n - k)) - (\<Sum>k=1..<n. k * \<chi> (n - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..<n. (of_nat n - of_nat k) * \<chi> (n - k)) = of_nat n * (\<Sum>k = 1..<n. \<chi> (n - k)) - (\<Sum>k = 1..<n. of_nat k * \<chi> (n - k))
[PROOF STEP]
by (simp add: algebra_simps sum_subtractf sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..<n. (of_nat n - of_nat k) * \<chi> (n - k)) = of_nat n * (\<Sum>k = 1..<n. \<chi> (n - k)) - (\<Sum>k = 1..<n. of_nat k * \<chi> (n - k))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..<n. (of_nat n - of_nat k) * \<chi> (n - k)) = of_nat n * (\<Sum>k = 1..<n. \<chi> (n - k)) - (\<Sum>k = 1..<n. of_nat k * \<chi> (n - k))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
have "(\<Sum>k=1..<n. \<chi> (n - k)) = (\<Sum>k=1..<n. \<chi> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..<n. \<chi> (n - k)) = sum \<chi> {1..<n}
[PROOF STEP]
by (intro sum.reindex_bij_witness[where i = "\<lambda>k. n - k" and j = "\<lambda>k. n - k"]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..<n. \<chi> (n - k)) = sum \<chi> {1..<n}

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..<n. \<chi> (n - k)) = sum \<chi> {1..<n}

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
have "\<dots> = (\<Sum>k<n. \<chi> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum \<chi> {1..<n} = sum \<chi> {..<n}
[PROOF STEP]
by (intro sum.mono_neutral_left) (auto simp: Suc_le_eq)
[PROOF STATE]
proof (state)
this:
sum \<chi> {1..<n} = sum \<chi> {..<n}

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum \<chi> {1..<n} = sum \<chi> {..<n}

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum \<chi> {..<n} = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> principal_dchar n
\<chi> (n - 1) = 1

goal (1 subgoal):
 1. sum \<chi> {..<n} = 0
[PROOF STEP]
by (simp add: sum_dcharacter_block)
[PROOF STATE]
proof (state)
this:
sum \<chi> {..<n} = 0

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum \<chi> {..<n} = 0

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
have "(\<Sum>k=1..<n. of_nat k * \<chi> (n - k)) = (\<Sum>k=1..<n. k * \<chi> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..<n. of_nat k * \<chi> (n - k)) = (\<Sum>k = 1..<n. of_nat k * \<chi> k)
[PROOF STEP]
proof (intro sum.cong refl)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {1..<n} \<Longrightarrow> of_nat x * \<chi> (n - x) = of_nat x * \<chi> x
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {1..<n} \<Longrightarrow> of_nat x * \<chi> (n - x) = of_nat x * \<chi> x
[PROOF STEP]
assume k: "k \<in> {1..<n}"
[PROOF STATE]
proof (state)
this:
k \<in> {1..<n}

goal (1 subgoal):
 1. \<And>x. x \<in> {1..<n} \<Longrightarrow> of_nat x * \<chi> (n - x) = of_nat x * \<chi> x
[PROOF STEP]
have "of_nat k * \<chi> k = of_nat k * \<chi> ((n - 1) * k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat k * \<chi> k = of_nat k * \<chi> ((n - 1) * k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> principal_dchar n
\<chi> (n - 1) = 1

goal (1 subgoal):
 1. of_nat k * \<chi> k = of_nat k * \<chi> ((n - 1) * k)
[PROOF STEP]
by (subst mult) simp_all
[PROOF STATE]
proof (state)
this:
of_nat k * \<chi> k = of_nat k * \<chi> ((n - 1) * k)

goal (1 subgoal):
 1. \<And>x. x \<in> {1..<n} \<Longrightarrow> of_nat x * \<chi> (n - x) = of_nat x * \<chi> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat k * \<chi> k = of_nat k * \<chi> ((n - 1) * k)

goal (1 subgoal):
 1. \<And>x. x \<in> {1..<n} \<Longrightarrow> of_nat x * \<chi> (n - x) = of_nat x * \<chi> x
[PROOF STEP]
have "(n - 1) * k = n - k + (k - 1) * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n - 1) * k = n - k + (k - 1) * n
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k \<in> {1..<n}

goal (1 subgoal):
 1. (n - 1) * k = n - k + (k - 1) * n
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(n - 1) * k = n - k + (k - 1) * n

goal (1 subgoal):
 1. \<And>x. x \<in> {1..<n} \<Longrightarrow> of_nat x * \<chi> (n - x) = of_nat x * \<chi> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(n - 1) * k = n - k + (k - 1) * n

goal (1 subgoal):
 1. \<And>x. x \<in> {1..<n} \<Longrightarrow> of_nat x * \<chi> (n - x) = of_nat x * \<chi> x
[PROOF STEP]
have "\<chi> \<dots> = \<chi> (n - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> (n - k + (k - 1) * n) = \<chi> (n - k)
[PROOF STEP]
by (rule periodic_mult)
[PROOF STATE]
proof (state)
this:
\<chi> (n - k + (k - 1) * n) = \<chi> (n - k)

goal (1 subgoal):
 1. \<And>x. x \<in> {1..<n} \<Longrightarrow> of_nat x * \<chi> (n - x) = of_nat x * \<chi> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_nat k * \<chi> k = of_nat k * \<chi> (n - k)
[PROOF STEP]
show "of_nat k * \<chi> (n - k) = of_nat k * \<chi> k"
[PROOF STATE]
proof (prove)
using this:
of_nat k * \<chi> k = of_nat k * \<chi> (n - k)

goal (1 subgoal):
 1. of_nat k * \<chi> (n - k) = of_nat k * \<chi> k
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
of_nat k * \<chi> (n - k) = of_nat k * \<chi> k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..<n. of_nat k * \<chi> (n - k)) = (\<Sum>k = 1..<n. of_nat k * \<chi> k)

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = 1..<n. of_nat k * \<chi> k) = of_nat n * 0 - (\<Sum>k = 1..<n. of_nat k * \<chi> k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 1..<n. of_nat k * \<chi> k) = of_nat n * 0 - (\<Sum>k = 1..<n. of_nat k * \<chi> k)

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..<n. of_nat k * \<chi> k) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_conj_unit_commute:
  assumes "unitary U"
  and "U*A = A*U"
  and "A\<in> carrier_mat n n"
  and "U\<in> carrier_mat n n"
shows "mat_conj U A = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_conj U A = A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_conj U A = A
[PROOF STEP]
have "mat_conj U A = A*U * Complex_Matrix.adjoint U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_conj U A = A * U * Complex_Matrix.adjoint U
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U
U * A = A * U
A \<in> carrier_mat n n
U \<in> carrier_mat n n

goal (1 subgoal):
 1. mat_conj U A = A * U * Complex_Matrix.adjoint U
[PROOF STEP]
unfolding mat_conj_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U
U * A = A * U
A \<in> carrier_mat n n
U \<in> carrier_mat n n

goal (1 subgoal):
 1. U * A * Complex_Matrix.adjoint U = A * U * Complex_Matrix.adjoint U
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_conj U A = A * U * Complex_Matrix.adjoint U

goal (1 subgoal):
 1. mat_conj U A = A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_conj U A = A * U * Complex_Matrix.adjoint U

goal (1 subgoal):
 1. mat_conj U A = A
[PROOF STEP]
have "... = A * (U * Complex_Matrix.adjoint U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * U * Complex_Matrix.adjoint U = A * (U * Complex_Matrix.adjoint U)
[PROOF STEP]
proof (rule assoc_mult_mat, auto simp add: assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U \<in> carrier_mat (dim_col A) (dim_col U)
[PROOF STEP]
show "U \<in> carrier_mat (dim_col A) (dim_col U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<in> carrier_mat (dim_col A) (dim_col U)
[PROOF STEP]
using assms(3) assms(4)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
U \<in> carrier_mat n n

goal (1 subgoal):
 1. U \<in> carrier_mat (dim_col A) (dim_col U)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U \<in> carrier_mat (dim_col A) (dim_col U)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A * U * Complex_Matrix.adjoint U = A * (U * Complex_Matrix.adjoint U)

goal (1 subgoal):
 1. mat_conj U A = A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A * U * Complex_Matrix.adjoint U = A * (U * Complex_Matrix.adjoint U)

goal (1 subgoal):
 1. mat_conj U A = A
[PROOF STEP]
have "... = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * (U * Complex_Matrix.adjoint U) = A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U
U * A = A * U
A \<in> carrier_mat n n
U \<in> carrier_mat n n

goal (1 subgoal):
 1. A * (U * Complex_Matrix.adjoint U) = A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * (U * Complex_Matrix.adjoint U) = A

goal (1 subgoal):
 1. mat_conj U A = A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_conj U A = A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_conj U A = A

goal (1 subgoal):
 1. mat_conj U A = A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mat_conj U A = A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_rank_le:
  assumes "finite A"
  shows   "linorder_rank R A x \<le> card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_rank R A x \<le> card A
[PROOF STEP]
unfolding linorder_rank_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {y \<in> A - {x}. (y, x) \<in> R} \<le> card A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card {y \<in> A - {x}. (y, x) \<in> R} \<le> card A
[PROOF STEP]
by (rule card_mono) auto


[STATEMENT]
lemma int_of_uint64_0: "int_of_uint64 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int_of_uint64 0 = 0
[PROOF STEP]
unfolding int_of_uint64_0_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma discount_factor_positive:
  assumes "-1 < r"
  shows "\<And>n w . 0 < discount_factor r n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n w. 0 < discount_factor r n w
[PROOF STEP]
using assms disc_rfr_proc_positive
[PROOF STATE]
proof (prove)
using this:
- 1 < r
- 1 < ?r \<Longrightarrow> 0 < disc_rfr_proc ?r ?n ?w

goal (1 subgoal):
 1. \<And>n w. 0 < discount_factor r n w
[PROOF STEP]
unfolding discount_factor_def
[PROOF STATE]
proof (prove)
using this:
- 1 < r
- 1 < ?r \<Longrightarrow> 0 < disc_rfr_proc ?r ?n ?w

goal (1 subgoal):
 1. \<And>n w. 0 < inverse (disc_rfr_proc r n w)
[PROOF STEP]
by auto


[STATEMENT]
lemma hausdorff_distance_points [simp]:
  "hausdorff_distance {x} {y} = dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hausdorff_distance {x} {y} = dist x y
[PROOF STEP]
unfolding hausdorff_distance_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if {x} = {} \<or> {y} = {} \<or> \<not> bounded {x} \<or> \<not> bounded {y} then 0 else max (SUP x\<in>{x}. infdist x {y}) (SUP xa\<in>{y}. infdist xa {x})) = dist x y
[PROOF STEP]
by (auto, metis dist_commute max.idem)