[STATEMENT]
lemma Fourier_sum_offset:
  fixes f :: "real \<Rightarrow> real"
  assumes f: "f absolutely_integrable_on {-pi..pi}" and periodic: "\<And>x. f(x + 2*pi) = f x"
  shows  "(\<Sum>k\<le>2*n. Fourier_coefficient f k * trigonometric_set k t) =
          (\<Sum>k\<le>2*n. Fourier_coefficient (\<lambda>x. f(x+t)) k * trigonometric_set k 0)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "?lhs = Fourier_coefficient f 0 * trigonometric_set 0 t + (\<Sum>k = Suc 0..2*n. Fourier_coefficient f k * trigonometric_set k t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = Fourier_coefficient f 0 * trigonometric_set 0 t + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t)
[PROOF STEP]
by (simp add: atMost_atLeast0 sum.atLeast_Suc_atMost)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = Fourier_coefficient f 0 * trigonometric_set 0 t + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t)

goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = Fourier_coefficient f 0 * trigonometric_set 0 t + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t)

goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "(\<Sum>k = Suc 0..2*n. Fourier_coefficient f k * trigonometric_set k t) =
                 (\<Sum>k = Suc 0..2*n. Fourier_coefficient (\<lambda>x. f(x+t)) k * trigonometric_set k 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
case (Suc n')
[PROOF STATE]
proof (state)
this:
n = Suc n'

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t)
        = (\<Sum>k = Suc 0.. Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t)
[PROOF STEP]
by (simp add: Suc)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "\<dots> = (\<Sum>k \<le> Suc (2 * n'). Fourier_coefficient f(Suc k) * trigonometric_set (Suc k) t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient f (Suc k) * trigonometric_set (Suc k) t)
[PROOF STEP]
unfolding atMost_atLeast0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = 0..Suc (2 * n'). Fourier_coefficient f (Suc k) * trigonometric_set (Suc k) t)
[PROOF STEP]
using sum.shift_bounds_cl_Suc_ivl
[PROOF STATE]
proof (prove)
using this:
sum ?g {Suc ?m..Suc ?n} = (\<Sum>i = ?m..?n. ?g (Suc i))

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = 0..Suc (2 * n'). Fourier_coefficient f (Suc k) * trigonometric_set (Suc k) t)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient f (Suc k) * trigonometric_set (Suc k) t)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient f (Suc k) * trigonometric_set (Suc k) t)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "\<dots> = (\<Sum>k \<le> Suc (2 * n'). Fourier_coefficient (\<lambda>x. f(x+t)) (Suc k) * trigonometric_set (Suc k) 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient f (Suc k) * trigonometric_set (Suc k) t) = (\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient (\<lambda>x. f (x + t)) (Suc k) * trigonometric_set (Suc k) 0)
[PROOF STEP]
unfolding sum.in_pairs_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n'. Fourier_coefficient f (Suc (2 * i)) * trigonometric_set (Suc (2 * i)) t + Fourier_coefficient f (Suc (Suc (2 * i))) * trigonometric_set (Suc (Suc (2 * i))) t) = (\<Sum>i\<le>n'. Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (2 * i)) * trigonometric_set (Suc (2 * i)) 0 + Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (Suc (2 * i))) * trigonometric_set (Suc (Suc (2 * i))) 0)
[PROOF STEP]
proof (rule sum.cong [OF refl])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..n'} \<Longrightarrow> Fourier_coefficient f (Suc (2 * x)) * trigonometric_set (Suc (2 * x)) t + Fourier_coefficient f (Suc (Suc (2 * x))) * trigonometric_set (Suc (Suc (2 * x))) t = Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (2 * x)) * trigonometric_set (Suc (2 * x)) 0 + Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (Suc (2 * x))) * trigonometric_set (Suc (Suc (2 * x))) 0
[PROOF STEP]
show "Fourier_coefficient f(Suc (2 * k)) * trigonometric_set (Suc (2 * k)) t + Fourier_coefficient f(Suc (Suc (2 * k))) * trigonometric_set (Suc (Suc (2 * k))) t = Fourier_coefficient (\<lambda>x. f(x + t)) (Suc (2 * k)) * trigonometric_set (Suc (2 * k)) 0 + Fourier_coefficient (\<lambda>x. f(x + t)) (Suc (Suc (2 * k))) * trigonometric_set (Suc (Suc (2 * k))) 0"
        if "k \<in> {..n'}" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fourier_coefficient f (Suc (2 * k)) * trigonometric_set (Suc (2 * k)) t + Fourier_coefficient f (Suc (Suc (2 * k))) * trigonometric_set (Suc (Suc (2 * k))) t = Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (2 * k)) * trigonometric_set (Suc (2 * k)) 0 + Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (Suc (2 * k))) * trigonometric_set (Suc (Suc (2 * k))) 0
[PROOF STEP]
using that Fourier_offset_term [OF assms, of t ]
[PROOF STATE]
proof (prove)
using this:
k \<in> {..n'}
Fourier_coefficient (\<lambda>x. f (x + t)) (2 * ?n + 2) * trigonometric_set (2 * ?n + 2) 0 = Fourier_coefficient f (2 * ?n + 1) * trigonometric_set (2 * ?n + 1) t + Fourier_coefficient f (2 * ?n + 2) * trigonometric_set (2 * ?n + 2) t

goal (1 subgoal):
 1. Fourier_coefficient f (Suc (2 * k)) * trigonometric_set (Suc (2 * k)) t + Fourier_coefficient f (Suc (Suc (2 * k))) * trigonometric_set (Suc (Suc (2 * k))) t = Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (2 * k)) * trigonometric_set (Suc (2 * k)) 0 + Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (Suc (2 * k))) * trigonometric_set (Suc (Suc (2 * k))) 0
