[STATEMENT]
lemma det_echelon_form_of_column_k_det:
  fixes A::"'a::{bezout_domain}^'n::{mod_type}^'n::{mod_type}"
  assumes ib: "is_bezout_ext bezout"
  and det: "det_P * det B = det A"
  shows "fst ((echelon_form_of_column_k_det bezout) (det_P,A,i) k) * det B
  = det (fst (snd ((echelon_form_of_column_k_det bezout) (det_P,A,i) k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
let ?interchange="(interchange_rows A (from_nat i)
    (LEAST n. A $ n $ from_nat k \<noteq> 0 \<and> from_nat i \<le> n))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
let ?B="(bezout_iterate ?interchange (nrows A - Suc 0) (from_nat i) (from_nat k) bezout)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))
[PROOF STEP]
proof (unfold echelon_form_of_column_k_det_def Let_def echelon_form_of_column_k_def,
      auto simp add: assms)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
assume i: "from_nat i < m"
      and Amk: "A $ m $ from_nat k \<noteq> 0"
      and i_not_nrows: "i \<noteq> nrows A "
      and Aik: "A $ from_nat i $ from_nat k = 0"
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i < m
A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)
i \<noteq> nrows A
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)

goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
have "det ?B = det ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
proof (rule det_bezout_iterate[OF ib])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
show "?interchange $ from_nat i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (mono_tags, lifting) Amk LeastI_ex
          dual_order.strict_iff_order i interchange_rows_i)
[PROOF STATE]
proof (state)
this:
interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
show "nrows A - Suc 0 < ncols ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
unfolding nrows_def ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) - Suc 0 < CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
have "... = - det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) = - det A
[PROOF STEP]
proof (rule det_interchange_different_rows, rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mod_type_class.from_nat i = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) \<Longrightarrow> False
[PROOF STEP]
assume i_least: "from_nat i = (LEAST n. A $ n $ from_nat k \<noteq> 0 \<and> from_nat i \<le> n)"
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)

goal (1 subgoal):
 1. mod_type_class.from_nat i = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) \<Longrightarrow> False
[PROOF STEP]
have "A $ from_nat i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (poly_guards_query, lifting) Amk LeastI_ex
          linear i i_least leD)
[PROOF STATE]
proof (state)
this:
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. mod_type_class.from_nat i = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) \<Longrightarrow> False
[PROOF STEP]
thus "False"
[PROOF STATE]
proof (prove)
using this:
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
using Aik
[PROOF STATE]
proof (prove)
using this:
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) = - det A

goal (2 subgoals):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k = (0::'a)\<rbrakk> \<Longrightarrow> - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
 2. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = - det A
[PROOF STEP]
show "- det A = det ?B"
[PROOF STATE]
proof (prove)
using this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = - det A

goal (1 subgoal):
 1. - det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
assume i: "i \<noteq> nrows A"
      and Aik: "A $ from_nat i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (state)
this:
i \<noteq> nrows A
A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
have "det ?B = det ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
proof (rule det_bezout_iterate[OF ib])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
show "?interchange $ from_nat i $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (mono_tags, lifting) Aik LeastI order_refl interchange_rows_i)
[PROOF STATE]
proof (state)
this:
interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n) $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (1 subgoal):
 1. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
show "nrows A - Suc 0 < ncols ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))
[PROOF STEP]
unfolding nrows_def ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) - Suc 0 < CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nrows A - Suc 0 < ncols (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n))

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
have "... = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) = det A
[PROOF STEP]
by (rule det_interchange_same_rows, rule Least_equality[symmetric], auto simp add: Aik)
[PROOF STATE]
proof (state)
this:
det (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) = det A

goal (1 subgoal):
 1. \<And>m ma. \<lbrakk>mod_type_class.from_nat i \<le> m; A $ m $ mod_type_class.from_nat k \<noteq> (0::'a); mod_type_class.from_nat i < ma; A $ ma $ mod_type_class.from_nat k \<noteq> (0::'a); i \<noteq> nrows A; A $ mod_type_class.from_nat i $ mod_type_class.from_nat k \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det A
[PROOF STEP]
show "det A = det ?B"
[PROOF STATE]
proof (prove)
using this:
det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout) = det A

