[STATEMENT]
lemma continuous_IVT_local_extremum:
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
  assumes contf: "continuous_on (closed_segment a b) f"
      and "a \<noteq> b" "f a = f b"
  obtains z where "z \<in> open_segment a b"
                  "(\<forall>w \<in> closed_segment a b. (f w) \<le> (f z)) \<or>
                   (\<forall>w \<in> closed_segment a b. (f z) \<le> (f w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> open_segment a b; (\<forall>w\<in>closed_segment a b. f w \<le> f z) \<or> (\<forall>w\<in>closed_segment a b. f z \<le> f w)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> open_segment a b; (\<forall>w\<in>closed_segment a b. f w \<le> f z) \<or> (\<forall>w\<in>closed_segment a b. f z \<le> f w)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain c where "c \<in> closed_segment a b" and c: "\<And>y. y \<in> closed_segment a b \<Longrightarrow> f y \<le> f c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> closed_segment a b; \<And>y. y \<in> closed_segment a b \<Longrightarrow> f y \<le> f c\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using continuous_attains_sup [of "closed_segment a b" f] contf
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>compact (closed_segment a b); closed_segment a b \<noteq> {}; continuous_on (closed_segment a b) f\<rbrakk> \<Longrightarrow> \<exists>x\<in>closed_segment a b. \<forall>y\<in>closed_segment a b. f y \<le> f x
continuous_on (closed_segment a b) f

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

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> open_segment a b; (\<forall>w\<in>closed_segment a b. f w \<le> f z) \<or> (\<forall>w\<in>closed_segment a b. f z \<le> f w)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain d where "d \<in> closed_segment a b" and d: "\<And>y. y \<in> closed_segment a b \<Longrightarrow> f d \<le> f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>d \<in> closed_segment a b; \<And>y. y \<in> closed_segment a b \<Longrightarrow> f d \<le> f y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using continuous_attains_inf [of "closed_segment a b" f] contf
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>compact (closed_segment a b); closed_segment a b \<noteq> {}; continuous_on (closed_segment a b) f\<rbrakk> \<Longrightarrow> \<exists>x\<in>closed_segment a b. \<forall>y\<in>closed_segment a b. f x \<le> f y
continuous_on (closed_segment a b) f

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

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> open_segment a b; (\<forall>w\<in>closed_segment a b. f w \<le> f z) \<or> (\<forall>w\<in>closed_segment a b. f z \<le> f w)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof (cases "c \<in> open_segment a b \<or> d \<in> open_segment a b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c \<in> open_segment a b \<or> d \<in> open_segment a b \<Longrightarrow> thesis
 2. \<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b) \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c \<in> open_segment a b \<or> d \<in> open_segment a b

goal (2 subgoals):
 1. c \<in> open_segment a b \<or> d \<in> open_segment a b \<Longrightarrow> thesis
 2. \<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<in> open_segment a b \<or> d \<in> open_segment a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c \<in> open_segment a b \<or> d \<in> open_segment a b

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using c d that
[PROOF STATE]
proof (prove)
using this:
c \<in> open_segment a b \<or> d \<in> open_segment a b
?y \<in> closed_segment a b \<Longrightarrow> f ?y \<le> f c
?y \<in> closed_segment a b \<Longrightarrow> f d \<le> f ?y
\<lbrakk>?z \<in> open_segment a b; (\<forall>w\<in>closed_segment a b. f w \<le> f ?z) \<or> (\<forall>w\<in>closed_segment a b. f ?z \<le> f w)\<rbrakk> \<Longrightarrow> thesis

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

goal (1 subgoal):
 1. \<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b) \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b) \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b)

goal (1 subgoal):
 1. \<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b)
[PROOF STEP]
have "(c = a \<or> c = b) \<and> (d = a \<or> d = b)"
[PROOF STATE]
proof (prove)
using this:
\<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b)

goal (1 subgoal):
 1. (c = a \<or> c = b) \<and> (d = a \<or> d = b)
[PROOF STEP]
by (simp add: \<open>c \<in> closed_segment a b\<close> \<open>d \<in> closed_segment a b\<close> open_segment_def)
[PROOF STATE]
proof (state)
this:
(c = a \<or> c = b) \<and> (d = a \<or> d = b)

goal (1 subgoal):
 1. \<not> (c \<in> open_segment a b \<or> d \<in> open_segment a b) \<Longrightarrow> thesis
