[STATEMENT]
lemma sophomores_dream_aux2:
  "summable (\<lambda>k. (-1) ^ k / real ((k+1)^(k+1)))"
  "integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (-1)^n / (n+1)^(n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1))) &&& integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
define S where "S = (\<lambda>x::real. \<Sum>k. (x * ln x) ^ k / fact k)"
[PROOF STATE]
proof (state)
this:
S = (\<lambda>x. \<Sum>k. (x * ln x) ^ k / fact k)

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
have S_eq: "S x = x powr x" if "x > 0" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S x = x powr x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S x = x powr x
[PROOF STEP]
have "S x = exp (x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S x = exp (x * ln x)
[PROOF STEP]
by (simp add: S_def exp_def field_simps)
[PROOF STATE]
proof (state)
this:
S x = exp (x * ln x)

goal (1 subgoal):
 1. S x = x powr x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S x = exp (x * ln x)

goal (1 subgoal):
 1. S x = x powr x
[PROOF STEP]
have "\<dots> = x powr x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (x * ln x) = x powr x
[PROOF STEP]
using \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. exp (x * ln x) = x powr x
[PROOF STEP]
by (simp add: powr_def)
[PROOF STATE]
proof (state)
this:
exp (x * ln x) = x powr x

goal (1 subgoal):
 1. S x = x powr x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
S x = x powr x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S x = x powr x

goal (1 subgoal):
 1. S x = x powr x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
S x = x powr x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < ?x \<Longrightarrow> S ?x = ?x powr ?x

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
have cont: "continuous_on {0..1} (\<lambda>x::real. \<Sum>k<n. (x * ln x) ^ k / fact k)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k)
[PROOF STEP]
by (intro continuous_on_sum continuous_on_divide x_log_x_continuous continuous_on_power
              continuous_on_const) auto
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. \<Sum>k<?n. (x * ln x) ^ k / fact k)

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
obtain I J where IJ: "\<And>n. ((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral I n) {0..1}"
                       "(S has_integral J) {0..1}" "I \<longlonglongrightarrow> J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>I J. \<lbrakk>\<And>n. ((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral I n) {0..1}; (S has_integral J) {0..1}; I \<longlonglongrightarrow> J\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using uniform_limit_integral [OF uniform_limit_sophomores_dream1 cont]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sequentially \<noteq> bot; \<And>I J. \<lbrakk>\<And>n. ((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral I n) {0..1}; ((\<lambda>x. \<Sum>k. (x * ln x) ^ k / fact k) has_integral J) {0..1}; I \<longlonglongrightarrow> J\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>I J. \<lbrakk>\<And>n. ((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral I n) {0..1}; (S has_integral J) {0..1}; I \<longlonglongrightarrow> J\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: S_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>k<?n. (x * ln x) ^ k / fact k) has_integral I ?n) {0..1}
(S has_integral J) {0..1}
I \<longlonglongrightarrow> J

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
note \<open>(S has_integral J) {0..1}\<close>
[PROOF STATE]
proof (state)
this:
(S has_integral J) {0..1}

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(S has_integral J) {0..1}

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
have "(S has_integral J) {0..1} \<longleftrightarrow> (S has_integral J) {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S has_integral J) {0..1} = (S has_integral J) {0<..<1}
[PROOF STEP]
by (simp add: has_integral_Icc_iff_Ioo)
[PROOF STATE]
proof (state)
this:
(S has_integral J) {0..1} = (S has_integral J) {0<..<1}

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(S has_integral J) {0..1} = (S has_integral J) {0<..<1}

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> ((\<lambda>x. x powr x) has_integral J) {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S has_integral J) {0<..<1} = ((\<lambda>x. x powr x) has_integral J) {0<..<1}
[PROOF STEP]
by (intro has_integral_cong) (use S_eq in auto)
[PROOF STATE]
proof (state)
this:
(S has_integral J) {0<..<1} = ((\<lambda>x. x powr x) has_integral J) {0<..<1}

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(S has_integral J) {0<..<1} = ((\<lambda>x. x powr x) has_integral J) {0<..<1}

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> ((\<lambda>x. x powr x) has_integral J) {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr x) has_integral J) {0<..<1} = ((\<lambda>x. x powr x) has_integral J) {0..1}
[PROOF STEP]
by (simp add: has_integral_Icc_iff_Ioo)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr x) has_integral J) {0<..<1} = ((\<lambda>x. x powr x) has_integral J) {0..1}

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. x powr x) has_integral J) {0..1}
[PROOF STEP]
have integral: "((\<lambda>x. x powr x) has_integral J) {0..1}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr x) has_integral J) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. x powr x) has_integral J) {0..1}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr x) has_integral J) {0..1}

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
have I_eq: "I = (\<lambda>n. \<Sum>k<n. (-1) ^ k / real ((k+1)^(k+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I = (\<lambda>n. \<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
have "((\<lambda>x::real. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral
            (\<Sum>k<n. (-1) ^ k * fact k / real ((k + 1) ^ (k + 1)) / fact k)) {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral (\<Sum>k<n. (- 1) ^ k * fact k / real ((k + 1) ^ (k + 1)) / fact k)) {0<..<1}