goal (1 subgoal):
 1. det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det A = det (bezout_iterate (interchange_rows A (mod_type_class.from_nat i) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> mod_type_class.from_nat i \<le> n)) (nrows A - Suc 0) (mod_type_class.from_nat i) (mod_type_class.from_nat k) bezout)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fst (echelon_form_of_column_k_det bezout (det_P, A, i) k) * det B = det (fst (snd (echelon_form_of_column_k_det bezout (det_P, A, i) k)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) npMul:
  "\<And> n. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk>
        \<Longrightarrow> npow R (x \<cdot>\<^sub>r y) n = (npow R x n) \<cdot>\<^sub>r (npow R y n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R n\<^esup> = x^\<^bsup>R n\<^esup> \<cdot>\<^sub>r y^\<^bsup>R n\<^esup>
[PROOF STEP]
apply (induct_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R 0\<^esup> = x^\<^bsup>R 0\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
(* n=0 *)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R 0\<^esup> = x^\<^bsup>R 0\<^esup> \<cdot>\<^sub>r y^\<^bsup>R 0\<^esup>
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> 1\<^sub>r = 1\<^sub>r \<cdot>\<^sub>r 1\<^sub>r
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
apply (rule ring_r_one [THEN sym])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> 1\<^sub>r \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
apply (simp add:ring_one)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
(* n>0 *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> (x \<cdot>\<^sub>r y)^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R Suc na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R Suc na\<^esup>
[PROOF STEP]
apply (simp only:npow_suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup> \<cdot>\<^sub>r (x \<cdot>\<^sub>r y) = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r x \<cdot>\<^sub>r (y^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y)
[PROOF STEP]
apply (rule ring_tOp_rel[THEN sym])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> x^\<^bsup>R na\<^esup> \<in> carrier R
 2. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> x \<in> carrier R
 3. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> y^\<^bsup>R na\<^esup> \<in> carrier R
 4. \<And>n na. \<lbrakk>x \<in> carrier R; y \<in> carrier R; (x \<cdot>\<^sub>r y)^\<^bsup>R na\<^esup> = x^\<^bsup>R na\<^esup> \<cdot>\<^sub>r y^\<^bsup>R na\<^esup>\<rbrakk> \<Longrightarrow> y \<in> carrier R
[PROOF STEP]
apply (rule npClose, assumption+)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "filterlim (\<lambda>x::real. (tan x) powr x^2) (at_left 1) (at_right 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_right 0. tan x powr x\<^sup>2 :> at_left 1
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma even_fourtimes_len: "length fourtimes_tm mod 2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_even (length fourtimes_tm)
[PROOF STEP]
apply(auto simp: fourtimes_tm_def fourtimes_compile_tm_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_even (length (mopup_n_tm (Suc 0)))
[PROOF STEP]
by (metis mopup_mod2)


[STATEMENT]
lemma "p1 = (p2 = (p3 = (p4 = (p5 = (p1 = (p2 = (p3 = (p4 = p5))))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p1 = (p2 = (p3 = (p4 = (p5 = (p1 = (p2 = (p3 = (p4 = p5))))))))
[PROOF STEP]
by blast


[STATEMENT]
lemma nbae_image_nba_nbae: "nbae_image f (nba_nbae A) = nbae
    (alphabet A) (f ` initial A)
    (\<Union> p \<in> nodes A. \<Union> a \<in> alphabet A. f ` {p} \<times> {a} \<times> f ` transition A a p)
    (f ` {p \<in> nodes A. accepting A p})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nbae_image f (nba_nbae A) = nbae (alphabet A) (f ` initial A) (\<Union>p\<in>nodes A. \<Union>a\<in>alphabet A. f ` {p} \<times> {a} \<times> f ` transition A a p) (f ` {p \<in> nodes A. accepting A p})
[PROOF STEP]
unfolding nba_nbae_def nbae_image_def nbae.simps Set.filter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alphabete (nbae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) {a \<in> nodes A. accepting A a}) = alphabet A \<and> f ` initiale (nbae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) {a \<in> nodes A. accepting A a}) = f ` initial A \<and> (\<lambda>(p, a, q). (f p, a, f q)) ` transitione (nbae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) {a \<in> nodes A. accepting A a}) = (\<Union>p\<in>nodes A. \<Union>a\<in>alphabet A. f ` {p} \<times> {a} \<times> f ` transition A a p) \<and> f ` acceptinge (nbae (alphabet A) (initial A) (transitions (alphabet A) (nodes A) (transition A)) {a \<in> nodes A. accepting A a}) = f ` {p \<in> nodes A. accepting A p}
[PROOF STEP]
by force


[STATEMENT]
lemma bouncing_ball_dyn: "g < 0 \<Longrightarrow> h \<ge> 0 \<Longrightarrow>
  (\<lambda>s. s$1 = h \<and> s$2 = 0) \<le>
  |LOOP (
    (EVOL (\<phi> g) (\<lambda> s. s$1 \<ge> 0) T) ;
    (IF (\<lambda> s. s$1 = 0) THEN (2 ::= (\<lambda>s. - s$2)) ELSE skip))
  INV (\<lambda>s. 0 \<le> s$1 \<and>2 * g * s$1 = 2 * g * h + s$2 * s$2)]
  (\<lambda>s. 0 \<le> s$1 \<and> s$1 \<le> h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g < 0; 0 \<le> h\<rbrakk> \<Longrightarrow> (\<lambda>s. s $ 1 = h \<and> s $ 2 = 0) \<le> |LOOP EVOL (\<lambda>t s. \<chi>i. if i = 1 then g * t\<^sup>2 / 2 + s $ 2 * t + s $ 1 else g * t + s $ 2) (\<lambda>s. 0 \<le> s $ 1) T ; (IF (\<lambda>s. s $ 1 = 0) THEN (2 ::= (\<lambda>s. - s $ 2)) ELSE skip) INV (\<lambda>s. 0 \<le> s $ 1 \<and> 2 * g * s $ 1 = 2 * g * h + s $ 2 * s $ 2) ] (\<lambda>s. 0 \<le> s $ 1 \<and> s $ 1 \<le> h)
[PROOF STEP]
by (rule fbox_loopI) (auto simp: bb_real_arith)

\<comment> \<open>Verified with the flow. \<close>


[STATEMENT]
lemma bigo_const_mult2: "O(\<lambda>x. c * f x) \<le> O(f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O(\<lambda>x. c * f x) \<subseteq> O(f)
[PROOF STEP]
by (rule bigo_elt_subset, rule bigo_const_mult1)


[STATEMENT]
lemma diff_eq_conv_nat: "(x - y = (z::nat)) = (if y < x then x = y + z else z = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y = z) = (if y < x then x = y + z else z = 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma ennreal_minus: "0 \<le> q \<Longrightarrow> ennreal r - ennreal q = ennreal (r - q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> q \<Longrightarrow> ennreal r - ennreal q = ennreal (r - q)
[PROOF STEP]
by transfer
     (simp add: max.absorb2 zero_ereal_def flip: ereal_max)


[STATEMENT]
lemma of_bool_square: "(of_bool x)\<^sup>2 = ((of_bool x)::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_bool x)\<^sup>2 = of_bool x
[PROOF STEP]
by (cases x, auto)


[STATEMENT]
lemma lookup_pm_of_idx_pm:
  "lookup (pm_of_idx_pm xs f) = (\<lambda>x. lookup f (Min {i. i < length xs \<and> xs ! i = x}) when x \<in> set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (pm_of_idx_pm xs f) = (\<lambda>x. lookup f (Min {i. i < length xs \<and> xs ! i = x}) when x \<in> set xs)
[PROOF STEP]
unfolding pm_of_idx_pm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (Abs_poly_mapping (\<lambda>x. lookup f (Min {i. i < length xs \<and> xs ! i = x}) when x \<in> set xs)) = (\<lambda>x. lookup f (Min {i. i < length xs \<and> xs ! i = x}) when x \<in> set xs)
[PROOF STEP]
by (rule Abs_poly_mapping_inverse, simp)


[STATEMENT]
lemma is_zariski_open_empty [simp]: "is_zariski_open {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zariski_open {}
[PROOF STEP]
using UNIV is_zariski_open_def generated_topology_is_topology topological_space.open_empty
[PROOF STATE]
proof (prove)
using this:
generated_topology ?S ?B ?S
is_zariski_open ?U \<equiv> generated_topology Spec {U. \<exists>\<aa>. ideal \<aa> R (+) (\<cdot>) \<zero> \<one> \<and> U = Spec\<setminus>\<V> \<aa>} ?U
topological_space ?S (generated_topology ?S ?B)
topological_space ?S ?is_open \<Longrightarrow> ?is_open {}

goal (1 subgoal):
 1. is_zariski_open {}
[PROOF STEP]
by simp


[STATEMENT]
lemma intersperseE:
  assumes "\<sigma> permutes ({..<n})"
  assumes "length as + length bs = n"
  shows "length (intersperse \<sigma> as bs) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (intersperse \<sigma> as bs) = n
[PROOF STEP]
by (metis assms(2) intersperse_def length_append length_permute_list)


[STATEMENT]
lemma is_aligned_to_bl:
  "is_aligned (w :: 'a :: len word) n = (True \<notin> set (drop (size w - n) (to_bl w)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_aligned w n = (True \<notin> set (drop (size w - n) (to_bl w)))
[PROOF STEP]
by (simp add: is_aligned_mask eq_zero_set_bl bl_and_mask word_size)


[STATEMENT]
lemma abs_moebius_mu: "abs (moebius_mu n :: 'a :: linordered_idom) = ind squarefree n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>moebius_mu n\<bar> = ind squarefree n
[PROOF STEP]
by (auto simp: ind_def moebius_mu_def)


[STATEMENT]
lemma inorder_update_splay:
  "sorted1(inorder t) \<Longrightarrow> inorder(update x y t) = upd_list x y (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted1 (inorder t) \<Longrightarrow> inorder (update x y t) = upd_list x y (inorder t)
[PROOF STEP]
using inorder_splay[of x t, symmetric] sorted_splay[of t x]
[PROOF STATE]
proof (prove)
using this:
inorder t = inorder (Splay_Map.splay x t)
\<lbrakk>sorted1 (inorder t); Splay_Map.splay x t = \<langle>?l, ?a, ?r\<rangle>\<rbrakk> \<Longrightarrow> Sorted_Less.sorted (map fst (inorder ?l) @ x # map fst (inorder ?r))

goal (1 subgoal):
 1. sorted1 (inorder t) \<Longrightarrow> inorder (update x y t) = upd_list x y (inorder t)
[PROOF STEP]
by(auto simp: upd_list_simps upd_list_Cons upd_list_snoc neq_Leaf_iff split: tree.split)


[STATEMENT]
lemma rev_in_conv: "rev u \<in> A \<longleftrightarrow> u \<in> rev ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rev u \<in> A) = (u \<in> rev ` A)
[PROOF STEP]
by force


[STATEMENT]
lemma mtx_circ_flow_eq: "exp (t *\<^sub>R A) *\<^sub>V s = \<phi> t s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (t *\<^sub>R A) *\<^sub>V s = \<phi> t s
[PROOF STEP]
apply(rule local_flow.eq_solution[OF local_flow_sq_mtx_linear, symmetric, of _ "\<lambda>s. UNIV"], simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. \<phi> a s) \<in> Sols (\<lambda>t. (*\<^sub>V) A) (\<lambda>s. UNIV) UNIV 0 s
[PROOF STEP]
apply(rule ivp_solsI, simp_all add: sq_mtx_vec_mult_eq vec_eq_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i. (i = 2 \<longrightarrow>  D (\<lambda>x. s $ 2 * cos x - s $ 1 * sin x) = (\<lambda>x. \<Sum>j\<in>UNIV. (if j = 1 then - 1 else ((\<lambda>x. 0)(2 := 0)) j) * (if j = 1 then s $ 1 * cos x + s $ 2 * sin x else - s $ 1 * sin x + s $ 2 * cos x)) on UNIV) \<and> (i \<noteq> 2 \<longrightarrow> (i = 1 \<longrightarrow>  D (\<lambda>x. s $ 1 * cos x + s $ 2 * sin x) = (\<lambda>x. \<Sum>j\<in>UNIV. (if j = 1 then 0 else ((\<lambda>x. 0)(2 := 1)) j) * (if j = 1 then s $ 1 * cos x + s $ 2 * sin x else - s $ 1 * sin x + s $ 2 * cos x)) on UNIV) \<and> (i \<noteq> 1 \<longrightarrow>  D (\<lambda>x. s $ 2 * cos x - s $ 1 * sin x) = (\<lambda>x. 0) on UNIV))
 2. \<forall>i. i \<noteq> 1 \<longrightarrow> s $ 2 = s $ i
[PROOF STEP]
unfolding UNIV_2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i. (i = 2 \<longrightarrow>  D (\<lambda>x. s $ 2 * cos x - s $ 1 * sin x) = (\<lambda>x. \<Sum>j\<in>insert 1 (skip 2). (if j = 1 then - 1 else ((\<lambda>x. 0)(2 := 0)) j) * (if j = 1 then s $ 1 * cos x + s $ 2 * sin x else - s $ 1 * sin x + s $ 2 * cos x)) on UNIV) \<and> (i \<noteq> 2 \<longrightarrow> (i = 1 \<longrightarrow>  D (\<lambda>x. s $ 1 * cos x + s $ 2 * sin x) = (\<lambda>x. \<Sum>j\<in>insert 1 (skip 2). (if j = 1 then 0 else ((\<lambda>x. 0)(2 := 1)) j) * (if j = 1 then s $ 1 * cos x + s $ 2 * sin x else - s $ 1 * sin x + s $ 2 * cos x)) on UNIV) \<and> (i \<noteq> 1 \<longrightarrow>  D (\<lambda>x. s $ 2 * cos x - s $ 1 * sin x) = (\<lambda>x. 0) on UNIV))
 2. \<forall>i. i \<noteq> 1 \<longrightarrow> s $ 2 = s $ i
[PROOF STEP]
using exhaust_2
[PROOF STATE]
proof (prove)
using this:
?x = 1 \<or> ?x = 2

goal (2 subgoals):
 1. \<forall>i. (i = 2 \<longrightarrow>  D (\<lambda>x. s $ 2 * cos x - s $ 1 * sin x) = (\<lambda>x. \<Sum>j\<in>insert 1 (skip 2). (if j = 1 then - 1 else ((\<lambda>x. 0)(2 := 0)) j) * (if j = 1 then s $ 1 * cos x + s $ 2 * sin x else - s $ 1 * sin x + s $ 2 * cos x)) on UNIV) \<and> (i \<noteq> 2 \<longrightarrow> (i = 1 \<longrightarrow>  D (\<lambda>x. s $ 1 * cos x + s $ 2 * sin x) = (\<lambda>x. \<Sum>j\<in>insert 1 (skip 2). (if j = 1 then 0 else ((\<lambda>x. 0)(2 := 1)) j) * (if j = 1 then s $ 1 * cos x + s $ 2 * sin x else - s $ 1 * sin x + s $ 2 * cos x)) on UNIV) \<and> (i \<noteq> 1 \<longrightarrow>  D (\<lambda>x. s $ 2 * cos x - s $ 1 * sin x) = (\<lambda>x. 0) on UNIV))
 2. \<forall>i. i \<noteq> 1 \<longrightarrow> s $ 2 = s $ i
[PROOF STEP]
by (force intro!: poly_derivatives simp: matrix_vector_mult_def)+


[STATEMENT]
lemma "\<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace>
          \<lbrace>\<acute>Abr = ''Break''\<rbrace> \<bullet> WHILE True
          INV \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
          DO IF \<acute>M = a THEN RAISE \<acute>Abr :== ''Break''
               ELSE \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1
               FI
          OD
          \<lbrace>\<acute>S = a * b\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> \<lbrace>\<acute>Abr = ''Break''\<rbrace>\<bullet>WHILE True INV \<lbrace>\<acute>S = \<acute>M * b\<rbrace> DO IF \<acute>M = a THEN RAISE \<acute>Abr :== ''Break'' ELSE \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 FI OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
apply vcg
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>M S. \<lbrakk>M = 0; S = 0\<rbrakk> \<Longrightarrow> S = M * b
 2. \<And>M S. \<lbrakk>S = M * b; True\<rbrakk> \<Longrightarrow> (M = a \<longrightarrow> S = a * b) \<and> (M \<noteq> a \<longrightarrow> S + b = (M + 1) * b)
 3. \<And>M S. \<lbrakk>S = M * b; \<not> True\<rbrakk> \<Longrightarrow> S = a * b
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in prob_space) indep_vars_sum:
  fixes X :: "'i \<Rightarrow> 'a \<Rightarrow> real"
  assumes I: "finite I" "i \<notin> I" and indep: "indep_vars (\<lambda>_. borel) X (insert i I)"
  shows "indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
have "indep_var
    borel ((\<lambda>f. f i) \<circ> (\<lambda>\<omega>. restrict (\<lambda>i. X i \<omega>) {i}))
    borel ((\<lambda>f. \<Sum>i\<in>I. f i) \<circ> (\<lambda>\<omega>. restrict (\<lambda>i. X i \<omega>) I))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_var borel ((\<lambda>f. f i) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>{i}. X i \<omega>)) borel ((\<lambda>f. sum f I) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>I. X i \<omega>))
[PROOF STEP]
using I
[PROOF STATE]
proof (prove)
using this:
finite I
i \<notin> I

goal (1 subgoal):
 1. indep_var borel ((\<lambda>f. f i) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>{i}. X i \<omega>)) borel ((\<lambda>f. sum f I) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>I. X i \<omega>))