[PROOF STEP]
with \<open>a \<noteq> b\<close> \<open>f a = f b\<close> c d
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> b
f a = f b
?y \<in> closed_segment a b \<Longrightarrow> f ?y \<le> f c
?y \<in> closed_segment a b \<Longrightarrow> f d \<le> f ?y
(c = a \<or> c = b) \<and> (d = a \<or> d = b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b
f a = f b
?y \<in> closed_segment a b \<Longrightarrow> f ?y \<le> f c
?y \<in> closed_segment a b \<Longrightarrow> f d \<le> f ?y
(c = a \<or> c = b) \<and> (d = a \<or> d = b)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (rule_tac z = "midpoint a b" in that) (fastforce+)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_sqrt_ge_zero: "0 \<le> x \<Longrightarrow> 0 \<le> sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> 0 \<le> sqrt x
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> 0 \<le> root 2 x
[PROOF STEP]
by (rule real_root_ge_zero)


[STATEMENT]
lemma sum_cmul:
  fixes f:: "'c \<Rightarrow> ('a::semiring_1)^'n"
  shows "sum (\<lambda>x. c *s f x) S = c *s sum f S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>S. c *s f x) = c *s sum f S
[PROOF STEP]
by (simp add: vec_eq_iff sum_distrib_left)


[STATEMENT]
theorem bij_betw_linorder_of_list:
  assumes "finite A"
  shows   "bij_betw linorder_of_list (permutations_of_set A) {R. linorder_on A R}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw linorder_of_list (permutations_of_set A) {R. linorder_on A R}
[PROOF STEP]
proof (intro bij_betw_byWitness[where f' = "\<lambda>R. sorted_wrt_list_of_set R A"] ballI subsetI,
       goal_cases)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>a. a \<in> permutations_of_set A \<Longrightarrow> sorted_wrt_list_of_set (linorder_of_list a) A = a
 2. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 3. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 4. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
case (1 xs)
[PROOF STATE]
proof (state)
this:
xs \<in> permutations_of_set A

goal (4 subgoals):
 1. \<And>a. a \<in> permutations_of_set A \<Longrightarrow> sorted_wrt_list_of_set (linorder_of_list a) A = a
 2. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 3. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 4. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
xs \<in> permutations_of_set A

goal (1 subgoal):
 1. sorted_wrt_list_of_set (linorder_of_list xs) A = xs
[PROOF STEP]
by (intro sorted_wrt_list_of_set_eqI) (auto simp: permutations_of_set_def)
[PROOF STATE]
proof (state)
this:
sorted_wrt_list_of_set (linorder_of_list xs) A = xs

goal (3 subgoals):
 1. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 2. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 3. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 2. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 3. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
case (2 R)
[PROOF STATE]
proof (state)
this:
R \<in> {R. linorder_on A R}

goal (3 subgoals):
 1. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 2. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 3. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
hence R: "linorder_on A R"
[PROOF STATE]
proof (prove)
using this:
R \<in> {R. linorder_on A R}

goal (1 subgoal):
 1. linorder_on A R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
linorder_on A R

goal (3 subgoals):
 1. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 2. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 3. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
from R
[PROOF STATE]
proof (chain)
picking this:
linorder_on A R
[PROOF STEP]
have in_R: "x \<in> A" "y \<in> A" if "(x,y) \<in> R" for x y
[PROOF STATE]
proof (prove)
using this:
linorder_on A R

goal (1 subgoal):
 1. x \<in> A &&& y \<in> A
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
(x, y) \<in> R

goal (1 subgoal):
 1. x \<in> A &&& y \<in> A
[PROOF STEP]
by (auto simp: linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
(?x, ?y) \<in> R \<Longrightarrow> ?x \<in> A
(?x, ?y) \<in> R \<Longrightarrow> ?y \<in> A

goal (3 subgoals):
 1. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 2. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 3. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
let ?xs = "sorted_wrt_list_of_set R A"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 2. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 3. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
have xs: "distinct ?xs" "set ?xs = A" "sorted_wrt R ?xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (sorted_wrt_list_of_set R A) &&& set (sorted_wrt_list_of_set R A) = A &&& Linorder_Relations.sorted_wrt R (sorted_wrt_list_of_set R A)
[PROOF STEP]
by (rule linorder_sorted_wrt_list_of_set[OF R] assms order.refl)+
[PROOF STATE]
proof (state)
this:
distinct (sorted_wrt_list_of_set R A)
set (sorted_wrt_list_of_set R A) = A
Linorder_Relations.sorted_wrt R (sorted_wrt_list_of_set R A)

goal (3 subgoals):
 1. \<And>a'. a' \<in> {R. linorder_on A R} \<Longrightarrow> linorder_of_list (sorted_wrt_list_of_set a' A) = a'
 2. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 3. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
distinct (sorted_wrt_list_of_set R A)
set (sorted_wrt_list_of_set R A) = A
Linorder_Relations.sorted_wrt R (sorted_wrt_list_of_set R A)

goal (1 subgoal):
 1. linorder_of_list (sorted_wrt_list_of_set R A) = R
[PROOF STEP]
using sorted_wrt_linorder_index_le_iff[OF R, of ?xs]
[PROOF STATE]
proof (prove)
using this:
distinct (sorted_wrt_list_of_set R A)
set (sorted_wrt_list_of_set R A) = A
Linorder_Relations.sorted_wrt R (sorted_wrt_list_of_set R A)
\<lbrakk>set (sorted_wrt_list_of_set R A) \<subseteq> A; Linorder_Relations.sorted_wrt R (sorted_wrt_list_of_set R A); ?x \<in> set (sorted_wrt_list_of_set R A); ?y \<in> set (sorted_wrt_list_of_set R A)\<rbrakk> \<Longrightarrow> (index (sorted_wrt_list_of_set R A) ?x \<le> index (sorted_wrt_list_of_set R A) ?y) = ((?x, ?y) \<in> R)

goal (1 subgoal):
 1. linorder_of_list (sorted_wrt_list_of_set R A) = R
[PROOF STEP]
by (auto simp: linorder_of_list_def dest: in_R)
[PROOF STATE]
proof (state)
this:
linorder_of_list (sorted_wrt_list_of_set R A) = R

goal (2 subgoals):
 1. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 2. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 2. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
case (4 xs)
[PROOF STATE]
proof (state)
this:
xs \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R}

goal (2 subgoals):
 1. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 2. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R}
[PROOF STEP]
obtain R where R: "linorder_on A R" and xs [simp]: "xs = sorted_wrt_list_of_set R A"
[PROOF STATE]
proof (prove)
using this:
xs \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R}

goal (1 subgoal):
 1. (\<And>R. \<lbrakk>linorder_on A R; xs = sorted_wrt_list_of_set R A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
linorder_on A R
xs = sorted_wrt_list_of_set R A

goal (2 subgoals):
 1. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 2. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
let ?xs = "sorted_wrt_list_of_set R A"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 2. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
have xs: "distinct ?xs" "set ?xs = A" "sorted_wrt R ?xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (sorted_wrt_list_of_set R A) &&& set (sorted_wrt_list_of_set R A) = A &&& Linorder_Relations.sorted_wrt R (sorted_wrt_list_of_set R A)
[PROOF STEP]
by (rule linorder_sorted_wrt_list_of_set[OF R] assms order.refl)+
[PROOF STATE]
proof (state)
this:
distinct (sorted_wrt_list_of_set R A)
set (sorted_wrt_list_of_set R A) = A
Linorder_Relations.sorted_wrt R (sorted_wrt_list_of_set R A)

goal (2 subgoals):
 1. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
 2. \<And>x. x \<in> (\<lambda>R. sorted_wrt_list_of_set R A) ` {R. linorder_on A R} \<Longrightarrow> x \<in> permutations_of_set A
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
distinct (sorted_wrt_list_of_set R A)
set (sorted_wrt_list_of_set R A) = A
Linorder_Relations.sorted_wrt R (sorted_wrt_list_of_set R A)

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

goal (1 subgoal):
 1. \<And>x. x \<in> linorder_of_list ` permutations_of_set A \<Longrightarrow> x \<in> {R. linorder_on A R}
[PROOF STEP]
qed (auto simp: permutations_of_set_def)


[STATEMENT]
lemma sin_vangle_nonneg: "sin (vangle u v) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sin (vangle u v)
[PROOF STEP]
using vangle_bounds
[PROOF STATE]
proof (prove)
using this:
0 \<le> vangle ?u ?v
vangle ?u ?v \<le> pi

goal (1 subgoal):
 1. 0 \<le> sin (vangle u v)
[PROOF STEP]
by (rule sin_ge_zero)


[STATEMENT]
lemma equal_pair_count_mirror_pairwise[rule_format]: "
  \<lbrakk> length ps1 = length ps2;
    \<forall>i<length ps2. ps1 ! i = mirror_pair (ps2 ! i) \<rbrakk>
  \<Longrightarrow> equal_pair_count ps1 = equal_pair_count ps2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length ps1 = length ps2; \<forall>i<length ps2. ps1 ! i = mirror_pair (ps2 ! i)\<rbrakk> \<Longrightarrow> equal_pair_count ps1 = equal_pair_count ps2
[PROOF STEP]
apply (rule equal_pair_count_eq_pairwise, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>length ps1 = length ps2; \<forall>i<length ps2. ps1 ! i = mirror_pair (ps2 ! i); i < length ps2\<rbrakk> \<Longrightarrow> equal_pair (ps1 ! i) = equal_pair (ps2 ! i)
[PROOF STEP]
apply (simp add: mirror_pair_equal)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma binomial_Vandermonde_same: "sum (\<lambda>k. (n choose k)\<^sup>2) {0..n} = (2 * n) choose n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k)\<^sup>2) = 2 * n choose n
[PROOF STEP]
using binomial_Vandermonde[of n n n, symmetric]
[PROOF STATE]
proof (prove)
using this:
n + n choose n = (\<Sum>k = 0..n. (n choose k) * (n choose (n - k)))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k)\<^sup>2) = 2 * n choose n
[PROOF STEP]
unfolding mult_2
[PROOF STATE]
proof (prove)
using this:
n + n choose n = (\<Sum>k = 0..n. (n choose k) * (n choose (n - k)))

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (n choose k)\<^sup>2) = n + n choose n
[PROOF STEP]
by (metis atMost_atLeast0 choose_square_sum mult_2)