[PROOF STEP]
by (auto simp: trigonometric_set_def)
[PROOF STATE]
proof (state)
this:
?k \<in> {..n'} \<Longrightarrow> Fourier_coefficient f (Suc (2 * ?k)) * trigonometric_set (Suc (2 * ?k)) t + Fourier_coefficient f (Suc (Suc (2 * ?k))) * trigonometric_set (Suc (Suc (2 * ?k))) t = Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (2 * ?k)) * trigonometric_set (Suc (2 * ?k)) 0 + Fourier_coefficient (\<lambda>x. f (x + t)) (Suc (Suc (2 * ?k))) * trigonometric_set (Suc (Suc (2 * ?k))) 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient f (Suc k) * trigonometric_set (Suc k) t) = (\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient (\<lambda>x. f (x + t)) (Suc k) * trigonometric_set (Suc k) 0)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient f (Suc k) * trigonometric_set (Suc k) t) = (\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient (\<lambda>x. f (x + t)) (Suc k) * trigonometric_set (Suc k) 0)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "\<dots> = (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient (\<lambda>x. f(x+t)) k * trigonometric_set k 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient (\<lambda>x. f (x + t)) (Suc k) * trigonometric_set (Suc k) 0) = (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
by (simp only: atMost_atLeast0 sum.shift_bounds_cl_Suc_ivl)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient (\<lambda>x. f (x + t)) (Suc k) * trigonometric_set (Suc k) 0) = (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc (2 * n'). Fourier_coefficient (\<lambda>x. f (x + t)) (Suc k) * trigonometric_set (Suc k) 0) = (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "\<dots> = (\<Sum>k = Suc 0..2*n. Fourier_coefficient (\<lambda>x. f(x+t)) k * trigonometric_set k 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
by (simp add: Suc)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..Suc (Suc (2 * n')). Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
 2. \<And>nat. n = Suc nat \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (1 subgoal):
 1. (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "?rhs
           = Fourier_coefficient (\<lambda>x. f(x+t)) 0 * trigonometric_set 0 0 + (\<Sum>k = Suc 0..2*n. Fourier_coefficient (\<lambda>x. f(x+t)) k * trigonometric_set k 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0) = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0 + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
by (simp add: atMost_atLeast0 sum.atLeast_Suc_atMost)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0) = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0 + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0) = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0 + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
have "Fourier_coefficient f 0 * trigonometric_set 0 t
               = Fourier_coefficient (\<lambda>x. f(x+t)) 0 * trigonometric_set 0 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fourier_coefficient f 0 * trigonometric_set 0 t = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0
[PROOF STEP]
by (simp add: Fourier_coefficient_def orthonormal_coeff_def trigonometric_set_def l2product_def integral_periodic_offset periodic)
[PROOF STATE]
proof (state)
this:
Fourier_coefficient f 0 * trigonometric_set 0 t = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0

goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = Fourier_coefficient f 0 * trigonometric_set 0 t + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t)
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
(\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0) = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0 + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
Fourier_coefficient f 0 * trigonometric_set 0 t = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = Fourier_coefficient f 0 * trigonometric_set 0 t + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t)
(\<Sum>k = Suc 0..2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
(\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0) = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0 + (\<Sum>k = Suc 0..2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
Fourier_coefficient f 0 * trigonometric_set 0 t = Fourier_coefficient (\<lambda>x. f (x + t)) 0 * trigonometric_set 0 0

goal (1 subgoal):
 1. (\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>2 * n. Fourier_coefficient f k * trigonometric_set k t) = (\<Sum>k\<le>2 * n. Fourier_coefficient (\<lambda>x. f (x + t)) k * trigonometric_set k 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_offset_poly: "poly (offset_poly p h) x = poly p (h + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (offset_poly p h) x = poly p (h + x)
[PROOF STEP]
apply (induct p)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. poly (offset_poly 0 h) x = poly 0 (h + x)
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; poly (offset_poly p h) x = poly p (h + x)\<rbrakk> \<Longrightarrow> poly (offset_poly (pCons a p) h) x = poly (pCons a p) (h + x)
[PROOF STEP]
apply (simp add: offset_poly_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; poly (offset_poly p h) x = poly p (h + x)\<rbrakk> \<Longrightarrow> poly (offset_poly (pCons a p) h) x = poly (pCons a p) (h + x)
[PROOF STEP]
apply (simp add: offset_poly_pCons algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma probably_innocent:
  assumes approx: "1 / (2 * (p_H - p_j)) \<le> p_f" and "p_H \<noteq> p_j"
  shows "\<P>(\<omega> in \<PP>. \<exists>j\<in>H. visit {j} J \<omega> \<and> before_C {j} \<omega> \<bar> hit_C \<omega> ) \<le> 1 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cond_prob \<PP> (\<lambda>\<omega>. \<exists>j\<in>H. visit {j} J \<omega> \<and> before_C {j} \<omega>) hit_C \<le> 1 / 2
[PROOF STEP]
unfolding Pr_visit_eq_before_C
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (p_H - p_j) * p_f \<le> 1 / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 - (p_H - p_j) * p_f \<le> 1 / 2
[PROOF STEP]
have [simp]: "\<And>n :: nat. 1 \<le> real n \<longleftrightarrow> 1 \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (1 \<le> real n) = (1 \<le> n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 \<le> real ?n1) = (1 \<le> ?n1)

goal (1 subgoal):
 1. 1 - (p_H - p_j) * p_f \<le> 1 / 2
[PROOF STEP]
have "0 \<le> p_j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> p_j
[PROOF STEP]
unfolding p_j_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 1 / real (card J)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> p_j

goal (1 subgoal):
 1. 1 - (p_H - p_j) * p_f \<le> 1 / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> p_j
[PROOF STEP]
have "1 * p_j \<le> p_H"
[PROOF STATE]
proof (prove)
using this:
0 \<le> p_j

goal (1 subgoal):
 1. 1 * p_j \<le> p_H
[PROOF STEP]
unfolding H_eq2[symmetric]
[PROOF STATE]
proof (prove)
using this:
0 \<le> p_j

goal (1 subgoal):
 1. 1 * p_j \<le> real (card H) * p_j
[PROOF STEP]
using C_smaller
[PROOF STATE]
proof (prove)
using this:
0 \<le> p_j
C \<subset> J

goal (1 subgoal):
 1. 1 * p_j \<le> real (card H) * p_j
[PROOF STEP]
by (intro mult_mono) (auto simp: Suc_le_eq card_Diff_subset not_le)
[PROOF STATE]
proof (state)
this:
1 * p_j \<le> p_H

goal (1 subgoal):
 1. 1 - (p_H - p_j) * p_f \<le> 1 / 2
[PROOF STEP]
with \<open>p_H \<noteq> p_j\<close>
[PROOF STATE]
proof (chain)
picking this:
p_H \<noteq> p_j
1 * p_j \<le> p_H
[PROOF STEP]
have "p_j < p_H"
[PROOF STATE]
proof (prove)
using this:
p_H \<noteq> p_j
1 * p_j \<le> p_H

goal (1 subgoal):
 1. p_j < p_H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p_j < p_H

goal (1 subgoal):
 1. 1 - (p_H - p_j) * p_f \<le> 1 / 2
[PROOF STEP]
with approx
[PROOF STATE]
proof (chain)
picking this:
1 / (2 * (p_H - p_j)) \<le> p_f
p_j < p_H
[PROOF STEP]
show "1 - (p_H - p_j) * p_f \<le> 1 / 2"
[PROOF STATE]
proof (prove)
using this:
1 / (2 * (p_H - p_j)) \<le> p_f
p_j < p_H

goal (1 subgoal):
 1. 1 - (p_H - p_j) * p_f \<le> 1 / 2
[PROOF STEP]
by (auto simp add: field_simps divide_le_eq split: if_split_asm)
[PROOF STATE]
proof (state)
this:
1 - (p_H - p_j) * p_f \<le> 1 / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fact_ge_Suc_0_nat [simp]: "fact n \<ge> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 \<le> fact n
[PROOF STEP]
by (metis One_nat_def fact_ge_1)


[STATEMENT]
lemma neg_numeral_le_floor [simp]: "- numeral v \<le> \<lfloor>x\<rfloor> \<longleftrightarrow> - numeral v \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- numeral v \<le> \<lfloor>x\<rfloor>) = (- numeral v \<le> x)
[PROOF STEP]
by (simp add: le_floor_iff)


[STATEMENT]
lemma dimensionI:
  assumes "independent K Us" "Span K Us = E"
  shows "dimension (length Us) K E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dimension (length Us) K E
[PROOF STEP]
using dimension_independent[OF assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
dimension (length Us) K (Span K Us)
Span K Us = E

goal (1 subgoal):
 1. dimension (length Us) K E
[PROOF STEP]
by simp


[STATEMENT]
lemma domain_zero_sum: assumes "(domain_block x) + (domain_block y) = 0"
shows "domain_block x = 0" and "domain_block y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain_block x = 0 &&& domain_block y = 0
[PROOF STEP]
using domain_block_nonnegative add_nonneg_eq_0_iff assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> domain_block ?x
\<lbrakk>(0::?'a) \<le> ?x; (0::?'a) \<le> ?y\<rbrakk> \<Longrightarrow> (?x + ?y = (0::?'a)) = (?x = (0::?'a) \<and> ?y = (0::?'a))
domain_block x + domain_block y = 0

goal (1 subgoal):
 1. domain_block x = 0 &&& domain_block y = 0
[PROOF STEP]
apply metis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain_block y = 0
[PROOF STEP]
by (metis add_nonneg_eq_0_iff assms domain_block_nonnegative)


[STATEMENT]
lemma cdim_UNIV_basis_enum[simp]: \<open>cdim (UNIV::'a::basis_enum set) = length (canonical_basis::'a list)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cdim UNIV = length canonical_basis
[PROOF STEP]
apply (subst is_generator_set[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cdim (cspan (set canonical_basis)) = length canonical_basis
[PROOF STEP]
apply (subst complex_vector.dim_span_eq_card_independent)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. cindependent (set canonical_basis)
 2. card (set canonical_basis) = length canonical_basis
[PROOF STEP]
apply (rule is_cindependent_set)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set canonical_basis) = length canonical_basis
[PROOF STEP]
using distinct_canonical_basis distinct_card
[PROOF STATE]
proof (prove)
using this:
distinct canonical_basis
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs

goal (1 subgoal):
 1. card (set canonical_basis) = length canonical_basis
[PROOF STEP]
by blast


[STATEMENT]
lemma similar_mat_smult: fixes A :: "'a :: comm_ring_1 mat"
  assumes "similar_mat A B"
  shows "similar_mat (k \<cdot>\<^sub>m A) (k \<cdot>\<^sub>m B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat (k \<cdot>\<^sub>m A) (k \<cdot>\<^sub>m B)
[PROOF STEP]
using similar_mat_wit_smult assms
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit ?A ?B ?P ?Q \<Longrightarrow> similar_mat_wit (?k \<cdot>\<^sub>m ?A) (?k \<cdot>\<^sub>m ?B) ?P ?Q
similar_mat A B

goal (1 subgoal):
 1. similar_mat (k \<cdot>\<^sub>m A) (k \<cdot>\<^sub>m B)
[PROOF STEP]
unfolding similar_mat_def
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit ?A ?B ?P ?Q \<Longrightarrow> similar_mat_wit (?k \<cdot>\<^sub>m ?A) (?k \<cdot>\<^sub>m ?B) ?P ?Q
\<exists>P. Ex (similar_mat_wit A B P)

goal (1 subgoal):
 1. \<exists>P. Ex (similar_mat_wit (k \<cdot>\<^sub>m A) (k \<cdot>\<^sub>m B) P)
[PROOF STEP]
by blast


[STATEMENT]
lemma sinh_complex:
  fixes z :: complex
  shows "(exp z - inverse (exp z)) / 2 = -\<i> * sin(\<i> * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp z - inverse (exp z)) / 2 = - \<i> * sin (\<i> * z)
[PROOF STEP]
by (simp add: sin_exp_eq field_split_simps exp_minus)


[STATEMENT]
lemma minus_eq_nat_subst: fixes A::nat and B::nat and  C::nat and  D::nat and  E::nat
  assumes "A = B-C-D" and " -E = -C-D"
  shows " A = B-E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B - E
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A = B - C - D
- int E = - int C - int D

goal (1 subgoal):
 1. A = B - E
[PROOF STEP]
by linarith


[STATEMENT]
lemma integrable_restrict_UNIV:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  shows "(\<lambda>x. if x \<in> s then f x else 0) integrable_on UNIV \<longleftrightarrow> f integrable_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on UNIV) = (f integrable_on s)
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>y. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral y) UNIV) = (\<exists>y. (f has_integral y) s)
[PROOF STEP]
by auto


[STATEMENT]
lemma nths_zip: "nths (zip xs ys) I = zip (nths xs I) (nths ys I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths (zip xs ys) I = zip (nths xs I) (nths ys I)
[PROOF STEP]
proof (rule nth_equalityI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
 2. \<And>i. i < length (nths (zip xs ys) I) \<Longrightarrow> nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i
[PROOF STEP]
show "length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
proof (cases "length xs \<le> length ys")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
 2. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
length xs \<le> length ys

goal (2 subgoals):
 1. length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
 2. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs \<le> length ys
[PROOF STEP]
have "{i. i < length xs \<and> i \<in> I} \<subseteq> {i. i < length ys \<and> i \<in> I}"
[PROOF STATE]
proof (prove)
using this:
length xs \<le> length ys

goal (1 subgoal):
 1. {i. i < length xs \<and> i \<in> I} \<subseteq> {i. i < length ys \<and> i \<in> I}
[PROOF STEP]
by (simp add: Collect_mono less_le_trans)
[PROOF STATE]
proof (state)
this:
{i. i < length xs \<and> i \<in> I} \<subseteq> {i. i < length ys \<and> i \<in> I}

goal (2 subgoals):
 1. length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
 2. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < length xs \<and> i \<in> I} \<subseteq> {i. i < length ys \<and> i \<in> I}
[PROOF STEP]
have "card {i. i < length xs \<and> i \<in> I} \<le> card {i. i < length ys \<and> i \<in> I}"
[PROOF STATE]
proof (prove)
using this:
{i. i < length xs \<and> i \<in> I} \<subseteq> {i. i < length ys \<and> i \<in> I}

goal (1 subgoal):
 1. card {i. i < length xs \<and> i \<in> I} \<le> card {i. i < length ys \<and> i \<in> I}
[PROOF STEP]
by (metis (mono_tags, lifting) card_mono finite_nat_set_iff_bounded mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
card {i. i < length xs \<and> i \<in> I} \<le> card {i. i < length ys \<and> i \<in> I}

goal (2 subgoals):
 1. length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
 2. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card {i. i < length xs \<and> i \<in> I} \<le> card {i. i < length ys \<and> i \<in> I}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {i. i < length xs \<and> i \<in> I} \<le> card {i. i < length ys \<and> i \<in> I}

goal (1 subgoal):
 1. length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
unfolding length_nths length_zip
[PROOF STATE]
proof (prove)
using this:
card {i. i < length xs \<and> i \<in> I} \<le> card {i. i < length ys \<and> i \<in> I}

goal (1 subgoal):
 1. card {i. i < min (length xs) (length ys) \<and> i \<in> I} = min (card {i. i < length xs \<and> i \<in> I}) (card {i. i < length ys \<and> i \<in> I})
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
card {i. i < length xs \<and> i \<in> I} \<le> card {i. i < length ys \<and> i \<in> I}
length xs \<le> length ys

goal (1 subgoal):
 1. card {i. i < min (length xs) (length ys) \<and> i \<in> I} = min (card {i. i < length xs \<and> i \<in> I}) (card {i. i < length ys \<and> i \<in> I})
[PROOF STEP]
using min_def
[PROOF STATE]
proof (prove)
using this:
card {i. i < length xs \<and> i \<in> I} \<le> card {i. i < length ys \<and> i \<in> I}
length xs \<le> length ys
min ?a ?b = (if ?a \<le> ?b then ?a else ?b)

goal (1 subgoal):
 1. card {i. i < min (length xs) (length ys) \<and> i \<in> I} = min (card {i. i < length xs \<and> i \<in> I}) (card {i. i < length ys \<and> i \<in> I})
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))

goal (1 subgoal):
 1. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> length xs \<le> length ys

goal (1 subgoal):
 1. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> length xs \<le> length ys
[PROOF STEP]
have "{i. i < length ys \<and> i \<in> I} \<subseteq> {i. i < length xs \<and> i \<in> I}"
[PROOF STATE]
proof (prove)
using this:
\<not> length xs \<le> length ys

goal (1 subgoal):
 1. {i. i < length ys \<and> i \<in> I} \<subseteq> {i. i < length xs \<and> i \<in> I}
[PROOF STEP]
by (simp add: Collect_mono less_le_trans)
[PROOF STATE]
proof (state)
this:
{i. i < length ys \<and> i \<in> I} \<subseteq> {i. i < length xs \<and> i \<in> I}

goal (1 subgoal):
 1. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < length ys \<and> i \<in> I} \<subseteq> {i. i < length xs \<and> i \<in> I}
[PROOF STEP]
have "card {i. i < length ys \<and> i \<in> I} \<le> card {i. i < length xs \<and> i \<in> I}"
[PROOF STATE]
proof (prove)
using this:
{i. i < length ys \<and> i \<in> I} \<subseteq> {i. i < length xs \<and> i \<in> I}

goal (1 subgoal):
 1. card {i. i < length ys \<and> i \<in> I} \<le> card {i. i < length xs \<and> i \<in> I}
[PROOF STEP]
by (metis (mono_tags, lifting) card_mono finite_nat_set_iff_bounded mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
card {i. i < length ys \<and> i \<in> I} \<le> card {i. i < length xs \<and> i \<in> I}

goal (1 subgoal):
 1. \<not> length xs \<le> length ys \<Longrightarrow> length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card {i. i < length ys \<and> i \<in> I} \<le> card {i. i < length xs \<and> i \<in> I}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {i. i < length ys \<and> i \<in> I} \<le> card {i. i < length xs \<and> i \<in> I}

goal (1 subgoal):
 1. length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))
[PROOF STEP]
unfolding length_nths length_zip
[PROOF STATE]
proof (prove)
using this:
card {i. i < length ys \<and> i \<in> I} \<le> card {i. i < length xs \<and> i \<in> I}

goal (1 subgoal):
 1. card {i. i < min (length xs) (length ys) \<and> i \<in> I} = min (card {i. i < length xs \<and> i \<in> I}) (card {i. i < length ys \<and> i \<in> I})
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
card {i. i < length ys \<and> i \<in> I} \<le> card {i. i < length xs \<and> i \<in> I}
\<not> length xs \<le> length ys

goal (1 subgoal):
 1. card {i. i < min (length xs) (length ys) \<and> i \<in> I} = min (card {i. i < length xs \<and> i \<in> I}) (card {i. i < length ys \<and> i \<in> I})
[PROOF STEP]
using min_def
[PROOF STATE]
proof (prove)
using this:
card {i. i < length ys \<and> i \<in> I} \<le> card {i. i < length xs \<and> i \<in> I}
\<not> length xs \<le> length ys
min ?a ?b = (if ?a \<le> ?b then ?a else ?b)

goal (1 subgoal):
 1. card {i. i < min (length xs) (length ys) \<and> i \<in> I} = min (card {i. i < length xs \<and> i \<in> I}) (card {i. i < length ys \<and> i \<in> I})
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))

goal (1 subgoal):
 1. \<And>i. i < length (nths (zip xs ys) I) \<Longrightarrow> nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i
[PROOF STEP]
show "nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i" if "i < length (nths (zip xs ys) I)" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i
[PROOF STEP]
have "i < length (nths xs I)" "i < length (nths ys I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length (nths xs I) &&& i < length (nths ys I)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i < length (nths (zip xs ys) I)

goal (1 subgoal):
 1. i < length (nths xs I) &&& i < length (nths ys I)
[PROOF STEP]
by (simp_all add: \<open>length (nths (zip xs ys) I) = length (zip (nths xs I) (nths ys I))\<close>)
[PROOF STATE]
proof (state)
this:
i < length (nths xs I)
i < length (nths ys I)

goal (1 subgoal):
 1. nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i
[PROOF STEP]
show "nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i
[PROOF STEP]
unfolding nth_nths[OF \<open>i < length (nths (zip xs ys) I)\<close>[unfolded length_nths]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip xs ys ! pick I i = zip (nths xs I) (nths ys I) ! i
[PROOF STEP]
unfolding nth_zip[OF \<open>i < length (nths xs I)\<close> \<open>i < length (nths ys I)\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip xs ys ! pick I i = (nths xs I ! i, nths ys I ! i)
[PROOF STEP]
unfolding nth_zip[OF pick_le[OF \<open>i < length (nths xs I)\<close>[unfolded length_nths]]
                          pick_le[OF \<open>i < length (nths ys I)\<close>[unfolded length_nths]]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs ! pick I i, ys ! pick I i) = (nths xs I ! i, nths ys I ! i)
[PROOF STEP]
by (metis (full_types) \<open>i < length (nths xs I)\<close> \<open>i < length (nths ys I)\<close> length_nths nth_nths)
[PROOF STATE]
proof (state)
this:
nths (zip xs ys) I ! i = zip (nths xs I) (nths ys I) ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i < length (nths (zip xs ys) I) \<Longrightarrow> nths (zip xs ys) I ! ?i = zip (nths xs I) (nths ys I) ! ?i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldli_size_abort_aux:
    "\<lbrakk>n0\<le>m; distinct (map fst l)\<rbrakk> \<Longrightarrow>
      foldli l (\<lambda>n. n<m) (\<lambda>_ n. Suc n) n0 = min m (n0 + card (dom (map_of l)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n0 \<le> m; distinct (map fst l)\<rbrakk> \<Longrightarrow> foldli l (\<lambda>n. n < m) (\<lambda>_. Suc) n0 = min m (n0 + card (dom (map_of l)))
[PROOF STEP]
apply (induct l arbitrary: n0)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n0. \<lbrakk>n0 \<le> m; distinct (map fst [])\<rbrakk> \<Longrightarrow> foldli [] (\<lambda>n. n < m) (\<lambda>_. Suc) n0 = min m (n0 + card (dom (map_of [])))
 2. \<And>a l n0. \<lbrakk>\<And>n0. \<lbrakk>n0 \<le> m; distinct (map fst l)\<rbrakk> \<Longrightarrow> foldli l (\<lambda>n. n < m) (\<lambda>_. Suc) n0 = min m (n0 + card (dom (map_of l))); n0 \<le> m; distinct (map fst (a # l))\<rbrakk> \<Longrightarrow> foldli (a # l) (\<lambda>n. n < m) (\<lambda>_. Suc) n0 = min m (n0 + card (dom (map_of (a # l))))
[PROOF STEP]
apply (auto simp: dom_map_of_conv_image_fst)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma rel_list_all2_trans:
  "\<lbrakk> \<And>a b c. \<lbrakk>(a,b) \<in> R; (b,c) \<in> S\<rbrakk> \<Longrightarrow> (a,c) \<in> T;
    list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk>
  \<Longrightarrow> list_all2 (fun_of T) as cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a b c. \<lbrakk>(a, b) \<in> R; (b, c) \<in> S\<rbrakk> \<Longrightarrow> (a, c) \<in> T; list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk> \<Longrightarrow> list_all2 (fun_of T) as cs
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a b c. \<lbrakk>(a, b) \<in> R; (b, c) \<in> S\<rbrakk> \<Longrightarrow> (a, c) \<in> T; list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk> \<Longrightarrow> list_all2 (fun_of T) as cs
[PROOF STEP]
by (rule list_all2_trans) auto


[STATEMENT]
lemma num_wtn_conv:
  assumes "E \<in> sets M"
    and "\<bar>\<mu> E\<bar> < \<infinity>"
  shows "(\<lambda>n. 1/(num_wtn E n)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / real (num_wtn E n)) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule summable_LIMSEQ_zero)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (num_wtn E n))
[PROOF STEP]
show "summable (\<lambda>n. 1 / real (num_wtn E n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (num_wtn E n))
[PROOF STEP]
using assms inv_num_wtn_summable
[PROOF STATE]
proof (prove)
using this:
E \<in> sets M
\<bar>\<mu> E\<bar> < \<infinity>
\<lbrakk>?E \<in> sets M; \<bar>\<mu> ?E\<bar> < \<infinity>\<rbrakk> \<Longrightarrow> summable (\<lambda>n. 1 / real (num_wtn ?E n))

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (num_wtn E n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. 1 / real (num_wtn E n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isFDERIV_Suc: "isFDERIV (Suc n) (d#ds) (f#fs) xs \<longleftrightarrow>
  isFDERIV n ds fs xs \<and> isDERIV d f xs
  \<and> (\<forall>x2 < n. isDERIV d (fs ! x2) xs)
  \<and> (\<forall>x2 < n. isDERIV (ds ! x2) f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isFDERIV (Suc n) (d # ds) (f # fs) xs = (isFDERIV n ds fs xs \<and> isDERIV d f xs \<and> (\<forall>x2<n. isDERIV d (fs ! x2) xs) \<and> (\<forall>x2<n. isDERIV (ds ! x2) f xs))
[PROOF STEP]
unfolding isFDERIV_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i<Suc n. \<forall>j<Suc n. isDERIV ((d # ds) ! i) ((f # fs) ! j) xs) \<and> length (f # fs) = Suc n \<and> length (d # ds) = Suc n) = (((\<forall>i<n. \<forall>j<n. isDERIV (ds ! i) (fs ! j) xs) \<and> length fs = n \<and> length ds = n) \<and> isDERIV d f xs \<and> (\<forall>x2<n. isDERIV d (fs ! x2) xs) \<and> (\<forall>x2<n. isDERIV (ds ! x2) f xs))
[PROOF STEP]
by (auto simp: isFDERIV_def nth_Cons split: nat.splits)


[STATEMENT]
lemma card_triangle_3:
  assumes "t \<in> triangle_set"
  shows "card t = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card t = 3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
t \<in> triangle_set

goal (1 subgoal):
 1. card t = 3
[PROOF STEP]
by (auto simp: triangle_set_def edge_vertices_not_equal triangle_in_graph_def)


[STATEMENT]
lemma (in group) ord_eq_1:
   "x \<in> carrier G \<Longrightarrow> (ord x = 1 \<longleftrightarrow> x = \<one>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> (ord x = 1) = (x = \<one>)
[PROOF STEP]
by (metis pow_eq_id nat_dvd_1_iff_1 nat_pow_eone)


[STATEMENT]
lemma add_eq_0_iff_both_eq_0_hmset[simp]: "M + N = 0 \<longleftrightarrow> M = 0 \<and> N = 0" for M N :: hmultiset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M + N = 0) = (M = 0 \<and> N = 0)
[PROOF STEP]
by (intro add_nonneg_eq_0_iff zero_le_hmset)


[STATEMENT]
lemma ord_eq_0: "ord n a = 0 \<longleftrightarrow> \<not> coprime n a"
  for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ord n a = 0) = (\<not> coprime n a)
[PROOF STEP]
by (cases "coprime n a") (simp add: coprime_ord, simp add: ord_def)


[STATEMENT]
lemma poly_mod_sum:
  fixes x y z :: "'b::field poly"
  assumes f: "finite A"
  shows "sum f A mod z = sum (\<lambda>i. f i mod z) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A mod z = (\<Sum>i\<in>A. f i mod z)
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. sum f A mod z = (\<Sum>i\<in>A. f i mod z)
[PROOF STEP]
by (induct, auto simp add: poly_mod_add_left)


[STATEMENT]
lemma relpow_refl_mono:
 assumes refl:"\<And> x. (x,x) \<in> Rel"
 shows "m \<le> n \<Longrightarrow>(a,b) \<in> Rel ^^ m \<Longrightarrow> (a,b) \<in> Rel ^^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n; (a, b) \<in> Rel ^^ m\<rbrakk> \<Longrightarrow> (a, b) \<in> Rel ^^ n
[PROOF STEP]
proof (induct rule:dec_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ m
 2. \<And>na. \<lbrakk>m \<le> na; na < n; (a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ na; (a, b) \<in> Rel ^^ m\<rbrakk> \<Longrightarrow> (a, b) \<in> Rel ^^ Suc na
[PROOF STEP]
case (step i)
[PROOF STATE]
proof (state)
this:
m \<le> i
i < n
(a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ i
(a, b) \<in> Rel ^^ m

goal (2 subgoals):
 1. (a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ m
 2. \<And>na. \<lbrakk>m \<le> na; na < n; (a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ na; (a, b) \<in> Rel ^^ m\<rbrakk> \<Longrightarrow> (a, b) \<in> Rel ^^ Suc na
[PROOF STEP]
hence abi:"(a, b) \<in> Rel ^^ i"
[PROOF STATE]
proof (prove)
using this:
m \<le> i
i < n
(a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ i
(a, b) \<in> Rel ^^ m

goal (1 subgoal):
 1. (a, b) \<in> Rel ^^ i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a, b) \<in> Rel ^^ i

goal (2 subgoals):
 1. (a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ m
 2. \<And>na. \<lbrakk>m \<le> na; na < n; (a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ na; (a, b) \<in> Rel ^^ m\<rbrakk> \<Longrightarrow> (a, b) \<in> Rel ^^ Suc na
[PROOF STEP]
from refl[of b] abi relpowp_Suc_I[of i "\<lambda> x y. (x,y) \<in> Rel"]
[PROOF STATE]
proof (chain)
picking this:
(b, b) \<in> Rel
(a, b) \<in> Rel ^^ i
\<lbrakk>((\<lambda>x y. (x, y) \<in> Rel) ^^ i) ?x ?y; (?y, ?z) \<in> Rel\<rbrakk> \<Longrightarrow> ((\<lambda>x y. (x, y) \<in> Rel) ^^ Suc i) ?x ?z
[PROOF STEP]
show "(a, b) \<in> Rel ^^ Suc i"
[PROOF STATE]
proof (prove)
using this:
(b, b) \<in> Rel
(a, b) \<in> Rel ^^ i
\<lbrakk>((\<lambda>x y. (x, y) \<in> Rel) ^^ i) ?x ?y; (?y, ?z) \<in> Rel\<rbrakk> \<Longrightarrow> ((\<lambda>x y. (x, y) \<in> Rel) ^^ Suc i) ?x ?z

goal (1 subgoal):
 1. (a, b) \<in> Rel ^^ Suc i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a, b) \<in> Rel ^^ Suc i

goal (1 subgoal):
 1. (a, b) \<in> Rel ^^ m \<Longrightarrow> (a, b) \<in> Rel ^^ m
[PROOF STEP]
qed


[STATEMENT]
lemma sum_diff_in: "(\<Sum>i=0..<(x::nat). (f i)::('a mod_ring)) - (\<Sum>i=0..<x. g i) =
                    (\<Sum>i=0..<x. f i - g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..<x} - sum g {0..<x} = (\<Sum>i = 0..<x. f i - g i)
[PROOF STEP]
by(induction x) (auto simp add: algebra_simps)


[STATEMENT]
lemma ceiling_divide_lower:
  fixes q :: "'a::floor_ceiling"
  shows "q > 0 \<Longrightarrow> (of_int \<lceil>p / q\<rceil> - 1) * q < p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < q \<Longrightarrow> (of_int \<lceil>p / q\<rceil> - (1::'a)) * q < p
[PROOF STEP]
by (meson ceiling_eq_iff pos_less_divide_eq)


[STATEMENT]
lemma mset_merge: "mset_tree (merge t1 t2) = mset_tree t1 + mset_tree t2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset_tree (merge t1 t2) = mset_tree t1 + mset_tree t2
[PROOF STEP]
by (induction t1 t2 rule: merge.induct) (auto simp add: node_def ac_simps)


[STATEMENT]
lemma "fset (fconcat xss) = (\<Union>xs\<in>fset xss. fset xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fset (fconcat xss) = \<Union> (fset ` fset xss)
[PROOF STEP]
using set_concat [Transfer.transferred]
[PROOF STATE]
proof (prove)
using this:
fset (fconcat ?xs) = \<Union> (fset ` fset ?xs)

goal (1 subgoal):
 1. fset (fconcat xss) = \<Union> (fset ` fset xss)
[PROOF STEP]
.


[STATEMENT]
lemma hoare_Sup: "hoare (Sup P) x q = (\<forall> p \<in> P . hoare p x q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hoare (\<Squnion> P) x q = (\<forall>p\<in>P. hoare p x q)
[PROOF STEP]
apply (simp add: hoare_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> P \<le> wp x q) = (\<forall>p\<in>P. p \<le> wp x q)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<Squnion> P \<le> wp x q; p \<in> P\<rbrakk> \<Longrightarrow> p \<le> wp x q
 2. \<forall>p\<in>P. p \<le> wp x q \<Longrightarrow> \<Squnion> P \<le> wp x q
[PROOF STEP]
apply (rule_tac y = "Sup P" in order_trans, simp_all add: Sup_upper)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>P. p \<le> wp x q \<Longrightarrow> \<Squnion> P \<le> wp x q
[PROOF STEP]
apply (rule Sup_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>\<forall>p\<in>P. p \<le> wp x q; xa \<in> P\<rbrakk> \<Longrightarrow> xa \<le> wp x q
[PROOF STEP]
by simp


[STATEMENT]
lemma card_bij':
  assumes "f \<in> A \<rightarrow> B" "\<And>x. x \<in> A \<Longrightarrow> g (f x) = x"
    and "g \<in> B \<rightarrow> A" "\<And>x. x \<in> B \<Longrightarrow> f (g x) = x"
  shows "card A = card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = card B
[PROOF STEP]
apply (rule bij_betw_same_card)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ?f A B
[PROOF STEP]
apply (rule bij_betwI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. ?f \<in> A \<rightarrow> B
 2. ?g2 \<in> B \<rightarrow> A
 3. \<And>x. x \<in> A \<Longrightarrow> ?g2 (?f x) = x
 4. \<And>y. y \<in> B \<Longrightarrow> ?f (?g2 y) = y
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_coeffs_smult_cmod:
  "(\<Sum>a\<leftarrow>coeffs (smult v p). (cmod a)^2) = (cmod v)^2 * (\<Sum>a\<leftarrow>coeffs p. (cmod a)^2)"
  (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm2 (Polynomial.smult v p) = (cmod v)\<^sup>2 * norm2 p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm2 (Polynomial.smult v p) = (cmod v)\<^sup>2 * norm2 p
[PROOF STEP]
have "?l = (\<Sum>a\<leftarrow>coeffs p. (cmod v)^2 * (cmod a)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm2 (Polynomial.smult v p) = (\<Sum>a\<leftarrow>coeffs p. (cmod v)\<^sup>2 * (cmod a)\<^sup>2)
[PROOF STEP]
by(cases "v=0";induct p,auto)
[PROOF STATE]
proof (state)
this:
norm2 (Polynomial.smult v p) = (\<Sum>a\<leftarrow>coeffs p. (cmod v)\<^sup>2 * (cmod a)\<^sup>2)

goal (1 subgoal):
 1. norm2 (Polynomial.smult v p) = (cmod v)\<^sup>2 * norm2 p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
norm2 (Polynomial.smult v p) = (\<Sum>a\<leftarrow>coeffs p. (cmod v)\<^sup>2 * (cmod a)\<^sup>2)

goal (1 subgoal):
 1. norm2 (Polynomial.smult v p) = (cmod v)\<^sup>2 * norm2 p
[PROOF STEP]
by (auto simp:sum_list_const_mult)
[PROOF STATE]
proof (state)
this:
norm2 (Polynomial.smult v p) = (cmod v)\<^sup>2 * norm2 p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_atLeast_Suc_shift: "0 < b \<Longrightarrow> a \<le> b \<Longrightarrow> sum f {Suc a..b} = (\<Sum>i=a..b - 1. f (Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b; a \<le> b\<rbrakk> \<Longrightarrow> sum f {Suc a..b} = (\<Sum>i = a..b - 1. f (Suc i))
[PROOF STEP]
by (metis Suc_pred' sum.shift_bounds_cl_Suc_ivl)


[STATEMENT]
lemma INF_Sigma:
  fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: complete_lattice"
  shows "(INF i \<in> A. INF j \<in> B i. f i j) = (INF p \<in> Sigma A B. f (fst p) (snd p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i\<in>A. Inf (f i ` B i)) = (INF p\<in>Sigma A B. f (fst p) (snd p))
[PROOF STEP]
by (rule antisym) (auto intro!: INF_greatest INF_lower2)


[STATEMENT]
lemma last_before_Some: "last_before P n = Some m \<Longrightarrow> m < n \<and> P m \<and> (\<forall>k \<in> {m<..<n}. \<not>P k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last_before P n = Some m \<Longrightarrow> m < n \<and> P m \<and> (\<forall>k\<in>{m<..<n}. \<not> P k)
[PROOF STEP]
apply (induction P n rule: last_before.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>P. last_before P 0 = Some m \<Longrightarrow> m < 0 \<and> P m \<and> (\<forall>k\<in>{m<..<0}. \<not> P k)
 2. \<And>P n. \<lbrakk>\<lbrakk>\<not> P n; last_before P n = Some m\<rbrakk> \<Longrightarrow> m < n \<and> P m \<and> (\<forall>k\<in>{m<..<n}. \<not> P k); last_before P (Suc n) = Some m\<rbrakk> \<Longrightarrow> m < Suc n \<and> P m \<and> (\<forall>k\<in>{m<..<Suc n}. \<not> P k)
[PROOF STEP]
apply (auto split: if_splits)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P n k. \<lbrakk>\<not> P n; last_before P n = Some m; P m; \<forall>k\<in>{m<..<n}. \<not> P k; P k; m < k; k < Suc n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (metis greaterThanLessThan_iff less_antisym)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma add_minus_left [simp]: "x \<in> V \<Longrightarrow> - x + x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> V \<Longrightarrow> - x + x = (0::'a)
[PROOF STEP]
by (simp add: diff_eq2 add_commute)


[STATEMENT]
lemma image_mset_subseteq_mono: "A \<subseteq># B \<Longrightarrow> image_mset f A \<subseteq># image_mset f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq># B \<Longrightarrow> image_mset f A \<subseteq># image_mset f B
[PROOF STEP]
by (metis image_mset_union subset_mset.le_iff_add)


[STATEMENT]
lemma sums_cot_pfd_complex:
  fixes x :: complex
  shows "(\<lambda>n. 2 * x / (x ^ 2 - of_nat (Suc n) ^ 2)) sums cot_pfd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums cot_pfd x
[PROOF STEP]
using tendsto_uniform_limitI[OF uniform_limit_cot_pfd_complex[of "norm x"], of x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> cmod x; x \<in> cball 0 (cmod x)\<rbrakk> \<Longrightarrow> (\<lambda>y. \<Sum>n<y. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) \<longlonglongrightarrow> cot_pfd x

goal (1 subgoal):
 1. (\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums cot_pfd x
[PROOF STEP]
by (simp add: sums_def)


[STATEMENT]
lemma horiz_vector_helper_pos:
  fixes p:: "real poly"
  assumes nonzero: "p\<noteq>0"
  fixes qs:: "real poly list"
  assumes pairwise_rel_prime_1: "\<forall>q. ((List.member qs q) \<longrightarrow> (coprime p q))"
  fixes I:: "nat list"
  fixes sign:: "rat list"
  fixes x:: "real"
  assumes root_p: "x \<in> {x. poly p x = 0}"
  assumes sign_fix: "sign = consistent_sign_vec_copr qs x"
  assumes welldefined: "list_constr I (length qs)"
  shows "(poly (prod_list (retrieve_polys qs I)) x > 0) \<longleftrightarrow> (z I sign = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)
[PROOF STEP]
using horiz_vector_helper_pos_ind
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p \<noteq> 0; \<forall>q. List.member ?qs q \<longrightarrow> coprime ?p q; ?x \<in> {x. poly ?p x = 0}; ?sign = consistent_sign_vec_copr ?qs ?x\<rbrakk> \<Longrightarrow> list_constr ?I (length ?qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys ?qs ?I)) ?x) = (z ?I ?sign = 1)

goal (1 subgoal):
 1. (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)
[PROOF STEP]
using pairwise_rel_prime_1 nonzero  root_p sign_fix welldefined
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?p \<noteq> 0; \<forall>q. List.member ?qs q \<longrightarrow> coprime ?p q; ?x \<in> {x. poly ?p x = 0}; ?sign = consistent_sign_vec_copr ?qs ?x\<rbrakk> \<Longrightarrow> list_constr ?I (length ?qs) \<longrightarrow> (0 < poly (prod_list (retrieve_polys ?qs ?I)) ?x) = (z ?I ?sign = 1)
\<forall>q. List.member qs q \<longrightarrow> coprime p q
p \<noteq> 0
x \<in> {x. poly p x = 0}
sign = consistent_sign_vec_copr qs x
list_constr I (length qs)

goal (1 subgoal):
 1. (0 < poly (prod_list (retrieve_polys qs I)) x) = (z I sign = 1)
[PROOF STEP]
by blast


[STATEMENT]
lemma matrix_vector_mult_code': "(X *v x) $ i = (\<Sum>j\<in>UNIV. X $ i $ j * x $ j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X *v x) $ i = (\<Sum>j\<in>UNIV. X $ i $ j * x $ j)
[PROOF STEP]
by (simp add: matrix_vector_mult_def)


[STATEMENT]
lemma simple_path_rectpath [simp, intro]:
  assumes "Re a1 \<noteq> Re a3" "Im a1 \<noteq> Im a3"
  shows   "simple_path (rectpath a1 a3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_path (rectpath a1 a3)
[PROOF STEP]
unfolding rectpath_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_path (linepath a1 (Complex (Re a3) (Im a1)) +++ linepath (Complex (Re a3) (Im a1)) a3 +++ linepath a3 (Complex (Re a1) (Im a3)) +++ linepath (Complex (Re a1) (Im a3)) a1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re a1 \<noteq> Re a3
Im a1 \<noteq> Im a3

goal (1 subgoal):
 1. simple_path (linepath a1 (Complex (Re a3) (Im a1)) +++ linepath (Complex (Re a3) (Im a1)) a3 +++ linepath a3 (Complex (Re a1) (Im a3)) +++ linepath (Complex (Re a1) (Im a3)) a1)
[PROOF STEP]
by (intro simple_path_join_loop arc_join arc_linepath)
     (auto simp: complex_eq_iff path_image_join closed_segment_same_Re closed_segment_same_Im)


[STATEMENT]
lemma unitary_unit_col [simp]:
  assumes "unitary U" and "dim_col U = n" and "i < n"
  shows "\<parallel>col U i\<parallel> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>col U i\<parallel> = 1
[PROOF STEP]
using assms unit_vec_to_col unitary_is_length_preserving
[PROOF STATE]
proof (prove)
using this:
unitary U
dim_col U = n
i < n
\<lbrakk>dim_col ?A = ?n; ?i < ?n\<rbrakk> \<Longrightarrow> col ?A ?i = col_fst (?A * |unit_vec ?n ?i\<rangle>)
\<lbrakk>unitary ?U; dim_vec ?v = dim_col ?U\<rbrakk> \<Longrightarrow> \<parallel>col_fst (?U * |?v\<rangle>)\<parallel> = \<parallel>?v\<parallel>

goal (1 subgoal):
 1. \<parallel>col U i\<parallel> = 1
[PROOF STEP]
by simp


[STATEMENT]
theorem Shuffle_assoc[simp]: "Shuffle (Shuffle r s) t = Shuffle r (Shuffle s t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Shuffle (Shuffle r s) t = Shuffle r (Shuffle s t)
[PROOF STEP]
by (coinduction arbitrary: r s t rule: language_coinduct_upto_Plus) fastforce


[STATEMENT]
lemma undirected_correct:
    "FiniteGraph.undirected (list_graph_to_graph G) = list_graph_to_graph (undirected G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FiniteGraph.undirected (list_graph_to_graph G) = list_graph_to_graph (FiniteListGraph.undirected G)
[PROOF STEP]
unfolding FiniteGraph.undirected_def undirected_def list_graph_to_graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lparr>nodes = nodes \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>, edges = edges \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> \<union> {(b, a). (a, b) \<in> edges \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>}\<rparr> = \<lparr>nodes = set (nodesL \<lparr>nodesL = nodesL G, edgesL = remdups (edgesL G @ backlinks (edgesL G))\<rparr>), edges = set (edgesL \<lparr>nodesL = nodesL G, edgesL = remdups (edgesL G @ backlinks (edgesL G))\<rparr>)\<rparr>
[PROOF STEP]
by (simp add: backlinks_set)


[STATEMENT]
lemma Ln_eq_iff: "w \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> (Ln w = Ln z \<longleftrightarrow> w = z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w \<noteq> 0; z \<noteq> 0\<rbrakk> \<Longrightarrow> (Ln w = Ln z) = (w = z)
[PROOF STEP]
by (metis exp_Ln)


[STATEMENT]
lemma basis_enum_of_vec_add:
  assumes [simp]: \<open>dim_vec v1 = length (canonical_basis :: 'a::basis_enum list)\<close>
    \<open>dim_vec v2 = length (canonical_basis :: 'a list)\<close>
  shows \<open>((basis_enum_of_vec (v1 + v2)) :: 'a) = basis_enum_of_vec v1 + basis_enum_of_vec v2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_enum_of_vec (v1 + v2) = basis_enum_of_vec v1 + basis_enum_of_vec v2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. basis_enum_of_vec (v1 + v2) = basis_enum_of_vec v1 + basis_enum_of_vec v2
[PROOF STEP]
have \<open>length (list_of_vec v1) = length (list_of_vec v2)\<close> and \<open>length (list_of_vec v2) = length (canonical_basis :: 'a list)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (list_of_vec v1) = length (list_of_vec v2) &&& length (list_of_vec v2) = length canonical_basis
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
length (list_of_vec v1) = length (list_of_vec v2)
length (list_of_vec v2) = length canonical_basis

goal (1 subgoal):
 1. basis_enum_of_vec (v1 + v2) = basis_enum_of_vec v1 + basis_enum_of_vec v2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (list_of_vec v1) = length (list_of_vec v2)
length (list_of_vec v2) = length canonical_basis
[PROOF STEP]
have \<open>sum_list (map2 (*\<^sub>C) (map2 (+) (list_of_vec v1) (list_of_vec v2)) (canonical_basis::'a list))
    = sum_list (map2 (*\<^sub>C) (list_of_vec v1) canonical_basis) + sum_list (map2 (*\<^sub>C) (list_of_vec v2) canonical_basis)\<close>
[PROOF STATE]
proof (prove)
using this:
length (list_of_vec v1) = length (list_of_vec v2)
length (list_of_vec v2) = length canonical_basis

goal (1 subgoal):
 1. sum_list (map2 (*\<^sub>C) (map2 (+) (list_of_vec v1) (list_of_vec v2)) canonical_basis) = sum_list (map2 (*\<^sub>C) (list_of_vec v1) canonical_basis) + sum_list (map2 (*\<^sub>C) (list_of_vec v2) canonical_basis)
[PROOF STEP]
apply (induction rule: list_induct3)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sum_list (map2 (*\<^sub>C) (map2 (+) [] []) []) = sum_list (map2 (*\<^sub>C) [] []) + sum_list (map2 (*\<^sub>C) [] [])
 2. \<And>x xs y ys z zs. \<lbrakk>length xs = length ys; length ys = length zs; sum_list (map2 (*\<^sub>C) (map2 (+) xs ys) zs) = sum_list (map2 (*\<^sub>C) xs zs) + sum_list (map2 (*\<^sub>C) ys zs)\<rbrakk> \<Longrightarrow> sum_list (map2 (*\<^sub>C) (map2 (+) (x # xs) (y # ys)) (z # zs)) = sum_list (map2 (*\<^sub>C) (x # xs) (z # zs)) + sum_list (map2 (*\<^sub>C) (y # ys) (z # zs))
[PROOF STEP]
by (auto simp: scaleC_add_left)
[PROOF STATE]
proof (state)
this:
sum_list (map2 (*\<^sub>C) (map2 (+) (list_of_vec v1) (list_of_vec v2)) canonical_basis) = sum_list (map2 (*\<^sub>C) (list_of_vec v1) canonical_basis) + sum_list (map2 (*\<^sub>C) (list_of_vec v2) canonical_basis)

goal (1 subgoal):
 1. basis_enum_of_vec (v1 + v2) = basis_enum_of_vec v1 + basis_enum_of_vec v2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum_list (map2 (*\<^sub>C) (map2 (+) (list_of_vec v1) (list_of_vec v2)) canonical_basis) = sum_list (map2 (*\<^sub>C) (list_of_vec v1) canonical_basis) + sum_list (map2 (*\<^sub>C) (list_of_vec v2) canonical_basis)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_list (map2 (*\<^sub>C) (map2 (+) (list_of_vec v1) (list_of_vec v2)) canonical_basis) = sum_list (map2 (*\<^sub>C) (list_of_vec v1) canonical_basis) + sum_list (map2 (*\<^sub>C) (list_of_vec v2) canonical_basis)

goal (1 subgoal):
 1. basis_enum_of_vec (v1 + v2) = basis_enum_of_vec v1 + basis_enum_of_vec v2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sum_list (map2 (*\<^sub>C) (map2 (+) (list_of_vec v1) (list_of_vec v2)) canonical_basis) = sum_list (map2 (*\<^sub>C) (list_of_vec v1) canonical_basis) + sum_list (map2 (*\<^sub>C) (list_of_vec v2) canonical_basis)
dim_vec v1 = length canonical_basis
dim_vec v2 = length canonical_basis

goal (1 subgoal):
 1. basis_enum_of_vec (v1 + v2) = basis_enum_of_vec v1 + basis_enum_of_vec v2
[PROOF STEP]
by (auto simp: basis_enum_of_vec_def list_of_vec_plus)
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (v1 + v2) = basis_enum_of_vec v1 + basis_enum_of_vec v2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bigo_sum3: "f =o O(h) \<Longrightarrow>
    (\<lambda>x. \<Sum>y \<in> A x. (l x y) * f(k x y)) =o
      O(\<lambda>x. \<Sum>y \<in> A x. \<bar>l x y * h(k x y)\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> O(h) \<Longrightarrow> (\<lambda>x. \<Sum>y\<in>A x. l x y * f (k x y)) \<in> O(\<lambda>x. \<Sum>y\<in>A x. \<bar>l x y * h (k x y)\<bar>)
[PROOF STEP]
apply (rule bigo_sum1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f \<in> O(h) \<Longrightarrow> \<forall>x y. (0::'b) \<le> \<bar>l x y * h (k x y)\<bar>
 2. f \<in> O(h) \<Longrightarrow> \<exists>c. \<forall>x y. \<bar>l x y * f (k x y)\<bar> \<le> c * \<bar>l x y * h (k x y)\<bar>
[PROOF STEP]
apply (rule allI)+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. f \<in> O(h) \<Longrightarrow> (0::'b) \<le> \<bar>l x y * h (k x y)\<bar>
 2. f \<in> O(h) \<Longrightarrow> \<exists>c. \<forall>x y. \<bar>l x y * f (k x y)\<bar> \<le> c * \<bar>l x y * h (k x y)\<bar>
[PROOF STEP]
apply (rule abs_ge_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> O(h) \<Longrightarrow> \<exists>c. \<forall>x y. \<bar>l x y * f (k x y)\<bar> \<le> c * \<bar>l x y * h (k x y)\<bar>
[PROOF STEP]
apply (unfold bigo_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {ha. \<exists>c. \<forall>x. \<bar>ha x\<bar> \<le> c * \<bar>h x\<bar>} \<Longrightarrow> \<exists>c. \<forall>x y. \<bar>l x y * f (k x y)\<bar> \<le> c * \<bar>l x y * h (k x y)\<bar>
[PROOF STEP]
apply (auto simp add: abs_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c. \<forall>x. \<bar>f x\<bar> \<le> c * \<bar>h x\<bar> \<Longrightarrow> \<exists>c. \<forall>x y. \<bar>l x y\<bar> * \<bar>f (k x y)\<bar> \<le> c * (\<bar>l x y\<bar> * \<bar>h (k x y)\<bar>)
[PROOF STEP]
by (metis abs_ge_zero mult.left_commute mult_left_mono)


[STATEMENT]
lemma transpose_rowvector: "transpose(rowvector v) = columnvector v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (rowvector v) = columnvector v
[PROOF STEP]
by (simp add: transpose_def columnvector_def rowvector_def vec_eq_iff)


[STATEMENT]
lemma Rdual:
     "\<forall>S. (S \<subseteq> A -->( \<exists>L. isLub S (| pset = A, order = r|) L))
      ==> \<forall>S. (S \<subseteq> A --> (\<exists>G. isGlb S (| pset = A, order = r|) G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>S\<subseteq>A. \<exists>L. isLub S \<lparr>pset = A, order = r\<rparr> L \<Longrightarrow> \<forall>S\<subseteq>A. \<exists>G. isGlb S \<lparr>pset = A, order = r\<rparr> G
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<forall>S\<subseteq>A. \<exists>L. isLub S \<lparr>pset = A, order = r\<rparr> L; S \<subseteq> A\<rbrakk> \<Longrightarrow> \<exists>G. isGlb S \<lparr>pset = A, order = r\<rparr> G
[PROOF STEP]
apply (rule_tac x = "lub {y. y \<in> A & (\<forall>k \<in> S. (y, k) \<in> r)}
                      (|pset = A, order = r|) " in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<forall>S\<subseteq>A. \<exists>L. isLub S \<lparr>pset = A, order = r\<rparr> L; S \<subseteq> A\<rbrakk> \<Longrightarrow> isGlb S \<lparr>pset = A, order = r\<rparr> (lub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr>)
[PROOF STEP]
apply (drule_tac x = "{y. y \<in> A & (\<forall>k \<in> S. (y,k) \<in> r) }" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> A; {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<subseteq> A \<longrightarrow> (\<exists>L. isLub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr> L)\<rbrakk> \<Longrightarrow> isGlb S \<lparr>pset = A, order = r\<rparr> (lub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr>)
[PROOF STEP]
apply (drule mp, fast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> A; \<exists>L. isLub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr> L\<rbrakk> \<Longrightarrow> isGlb S \<lparr>pset = A, order = r\<rparr> (lub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr>)
[PROOF STEP]
apply (simp add: isLub_lub isGlb_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> A; isLub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr> (lub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr>)\<rbrakk> \<Longrightarrow> lub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr> \<in> A \<and> (\<forall>y\<in>S. (lub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr>, y) \<in> r) \<and> (\<forall>z\<in>A. (\<forall>y\<in>S. (z, y) \<in> r) \<longrightarrow> (z, lub {y \<in> A. \<forall>k\<in>S. (y, k) \<in> r} \<lparr>pset = A, order = r\<rparr>) \<in> r)
[PROOF STEP]
apply (simp add: isLub_def, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma connected_contains_Ioo:
  fixes A :: "'a :: linorder_topology set"
  assumes "connected A" "a \<in> A" "b \<in> A" shows "{a <..< b} \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a<..<b} \<subseteq> A
[PROOF STEP]
using connectedD_interval[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<le> ?z; ?z \<le> b\<rbrakk> \<Longrightarrow> ?z \<in> A

goal (1 subgoal):
 1. {a<..<b} \<subseteq> A
[PROOF STEP]
by (simp add: subset_eq Ball_def less_imp_le)


[STATEMENT]
lemma odd_of_intvl_intvl:
  fixes S :: "nat set"
  assumes "S = {m..n} \<inter> {i. odd i}"
  shows "\<exists>m' n'. S = Suc ` (\<lambda>i. i * 2) ` {m'..n'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m' n'. S = Suc ` (\<lambda>i. i * 2) ` {m'..n'}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>m' n'. S = Suc ` (\<lambda>i. i * 2) ` {m'..n'}
[PROOF STEP]
have step1: "\<exists>m'. S = Suc ` ({m'..n - 1} \<inter> {i. even i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m'. S = Suc ` ({m'..n - 1} \<inter> Collect even)
[PROOF STEP]
apply (rule_tac x="if n = 0 then 1 else m - 1" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = Suc ` ({if n = 0 then 1 else m - 1..n - 1} \<inter> Collect even)
[PROOF STEP]
apply (auto simp: assms image_def elim!: oddE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>m'. S = Suc ` ({m'..n - 1} \<inter> Collect even)

goal (1 subgoal):
 1. \<exists>m' n'. S = Suc ` (\<lambda>i. i * 2) ` {m'..n'}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>m'. S = Suc ` ({m'..n - 1} \<inter> Collect even)

goal (1 subgoal):
 1. \<exists>m' n'. S = Suc ` (\<lambda>i. i * 2) ` {m'..n'}
[PROOF STEP]
by (metis even_of_intvl_intvl)
[PROOF STATE]
proof (state)
this:
\<exists>m' n'. S = Suc ` (\<lambda>i. i * 2) ` {m'..n'}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_le_pow:
  assumes "r \<le> n"
  shows "n choose r \<le> n ^ r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose r \<le> n ^ r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose r \<le> n ^ r
[PROOF STEP]
have "n choose r \<le> fact n div fact (n - r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose r \<le> fact n div fact (n - r)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r \<le> n

goal (1 subgoal):
 1. n choose r \<le> fact n div fact (n - r)
[PROOF STEP]
by (subst binomial_fact_lemma[symmetric]) auto
[PROOF STATE]
proof (state)
this:
n choose r \<le> fact n div fact (n - r)

goal (1 subgoal):
 1. n choose r \<le> n ^ r
[PROOF STEP]
with fact_div_fact_le_pow [OF assms]
[PROOF STATE]
proof (chain)
picking this:
fact n div fact (n - r) \<le> n ^ r
n choose r \<le> fact n div fact (n - r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fact n div fact (n - r) \<le> n ^ r
n choose r \<le> fact n div fact (n - r)

goal (1 subgoal):
 1. n choose r \<le> n ^ r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n choose r \<le> n ^ r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power_up_eq_zero_iff[simp]: "power_up prec b n = 0 \<longleftrightarrow> b = 0 \<and> n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (power_up prec b n = 0) = (b = 0 \<and> n \<noteq> 0)
[PROOF STEP]
proof (induction n arbitrary: b rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x b. (\<And>y b. y < x \<Longrightarrow> (power_up prec b y = 0) = (b = 0 \<and> y \<noteq> 0)) \<Longrightarrow> (power_up prec b x = 0) = (b = 0 \<and> x \<noteq> 0)
[PROOF STEP]
case (less x)
[PROOF STATE]
proof (state)
this:
?y < x \<Longrightarrow> (power_up prec ?b ?y = 0) = (?b = 0 \<and> ?y \<noteq> 0)

goal (1 subgoal):
 1. \<And>x b. (\<And>y b. y < x \<Longrightarrow> (power_up prec b y = 0) = (b = 0 \<and> y \<noteq> 0)) \<Longrightarrow> (power_up prec b x = 0) = (b = 0 \<and> x \<noteq> 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y < x \<Longrightarrow> (power_up prec ?b ?y = 0) = (?b = 0 \<and> ?y \<noteq> 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?y < x \<Longrightarrow> (power_up prec ?b ?y = 0) = (?b = 0 \<and> ?y \<noteq> 0)

goal (1 subgoal):
 1. (power_up prec b x = 0) = (b = 0 \<and> x \<noteq> 0)
[PROOF STEP]
using power_up_simp[of _ _ "x - 1"]
[PROOF STATE]
proof (prove)
using this:
?y < x \<Longrightarrow> (power_up prec ?b ?y = 0) = (?b = 0 \<and> ?y \<noteq> 0)
power_up ?p ?x (Suc (x - 1)) = (if odd (x - 1) then truncate_up ?p ((power_up ?p ?x (Suc (x - 1) div 2))\<^sup>2) else truncate_up ?p (?x * power_up ?p ?x (x - 1)))

goal (1 subgoal):
 1. (power_up prec b x = 0) = (b = 0 \<and> x \<noteq> 0)
[PROOF STEP]
by (cases x) (auto simp: algebra_split_simps zero_le_mult_iff div2_less_self)
[PROOF STATE]
proof (state)
this:
(power_up prec b x = 0) = (b = 0 \<and> x \<noteq> 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_path_image_join:
  assumes "path_image g1 \<subseteq> s"
    and "path_image g2 \<subseteq> s"
  shows "path_image (g1 +++ g2) \<subseteq> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (g1 +++ g2) \<subseteq> s
[PROOF STEP]
using path_image_join_subset[of g1 g2] and assms
[PROOF STATE]
proof (prove)
using this:
path_image (g1 +++ g2) \<subseteq> path_image g1 \<union> path_image g2
path_image g1 \<subseteq> s
path_image g2 \<subseteq> s

goal (1 subgoal):
 1. path_image (g1 +++ g2) \<subseteq> s
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_Stars_Cons:
  assumes "finite V" "finite Vs"
  shows "finite (Stars_Cons V Vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Stars_Cons V Vs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite V
finite Vs

goal (1 subgoal):
 1. finite (Stars_Cons V Vs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>finite V; finite Vs\<rbrakk> \<Longrightarrow> finite (Stars_Cons V Vs)
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
finite Vs
[PROOF STEP]
have "finite (Stars -` Vs)"
[PROOF STATE]
proof (prove)
using this:
finite Vs

goal (1 subgoal):
 1. finite (Stars -` Vs)
[PROOF STEP]
by(simp add: finite_vimageI inj_on_def)
[PROOF STATE]
proof (state)
this:
finite (Stars -` Vs)

goal (1 subgoal):
 1. \<lbrakk>finite V; finite Vs\<rbrakk> \<Longrightarrow> finite (Stars_Cons V Vs)
[PROOF STEP]
with assms(1)
[PROOF STATE]
proof (chain)
picking this:
finite V
finite (Stars -` Vs)
[PROOF STEP]
have "finite (V \<times> (Stars -` Vs))"
[PROOF STATE]
proof (prove)
using this:
finite V
finite (Stars -` Vs)

goal (1 subgoal):
 1. finite (V \<times> Stars -` Vs)
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
finite (V \<times> Stars -` Vs)

goal (1 subgoal):
 1. \<lbrakk>finite V; finite Vs\<rbrakk> \<Longrightarrow> finite (Stars_Cons V Vs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (V \<times> Stars -` Vs)
[PROOF STEP]
have "finite ((\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> (Stars -` Vs)))"
[PROOF STATE]
proof (prove)
using this:
finite (V \<times> Stars -` Vs)

goal (1 subgoal):
 1. finite ((\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs))

goal (1 subgoal):
 1. \<lbrakk>finite V; finite Vs\<rbrakk> \<Longrightarrow> finite (Stars_Cons V Vs)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs))

goal (1 subgoal):
 1. \<lbrakk>finite V; finite Vs\<rbrakk> \<Longrightarrow> finite (Stars_Cons V Vs)
[PROOF STEP]
have "Stars_Cons V Vs = (\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> (Stars -` Vs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stars_Cons V Vs = (\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs)
[PROOF STEP]
unfolding Stars_Cons_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Stars (v # vs) |v vs. v \<in> V \<and> Stars vs \<in> Vs} = (\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Stars_Cons V Vs = (\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs)

goal (1 subgoal):
 1. \<lbrakk>finite V; finite Vs\<rbrakk> \<Longrightarrow> finite (Stars_Cons V Vs)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite ((\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs))
Stars_Cons V Vs = (\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs)
[PROOF STEP]
show "finite (Stars_Cons V Vs)"
[PROOF STATE]
proof (prove)
using this:
finite ((\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs))
Stars_Cons V Vs = (\<lambda>(v, vs). Stars (v # vs)) ` (V \<times> Stars -` Vs)

goal (1 subgoal):
 1. finite (Stars_Cons V Vs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (Stars_Cons V Vs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in euclidean_space) norm_Basis[simp]: "u \<in> Basis \<Longrightarrow> norm u = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> Basis \<Longrightarrow> norm u = 1
[PROOF STEP]
unfolding norm_eq_sqrt_inner
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> Basis \<Longrightarrow> sqrt (inner u u) = 1
[PROOF STEP]
by (simp add: inner_Basis)


[STATEMENT]
lemma distinct_adj_append_iff:
  "distinct_adj (xs @ ys) \<longleftrightarrow>
     distinct_adj xs \<and> distinct_adj ys \<and> (xs = [] \<or> ys = [] \<or> last xs \<noteq> hd ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct_adj (xs @ ys) = (distinct_adj xs \<and> distinct_adj ys \<and> (xs = [] \<or> ys = [] \<or> last xs \<noteq> hd ys))
[PROOF STEP]
by (auto simp: distinct_adj_def successively_append_iff)


[STATEMENT]
lemma cross_ratio_equal_1:
  assumes "proj2_Col p q r" and "p \<noteq> q" and "r \<noteq> p" and "r \<noteq> q"
  shows "cross_ratio p q r r = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_ratio p q r r = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cross_ratio p q r r = 1
[PROOF STEP]
from \<open>proj2_Col p q r\<close> and \<open>p \<noteq> q\<close> and \<open>r \<noteq> p\<close> and \<open>r \<noteq> q\<close>
[PROOF STATE]
proof (chain)
picking this:
proj2_Col p q r
p \<noteq> q
r \<noteq> p
r \<noteq> q
[PROOF STEP]
have "proj2_Col_coeff p q r \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
proj2_Col p q r
p \<noteq> q
r \<noteq> p
r \<noteq> q

goal (1 subgoal):
 1. proj2_Col_coeff p q r \<noteq> 0
[PROOF STEP]
by (rule proj2_Col_distinct_coeff_non_zero)
[PROOF STATE]
proof (state)
this:
proj2_Col_coeff p q r \<noteq> 0

goal (1 subgoal):
 1. cross_ratio p q r r = 1
[PROOF STEP]
thus "cross_ratio p q r r = 1"
[PROOF STATE]
proof (prove)
using this:
proj2_Col_coeff p q r \<noteq> 0

goal (1 subgoal):
 1. cross_ratio p q r r = 1
[PROOF STEP]
by (unfold cross_ratio_def) simp
[PROOF STATE]
proof (state)
this:
cross_ratio p q r r = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_image_join_subset: "path_image (g1 +++ g2) \<subseteq> path_image g1 \<union> path_image g2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (g1 +++ g2) \<subseteq> path_image g1 \<union> path_image g2
[PROOF STEP]
unfolding path_image_def joinpaths_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> 1 / 2 then g1 (2 * x) else g2 (2 * x - 1)) ` {0..1} \<subseteq> g1 ` {0..1} \<union> g2 ` {0..1}
[PROOF STEP]
by auto


[STATEMENT]
lemma Smith_normal_form_of_soundness:
  fixes A::"'a::{bezout_ring}^'cols::{mod_type}^'rows::{mod_type}"
  assumes b: "is_bezout_ext bezout"
  assumes PSQ: "(P,S,Q) = Smith_normal_form_of A bezout"
  shows "S = P**A**Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
obtain P'' D Q'' where PDQ_diag: "(P'',D,Q'') = diagonalize A bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P'' D Q''. (P'', D, Q'') = local.diagonalize A bezout \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis prod_cases3)
[PROOF STATE]
proof (state)
this:
(P'', D, Q'') = local.diagonalize A bezout

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have 1: "invertible P'' \<and> invertible Q'' \<and> isDiagonal D \<and> D = P''**A**Q''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible P'' \<and> invertible Q'' \<and> isDiagonal D \<and> D = P'' ** A ** Q''
[PROOF STEP]
by (rule soundness_diagonalize[OF b PDQ_diag[symmetric]])
[PROOF STATE]
proof (state)
this:
invertible P'' \<and> invertible Q'' \<and> isDiagonal D \<and> D = P'' ** A ** Q''

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
obtain P' Q' where PSQ_D: "(P',S,Q') = diagonal_to_Smith_PQ D bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P' Q'. (P', S, Q') = diagonal_to_Smith_PQ D bezout \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using PSQ PDQ_diag
[PROOF STATE]
proof (prove)
using this:
(P, S, Q) = Smith_normal_form_of A bezout
(P'', D, Q'') = local.diagonalize A bezout

goal (1 subgoal):
 1. (\<And>P' Q'. (P', S, Q') = diagonal_to_Smith_PQ D bezout \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Smith_normal_form_of_def
[PROOF STATE]
proof (prove)
using this:
(P, S, Q) = (let (P'', D, Q'') = local.diagonalize A bezout; (P', S, Q') = diagonal_to_Smith_PQ D bezout in (P' ** P'', S, Q'' ** Q'))
(P'', D, Q'') = local.diagonalize A bezout

goal (1 subgoal):
 1. (\<And>P' Q'. (P', S, Q') = diagonal_to_Smith_PQ D bezout \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
using this:
(P, S, Q) = (case local.diagonalize A bezout of (P'', D, Q'') \<Rightarrow> case diagonal_to_Smith_PQ D bezout of (P', S, Q') \<Rightarrow> (P' ** P'', S, Q'' ** Q'))
(P'', D, Q'') = local.diagonalize A bezout

goal (1 subgoal):
 1. (\<And>P' Q'. (P', S, Q') = diagonal_to_Smith_PQ D bezout \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (smt Pair_inject case_prod_beta' surjective_pairing)
[PROOF STATE]
proof (state)
this:
(P', S, Q') = diagonal_to_Smith_PQ D bezout

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have 2: "invertible P' \<and> invertible Q' \<and> Smith_normal_form S \<and> S = P'**D**Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible P' \<and> invertible Q' \<and> Smith_normal_form S \<and> S = P' ** D ** Q'
[PROOF STEP]
using diagonal_to_Smith_PQ' 1 b PSQ_D
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>isDiagonal ?A; is_bezout_ext ?bezout; (?P, ?S, ?Q) = diagonal_to_Smith_PQ ?A ?bezout\<rbrakk> \<Longrightarrow> ?S = ?P ** ?A ** ?Q \<and> invertible ?P \<and> invertible ?Q \<and> Smith_normal_form ?S
invertible P'' \<and> invertible Q'' \<and> isDiagonal D \<and> D = P'' ** A ** Q''
is_bezout_ext bezout
(P', S, Q') = diagonal_to_Smith_PQ D bezout

goal (1 subgoal):
 1. invertible P' \<and> invertible Q' \<and> Smith_normal_form S \<and> S = P' ** D ** Q'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
invertible P' \<and> invertible Q' \<and> Smith_normal_form S \<and> S = P' ** D ** Q'

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have P: "P = P'**P''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P = P' ** P''
[PROOF STEP]
by (metis (mono_tags, lifting) PDQ_diag PSQ_D Pair_inject
        Smith_normal_form_of_def PSQ old.prod.case)
[PROOF STATE]
proof (state)
this:
P = P' ** P''

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have Q: "Q = Q''**Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q = Q'' ** Q'
[PROOF STEP]
by (metis (mono_tags, lifting) PDQ_diag PSQ_D Pair_inject
        Smith_normal_form_of_def PSQ old.prod.case)
[PROOF STATE]
proof (state)
this:
Q = Q'' ** Q'

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have "S = P**A**Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = P ** A ** Q
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
invertible P'' \<and> invertible Q'' \<and> isDiagonal D \<and> D = P'' ** A ** Q''
invertible P' \<and> invertible Q' \<and> Smith_normal_form S \<and> S = P' ** D ** Q'

goal (1 subgoal):
 1. S = P ** A ** Q
[PROOF STEP]
by (simp add: P Q matrix_mul_assoc)
[PROOF STATE]
proof (state)
this:
S = P ** A ** Q

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S = P ** A ** Q

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have "invertible P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible P
[PROOF STEP]
using P
[PROOF STATE]
proof (prove)
using this:
P = P' ** P''

goal (1 subgoal):
 1. invertible P
[PROOF STEP]
by (simp add: 1 2 invertible_mult)
[PROOF STATE]
proof (state)
this:
invertible P

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
invertible P

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
have "invertible Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible Q
[PROOF STEP]
using Q
[PROOF STATE]
proof (prove)
using this:
Q = Q'' ** Q'

goal (1 subgoal):
 1. invertible Q
[PROOF STEP]
by (simp add: 1 2 invertible_mult)
[PROOF STATE]
proof (state)
this:
invertible Q

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S = P ** A ** Q
invertible P
invertible Q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = P ** A ** Q
invertible P
invertible Q

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
S = P ** A ** Q
invertible P
invertible Q
invertible P' \<and> invertible Q' \<and> Smith_normal_form S \<and> S = P' ** D ** Q'

goal (1 subgoal):
 1. S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S = P ** A ** Q \<and> invertible P \<and> invertible Q \<and> Smith_normal_form S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem th_2: "k > 0 \<Longrightarrow> (\<forall> u. c_fold (c_unfold k u) = u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> \<forall>u. c_fold (c_unfold k u) = u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> \<forall>u. c_fold (c_unfold k u) = u
[PROOF STEP]
assume A1: "k>0"
[PROOF STATE]
proof (state)
this:
0 < k

goal (1 subgoal):
 1. 0 < k \<Longrightarrow> \<forall>u. c_fold (c_unfold k u) = u
[PROOF STEP]
let ?k1 = "k-(1::nat)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> \<forall>u. c_fold (c_unfold k u) = u
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
0 < k
[PROOF STEP]
have S1: "Suc ?k1 = k"
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. Suc (k - 1) = k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc (k - 1) = k

goal (1 subgoal):
 1. 0 < k \<Longrightarrow> \<forall>u. c_fold (c_unfold k u) = u
[PROOF STEP]
have S2: "\<forall> u. c_fold (c_unfold (Suc ?k1) u) = u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc (k - 1)) u) = u
[PROOF STEP]
by (rule th_1)
[PROOF STATE]
proof (state)
this:
\<forall>u. c_fold (c_unfold (Suc (k - 1)) u) = u

goal (1 subgoal):
 1. 0 < k \<Longrightarrow> \<forall>u. c_fold (c_unfold k u) = u
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
Suc (k - 1) = k
\<forall>u. c_fold (c_unfold (Suc (k - 1)) u) = u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Suc (k - 1) = k
\<forall>u. c_fold (c_unfold (Suc (k - 1)) u) = u

goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold k u) = u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>u. c_fold (c_unfold k u) = u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vars_setsum: "finite S \<Longrightarrow> vars (\<Sum>m\<in>S. f m) \<subseteq> (\<Union>m\<in>S. vars (f m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> vars (sum f S) \<subseteq> (\<Union>m\<in>S. vars (f m))
[PROOF STEP]
proof (induction S rule:finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vars (sum f {}) \<subseteq> (\<Union>m\<in>{}. vars (f m))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. vars (sum f {}) \<subseteq> (\<Union>m\<in>{}. vars (f m))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (sum f {}) \<subseteq> (\<Union>m\<in>{}. vars (f m))
[PROOF STEP]
by (metis UN_empty eq_iff monom_zero sum.empty single_zero vars_monom_single_cases)
[PROOF STATE]
proof (state)
this:
vars (sum f {}) \<subseteq> (\<Union>m\<in>{}. vars (f m))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
case (insert s S)
[PROOF STATE]
proof (state)
this:
finite S
s \<notin> S
vars (sum f S) \<subseteq> (\<Union>m\<in>S. vars (f m))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
s \<notin> S
vars (sum f S) \<subseteq> (\<Union>m\<in>S. vars (f m))
[PROOF STEP]
have "vars (sum f (insert s S)) = vars (f s + sum f S)"
[PROOF STATE]
proof (prove)
using this:
finite S
s \<notin> S
vars (sum f S) \<subseteq> (\<Union>m\<in>S. vars (f m))

goal (1 subgoal):
 1. vars (sum f (insert s S)) = vars (f s + sum f S)
[PROOF STEP]
by (metis sum.insert)
[PROOF STATE]
proof (state)
this:
vars (sum f (insert s S)) = vars (f s + sum f S)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vars (sum f (insert s S)) = vars (f s + sum f S)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
have "... \<subseteq> vars (f s) \<union> vars (sum f S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (f s + sum f S) \<subseteq> vars (f s) \<union> vars (sum f S)
[PROOF STEP]
by (simp add: vars_add)
[PROOF STATE]
proof (state)
this:
vars (f s + sum f S) \<subseteq> vars (f s) \<union> vars (sum f S)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vars (f s + sum f S) \<subseteq> vars (f s) \<union> vars (sum f S)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
have "... \<subseteq> (\<Union>m\<in>insert s S. vars (f m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (f s) \<union> vars (sum f S) \<subseteq> (\<Union>m\<in>insert s S. vars (f m))
[PROOF STEP]
using insert.IH
[PROOF STATE]
proof (prove)
using this:
vars (sum f S) \<subseteq> (\<Union>m\<in>S. vars (f m))

goal (1 subgoal):
 1. vars (f s) \<union> vars (sum f S) \<subseteq> (\<Union>m\<in>insert s S. vars (f m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vars (f s) \<union> vars (sum f S) \<subseteq> (\<Union>m\<in>insert s S. vars (f m))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; vars (sum f F) \<subseteq> (\<Union>m\<in>F. vars (f m))\<rbrakk> \<Longrightarrow> vars (sum f (insert x F)) \<subseteq> (\<Union>m\<in>insert x F. vars (f m))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vars (sum f (insert s S)) \<subseteq> (\<Union>m\<in>insert s S. vars (f m))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
vars (sum f (insert s S)) \<subseteq> (\<Union>m\<in>insert s S. vars (f m))

goal (1 subgoal):
 1. vars (sum f (insert s S)) \<subseteq> (\<Union>m\<in>insert s S. vars (f m))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
vars (sum f (insert s S)) \<subseteq> (\<Union>m\<in>insert s S. vars (f m))

goal:
No subgoals!
[PROOF STEP]
qed