[PROOF STEP]
by (intro indep_var_compose[OF indep_var_restrict[OF indep]] ) auto
[PROOF STATE]
proof (state)
this:
indep_var borel ((\<lambda>f. f i) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>{i}. X i \<omega>)) borel ((\<lambda>f. sum f I) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>I. X i \<omega>))

goal (1 subgoal):
 1. indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
indep_var borel ((\<lambda>f. f i) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>{i}. X i \<omega>)) borel ((\<lambda>f. sum f I) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>I. X i \<omega>))

goal (1 subgoal):
 1. indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
have "((\<lambda>f. f i) \<circ> (\<lambda>\<omega>. restrict (\<lambda>i. X i \<omega>) {i})) = X i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. f i) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>{i}. X i \<omega>) = X i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>f. f i) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>{i}. X i \<omega>) = X i

goal (1 subgoal):
 1. indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>f. f i) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>{i}. X i \<omega>) = X i

goal (1 subgoal):
 1. indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
have "((\<lambda>f. \<Sum>i\<in>I. f i) \<circ> (\<lambda>\<omega>. restrict (\<lambda>i. X i \<omega>) I)) = (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. sum f I) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>I. X i \<omega>) = (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
by (auto cong: rev_conj_cong)
[PROOF STATE]
proof (state)
this:
(\<lambda>f. sum f I) \<circ> (\<lambda>\<omega>. \<lambda>i\<in>I. X i \<omega>) = (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)

goal (1 subgoal):
 1. indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