[STATEMENT]
lemma "continuous_on UNIV inv_stereographic"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on UNIV inv_stereographic
[PROOF STEP]
unfolding continuous_on_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>UNIV. dist x' x < d \<longrightarrow> dist (inv_stereographic x') (inv_stereographic x) < e
[PROOF STEP]
unfolding dist_complex_homo_def dist_riemann_sphere_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>UNIV. dist_fs x' x < d \<longrightarrow> dist_riemann_sphere' (inv_stereographic x') (inv_stereographic x) < e
[PROOF STEP]
by (subst dist_stereographic, auto)


[STATEMENT]
lemma scalar_vector_matrix_assoc:
  fixes k :: "'a::{field}" and x :: "'a::{field}^'n" and A :: "'a^'m^'n"
  shows "(k *s x) v* A = k *s (x v* A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k *s x v* A = k *s (x v* A)
[PROOF STEP]
by (metis transpose_matrix_vector vector_scalar_commute)


[STATEMENT]
theorem real_integrable_def:
  "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and>
    (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) \<noteq> \<infinity> \<and> (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M) \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M f = (f \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity> \<and> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>)
[PROOF STEP]
unfolding integrable_iff_bounded
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>) = (f \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity> \<and> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>)
[PROOF STEP]
proof (safe del: notI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 3. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
assume *: "(\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M) < \<infinity>"
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>

goal (3 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 3. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) \<le> (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M
[PROOF STEP]
by (intro nn_integral_mono) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M

goal (3 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 3. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M

goal (3 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 3. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
note *
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>

goal (3 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 3. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M < \<infinity>
[PROOF STEP]
show "(\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M < \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>

goal (2 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M) \<le> (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M
[PROOF STEP]
by (intro nn_integral_mono) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M

goal (2 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M

goal (2 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
note *
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>

goal (2 subgoals):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
 2. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M < \<infinity>
[PROOF STEP]
show "(\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M) \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M < \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
assume [measurable]: "f \<in> borel_measurable M"
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable M

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
assume fin: "(\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) \<noteq> \<infinity>" "(\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M) \<noteq> \<infinity>"
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
have "(\<integral>\<^sup>+ x. norm (f x) \<partial>M) = (\<integral>\<^sup>+ x. ennreal (f x) + ennreal (- f x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = \<integral>\<^sup>+ x. ennreal (f x) + ennreal (- f x) \<partial>M
[PROOF STEP]
by (intro nn_integral_cong) (auto simp: abs_real_def ennreal_neg)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = \<integral>\<^sup>+ x. ennreal (f x) + ennreal (- f x) \<partial>M

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = \<integral>\<^sup>+ x. ennreal (f x) + ennreal (- f x) \<partial>M

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
have"\<dots> = (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) + (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) + ennreal (- f x) \<partial>M = \<integral>\<^sup>+ x. ennreal (f x) \<partial>M + \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M
[PROOF STEP]
by (intro nn_integral_add) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) + ennreal (- f x) \<partial>M = \<integral>\<^sup>+ x. ennreal (f x) \<partial>M + \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) + ennreal (- f x) \<partial>M = \<integral>\<^sup>+ x. ennreal (f x) \<partial>M + \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
have "\<dots> < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M + \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M < \<infinity>
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M + \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M < \<infinity>
[PROOF STEP]
by (auto simp: less_top)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M + \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M < \<infinity>

goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>; \<integral>\<^sup>+ x. ennreal (- f x) \<partial>M \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
show "(\<integral>\<^sup>+ x. norm (f x) \<partial>M) < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma UNIV_7: "UNIV = {1::7, 2::7, 3::7, 4::7, 5::7, 6::7, 7::7}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = {1, 2, 3, 4, 5, 6, 7}
[PROOF STEP]
using exhaust_7
[PROOF STATE]
proof (prove)
using this:
?x = 1 \<or> ?x = 2 \<or> ?x = 3 \<or> ?x = 4 \<or> ?x = 5 \<or> ?x = 6 \<or> ?x = 7

goal (1 subgoal):
 1. UNIV = {1, 2, 3, 4, 5, 6, 7}
[PROOF STEP]
by auto


[STATEMENT]
lemma two_cong_0_iff_nat: "[2 = 0] (mod int p) \<longleftrightarrow> p = 1 \<or> p = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [2 = 0] (mod int p) = (p = 1 \<or> p = 2)
[PROOF STEP]
unfolding cong_iff_dvd_diff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int p dvd 2 - 0) = (p = 1 \<or> p = 2)
[PROOF STEP]
using two_is_prime_nat prime_nat_iff int_dvd_int_iff[of p 2]
[PROOF STATE]
proof (prove)
using this:
prime 2
prime ?n = (1 < ?n \<and> (\<forall>m. m dvd ?n \<longrightarrow> m = 1 \<or> m = ?n))
(int p dvd int 2) = (p dvd 2)

goal (1 subgoal):
 1. (int p dvd 2 - 0) = (p = 1 \<or> p = 2)
[PROOF STEP]
by auto


[STATEMENT]
lemma binomial_absorption: "Suc k * (n choose Suc k) = n * ((n - 1) choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k * (n choose Suc k) = n * (n - 1 choose k)
[PROOF STEP]
by (cases n) (simp_all add: binomial_eq_0 Suc_times_binomial del: binomial_Suc_Suc mult_Suc)


[STATEMENT]
lemma iadd_SUP_le_iff: "n + (SUP x\<in>A. f x :: enat) \<le> y \<longleftrightarrow> (if A = {} then n \<le> y else \<forall>x\<in>A. n + f x \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n + \<Squnion> (f ` A) \<le> y) = (if A = {} then n \<le> y else \<forall>x\<in>A. n + f x \<le> y)
[PROOF STEP]
by(simp add: bot_enat_def SUP_enat_add_right[symmetric] SUP_le_iff)


[STATEMENT]
lemma E_linear_plus2: "finite (set_pmf A) \<Longrightarrow> E (map_pmf f A) + E (map_pmf g A) = E (map_pmf (\<lambda>x. (f x) + (g x)) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set_pmf A) \<Longrightarrow> E (map_pmf f A) + E (map_pmf g A) = E (map_pmf (\<lambda>x. f x + g x) A)
[PROOF STEP]
unfolding E_def integral_map_pmf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set_pmf A) \<Longrightarrow> measure_pmf.expectation A f + measure_pmf.expectation A g = measure_pmf.expectation A (\<lambda>x. f x + g x)
[PROOF STEP]
apply(rule Bochner_Integration.integral_add[of "measure_pmf A" f g, symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (set_pmf A) \<Longrightarrow> integrable (measure_pmf A) f
 2. finite (set_pmf A) \<Longrightarrow> integrable (measure_pmf A) g
[PROOF STEP]
by (simp_all add: integrable_measure_pmf_finite)


[STATEMENT]
lemma convex_rel_interior_iff:
  fixes S :: "'n::euclidean_space set"
  assumes "convex S"
    and "S \<noteq> {}"
  shows "z \<in> rel_interior S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z \<in> rel_interior S) = (\<forall>x\<in>S. \<exists>e>1. (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)
[PROOF STEP]
using assms hull_subset[of S "affine"]
    convex_rel_interior_if[of S z] convex_rel_interior_only_if[of S z]
[PROOF STATE]
proof (prove)
using this:
convex S
S \<noteq> {}
S \<subseteq> affine hull S
\<lbrakk>convex S; z \<in> rel_interior S\<rbrakk> \<Longrightarrow> \<forall>x\<in>affine hull S. \<exists>m>1. \<forall>e. 1 < e \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S
\<lbrakk>convex S; S \<noteq> {}; \<forall>x\<in>S. \<exists>e>1. (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S\<rbrakk> \<Longrightarrow> z \<in> rel_interior S

goal (1 subgoal):
 1. (z \<in> rel_interior S) = (\<forall>x\<in>S. \<exists>e>1. (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)
[PROOF STEP]
by auto


[STATEMENT]
lemma cis_mult_cmod_id: "cis (Arg x) * of_real (cmod x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (Arg x) * complex_of_real (cmod x) = x
[PROOF STEP]
using rcis_cmod_Arg[unfolded rcis_def]
[PROOF STATE]
proof (prove)
using this:
complex_of_real (cmod ?z) * cis (Arg ?z) = ?z

goal (1 subgoal):
 1. cis (Arg x) * complex_of_real (cmod x) = x
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma bool_lists_card: "card {bl::bool list. length bl = m} = b^m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card {bl. length bl = m}) = b ^ m
[PROOF STEP]
using card_lists_length_eq[of "UNIV::bool set"]
[PROOF STATE]
proof (prove)
using this:
finite UNIV \<Longrightarrow> card {xs. set xs \<subseteq> UNIV \<and> length xs = ?n} = CARD(bool) ^ ?n

goal (1 subgoal):
 1. real (card {bl. length bl = m}) = b ^ m
[PROOF STEP]
by (simp add: b_val)


[STATEMENT]
lemma has_ell2_norm_bdd_above: \<open>has_ell2_norm x \<longleftrightarrow> bdd_above (sum (\<lambda>xa. norm ((x xa)\<^sup>2)) ` Collect finite)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_ell2_norm x = bdd_above (sum (\<lambda>xa. cmod ((x xa)\<^sup>2)) ` Collect finite)
[PROOF STEP]
by (simp add: has_ell2_norm_def abs_summable_iff_bdd_above)


[STATEMENT]
lemma subresultant_smult_right:assumes "(c :: 'a :: {comm_ring_1, semiring_no_zero_divisors}) \<noteq> 0"
  shows "subresultant J f (smult c g) = smult (c ^ (degree f - J)) (subresultant J f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subresultant J f (Polynomial.smult c g) = Polynomial.smult (c ^ (degree f - J)) (subresultant J f g)
[PROOF STEP]
unfolding subresultant_swap[of _ f] subresultant_smult_left[OF assms]
    degree_smult_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult ((- (1::'a)) ^ ((degree f - J) * ((if c = (0::'a) then 0 else degree g) - J))) (Polynomial.smult (c ^ (degree f - J)) (subresultant J g f)) = Polynomial.smult (c ^ (degree f - J)) (Polynomial.smult ((- (1::'a)) ^ ((degree f - J) * (degree g - J))) (subresultant J g f))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. Polynomial.smult ((- (1::'a)) ^ ((degree f - J) * ((if c = (0::'a) then 0 else degree g) - J))) (Polynomial.smult (c ^ (degree f - J)) (subresultant J g f)) = Polynomial.smult (c ^ (degree f - J)) (Polynomial.smult ((- (1::'a)) ^ ((degree f - J) * (degree g - J))) (subresultant J g f))
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma mset_ran_eq_single_conv: "mset_ran a r = {#x#} \<longleftrightarrow> (\<exists>i. r={i} \<and> x= a i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mset_ran a r = {#x#}) = (\<exists>i. r = {i} \<and> x = a i)
[PROOF STEP]
apply (cases "finite r")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite r \<Longrightarrow> (mset_ran a r = {#x#}) = (\<exists>i. r = {i} \<and> x = a i)
 2. infinite r \<Longrightarrow> (mset_ran a r = {#x#}) = (\<exists>i. r = {i} \<and> x = a i)
[PROOF STEP]
apply (auto simp: mset_ran_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite r; image_mset a (mset_set r) = {#x#}\<rbrakk> \<Longrightarrow> \<exists>i. r = {i} \<and> x = a i
[PROOF STEP]
using finite_set_mset_mset_set msed_map_invR
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> set_mset (mset_set ?A) = ?A
image_mset ?f ?M = add_mset ?b ?N \<Longrightarrow> \<exists>M1 a. ?M = add_mset a M1 \<and> ?f a = ?b \<and> image_mset ?f M1 = ?N

goal (1 subgoal):
 1. \<lbrakk>finite r; image_mset a (mset_set r) = {#x#}\<rbrakk> \<Longrightarrow> \<exists>i. r = {i} \<and> x = a i
[PROOF STEP]
by force


[STATEMENT]
lemma setprod_eq_one:
  fixes f::"nat \<Rightarrow> nat"
  assumes "\<forall>i \<le> n. f i = Suc 0"
  shows "(\<Prod>i \<le> n. f i) = Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..n} = Suc 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>n. f i = Suc 0

goal (1 subgoal):
 1. prod f {..n} = Suc 0
[PROOF STEP]
by (induct n) (auto)


[STATEMENT]
lemma cblinfun_eq_on_canonical_basis:
  fixes f g::"'a::{basis_enum,complex_normed_vector} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector"
  defines "basis == set (canonical_basis::'a list)"
  assumes "\<And>u. u \<in> basis \<Longrightarrow> f *\<^sub>V u = g *\<^sub>V u"
  shows  "f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = g
[PROOF STEP]
apply (rule cblinfun_eq_on_UNIV_span[where basis=basis])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. cspan basis = UNIV
 2. \<And>s. s \<in> basis \<Longrightarrow> f *\<^sub>V s = g *\<^sub>V s
[PROOF STEP]
using assms is_generator_set is_cindependent_set
[PROOF STATE]
proof (prove)
using this:
basis \<equiv> set canonical_basis
?u \<in> basis \<Longrightarrow> f *\<^sub>V ?u = g *\<^sub>V ?u
cspan (set canonical_basis) = UNIV
cindependent (set canonical_basis)

goal (2 subgoals):
 1. cspan basis = UNIV
 2. \<And>s. s \<in> basis \<Longrightarrow> f *\<^sub>V s = g *\<^sub>V s
[PROOF STEP]
by auto


[STATEMENT]
lemma homeomorphic_compact:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space"
  shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s \<Longrightarrow> s homeomorphic t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>compact s; continuous_on s f; f ` s = t; inj_on f s\<rbrakk> \<Longrightarrow> s homeomorphic t
[PROOF STEP]
unfolding homeomorphic_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>compact s; continuous_on s f; f ` s = t; inj_on f s\<rbrakk> \<Longrightarrow> \<exists>f g. homeomorphism s t f g
[PROOF STEP]
by (metis homeomorphism_compact)


[STATEMENT]
lemma ffact_add:
  fixes x y :: "'a::{ab_group_add, comm_semiring_1_cancel, ring_1}"
  shows "ffact n (x + y) = (\<Sum>k=0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ffact 0 (x + y) = (\<Sum>k = 0..0. of_nat (0 choose k) * ffact k x * ffact (0 - k) y)
 2. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. ffact 0 (x + y) = (\<Sum>k = 0..0. of_nat (0 choose k) * ffact k x * ffact (0 - k) y)
 2. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact 0 (x + y) = (\<Sum>k = 0..0. of_nat (0 choose k) * ffact k x * ffact (0 - k) y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ffact 0 (x + y) = (\<Sum>k = 0..0. of_nat (0 choose k) * ffact k x * ffact (0 - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
let ?s = "\<lambda>k. of_nat (n choose k) * ffact k x * ffact (n - k) y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
let ?t = "\<lambda>k. ffact k x * ffact (Suc n - k) y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
let ?u = "\<lambda>k. ffact (Suc k) x * ffact (n - k) y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "ffact (Suc n) (x + y) = (x + y - of_nat n) * ffact n (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact (Suc n) (x + y) = (x + y - of_nat n) * ffact n (x + y)
[PROOF STEP]
by (simp add: ffact_Suc_rev)
[PROOF STATE]
proof (state)
this:
ffact (Suc n) (x + y) = (x + y - of_nat n) * ffact n (x + y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ffact (Suc n) (x + y) = (x + y - of_nat n) * ffact n (x + y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (x + y - of_nat n) * (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y - of_nat n) * ffact n (x + y) = (x + y - of_nat n) * (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)
[PROOF STEP]
using Suc.hyps
[PROOF STATE]
proof (prove)
using this:
ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)

goal (1 subgoal):
 1. (x + y - of_nat n) * ffact n (x + y) = (x + y - of_nat n) * (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x + y - of_nat n) * ffact n (x + y) = (x + y - of_nat n) * (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y - of_nat n) * ffact n (x + y) = (x + y - of_nat n) * (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. ?s k * (x + y - of_nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y - of_nat n) * (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (x + y - of_nat n))
[PROOF STEP]
by (simp add: mult.commute sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(x + y - of_nat n) * (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (x + y - of_nat n))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y - of_nat n) * (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (x + y - of_nat n))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. ?s k * ((y + of_nat k - of_nat n) + (x - of_nat k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (x + y - of_nat n)) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k)))
[PROOF STEP]
by (auto intro: sum.cong simp add: diff_add_eq add_diff_eq add.commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (x + y - of_nat n)) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k)))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (x + y - of_nat n)) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k)))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. of_nat (n choose k) * (?t k + ?u k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
assume "k \<le> n"
[PROOF STATE]
proof (state)
this:
k \<le> n

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "?u k = ffact k x * ffact (n - k) y * (x - of_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact (Suc k) x * ffact (n - k) y = ffact k x * ffact (n - k) y * (x - of_nat k)
[PROOF STEP]
by (simp add: ffact_Suc_rev Suc_diff_le of_nat_diff mult.commute mult.left_commute)
[PROOF STATE]
proof (state)
this:
ffact (Suc k) x * ffact (n - k) y = ffact k x * ffact (n - k) y * (x - of_nat k)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ffact (Suc k) x * ffact (n - k) y = ffact k x * ffact (n - k) y * (x - of_nat k)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
from \<open>k \<le> n\<close>
[PROOF STATE]
proof (chain)
picking this:
k \<le> n
[PROOF STEP]
have "?t k = ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n)"
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. ffact k x * ffact (Suc n - k) y = ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n)
[PROOF STEP]
by (simp add: ffact_Suc_rev Suc_diff_le of_nat_diff diff_diff_eq2 mult.commute mult.left_commute)
[PROOF STATE]
proof (state)
this:
ffact k x * ffact (Suc n - k) y = ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ffact (Suc k) x * ffact (n - k) y = ffact k x * ffact (n - k) y * (x - of_nat k)
ffact k x * ffact (Suc n - k) y = ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n)
[PROOF STEP]
have
        "?s k * ((y + of_nat k - of_nat n) + (x - of_nat k)) = of_nat (n choose k) * (?t k + ?u k)"
[PROOF STATE]
proof (prove)
using this:
ffact (Suc k) x * ffact (n - k) y = ffact k x * ffact (n - k) y * (x - of_nat k)
ffact k x * ffact (Suc n - k) y = ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n)

goal (1 subgoal):
 1. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k)) = of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y)
[PROOF STEP]
by (metis (no_types, lifting) distrib_left mult.assoc)
[PROOF STATE]
proof (state)
this:
of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k)) = of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?k2 \<le> n \<Longrightarrow> of_nat (n choose ?k2) * ffact ?k2 x * ffact (n - ?k2) y * (y + of_nat ?k2 - of_nat n + (x - of_nat ?k2)) = of_nat (n choose ?k2) * (ffact ?k2 x * ffact (Suc n - ?k2) y + ffact (Suc ?k2) x * ffact (n - ?k2) y)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
?k2 \<le> n \<Longrightarrow> of_nat (n choose ?k2) * ffact ?k2 x * ffact (n - ?k2) y * (y + of_nat ?k2 - of_nat n + (x - of_nat ?k2)) = of_nat (n choose ?k2) * (ffact ?k2 x * ffact (Suc n - ?k2) y + ffact (Suc ?k2) x * ffact (n - ?k2) y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?k2 \<le> n \<Longrightarrow> of_nat (n choose ?k2) * ffact ?k2 x * ffact (n - ?k2) y * (y + of_nat ?k2 - of_nat n + (x - of_nat ?k2)) = of_nat (n choose ?k2) * (ffact ?k2 x * ffact (Suc n - ?k2) y + ffact (Suc ?k2) x * ffact (n - ?k2) y)

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by (auto intro: sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y * (y + of_nat k - of_nat n + (x - of_nat k))) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. of_nat (n choose k) * ?t k) + (\<Sum>k = 0..n. of_nat (n choose k) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by (simp add: sum.distrib distrib_left mult.commute mult.left_commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y + ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = ?t 0 + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "\<dots> = (?t 0 + (\<Sum>k = 0..n. of_nat (n choose Suc k) * ?u k)) + (\<Sum>k = 0..n. of_nat (n choose k) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "(\<Sum>k = Suc 0..n. of_nat (n choose k) * ?t k) = (\<Sum>k = 0..n. of_nat (n choose Suc k) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "(\<Sum>k = Suc 0..n. of_nat (n choose k) * ?t k) = (\<Sum>k = Suc 0..Suc n. of_nat (n choose k) * ?t k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = Suc 0..Suc n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y))
[PROOF STEP]
by (simp add: binomial_eq_0)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = Suc 0..Suc n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y))

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

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "\<dots> = (sum ((\<lambda>k. of_nat (n choose k) * ?t k) o Suc) {0..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = sum ((\<lambda>k. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n}
[PROOF STEP]
by (simp only: sum.reindex[symmetric, of Suc] inj_Suc image_Suc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = sum ((\<lambda>k. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n}

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

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..n. of_nat (n choose Suc k) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>k. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n} = (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>k. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) \<circ> Suc) {0..n} = (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

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

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) = (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

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

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by (simp add: sum.atLeast_Suc_atMost[of _ _ "\<lambda>k. of_nat (n choose k) * ?t k"])
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y))

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

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
have "\<dots> = ?t 0 + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by (simp add: distrib_right sum.distrib)
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

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

goal (1 subgoal):
 1. (\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. of_nat (n choose k) * (ffact k x * ffact (Suc n - k) y)) + (\<Sum>k = 0..n. of_nat (n choose k) * (ffact (Suc k) x * ffact (n - k) y)) = ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y))

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
let ?v = "\<lambda>k. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = ?v 0 + (\<Sum>k = 0..n. of_nat (Suc n choose (Suc k)) * ?u k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = of_nat (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = of_nat (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y))

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

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = ?v 0 + (\<Sum>k = Suc 0..Suc n. ?v k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) = of_nat (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
by (simp only: sum.shift_bounds_cl_Suc_ivl diff_Suc_Suc mult.assoc)
[PROOF STATE]
proof (state)
this:
of_nat (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (Suc n choose Suc k) * (ffact (Suc k) x * ffact (n - k) y)) = of_nat (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

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

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
by (simp add: sum.atLeast_Suc_atMost)
[PROOF STATE]
proof (state)
this:
of_nat (Suc n choose 0) * ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = Suc 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

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

goal (1 subgoal):
 1. ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ffact 0 x * ffact (Suc n - 0) y + (\<Sum>k = 0..n. of_nat (n choose k + (n choose Suc k)) * (ffact (Suc k) x * ffact (n - k) y)) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal (1 subgoal):
 1. \<And>n. ffact n (x + y) = (\<Sum>k = 0..n. of_nat (n choose k) * ffact k x * ffact (n - k) y) \<Longrightarrow> ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal (1 subgoal):
 1. ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ffact (Suc n) (x + y) = (\<Sum>k = 0..Suc n. of_nat (Suc n choose k) * ffact k x * ffact (Suc n - k) y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fourier_sum_0_integrals:
  assumes "f absolutely_integrable_on {-pi..pi}"
  shows "(\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k 0) =
          (integral\<^sup>L (lebesgue_on {-pi..pi}) f / 2 +
           (\<Sum>k = Suc 0..n div 2. integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. cos(k * x) * f x))) / pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k 0) = (integral\<^sup>L (lebesgue_on {- pi..pi}) f / 2 + (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x)) / pi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k 0) = (integral\<^sup>L (lebesgue_on {- pi..pi}) f / 2 + (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x)) / pi
[PROOF STEP]
have "integral\<^sup>L (lebesgue_on {-pi..pi}) f / (sqrt (2 * pi) * sqrt 2 * sqrt pi) = integral\<^sup>L (lebesgue_on {-pi..pi}) f / (2 * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {- pi..pi}) f / (sqrt (2 * pi) * sqrt 2 * sqrt pi) = integral\<^sup>L (lebesgue_on {- pi..pi}) f / (2 * pi)
[PROOF STEP]
by (simp add: algebra_simps real_sqrt_mult)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (lebesgue_on {- pi..pi}) f / (sqrt (2 * pi) * sqrt 2 * sqrt pi) = integral\<^sup>L (lebesgue_on {- pi..pi}) f / (2 * pi)

goal (1 subgoal):
 1. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k 0) = (integral\<^sup>L (lebesgue_on {- pi..pi}) f / 2 + (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x)) / pi
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (lebesgue_on {- pi..pi}) f / (sqrt (2 * pi) * sqrt 2 * sqrt pi) = integral\<^sup>L (lebesgue_on {- pi..pi}) f / (2 * pi)

goal (1 subgoal):
 1. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k 0) = (integral\<^sup>L (lebesgue_on {- pi..pi}) f / 2 + (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x)) / pi
[PROOF STEP]
have "(\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {-pi..pi}. trigonometric_set (2*k) x * f x) / sqrt pi
               = (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {-pi..pi}. cos (k * x) * f x) / pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. trigonometric_set (2 * k) x * f x) / sqrt pi = (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x) / pi