[PROOF STEP]
by (intro has_integral_sum has_integral_divide sophomores_dream_aux_integral) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral (\<Sum>k<n. (- 1) ^ k * fact k / real ((k + 1) ^ (k + 1)) / fact k)) {0<..<1}

goal (1 subgoal):
 1. \<And>n. I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral (\<Sum>k<n. (- 1) ^ k * fact k / real ((k + 1) ^ (k + 1)) / fact k)) {0<..<1}

goal (1 subgoal):
 1. \<And>n. I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
have "(\<Sum>k<n. (- 1) ^ k * fact k / real ((k + 1) ^ (k + 1)) / fact k) =
               (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n. (- 1) ^ k * fact k / real ((k + 1) ^ (k + 1)) / fact k) = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n. (- 1) ^ k * fact k / real ((k + 1) ^ (k + 1)) / fact k) = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))

goal (1 subgoal):
 1. \<And>n. I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n. (- 1) ^ k * fact k / real ((k + 1) ^ (k + 1)) / fact k) = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))

goal (1 subgoal):
 1. \<And>n. I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
note has_integral_Icc_iff_Ioo [symmetric]
[PROOF STATE]
proof (state)
this:
(?f has_integral ?I) {?a<..<?b} = (?f has_integral ?I) {?a..?b}

goal (1 subgoal):
 1. \<And>n. I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))) {0..1}
[PROOF STEP]
show "I n = (\<Sum>k<n. (-1) ^ k / real ((k+1)^(k+1)))"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<Sum>k<n. (x * ln x) ^ k / fact k) has_integral (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))) {0..1}

goal (1 subgoal):
 1. I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
by (rule has_integral_unique [OF IJ(1)[of n]])
[PROOF STATE]
proof (state)
this:
I n = (\<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
I = (\<lambda>n. \<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
hence sums: "(\<lambda>k. (-1) ^ k / real ((k + 1) ^ (k + 1))) sums J"
[PROOF STATE]
proof (prove)
using this:
I = (\<lambda>n. \<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))

goal (1 subgoal):
 1. (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1))) sums J
[PROOF STEP]
using IJ(3) I_eq
[PROOF STATE]
proof (prove)
using this:
I = (\<lambda>n. \<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
I \<longlonglongrightarrow> J
I = (\<lambda>n. \<Sum>k<n. (- 1) ^ k / real ((k + 1) ^ (k + 1)))

goal (1 subgoal):
 1. (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1))) sums J
[PROOF STEP]
by (simp add: sums_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1))) sums J

goal (2 subgoals):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
 2. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
from sums
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1))) sums J
[PROOF STEP]
show "summable (\<lambda>k. (-1) ^ k / real ((k+1)^(k+1)))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1))) sums J

goal (1 subgoal):
 1. summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
[PROOF STEP]
by (simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
from integral sums
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. x powr x) has_integral J) {0..1}
(\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1))) sums J
[PROOF STEP]
show "integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (-1)^n / (n+1)^(n+1))"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr x) has_integral J) {0..1}
(\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1))) sums J

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))
[PROOF STEP]
by (simp add: sums_iff has_integral_iff)
[PROOF STATE]
proof (state)
this:
integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary_unit_row [simp]:
  assumes "unitary U" and "dim_row U = n" and "i < n"
  shows "\<parallel>row U i\<parallel> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>row U i\<parallel> = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<parallel>row U i\<parallel> = 1