indep_var borel (X i) borel (\<lambda>a. \<Sum>i\<in>I. X i a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
indep_var borel (X i) borel (\<lambda>a. \<Sum>i\<in>I. X i a)

goal (1 subgoal):
 1. indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
indep_var borel (X i) borel (\<lambda>\<omega>. \<Sum>i\<in>I. X i \<omega>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_berlekamp_basis_eq: "(set (berlekamp_basis u))
  = (Poly \<circ> list_of_vec)` (set (find_base_vectors (berlekamp_resulting_mat u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (berlekamp_basis u) = (Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))
[PROOF STEP]
by (auto simp add: image_def o_def berlekamp_basis_def)


[STATEMENT]
lemma rel_interior_sum_gen:
  fixes S :: "'a \<Rightarrow> 'n::euclidean_space set"
  assumes "\<And>i. i\<in>I \<Longrightarrow> convex (S i)"
  shows "rel_interior (sum S I) = sum (\<lambda>i. rel_interior (S i)) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior (sum S I) = (\<Sum>i\<in>I. rel_interior (S i))
[PROOF STEP]
using rel_interior_sum rel_interior_sing[of "0"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>convex ?S; convex ?T\<rbrakk> \<Longrightarrow> rel_interior (?S + ?T) = rel_interior ?S + rel_interior ?T
rel_interior {0::?'b1} = {0::?'b1}
?i \<in> I \<Longrightarrow> convex (S ?i)

goal (1 subgoal):
 1. rel_interior (sum S I) = (\<Sum>i\<in>I. rel_interior (S i))
[PROOF STEP]
by (subst sum_set_cond_linear[of convex], auto simp add: convex_set_plus)


[STATEMENT]
lemma sorted_primes_upto [iff]: "sorted (primes_upto n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (primes_upto n)
[PROOF STEP]
by (simp add: primes_upto_def)


[STATEMENT]
lemma exists_basis: "\<exists>X::'a::{field}^'n^'n. is_basis (set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>X. is_basis (set_of_vector X)
[PROOF STEP]
using is_basis_cart_basis'
[PROOF STATE]
proof (prove)
using this:
is_basis (set_of_vector cart_basis')

goal (1 subgoal):
 1. \<exists>X. is_basis (set_of_vector X)
[PROOF STEP]
by auto


[STATEMENT]
lemma ennreal_of_enat_enat[simp]: "ennreal_of_enat (enat n) = of_nat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal_of_enat (enat n) = of_nat n
[PROOF STEP]
by (simp add: ennreal_of_enat_def)


[STATEMENT]
theorem UP_domain:
  "domain P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain P
[PROOF STEP]
by (auto intro!: domainI UP_cring UP_one_not_zero UP_integral del: disjCI)


[STATEMENT]
lemma ide_char\<^sub>S\<^sub>C:
    assumes "arr f"
    shows "ide f \<longleftrightarrow> Dom f = Cod f \<and> Fun f = (\<lambda>x \<in> Dom f. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ide f = (Dom f = Cod f \<and> Fun f = (\<lambda>x\<in>Dom f. x))
[PROOF STEP]
using assms mkIde_as_mkArr mkArr_Fun Fun_ide in_homE ide_cod mkArr_Fun mkIde_set
[PROOF STATE]
proof (prove)
using this:
arr f
setp ?A \<Longrightarrow> mkArr ?A ?A (\<lambda>x. x) = mkIde ?A
arr ?f \<Longrightarrow> mkArr (Dom ?f) (Cod ?f) (Fun ?f) = ?f
ide ?a \<Longrightarrow> Fun ?a = (\<lambda>x\<in>local.set ?a. x)
\<lbrakk>\<guillemotleft>?f : ?a \<rightarrow> ?b\<guillemotright>; \<lbrakk>arr ?f; local.dom ?f = ?a; cod ?f = ?b\<rbrakk> \<Longrightarrow> ?T\<rbrakk> \<Longrightarrow> ?T
arr ?f \<Longrightarrow> ide (cod ?f)
arr ?f \<Longrightarrow> mkArr (Dom ?f) (Cod ?f) (Fun ?f) = ?f
ide ?a \<Longrightarrow> mkIde (local.set ?a) = ?a

goal (1 subgoal):
 1. ide f = (Dom f = Cod f \<and> Fun f = (\<lambda>x\<in>Dom f. x))
[PROOF STEP]
by (metis ide_char)


[STATEMENT]
lemma Riemann_lebesgue_sin_half:
  assumes "f absolutely_integrable_on {-pi..pi}"
  shows "(\<lambda>n. LINT x|lebesgue_on {-pi..pi}. sin ((real n + 1/2) * x) * f x) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. sin ((real n + 1 / 2) * x) * f x) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (simp add: algebra_simps sin_add)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. f x * (cos (x * real n) * sin (x / 2)) + f x * (sin (x * real n) * cos (x / 2))) \<longlonglongrightarrow> 0
[PROOF STEP]
let ?INT = "integral\<^sup>L (lebesgue_on {-pi..pi})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. f x * (cos (x * real n) * sin (x / 2)) + f x * (sin (x * real n) * cos (x / 2))) \<longlonglongrightarrow> 0
[PROOF STEP]
let ?f = "(\<lambda>n. ?INT (\<lambda>x. sin(n * x) * cos(1/2 * x) * f x) +
                 ?INT (\<lambda>x. cos(n * x) * sin(1/2 * x) * f x))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. f x * (cos (x * real n) * sin (x / 2)) + f x * (sin (x * real n) * cos (x / 2))) \<longlonglongrightarrow> 0
[PROOF STEP]
show "(\<lambda>n. ?INT (\<lambda>x. f x * (cos (x * real n) * sin (x/2)) + f x * (sin (x * real n) * cos (x/2)))) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. f x * (cos (x * real n) * sin (x / 2)) + f x * (sin (x * real n) * cos (x / 2))) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule Lim_transform_eventually)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> 0
 2. \<forall>\<^sub>F x in sequentially. ?f x = LINT xa|lebesgue_on {- pi..pi}. f xa * (cos (xa * real x) * sin (xa / 2)) + f xa * (sin (xa * real x) * cos (xa / 2))
[PROOF STEP]
have sin: "(\<lambda>x. sin (1/2 * x) * f x) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sin (1 / 2 * x) * f x) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
by (intro absolutely_integrable_sin_product assms)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sin (1 / 2 * x) * f x) absolutely_integrable_on {- pi..pi}

goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> 0
 2. \<forall>\<^sub>F x in sequentially. ?f x = LINT xa|lebesgue_on {- pi..pi}. f xa * (cos (xa * real x) * sin (xa / 2)) + f xa * (sin (xa * real x) * cos (xa / 2))
[PROOF STEP]
have cos: "(\<lambda>x. cos (1/2 * x) * f x) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. cos (1 / 2 * x) * f x) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
by (intro absolutely_integrable_cos_product assms)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. cos (1 / 2 * x) * f x) absolutely_integrable_on {- pi..pi}

goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> 0
 2. \<forall>\<^sub>F x in sequentially. ?f x = LINT xa|lebesgue_on {- pi..pi}. f xa * (cos (xa * real x) * sin (xa / 2)) + f xa * (sin (xa * real x) * cos (xa / 2))
[PROOF STEP]
show "\<forall>\<^sub>F n in sequentially. ?f n = ?INT (\<lambda>x. f x * (cos (x * real n) * sin (x/2)) + f x * (sin (x * real n) * cos (x/2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * cos (1 / 2 * x) * f x) + (LINT x|lebesgue_on {- pi..pi}. cos (real n * x) * sin (1 / 2 * x) * f x) = LINT x|lebesgue_on {- pi..pi}. f x * (cos (x * real n) * sin (x / 2)) + f x * (sin (x * real n) * cos (x / 2))
[PROOF STEP]
unfolding mult.assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * (cos (1 / 2 * x) * f x)) + (LINT x|lebesgue_on {- pi..pi}. cos (real n * x) * (sin (1 / 2 * x) * f x)) = LINT x|lebesgue_on {- pi..pi}. f x * (cos (x * real n) * sin (x / 2)) + f x * (sin (x * real n) * cos (x / 2))
[PROOF STEP]
apply (rule eventuallyI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * (cos (1 / 2 * xa) * f xa)) + (LINT xa|lebesgue_on {- pi..pi}. cos (real x * xa) * (sin (1 / 2 * xa) * f xa)) = LINT xa|lebesgue_on {- pi..pi}. f xa * (cos (xa * real x) * sin (xa / 2)) + f xa * (sin (xa * real x) * cos (xa / 2))
[PROOF STEP]
apply (subst Bochner_Integration.integral_add [symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. integrable (lebesgue_on {- pi..pi}) (\<lambda>xa. sin (real x * xa) * (cos (1 / 2 * xa) * f xa))
 2. \<And>x. integrable (lebesgue_on {- pi..pi}) (\<lambda>xa. cos (real x * xa) * (sin (1 / 2 * xa) * f xa))
 3. \<And>x. LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * (cos (1 / 2 * xa) * f xa) + cos (real x * xa) * (sin (1 / 2 * xa) * f xa) = LINT xa|lebesgue_on {- pi..pi}. f xa * (cos (xa * real x) * sin (xa / 2)) + f xa * (sin (xa * real x) * cos (xa / 2))
[PROOF STEP]
apply (safe intro!: cos absolutely_integrable_sin_product sin absolutely_integrable_cos_product absolutely_integrable_imp_integrable)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. {- pi..pi} \<in> sets lebesgue
 2. \<And>x. {- pi..pi} \<in> sets lebesgue
 3. \<And>x. LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * (cos (1 / 2 * xa) * f xa) + cos (real x * xa) * (sin (1 / 2 * xa) * f xa) = LINT xa|lebesgue_on {- pi..pi}. f xa * (cos (xa * real x) * sin (xa / 2)) + f xa * (sin (xa * real x) * cos (xa / 2))
[PROOF STEP]
apply (auto simp: algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * cos (1 / 2 * x) * f x) + (LINT x|lebesgue_on {- pi..pi}. cos (real n * x) * sin (1 / 2 * x) * f x) = LINT x|lebesgue_on {- pi..pi}. f x * (cos (x * real n) * sin (x / 2)) + f x * (sin (x * real n) * cos (x / 2))

goal (1 subgoal):
 1. (\<lambda>n. (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * cos (1 / 2 * x) * f x) + (LINT x|lebesgue_on {- pi..pi}. cos (real n * x) * sin (1 / 2 * x) * f x)) \<longlonglongrightarrow> 0
[PROOF STEP]
have "?f \<longlonglongrightarrow> 0 + 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * cos (1 / 2 * xa) * f xa) + (LINT xa|lebesgue_on {- pi..pi}. cos (real x * xa) * sin (1 / 2 * xa) * f xa)) \<longlonglongrightarrow> 0 + 0
[PROOF STEP]
unfolding mult.assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * (cos (1 / 2 * xa) * f xa)) + (LINT xa|lebesgue_on {- pi..pi}. cos (real x * xa) * (sin (1 / 2 * xa) * f xa))) \<longlonglongrightarrow> 0 + 0
[PROOF STEP]
by (intro tendsto_add Riemann_lebesgue_sin Riemann_lebesgue_cos sin cos)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * cos (1 / 2 * xa) * f xa) + (LINT xa|lebesgue_on {- pi..pi}. cos (real x * xa) * sin (1 / 2 * xa) * f xa)) \<longlonglongrightarrow> 0 + 0

goal (1 subgoal):
 1. (\<lambda>n. (LINT x|lebesgue_on {- pi..pi}. sin (real n * x) * cos (1 / 2 * x) * f x) + (LINT x|lebesgue_on {- pi..pi}. cos (real n * x) * sin (1 / 2 * x) * f x)) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. (LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * cos (1 / 2 * xa) * f xa) + (LINT xa|lebesgue_on {- pi..pi}. cos (real x * xa) * sin (1 / 2 * xa) * f xa)) \<longlonglongrightarrow> 0 + 0
[PROOF STEP]
show "?f \<longlonglongrightarrow> (0::real)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * cos (1 / 2 * xa) * f xa) + (LINT xa|lebesgue_on {- pi..pi}. cos (real x * xa) * sin (1 / 2 * xa) * f xa)) \<longlonglongrightarrow> 0 + 0

goal (1 subgoal):
 1. (\<lambda>x. (LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * cos (1 / 2 * xa) * f xa) + (LINT xa|lebesgue_on {- pi..pi}. cos (real x * xa) * sin (1 / 2 * xa) * f xa)) \<longlonglongrightarrow> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (LINT xa|lebesgue_on {- pi..pi}. sin (real x * xa) * cos (1 / 2 * xa) * f xa) + (LINT xa|lebesgue_on {- pi..pi}. cos (real x * xa) * sin (1 / 2 * xa) * f xa)) \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. LINT x|lebesgue_on {- pi..pi}. f x * (cos (x * real n) * sin (x / 2)) + f x * (sin (x * real n) * cos (x / 2))) \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma copair_qbs_space[simp]: "qbs_space (copair_qbs X Y) = qbs_space X <+> qbs_space Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_space (X <+>\<^sub>Q Y) = qbs_space X <+> qbs_space Y
[PROOF STEP]
by(simp add: qbs_space_def copair_qbs_correct)


[STATEMENT]
lemma replicate_eq_list_of_eucl_zero: "replicate DIM('a::executable_euclidean_space) 0 = list_of_eucl (0::'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replicate DIM('a) 0 = list_of_eucl (0::'a)
[PROOF STEP]
by (auto intro!: nth_equalityI)


[STATEMENT]
lemma lsc_hull_of_convex_agrees:
  fixes f :: "'a::euclidean_space \<Rightarrow> ereal"
  assumes "convex_on UNIV f"
  shows "\<forall>x. (f x = (lsc_hull f) x) | x : rel_frontier (domain f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x = lsc_hull f x \<or> x \<in> rel_frontier (domain f)
[PROOF STEP]
by (metis DiffI assms lsc_hull_of_convex_agrees_onRI lsc_hull_of_convex_agrees_outside rel_frontier_def)


[STATEMENT]
lemma beta_C_meta_3[PLM]:
    assumes "IsProperInXYZ \<phi>"
    shows "[\<lparr>\<^bold>\<lambda>\<^sup>3 (\<lambda> x y z. \<phi> (x\<^sup>P) (y\<^sup>P) (z\<^sup>P)), x\<^sup>P, y\<^sup>P, z\<^sup>P\<rparr> \<^bold>\<equiv> \<phi> (x\<^sup>P) (y\<^sup>P) (z\<^sup>P) in v]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [\<lparr>\<^bold>\<lambda>\<^sup>3 (\<lambda>x y z. \<phi> (x\<^sup>P) (y\<^sup>P) (z\<^sup>P)),x\<^sup>P,y\<^sup>P,z\<^sup>P\<rparr> \<^bold>\<equiv> \<phi> (x\<^sup>P) (y\<^sup>P) (z\<^sup>P) in v]
[PROOF STEP]
using lambda_predicates_2_3[OF assms, axiom_instance]
[PROOF STATE]
proof (prove)
using this:
[\<lparr>\<^bold>\<lambda>\<^sup>3 (\<lambda>x y z. \<phi> (x\<^sup>P) (y\<^sup>P) (z\<^sup>P)),?x1\<^sup>P,?y1\<^sup>P,?z1\<^sup>P\<rparr> \<^bold>\<equiv> \<phi> (?x1\<^sup>P) (?y1\<^sup>P) (?z1\<^sup>P) in ?v]

goal (1 subgoal):
 1. [\<lparr>\<^bold>\<lambda>\<^sup>3 (\<lambda>x y z. \<phi> (x\<^sup>P) (y\<^sup>P) (z\<^sup>P)),x\<^sup>P,y\<^sup>P,z\<^sup>P\<rparr> \<^bold>\<equiv> \<phi> (x\<^sup>P) (y\<^sup>P) (z\<^sup>P) in v]
[PROOF STEP]
by auto


[STATEMENT]
lemma nn_integral_indicator_singleton'[simp]:
  assumes [measurable]: "{y} \<in> sets M"
  shows "(\<integral>\<^sup>+x. ennreal (f x * indicator {y} x) \<partial>M) = f y * emeasure M {y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x * indicat_real {y} x) \<partial>M = ennreal (f y) * emeasure M {y}
[PROOF STEP]
by (subst nn_integral_set_ennreal[symmetric]) (simp)


[STATEMENT]
lemma one_le_\<omega>[simp]: "1 \<le> \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> \<omega>
[PROOF STEP]
by (simp add: less_imp_le)


[STATEMENT]
lemma hypnat_dvd_all_hypnat_of_nat:
  "\<exists>N::hypnat. 0 < N \<and> (\<forall>n \<in> - {0::nat}. hypnat_of_nat n dvd N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N>0. \<forall>n\<in>- {0}. hypnat_of_nat n dvd N
[PROOF STEP]
by (metis Compl_iff gr0I hdvd_by_all hypnat_of_nat_le_whn singletonI star_of_0_less)


[STATEMENT]
lemma LIMSEQ_less_Ex:
   "\<lbrakk> X \<longlonglongrightarrow> (x::real); x < y \<rbrakk> \<Longrightarrow> \<exists>n. X n < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow> x; x < y\<rbrakk> \<Longrightarrow> \<exists>n. X n < y
[PROOF STEP]
by (meson LIMSEQ_le_const not_less)


[STATEMENT]
lemma openin_path_component_locally_path_connected:
  "locally path_connected S
        \<Longrightarrow> openin (top_of_set S) (path_component_set S x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally path_connected S \<Longrightarrow> openin (top_of_set S) (path_component_set S x)
[PROOF STEP]
by (metis (no_types) empty_iff locally_path_connected_2 openin_subopen openin_subtopology_self path_component_eq_empty)


[STATEMENT]
lemma (in B1_algebra) one_plus_star:  "x\<^sup>\<star> = (1 + x)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> = ((1::'a) + x)\<^sup>\<star>
[PROOF STEP]
by (metis C11_var R add_idem' mult_onel mult_oner)


[STATEMENT]
lemma singular_relboundary_add:
   "\<lbrakk>singular_relboundary p X S a; singular_relboundary p X S b\<rbrakk> \<Longrightarrow> singular_relboundary p X S (a+b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>singular_relboundary p X S a; singular_relboundary p X S b\<rbrakk> \<Longrightarrow> singular_relboundary p X S (a + b)
[PROOF STEP]
unfolding singular_relboundary_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>d. singular_chain (Suc p) X d \<and> (chain_boundary (Suc p) d, a) \<in> mod_subset p (subtopology X S); \<exists>d. singular_chain (Suc p) X d \<and> (chain_boundary (Suc p) d, b) \<in> mod_subset p (subtopology X S)\<rbrakk> \<Longrightarrow> \<exists>d. singular_chain (Suc p) X d \<and> (chain_boundary (Suc p) d, a + b) \<in> mod_subset p (subtopology X S)
[PROOF STEP]
by (metis chain_boundary_add mod_subset_add singular_chain_add)


[STATEMENT]
lemma sums_alternating_upper_lower:
  fixes a :: "nat \<Rightarrow> real"
  assumes mono: "\<And>n. a (Suc n) \<le> a n"
    and a_pos: "\<And>n. 0 \<le> a n"
    and "a \<longlonglongrightarrow> 0"
  shows "\<exists>l. ((\<forall>n. (\<Sum>i<2*n. (- 1)^i*a i) \<le> l) \<and> (\<lambda> n. \<Sum>i<2*n. (- 1)^i*a i) \<longlonglongrightarrow> l) \<and>
             ((\<forall>n. l \<le> (\<Sum>i<2*n + 1. (- 1)^i*a i)) \<and> (\<lambda> n. \<Sum>i<2*n + 1. (- 1)^i*a i) \<longlonglongrightarrow> l)"
  (is "\<exists>l. ((\<forall>n. ?f n \<le> l) \<and> _) \<and> ((\<forall>n. l \<le> ?g n) \<and> _)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l. ((\<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> l) \<and> (\<lambda>n. \<Sum>i<2 * n. (- 1) ^ i * a i) \<longlonglongrightarrow> l) \<and> (\<forall>n. l \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)) \<and> (\<lambda>n. \<Sum>i<2 * n + 1. (- 1) ^ i * a i) \<longlonglongrightarrow> l
[PROOF STEP]
proof (rule nested_sequence_unique)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * Suc n. (- 1) ^ i * a i)
 2. \<forall>n. (\<Sum>i<2 * Suc n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
 3. \<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
 4. (\<lambda>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) - (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)) \<longlonglongrightarrow> 0
[PROOF STEP]
have fg_diff: "\<And>n. ?f n - ?g n = - a (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) - (\<Sum>i<2 * n + 1. (- 1) ^ i * a i) = - a (2 * n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<2 * ?n. (- 1) ^ i * a i) - (\<Sum>i<2 * ?n + 1. (- 1) ^ i * a i) = - a (2 * ?n)

goal (4 subgoals):
 1. \<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * Suc n. (- 1) ^ i * a i)
 2. \<forall>n. (\<Sum>i<2 * Suc n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
 3. \<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
 4. (\<lambda>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) - (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)) \<longlonglongrightarrow> 0
[PROOF STEP]
show "\<forall>n. ?f n \<le> ?f (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * Suc n. (- 1) ^ i * a i)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * Suc n. (- 1) ^ i * a i)
[PROOF STEP]
show "?f n \<le> ?f (Suc n)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * Suc n. (- 1) ^ i * a i)
[PROOF STEP]
using mono[of "2*n"]
[PROOF STATE]
proof (prove)
using this:
a (Suc (2 * n)) \<le> a (2 * n)

goal (1 subgoal):
 1. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * Suc n. (- 1) ^ i * a i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<2 * ?n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * Suc ?n. (- 1) ^ i * a i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * Suc n. (- 1) ^ i * a i)

goal (3 subgoals):
 1. \<forall>n. (\<Sum>i<2 * Suc n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
 2. \<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
 3. (\<lambda>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) - (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)) \<longlonglongrightarrow> 0
[PROOF STEP]
show "\<forall>n. ?g (Suc n) \<le> ?g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. (\<Sum>i<2 * Suc n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i<2 * Suc n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
[PROOF STEP]
show "?g (Suc n) \<le> ?g n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<2 * Suc n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
[PROOF STEP]
using mono[of "Suc (2*n)"]
[PROOF STATE]
proof (prove)
using this:
a (Suc (Suc (2 * n))) \<le> a (Suc (2 * n))

goal (1 subgoal):
 1. (\<Sum>i<2 * Suc n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<2 * Suc ?n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * ?n + 1. (- 1) ^ i * a i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n. (\<Sum>i<2 * Suc n + 1. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)

goal (2 subgoals):
 1. \<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
 2. (\<lambda>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) - (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)) \<longlonglongrightarrow> 0
[PROOF STEP]
show "\<forall>n. ?f n \<le> ?g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
[PROOF STEP]
show "?f n \<le> ?g n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
[PROOF STEP]
using fg_diff a_pos
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i<2 * ?n. (- 1) ^ i * a i) - (\<Sum>i<2 * ?n + 1. (- 1) ^ i * a i) = - a (2 * ?n)
0 \<le> a ?n

goal (1 subgoal):
 1. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<2 * ?n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * ?n + 1. (- 1) ^ i * a i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) - (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)) \<longlonglongrightarrow> 0
[PROOF STEP]
show "(\<lambda>n. ?f n - ?g n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) - (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)) \<longlonglongrightarrow> 0
[PROOF STEP]
unfolding fg_diff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - a (2 * n)) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule LIMSEQ_I)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (- a (2 * n) - 0) < r
[PROOF STEP]
fix r :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (- a (2 * n) - 0) < r
[PROOF STEP]
assume "0 < r"
[PROOF STATE]
proof (state)
this:
0 < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (- a (2 * n) - 0) < r
[PROOF STEP]
with \<open>a \<longlonglongrightarrow> 0\<close>[THEN LIMSEQ_D]
[PROOF STATE]
proof (chain)
picking this:
0 < ?r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (a n - 0) < ?r
0 < r
[PROOF STEP]
obtain N where "\<And> n. n \<ge> N \<Longrightarrow> norm (a n - 0) < r"
[PROOF STATE]
proof (prove)
using this:
0 < ?r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (a n - 0) < ?r
0 < r

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> norm (a n - 0) < r) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<le> ?n \<Longrightarrow> norm (a ?n - 0) < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (- a (2 * n) - 0) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<le> ?n \<Longrightarrow> norm (a ?n - 0) < r
[PROOF STEP]
have "\<forall>n \<ge> N. norm (- a (2 * n) - 0) < r"
[PROOF STATE]
proof (prove)
using this:
N \<le> ?n \<Longrightarrow> norm (a ?n - 0) < r

goal (1 subgoal):
 1. \<forall>n\<ge>N. norm (- a (2 * n) - 0) < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>N. norm (- a (2 * n) - 0) < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (- a (2 * n) - 0) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<ge>N. norm (- a (2 * n) - 0) < r
[PROOF STEP]
show "\<exists>N. \<forall>n \<ge> N. norm (- a (2 * n) - 0) < r"
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>N. norm (- a (2 * n) - 0) < r

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. norm (- a (2 * n) - 0) < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>n\<ge>N. norm (- a (2 * n) - 0) < r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<Sum>i<2 * n. (- 1) ^ i * a i) - (\<Sum>i<2 * n + 1. (- 1) ^ i * a i)) \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma islimpt_iff_eventually: "x islimpt S \<longleftrightarrow> \<not> eventually (\<lambda>y. y \<notin> S) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x islimpt S = (\<not> (\<forall>\<^sub>F y in at x. y \<notin> S))
[PROOF STEP]
unfolding islimpt_def eventually_at_topological
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>T. x \<in> T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y \<in> T \<and> y \<noteq> x)) = (\<nexists>Sa. open Sa \<and> x \<in> Sa \<and> (\<forall>xa\<in>Sa. xa \<noteq> x \<longrightarrow> xa \<in> UNIV \<longrightarrow> xa \<notin> S))
[PROOF STEP]
by auto


[STATEMENT]
lemma cnj_mult [simp]: "cnj (x * y) = cnj y * cnj x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Quaternions.cnj (x * y) = Quaternions.cnj y * Quaternions.cnj x
[PROOF STEP]
by (simp add: quat_eq_iff)


[STATEMENT]
lemma lem3: "N(s(s(s(s(e)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N (s (s (s (s e))))
[PROOF STEP]
by (simp add: lem1 lem2)


[STATEMENT]
lemma "Let y (%x. [x,x]) = [y, y]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (let x = y in [x, x]) = [y, y]
[PROOF STEP]
by normalization


[STATEMENT]
lemma w_method_via_h_framework_lists_2_completeness :
  fixes M1 :: "('a::linorder,'b::linorder,'c::linorder) fsm"
  fixes M2 :: "('d,'b,'c) fsm"
  assumes "observable M1"
  and     "observable M2"
  and     "minimal M1"
  and     "minimal M2"
  and     "size_r M1 \<le> m"
  and     "size M2 \<le> m"
  and     "inputs M2 = inputs M1"
  and     "outputs M2 = outputs M1"
shows "(L M1 = L M2) \<longleftrightarrow> list_all (passes_test_case M2 (initial M2)) (w_method_via_h_framework_2_lists M1 m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (w_method_via_h_framework_2_lists M1 m)
[PROOF STEP]
using h_framework_static_with_empty_graph_lists_completeness[OF assms, where dist_fun="(\<lambda> k q . distinguishing_set_reduced M1)", OF _ distinguishing_set_reduced_finite]
[PROOF STATE]
proof (prove)
using this:
(\<And>q1 q2. \<lbrakk>q1 \<in> FSM.states M1; q2 \<in> FSM.states M1; q1 \<noteq> q2\<rbrakk> \<Longrightarrow> \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set_reduced M1) \<inter> Prefix_Tree.set (distinguishing_set_reduced M1) \<and> distinguishes M1 q1 q2 io) \<Longrightarrow> (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (h_framework_static_with_empty_graph_lists M1 (\<lambda>k q. distinguishing_set_reduced M1) m)

goal (1 subgoal):
 1. (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (w_method_via_h_framework_2_lists M1 m)
[PROOF STEP]
using distinguishing_set_reduced_distinguishes[OF assms(1,3)]
[PROOF STATE]
proof (prove)
using this:
(\<And>q1 q2. \<lbrakk>q1 \<in> FSM.states M1; q2 \<in> FSM.states M1; q1 \<noteq> q2\<rbrakk> \<Longrightarrow> \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set_reduced M1) \<inter> Prefix_Tree.set (distinguishing_set_reduced M1) \<and> distinguishes M1 q1 q2 io) \<Longrightarrow> (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (h_framework_static_with_empty_graph_lists M1 (\<lambda>k q. distinguishing_set_reduced M1) m)
\<lbrakk>?q1.0 \<in> FSM.states M1; ?q2.0 \<in> FSM.states M1; ?q1.0 \<noteq> ?q2.0\<rbrakk> \<Longrightarrow> \<exists>io\<in>Prefix_Tree.set (distinguishing_set_reduced M1). distinguishes M1 ?q1.0 ?q2.0 io

goal (1 subgoal):
 1. (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (w_method_via_h_framework_2_lists M1 m)
[PROOF STEP]
unfolding w_method_via_h_framework_2_lists_def h_framework_static_with_empty_graph_lists_def w_method_via_h_framework_2_def
[PROOF STATE]
proof (prove)
using this:
(\<And>q1 q2. \<lbrakk>q1 \<in> FSM.states M1; q2 \<in> FSM.states M1; q1 \<noteq> q2\<rbrakk> \<Longrightarrow> \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set_reduced M1) \<inter> Prefix_Tree.set (distinguishing_set_reduced M1) \<and> distinguishes M1 q1 q2 io) \<Longrightarrow> (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (sorted_list_of_maximal_sequences_in_tree (test_suite_from_io_tree M1 (FSM.initial M1) (h_framework_static_with_empty_graph M1 (\<lambda>k q. distinguishing_set_reduced M1) m)))
\<lbrakk>?q1.0 \<in> FSM.states M1; ?q2.0 \<in> FSM.states M1; ?q1.0 \<noteq> ?q2.0\<rbrakk> \<Longrightarrow> \<exists>io\<in>Prefix_Tree.set (distinguishing_set_reduced M1). distinguishes M1 ?q1.0 ?q2.0 io

goal (1 subgoal):
 1. (L M1 = L M2) = list_all (passes_test_case M2 (FSM.initial M2)) (sorted_list_of_maximal_sequences_in_tree (test_suite_from_io_tree M1 (FSM.initial M1) (h_framework_static_with_empty_graph M1 (\<lambda>k q. distinguishing_set_reduced M1) m)))
[PROOF STEP]
by blast


[STATEMENT]
lemma removeAll_overshadow_filter:
  "removeAll x (filter (\<lambda>xa. xa \<notin> A - {x}) xs) = removeAll x (filter (\<lambda> xa. xa \<notin> A) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. removeAll x (filter (\<lambda>xa. xa \<notin> A - {x}) xs) = removeAll x (filter (\<lambda>xa. xa \<notin> A) xs)
[PROOF STEP]
apply (simp add: removeAll_filter_not_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>xa. (xa \<in> A \<longrightarrow> xa = x) \<and> x \<noteq> xa) xs = filter (\<lambda>xa. xa \<notin> A \<and> x \<noteq> xa) xs
[PROOF STEP]
apply (rule filter_cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. xs = xs
 2. \<And>xa. xa \<in> set xs \<Longrightarrow> ((xa \<in> A \<longrightarrow> xa = x) \<and> x \<noteq> xa) = (xa \<notin> A \<and> x \<noteq> xa)
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set xs \<Longrightarrow> ((xa \<in> A \<longrightarrow> xa = x) \<and> x \<noteq> xa) = (xa \<notin> A \<and> x \<noteq> xa)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fps_XD'_funpow_affine:
  fixes G H :: "real fps"
  assumes [simp]: "fps_deriv G = 1"
  defines "S \<equiv> \<lambda>n i. fps_const (real (Stirling n i))"
  shows "(fps_XD' G ^^ n) H =
           (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
proof (induction n arbitrary: H)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>H. (fps_XD' G ^^ 0) H = (\<Sum>m\<le>0. S 0 m * G ^ m * (fps_deriv ^^ m) H)
 2. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>H. (fps_XD' G ^^ 0) H = (\<Sum>m\<le>0. S 0 m * G ^ m * (fps_deriv ^^ m) H)
 2. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_XD' G ^^ 0) H = (\<Sum>m\<le>0. S 0 m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
by (simp add: S_def)
[PROOF STATE]
proof (state)
this:
(fps_XD' G ^^ 0) H = (\<Sum>m\<le>0. S 0 m * G ^ m * (fps_deriv ^^ m) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
case (Suc n H)
[PROOF STATE]
proof (state)
this:
(fps_XD' G ^^ n) ?H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) ?H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
have "(\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H) =
        (\<Sum>i\<le>n. of_nat (Suc i) * S n (Suc i) *  G ^ Suc i * (fps_deriv ^^ Suc i) H) +
        (\<Sum>i\<le>n. S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H)"
    (is "_ = sum (\<lambda>i. ?f (Suc i)) \<dots> + ?S2")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H) = (\<Sum>i\<le>n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) + (\<Sum>i\<le>n. S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H)
[PROOF STEP]
by (subst sum.atMost_Suc_shift) (simp_all add: sum.distrib algebra_simps fps_of_nat S_def
          fps_const_add [symmetric] fps_const_mult [symmetric] del: fps_const_add fps_const_mult)
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H) = (\<Sum>i\<le>n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) + (\<Sum>i\<le>n. S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H) = (\<Sum>i\<le>n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) + (\<Sum>i\<le>n. S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
have "sum (\<lambda>i. ?f (Suc i)) {..n} = sum (\<lambda>i. ?f (Suc i)) {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H)
[PROOF STEP]
by (intro sum.mono_neutral_right) (auto simp: S_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
have "\<dots> = ?f 0 + \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = of_nat 0 * S n 0 * G ^ 0 * (fps_deriv ^^ 0) H + (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = of_nat 0 * S n 0 * G ^ 0 * (fps_deriv ^^ 0) H + (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = of_nat 0 * S n 0 * G ^ 0 * (fps_deriv ^^ 0) H + (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
have "\<dots> = sum ?f {..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat 0 * S n 0 * G ^ 0 * (fps_deriv ^^ 0) H + (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>a\<le>n. of_nat a * S n a * G ^ a * (fps_deriv ^^ a) H)
[PROOF STEP]
by (subst sum.atMost_shift [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
of_nat 0 * S n 0 * G ^ 0 * (fps_deriv ^^ 0) H + (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>a\<le>n. of_nat a * S n a * G ^ a * (fps_deriv ^^ a) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat 0 * S n 0 * G ^ 0 * (fps_deriv ^^ 0) H + (\<Sum>i<n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>a\<le>n. of_nat a * S n a * G ^ a * (fps_deriv ^^ a) H)

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
have "\<dots> + ?S2 = (\<Sum>x\<le>n. fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<le>n. of_nat a * S n a * G ^ a * (fps_deriv ^^ a) H) + (\<Sum>i\<le>n. S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>x\<le>n. fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H))
[PROOF STEP]
unfolding sum.distrib [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<le>n. of_nat x * S n x * G ^ x * (fps_deriv ^^ x) H + S n x * G ^ Suc x * (fps_deriv ^^ Suc x) H) = (\<Sum>x\<le>n. fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H))
[PROOF STEP]
proof (rule sum.cong, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {..n} = {..n}
 2. \<And>x. x \<in> {..n} \<Longrightarrow> of_nat x * S n x * G ^ x * (fps_deriv ^^ x) H + S n x * G ^ Suc x * (fps_deriv ^^ Suc x) H = fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H)
[PROOF STEP]
case (2 i)
[PROOF STATE]
proof (state)
this:
i \<in> {..n}

goal (2 subgoals):
 1. {..n} = {..n}
 2. \<And>x. x \<in> {..n} \<Longrightarrow> of_nat x * S n x * G ^ x * (fps_deriv ^^ x) H + S n x * G ^ Suc x * (fps_deriv ^^ Suc x) H = fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
i \<in> {..n}

goal (1 subgoal):
 1. of_nat i * S n i * G ^ i * (fps_deriv ^^ i) H + S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H = fps_XD' G (S n i * G ^ i * (fps_deriv ^^ i) H)
[PROOF STEP]
unfolding fps_XD'_prod fps_XD'_power
[PROOF STATE]
proof (prove)
using this:
i \<in> {..n}

goal (1 subgoal):
 1. of_nat i * S n i * G ^ i * (fps_deriv ^^ i) H + S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H = (fps_XD' G (S n i) * G ^ i + S n i * (of_nat i * G ^ (i - 1) * fps_XD' G G)) * (fps_deriv ^^ i) H + S n i * G ^ i * fps_XD' G ((fps_deriv ^^ i) H)
[PROOF STEP]
by (cases i) (auto simp: fps_XD'_prod fps_XD'_power_Suc algebra_simps of_nat_diff S_def fps_XD'_def)
[PROOF STATE]
proof (state)
this:
of_nat i * S n i * G ^ i * (fps_deriv ^^ i) H + S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H = fps_XD' G (S n i * G ^ i * (fps_deriv ^^ i) H)

goal (1 subgoal):
 1. {..n} = {..n}
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<le>n. of_nat a * S n a * G ^ a * (fps_deriv ^^ a) H) + (\<Sum>i\<le>n. S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>x\<le>n. fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H))

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<le>n. of_nat a * S n a * G ^ a * (fps_deriv ^^ a) H) + (\<Sum>i\<le>n. S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H) = (\<Sum>x\<le>n. fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H))

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
have "\<dots> = (fps_XD' G ^^ Suc n) H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<le>n. fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H)) = (fps_XD' G ^^ Suc n) H
[PROOF STEP]
by (simp add: Suc.IH fps_XD'_sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<le>n. fps_XD' G (S n x * G ^ x * (fps_deriv ^^ x) H)) = (fps_XD' G ^^ Suc n) H

goal (1 subgoal):
 1. \<And>n H. (\<And>H. (fps_XD' G ^^ n) H = (\<Sum>m\<le>n. S n m * G ^ m * (fps_deriv ^^ m) H)) \<Longrightarrow> (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H) = (fps_XD' G ^^ Suc n) H
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H) = (fps_XD' G ^^ Suc n) H

goal (1 subgoal):
 1. (fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(fps_XD' G ^^ Suc n) H = (\<Sum>m\<le>Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sumset_insert1: "NO_MATCH {} A \<Longrightarrow> sumset (insert x A) B = sumset {x} B \<union> sumset A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NO_MATCH {} A \<Longrightarrow> sumset (insert x A) B = sumset {x} B \<union> sumset A B
[PROOF STEP]
by (auto simp: sumset_eq)