[PROOF STEP]
by (simp add: trigonometric_set_def sum_divide_distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. trigonometric_set (2 * k) x * f x) / sqrt pi = (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x) / pi

goal (1 subgoal):
 1. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k 0) = (integral\<^sup>L (lebesgue_on {- pi..pi}) f / 2 + (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x)) / pi
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L (lebesgue_on {- pi..pi}) f / (sqrt (2 * pi) * sqrt 2 * sqrt pi) = integral\<^sup>L (lebesgue_on {- pi..pi}) f / (2 * pi)
(\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. trigonometric_set (2 * k) x * f x) / sqrt pi = (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x) / pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L (lebesgue_on {- pi..pi}) f / (sqrt (2 * pi) * sqrt 2 * sqrt pi) = integral\<^sup>L (lebesgue_on {- pi..pi}) f / (2 * pi)
(\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. trigonometric_set (2 * k) x * f x) / sqrt pi = (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x) / pi

goal (1 subgoal):
 1. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k 0) = (integral\<^sup>L (lebesgue_on {- pi..pi}) f / 2 + (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x)) / pi
[PROOF STEP]
unfolding Fourier_sum_0_explicit
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L (lebesgue_on {- pi..pi}) f / (sqrt (2 * pi) * sqrt 2 * sqrt pi) = integral\<^sup>L (lebesgue_on {- pi..pi}) f / (2 * pi)
(\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. trigonometric_set (2 * k) x * f x) / sqrt pi = (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x) / pi

goal (1 subgoal):
 1. (Fourier_coefficient f 0 / sqrt 2 + (\<Sum>k = 1..n div 2. Fourier_coefficient f (2 * k))) / sqrt pi = (integral\<^sup>L (lebesgue_on {- pi..pi}) f / 2 + (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x)) / pi
[PROOF STEP]
by (simp add: Fourier_coefficient_def orthonormal_coeff_def l2product_def trigonometric_set add_divide_distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k 0) = (integral\<^sup>L (lebesgue_on {- pi..pi}) f / 2 + (\<Sum>k = Suc 0..n div 2. LINT x|lebesgue_on {- pi..pi}. cos (real k * x) * f x)) / pi

goal:
No subgoals!
[PROOF STEP]
qed