[PROOF STEP]
have "row U i = col (U\<^sup>t) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row U i = col U\<^sup>t i
[PROOF STEP]
using  assms(2-3)
[PROOF STATE]
proof (prove)
using this:
dim_row U = n
i < n

goal (1 subgoal):
 1. row U i = col U\<^sup>t i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
row U i = col U\<^sup>t i

goal (1 subgoal):
 1. \<parallel>row U i\<parallel> = 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
row U i = col U\<^sup>t i

goal (1 subgoal):
 1. \<parallel>row U i\<parallel> = 1
[PROOF STEP]
using assms transpose_of_unitary_is_unitary unitary_unit_col
[PROOF STATE]
proof (prove)
using this:
row U i = col U\<^sup>t i
unitary U
dim_row U = n
i < n
unitary ?U \<Longrightarrow> unitary ?U\<^sup>t
\<lbrakk>unitary ?U; dim_col ?U = ?n; ?i < ?n\<rbrakk> \<Longrightarrow> \<parallel>col ?U ?i\<parallel> = 1

goal (1 subgoal):
 1. \<parallel>row U i\<parallel> = 1
[PROOF STEP]
by (metis index_transpose_mat(3))
[PROOF STATE]
proof (state)
this:
\<parallel>row U i\<parallel> = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in aGroup) nsum_memTr: "(\<forall>j \<le> n. f j \<in> carrier A) \<longrightarrow>
                                 nsum A f n \<in> carrier A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<le>n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f n \<in> carrier A
[PROOF STEP]
apply (induct_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>0. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f 0 \<in> carrier A
 2. \<And>n. (\<forall>j\<le>n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f n \<in> carrier A \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n \<in> carrier A
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>j\<le>n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f n \<in> carrier A \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n \<in> carrier A
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>j\<le>n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f n \<in> carrier A; \<forall>j\<le>Suc n. f j \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f Suc n \<in> carrier A
[PROOF STEP]
apply (cut_tac n = n in Nsetn_sub_mem1, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n \<in> carrier A; \<forall>j\<le>Suc n. f j \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) \<in> carrier A
[PROOF STEP]
apply (frule_tac a = "Suc n" in forall_spec, simp,
         thin_tac "\<forall>j\<le>Suc n. f j \<in> carrier A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n \<in> carrier A; f (Suc n) \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) \<in> carrier A
[PROOF STEP]
apply (rule ag_pOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sorted_list_of_set_Min_Cons:
  assumes "finite A" "A \<noteq> {}"
  shows "sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
have *: "A = insert (Min A) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = insert (Min A) A
[PROOF STEP]
using assms Min_in
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
\<lbrakk>finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> Min ?A \<in> ?A

goal (1 subgoal):
 1. A = insert (Min A) A
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
A = insert (Min A) A

goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = insert (Min A) A
[PROOF STEP]
have "sorted_list_of_set A = insort (Min A) (sorted_list_of_set (A - {Min A}))"
[PROOF STATE]
proof (prove)
using this:
A = insert (Min A) A

goal (1 subgoal):
 1. sorted_list_of_set A = insort (Min A) (sorted_list_of_set (A - {Min A}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A = insert (Min A) A
finite A
A \<noteq> {}

goal (1 subgoal):
 1. sorted_list_of_set A = insort (Min A) (sorted_list_of_set (A - {Min A}))
[PROOF STEP]
by (subst *, intro sorted_list_of_set_insert_remove) auto
[PROOF STATE]
proof (state)
this:
sorted_list_of_set A = insort (Min A) (sorted_list_of_set (A - {Min A}))

goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sorted_list_of_set A = insort (Min A) (sorted_list_of_set (A - {Min A}))

goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
have "\<dots> = Min A # sorted_list_of_set (A - {Min A})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insort (Min A) (sorted_list_of_set (A - {Min A})) = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. insort (Min A) (sorted_list_of_set (A - {Min A})) = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
by (intro insort_is_Cons) (auto)
[PROOF STATE]
proof (state)
this:
insort (Min A) (sorted_list_of_set (A - {Min A})) = Min A # sorted_list_of_set (A - {Min A})

goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})

goal (1 subgoal):
 1. sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_list_of_set A = Min A # sorted_list_of_set (A - {Min A})

goal:
No subgoals!
[PROOF STEP]
qed