[STATEMENT]
lemma log_ceil_idem:
  assumes"(x::real) \<ge> 1"
  shows "\<lceil>lb x \<rceil> = \<lceil>lb \<lceil>x\<rceil>\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
have "\<lceil>log 2 x \<rceil> \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<lceil>log 2 x\<rceil>
[PROOF STEP]
by (smt (verit, ccfv_SIG) assms zero_le_ceiling zero_le_log_cancel_iff)
[PROOF STATE]
proof (state)
this:
0 \<le> \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
have " \<lceil>log 2 x \<rceil> -1 < log 2 x \<and>log 2 x  \<le> \<lceil>log 2 x \<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 x \<and> log 2 x \<le> real_of_int \<lceil>log 2 x\<rceil>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 x \<and> log 2 x \<le> real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 x \<and> log 2 x \<le> real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
hence "2 powr (\<lceil>log 2 x \<rceil> -1) < x  \<and> x \<le> 2 powr ( \<lceil>log 2 x \<rceil>)"
[PROOF STATE]
proof (prove)
using this:
real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 x \<and> log 2 x \<le> real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. 2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < x \<and> x \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
[PROOF STEP]
by (smt (verit, ccfv_SIG) assms less_log_iff real_nat_ceiling_ge)
[PROOF STATE]
proof (state)
this:
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < x \<and> x \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < x \<and> x \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
hence "2 powr ((\<lceil>log 2 x \<rceil> -1)) < \<lceil>x\<rceil>" and " \<lceil>x\<rceil> \<le> 2 powr (\<lceil>log 2 x \<rceil>)"
[PROOF STATE]
proof (prove)
using this:
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < x \<and> x \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. 2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < real_of_int \<lceil>x\<rceil> &&& real_of_int \<lceil>x\<rceil> \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
[PROOF STEP]
apply linarith
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lceil>x\<rceil> \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
[PROOF STEP]
using \<open>0 \<le> \<lceil>log 2 x\<rceil>\<close> calculation(2) ceiling_mono powr_int
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<lceil>log 2 x\<rceil>
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < x \<and> x \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
?y \<le> ?x \<Longrightarrow> \<lceil>?y\<rceil> \<le> \<lceil>?x\<rceil>
0 < ?x \<Longrightarrow> ?x powr real_of_int ?i = (if 0 \<le> ?i then ?x ^ nat ?i else 1 / ?x ^ nat (- ?i))

goal (1 subgoal):
 1. real_of_int \<lceil>x\<rceil> \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < real_of_int \<lceil>x\<rceil>
real_of_int \<lceil>x\<rceil> \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < real_of_int \<lceil>x\<rceil>
real_of_int \<lceil>x\<rceil> \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
hence  " \<lceil>log 2 x \<rceil> -1 < log 2 \<lceil> x \<rceil> \<and>log 2 \<lceil>x\<rceil> \<le> \<lceil>log 2 x \<rceil>"
[PROOF STATE]
proof (prove)
using this:
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < real_of_int \<lceil>x\<rceil>
real_of_int \<lceil>x\<rceil> \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 (real_of_int \<lceil>x\<rceil>) \<and> log 2 (real_of_int \<lceil>x\<rceil>) \<le> real_of_int \<lceil>log 2 x\<rceil>
[PROOF STEP]
by (smt (verit, best) assms ceiling_correct less_log_iff)
[PROOF STATE]
proof (state)
this:
real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 (real_of_int \<lceil>x\<rceil>) \<and> log 2 (real_of_int \<lceil>x\<rceil>) \<le> real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 x \<and> log 2 x \<le> real_of_int \<lceil>log 2 x\<rceil>
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < x \<and> x \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < real_of_int \<lceil>x\<rceil>
real_of_int \<lceil>x\<rceil> \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 (real_of_int \<lceil>x\<rceil>) \<and> log 2 (real_of_int \<lceil>x\<rceil>) \<le> real_of_int \<lceil>log 2 x\<rceil>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 x \<and> log 2 x \<le> real_of_int \<lceil>log 2 x\<rceil>
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < x \<and> x \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
2 powr real_of_int (\<lceil>log 2 x\<rceil> - 1) < real_of_int \<lceil>x\<rceil>
real_of_int \<lceil>x\<rceil> \<le> 2 powr real_of_int \<lceil>log 2 x\<rceil>
real_of_int (\<lceil>log 2 x\<rceil> - 1) < log 2 (real_of_int \<lceil>x\<rceil>) \<and> log 2 (real_of_int \<lceil>x\<rceil>) \<le> real_of_int \<lceil>log 2 x\<rceil>

goal (1 subgoal):
 1. \<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lceil>log 2 x\<rceil> = \<lceil>log 2 (real_of_int \<lceil>x\<rceil>)\<rceil>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtrancl_on_converseI:
  assumes "(y, x) \<in> rtrancl_on F r" shows "(x, y) \<in> rtrancl_on F (r\<inverse>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(y, x) \<in> rtrancl_on F r

goal (1 subgoal):
 1. (x, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
proof induct
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y \<in> F \<Longrightarrow> (y, y) \<in> rtrancl_on F (r\<inverse>)
 2. \<And>ya z. \<lbrakk>(y, ya) \<in> rtrancl_on F r; (ya, z) \<in> r; ya \<in> F; z \<in> F; (ya, y) \<in> rtrancl_on F (r\<inverse>)\<rbrakk> \<Longrightarrow> (z, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
case (step a b)
[PROOF STATE]
proof (state)
this:
(y, a) \<in> rtrancl_on F r
(a, b) \<in> r
a \<in> F
b \<in> F
(a, y) \<in> rtrancl_on F (r\<inverse>)

goal (2 subgoals):
 1. y \<in> F \<Longrightarrow> (y, y) \<in> rtrancl_on F (r\<inverse>)
 2. \<And>ya z. \<lbrakk>(y, ya) \<in> rtrancl_on F r; (ya, z) \<in> r; ya \<in> F; z \<in> F; (ya, y) \<in> rtrancl_on F (r\<inverse>)\<rbrakk> \<Longrightarrow> (z, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(y, a) \<in> rtrancl_on F r
(a, b) \<in> r
a \<in> F
b \<in> F
(a, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
have "(b,b) \<in> rtrancl_on F (r\<inverse>)" "(b,a) \<in> r\<inverse>"
[PROOF STATE]
proof (prove)
using this:
(y, a) \<in> rtrancl_on F r
(a, b) \<in> r
a \<in> F
b \<in> F
(a, y) \<in> rtrancl_on F (r\<inverse>)

goal (1 subgoal):
 1. (b, b) \<in> rtrancl_on F (r\<inverse>) &&& (b, a) \<in> r\<inverse>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b, b) \<in> rtrancl_on F (r\<inverse>)
(b, a) \<in> r\<inverse>

goal (2 subgoals):
 1. y \<in> F \<Longrightarrow> (y, y) \<in> rtrancl_on F (r\<inverse>)
 2. \<And>ya z. \<lbrakk>(y, ya) \<in> rtrancl_on F r; (ya, z) \<in> r; ya \<in> F; z \<in> F; (ya, y) \<in> rtrancl_on F (r\<inverse>)\<rbrakk> \<Longrightarrow> (z, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(b, b) \<in> rtrancl_on F (r\<inverse>)
(b, a) \<in> r\<inverse>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(b, b) \<in> rtrancl_on F (r\<inverse>)
(b, a) \<in> r\<inverse>

goal (1 subgoal):
 1. (b, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
using step
[PROOF STATE]
proof (prove)
using this:
(b, b) \<in> rtrancl_on F (r\<inverse>)
(b, a) \<in> r\<inverse>
(y, a) \<in> rtrancl_on F r
(a, b) \<in> r
a \<in> F
b \<in> F
(a, y) \<in> rtrancl_on F (r\<inverse>)

goal (1 subgoal):
 1. (b, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
by (metis rtrancl_on_trans rtrancl_on_into_rtrancl_on)
[PROOF STATE]
proof (state)
this:
(b, y) \<in> rtrancl_on F (r\<inverse>)

goal (1 subgoal):
 1. y \<in> F \<Longrightarrow> (y, y) \<in> rtrancl_on F (r\<inverse>)
[PROOF STEP]
qed auto


[STATEMENT]
lemma fib_rec_odd:
  fixes \<phi> \<psi> :: real
  defines "\<phi> \<equiv> (1 + sqrt 5) / 2"
    and "\<psi> \<equiv> (1 - sqrt 5) / 2"
  shows "fib (Suc (2 * n)) = fib n^2 + fib (Suc n)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
have "of_nat (fib n^2 + fib (Suc n)^2) = ((\<phi> ^ n - \<psi> ^ n)\<^sup>2 + (\<phi> * \<phi> ^ n - \<psi> * \<psi> ^ n)\<^sup>2)/5"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real ((fib n)\<^sup>2 + (fib (Suc n))\<^sup>2) = ((\<phi> ^ n - \<psi> ^ n)\<^sup>2 + (\<phi> * \<phi> ^ n - \<psi> * \<psi> ^ n)\<^sup>2) / 5
[PROOF STEP]
by (simp add: fib_closed_form[folded \<phi>_def \<psi>_def] field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
real ((fib n)\<^sup>2 + (fib (Suc n))\<^sup>2) = ((\<phi> ^ n - \<psi> ^ n)\<^sup>2 + (\<phi> * \<phi> ^ n - \<psi> * \<psi> ^ n)\<^sup>2) / 5

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real ((fib n)\<^sup>2 + (fib (Suc n))\<^sup>2) = ((\<phi> ^ n - \<psi> ^ n)\<^sup>2 + (\<phi> * \<phi> ^ n - \<psi> * \<psi> ^ n)\<^sup>2) / 5

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
let ?A = "\<phi>^(2 * n) + \<psi>^(2 * n) - 2*(\<phi> * \<psi>)^n + \<phi>^(2 * n + 2) + \<psi>^(2 * n + 2) - 2*(\<phi> * \<psi>)^(n + 1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
have "(\<phi> ^ n - \<psi> ^ n)\<^sup>2 + (\<phi> * \<phi> ^ n - \<psi> * \<psi> ^ n)\<^sup>2 = ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<phi> ^ n - \<psi> ^ n)\<^sup>2 + (\<phi> * \<phi> ^ n - \<psi> * \<psi> ^ n)\<^sup>2 = \<phi> ^ (2 * n) + \<psi> ^ (2 * n) - 2 * (\<phi> * \<psi>) ^ n + \<phi> ^ (2 * n + 2) + \<psi> ^ (2 * n + 2) - 2 * (\<phi> * \<psi>) ^ (n + 1)
[PROOF STEP]
by (simp add: power2_eq_square algebra_simps power_mult power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(\<phi> ^ n - \<psi> ^ n)\<^sup>2 + (\<phi> * \<phi> ^ n - \<psi> * \<psi> ^ n)\<^sup>2 = \<phi> ^ (2 * n) + \<psi> ^ (2 * n) - 2 * (\<phi> * \<psi>) ^ n + \<phi> ^ (2 * n + 2) + \<psi> ^ (2 * n + 2) - 2 * (\<phi> * \<psi>) ^ (n + 1)

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<phi> ^ n - \<psi> ^ n)\<^sup>2 + (\<phi> * \<phi> ^ n - \<psi> * \<psi> ^ n)\<^sup>2 = \<phi> ^ (2 * n) + \<psi> ^ (2 * n) - 2 * (\<phi> * \<psi>) ^ n + \<phi> ^ (2 * n + 2) + \<psi> ^ (2 * n + 2) - 2 * (\<phi> * \<psi>) ^ (n + 1)

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
have "\<phi> * \<psi> = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> * \<psi> = - 1
[PROOF STEP]
by (simp add: \<phi>_def \<psi>_def field_simps)
[PROOF STATE]
proof (state)
this:
\<phi> * \<psi> = - 1

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<phi> * \<psi> = - 1
[PROOF STEP]
have "?A = \<phi>^(2 * n + 1) * (\<phi> + inverse \<phi>) + \<psi>^(2 * n + 1) * (\<psi> + inverse \<psi>)"
[PROOF STATE]
proof (prove)
using this:
\<phi> * \<psi> = - 1

goal (1 subgoal):
 1. \<phi> ^ (2 * n) + \<psi> ^ (2 * n) - 2 * (\<phi> * \<psi>) ^ n + \<phi> ^ (2 * n + 2) + \<psi> ^ (2 * n + 2) - 2 * (\<phi> * \<psi>) ^ (n + 1) = \<phi> ^ (2 * n + 1) * (\<phi> + inverse \<phi>) + \<psi> ^ (2 * n + 1) * (\<psi> + inverse \<psi>)
[PROOF STEP]
by (auto simp: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
\<phi> ^ (2 * n) + \<psi> ^ (2 * n) - 2 * (\<phi> * \<psi>) ^ n + \<phi> ^ (2 * n + 2) + \<psi> ^ (2 * n + 2) - 2 * (\<phi> * \<psi>) ^ (n + 1) = \<phi> ^ (2 * n + 1) * (\<phi> + inverse \<phi>) + \<psi> ^ (2 * n + 1) * (\<psi> + inverse \<psi>)

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> ^ (2 * n) + \<psi> ^ (2 * n) - 2 * (\<phi> * \<psi>) ^ n + \<phi> ^ (2 * n + 2) + \<psi> ^ (2 * n + 2) - 2 * (\<phi> * \<psi>) ^ (n + 1) = \<phi> ^ (2 * n + 1) * (\<phi> + inverse \<phi>) + \<psi> ^ (2 * n + 1) * (\<psi> + inverse \<psi>)

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
have "1 + sqrt 5 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 + sqrt 5
[PROOF STEP]
by (auto intro: add_pos_pos)
[PROOF STATE]
proof (state)
this:
0 < 1 + sqrt 5

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < 1 + sqrt 5
[PROOF STEP]
have "\<phi> + inverse \<phi> = sqrt 5"
[PROOF STATE]
proof (prove)
using this:
0 < 1 + sqrt 5

goal (1 subgoal):
 1. \<phi> + inverse \<phi> = sqrt 5
[PROOF STEP]
by (simp add: \<phi>_def field_simps)
[PROOF STATE]
proof (state)
this:
\<phi> + inverse \<phi> = sqrt 5

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> + inverse \<phi> = sqrt 5

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
have "\<psi> + inverse \<psi> = -sqrt 5"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> + inverse \<psi> = - sqrt 5
[PROOF STEP]
by (simp add: \<psi>_def field_simps)
[PROOF STATE]
proof (state)
this:
\<psi> + inverse \<psi> = - sqrt 5

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<psi> + inverse \<psi> = - sqrt 5

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
have "(\<phi> ^ (2 * n + 1) * sqrt 5 + \<psi> ^ (2 * n + 1) * - sqrt 5) / 5 =
    (\<phi> ^ (2 * n + 1) - \<psi> ^ (2 * n + 1)) * (sqrt 5 / 5)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<phi> ^ (2 * n + 1) * sqrt 5 + \<psi> ^ (2 * n + 1) * - sqrt 5) / 5 = (\<phi> ^ (2 * n + 1) - \<psi> ^ (2 * n + 1)) * (sqrt 5 / 5)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<phi> ^ (2 * n + 1) * sqrt 5 + \<psi> ^ (2 * n + 1) * - sqrt 5) / 5 = (\<phi> ^ (2 * n + 1) - \<psi> ^ (2 * n + 1)) * (sqrt 5 / 5)

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<phi> ^ (2 * n + 1) * sqrt 5 + \<psi> ^ (2 * n + 1) * - sqrt 5) / 5 = (\<phi> ^ (2 * n + 1) - \<psi> ^ (2 * n + 1)) * (sqrt 5 / 5)

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
have "sqrt 5 / 5 = inverse (sqrt 5)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt 5 / 5 = inverse (sqrt 5)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
sqrt 5 / 5 = inverse (sqrt 5)

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt 5 / 5 = inverse (sqrt 5)

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
have "(\<phi> ^ (2 * n + 1) - \<psi> ^ (2 * n + 1)) * \<dots> = of_nat (fib (Suc (2 * n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<phi> ^ (2 * n + 1) - \<psi> ^ (2 * n + 1)) * inverse (sqrt 5) = real (fib (Suc (2 * n)))
[PROOF STEP]
by (simp add: fib_closed_form[folded \<phi>_def \<psi>_def] divide_inverse)
[PROOF STATE]
proof (state)
this:
(\<phi> ^ (2 * n + 1) - \<psi> ^ (2 * n + 1)) * inverse (sqrt 5) = real (fib (Suc (2 * n)))

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real ((fib n)\<^sup>2 + (fib (Suc n))\<^sup>2) = real (fib (Suc (2 * n)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real ((fib n)\<^sup>2 + (fib (Suc n))\<^sup>2) = real (fib (Suc (2 * n)))

goal (1 subgoal):
 1. fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2
[PROOF STEP]
by (simp only: of_nat_eq_iff)
[PROOF STATE]
proof (state)
this:
fib (Suc (2 * n)) = (fib n)\<^sup>2 + (fib (Suc n))\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem is_Sup_binary: "is_Sup {x, y} sup = is_sup x y sup"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
have "is_Sup {x, y} sup = is_Inf (dual ` {x, y}) (dual sup)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Sup {x, y} sup = is_Inf (dual ` {x, y}) (dual sup)
[PROOF STEP]
by (simp only: dual_Inf)
[PROOF STATE]
proof (state)
this:
is_Sup {x, y} sup = is_Inf (dual ` {x, y}) (dual sup)

goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
is_Sup {x, y} sup = is_Inf (dual ` {x, y}) (dual sup)

goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
have "dual ` {x, y} = {dual x, dual y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual ` {x, y} = {dual x, dual y}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dual ` {x, y} = {dual x, dual y}

goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dual ` {x, y} = {dual x, dual y}

goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
have "is_Inf \<dots> (dual sup) = is_inf (dual x) (dual y) (dual sup)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Inf {dual x, dual y} (dual sup) = is_inf (dual x) (dual y) (dual sup)
[PROOF STEP]
by (rule is_Inf_binary)
[PROOF STATE]
proof (state)
this:
is_Inf {dual x, dual y} (dual sup) = is_inf (dual x) (dual y) (dual sup)

goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
is_Inf {dual x, dual y} (dual sup) = is_inf (dual x) (dual y) (dual sup)

goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
have "\<dots> = is_sup x y sup"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_inf (dual x) (dual y) (dual sup) = is_sup x y sup
[PROOF STEP]
by (simp only: dual_inf)
[PROOF STATE]
proof (state)
this:
is_inf (dual x) (dual y) (dual sup) = is_sup x y sup

goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
is_Sup {x, y} sup = is_sup x y sup

goal (1 subgoal):
 1. is_Sup {x, y} sup = is_sup x y sup
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
is_Sup {x, y} sup = is_sup x y sup

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma geometric_sums_times_norm:
  fixes c::"'a::{banach,real_normed_field}"
  assumes "norm c < 1"
  shows "(\<lambda>n. norm (c^n * of_nat n)) sums (norm c / (1 - norm c)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. norm (c ^ n * of_nat n)) sums (norm c / (1 - norm c)\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. norm (c ^ n * of_nat n)) sums (norm c / (1 - norm c)\<^sup>2)
[PROOF STEP]
have "norm (c^n * of_nat n) = (norm c) ^ n * of_nat n" for n::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (c ^ n * of_nat n) = norm c ^ n * real n
[PROOF STEP]
by (simp add: norm_power norm_mult)
[PROOF STATE]
proof (state)
this:
norm (c ^ ?n * of_nat ?n) = norm c ^ ?n * real ?n

goal (1 subgoal):
 1. (\<lambda>n. norm (c ^ n * of_nat n)) sums (norm c / (1 - norm c)\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (c ^ ?n * of_nat ?n) = norm c ^ ?n * real ?n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (c ^ ?n * of_nat ?n) = norm c ^ ?n * real ?n

goal (1 subgoal):
 1. (\<lambda>n. norm (c ^ n * of_nat n)) sums (norm c / (1 - norm c)\<^sup>2)
[PROOF STEP]
using geometric_sums_times_n[of "norm c"] assms
[PROOF STATE]
proof (prove)
using this:
norm (c ^ ?n * of_nat ?n) = norm c ^ ?n * real ?n
norm (norm c) < 1 \<Longrightarrow> (\<lambda>n. norm c ^ n * real n) sums (norm c / (1 - norm c)\<^sup>2)
norm c < 1

goal (1 subgoal):
 1. (\<lambda>n. norm (c ^ n * of_nat n)) sums (norm c / (1 - norm c)\<^sup>2)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>n. norm (c ^ n * of_nat n)) sums (norm c / (1 - norm c)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cartesian_product_complement_left:
  assumes "B \<subseteq> carrier (R\<^bsup>m\<^esup>)"
  assumes "A \<subseteq> carrier (R\<^bsup>n\<^esup>)"
  shows "cartesian_product (carrier (R\<^bsup>m\<^esup>)) A  - (cartesian_product B A) =
          cartesian_product ((carrier (R\<^bsup>m\<^esup>)) - B) A "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A = cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A \<subseteq> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A
 2. cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<subseteq> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
show "cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A \<subseteq> cartesian_product ((carrier (R\<^bsup>m\<^esup>)) - B) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A \<subseteq> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A
[PROOF STEP]
unfolding cartesian_product_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. \<exists>as\<in>carrier (R\<^bsup>m\<^esup>). \<exists>bs\<in>A. xs = as @ bs} - {xs. \<exists>as\<in>B. \<exists>bs\<in>A. xs = as @ bs} \<subseteq> {xs. \<exists>as\<in>carrier (R\<^bsup>m\<^esup>) - B. \<exists>bs\<in>A. xs = as @ bs}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A \<subseteq> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A

goal (1 subgoal):
 1. cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<subseteq> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
show "cartesian_product ((carrier (R\<^bsup>m\<^esup>)) - B) A \<subseteq> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<subseteq> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
assume A: "x \<in> cartesian_product ((carrier (R\<^bsup>m\<^esup>)) - B) A"
[PROOF STATE]
proof (state)
this:
x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A

goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
have 0: "x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A

goal (1 subgoal):
 1. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A
[PROOF STEP]
unfolding cartesian_product_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {xs. \<exists>as\<in>carrier (R\<^bsup>m\<^esup>) - B. \<exists>bs\<in>A. xs = as @ bs}

goal (1 subgoal):
 1. x \<in> {xs. \<exists>as\<in>carrier (R\<^bsup>m\<^esup>). \<exists>bs\<in>A. xs = as @ bs}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A

goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
have 1: "take m x \<in> (carrier (R\<^bsup>m\<^esup>)) - B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take m x \<in> carrier (R\<^bsup>m\<^esup>) - B
[PROOF STEP]
using A cartesian_product_memE[of x "((carrier (R\<^bsup>m\<^esup>)) - B)" A R m]
[PROOF STATE]
proof (prove)
using this:
x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A
\<lbrakk>x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A; carrier (R\<^bsup>m\<^esup>) - B \<subseteq> carrier (R\<^bsup>m\<^esup>)\<rbrakk> \<Longrightarrow> take m x \<in> carrier (R\<^bsup>m\<^esup>) - B
\<lbrakk>x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A; carrier (R\<^bsup>m\<^esup>) - B \<subseteq> carrier (R\<^bsup>m\<^esup>)\<rbrakk> \<Longrightarrow> drop m x \<in> A

goal (1 subgoal):
 1. take m x \<in> carrier (R\<^bsup>m\<^esup>) - B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
take m x \<in> carrier (R\<^bsup>m\<^esup>) - B

goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
have 2: "drop m x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop m x \<in> A
[PROOF STEP]
using cartesian_product_memE[of x "((carrier (R\<^bsup>m\<^esup>)) - B)" A R m]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A; carrier (R\<^bsup>m\<^esup>) - B \<subseteq> carrier (R\<^bsup>m\<^esup>)\<rbrakk> \<Longrightarrow> take m x \<in> carrier (R\<^bsup>m\<^esup>) - B
\<lbrakk>x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A; carrier (R\<^bsup>m\<^esup>) - B \<subseteq> carrier (R\<^bsup>m\<^esup>)\<rbrakk> \<Longrightarrow> drop m x \<in> A

goal (1 subgoal):
 1. drop m x \<in> A
[PROOF STEP]
by (metis  A  Diff_subset)
[PROOF STATE]
proof (state)
this:
drop m x \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<Longrightarrow> x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
show "x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A
[PROOF STEP]
apply(rule ccontr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A \<Longrightarrow> False
[PROOF STEP]
using A 0 1 2 cartesian_product_memE[of x B A R m] assms
[PROOF STATE]
proof (prove)
using this:
x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A
x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A
take m x \<in> carrier (R\<^bsup>m\<^esup>) - B
drop m x \<in> A
\<lbrakk>x \<in> cartesian_product B A; B \<subseteq> carrier (R\<^bsup>m\<^esup>)\<rbrakk> \<Longrightarrow> take m x \<in> B
\<lbrakk>x \<in> cartesian_product B A; B \<subseteq> carrier (R\<^bsup>m\<^esup>)\<rbrakk> \<Longrightarrow> drop m x \<in> A
B \<subseteq> carrier (R\<^bsup>m\<^esup>)
A \<subseteq> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. x \<notin> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A \<Longrightarrow> False
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cartesian_product (carrier (R\<^bsup>m\<^esup>) - B) A \<subseteq> cartesian_product (carrier (R\<^bsup>m\<^esup>)) A - cartesian_product B A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_bound:
  fixes f::"real \<Rightarrow> 'a::banach"
  assumes "a \<le> b"
  assumes "continuous_on {a .. b} f"
  assumes "\<And>t. t \<in> {a .. b} \<Longrightarrow> norm (f t) \<le> B"
  shows "norm (integral {a .. b} f) \<le> B * (b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
note continuous_on_imp_absolutely_integrable_on[OF assms(2)]
[PROOF STATE]
proof (state)
this:
norm (integral {a..b} f) \<le> integral {a..b} (\<lambda>x. norm (f x))

goal (1 subgoal):
 1. norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (integral {a..b} f) \<le> integral {a..b} (\<lambda>x. norm (f x))

goal (1 subgoal):
 1. norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
have "integral {a..b} (\<lambda>x. norm (f x)) \<le> integral {a..b} (\<lambda>_. B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a..b} (\<lambda>x. norm (f x)) \<le> integral {a..b} (\<lambda>_. B)
[PROOF STEP]
by (rule integral_le)
      (auto intro!: integrable_continuous_real continuous_intros assms)
[PROOF STATE]
proof (state)
this:
integral {a..b} (\<lambda>x. norm (f x)) \<le> integral {a..b} (\<lambda>_. B)

goal (1 subgoal):
 1. norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {a..b} (\<lambda>x. norm (f x)) \<le> integral {a..b} (\<lambda>_. B)

goal (1 subgoal):
 1. norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
have "\<dots> = B * (b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a..b} (\<lambda>_. B) = B * (b - a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<le> b
continuous_on {a..b} f
?t \<in> {a..b} \<Longrightarrow> norm (f ?t) \<le> B

goal (1 subgoal):
 1. integral {a..b} (\<lambda>_. B) = B * (b - a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral {a..b} (\<lambda>_. B) = B * (b - a)

goal (1 subgoal):
 1. norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (integral {a..b} f) \<le> B * (b - a)

goal (1 subgoal):
 1. norm (integral {a..b} f) \<le> B * (b - a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (integral {a..b} f) \<le> B * (b - a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma normalize_monom [simp]: "normalize (monom a n) = monom (normalize a) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (monom a n) = monom (normalize a) n
[PROOF STEP]
by (cases "a = 0") (simp_all add: map_poly_monom normalize_poly_eq_map_poly degree_monom_eq)


[STATEMENT]
lemma fds_abs_converges_ln:
  assumes "fds_abs_converges (fds_deriv f / f) s"
  shows   "fds_abs_converges (fds_ln l f) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_abs_converges (fds_ln l f) s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fds_abs_converges (fds_deriv f / f) s

goal (1 subgoal):
 1. fds_abs_converges (fds_ln l f) s
[PROOF STEP]
unfolding fds_ln_def
[PROOF STATE]
proof (prove)
using this:
fds_abs_converges (fds_deriv f / f) s

goal (1 subgoal):
 1. fds_abs_converges (fds_integral l (fds_deriv f / f)) s
[PROOF STEP]
by (intro fds_abs_converges_integral)


[STATEMENT]
lemma openin_topology\<^sub>N:
  "openin (topology\<^sub>N N) U \<longleftrightarrow> (\<forall>x\<in>U. \<exists>e>0. \<forall>y. eNorm N (y-x) < e \<longrightarrow> y \<in> U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (topology\<^sub>N N) U = (\<forall>x\<in>U. \<exists>e>0. \<forall>y. eNorm N (y - x) < e \<longrightarrow> y \<in> U)
[PROOF STEP]
unfolding topology\<^sub>N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (topology (\<lambda>U. \<forall>x\<in>U. \<exists>e>0. \<forall>y. eNorm N (y - x) < e \<longrightarrow> y \<in> U)) U = (\<forall>x\<in>U. \<exists>e>0. \<forall>y. eNorm N (y - x) < e \<longrightarrow> y \<in> U)
[PROOF STEP]
using istopology_topology\<^sub>N[of N]
[PROOF STATE]
proof (prove)
using this:
istopology (\<lambda>U. \<forall>x\<in>U. \<exists>e>0. \<forall>y. eNorm N (y - x) < e \<longrightarrow> y \<in> U)

goal (1 subgoal):
 1. openin (topology (\<lambda>U. \<forall>x\<in>U. \<exists>e>0. \<forall>y. eNorm N (y - x) < e \<longrightarrow> y \<in> U)) U = (\<forall>x\<in>U. \<exists>e>0. \<forall>y. eNorm N (y - x) < e \<longrightarrow> y \<in> U)
[PROOF STEP]
by (simp add: topology_inverse')


[STATEMENT]
lemma hyperbolic_pythagoras: "cosh x ^ 2 - sinh x ^ 2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cosh x)\<^sup>2 - (sinh x)\<^sup>2 = (1::'a)
[PROOF STEP]
by (simp add: cosh_square_eq)


[STATEMENT]
lemma round_up_shift: "round_up p (x * 2 powr k) = 2 powr k * round_up (p + k) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round_up p (x * 2 powr real_of_int k) = 2 powr real_of_int k * round_up (p + k) x
[PROOF STEP]
unfolding round_up_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lceil>x * 2 powr real_of_int k * 2 powr real_of_int p\<rceil> * 2 powr - real_of_int p = 2 powr real_of_int k * (real_of_int \<lceil>x * 2 powr real_of_int (p + k)\<rceil> * 2 powr - real_of_int (p + k))
[PROOF STEP]
by (simp add: powr_add powr_mult field_simps powr_diff)
    (simp flip: powr_add)


[STATEMENT]
lemma reciprocal_add:
  fixes P Q :: "'a::comm_semiring_0 poly"
  assumes "degree P \<le> p" and "degree Q \<le> p"
  shows "reciprocal_poly p (P + Q) = reciprocal_poly p P + reciprocal_poly p Q"
(is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly p (P + Q) = reciprocal_poly p P + reciprocal_poly p Q
[PROOF STEP]
proof (rule poly_eqI, cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. ?P2 n \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
 2. \<And>n. \<not> ?P2 n \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. ?P2 n \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
 2. \<And>n. \<not> ?P2 n \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
assume "n \<le> p"
[PROOF STATE]
proof (state)
this:
n \<le> p

goal (2 subgoals):
 1. \<And>n. ?P2 n \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
 2. \<And>n. \<not> ?P2 n \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<le> p
[PROOF STEP]
show "coeff ?L n = coeff ?R n"
[PROOF STATE]
proof (prove)
using this:
n \<le> p

goal (1 subgoal):
 1. coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<le> p
degree P \<le> p
degree Q \<le> p

goal (1 subgoal):
 1. coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
by (auto simp: degree_add_le coeff_reciprocal)
[PROOF STATE]
proof (state)
this:
coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n

goal (1 subgoal):
 1. \<And>n. \<not> n \<le> p \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<not> n \<le> p \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<not> n \<le> p \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
assume "\<not>n \<le> p"
[PROOF STATE]
proof (state)
this:
\<not> n \<le> p

goal (1 subgoal):
 1. \<And>n. \<not> n \<le> p \<Longrightarrow> coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> p
[PROOF STEP]
show "coeff ?L n = coeff ?R n"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> p

goal (1 subgoal):
 1. coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> p
degree P \<le> p
degree Q \<le> p

goal (1 subgoal):
 1. coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n
[PROOF STEP]
by (auto simp: degree_add_le coeff_reciprocal_less)
[PROOF STATE]
proof (state)
this:
coeff (reciprocal_poly p (P + Q)) n = coeff (reciprocal_poly p P + reciprocal_poly p Q) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_of_int:
  fixes z::complex and n::int
  assumes "z\<noteq>(0::complex)"
  shows "z powr of_int n = (if n\<ge>0 then z^nat n else inverse (z^nat (-n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z powr of_int n = (if 0 \<le> n then z ^ nat n else inverse (z ^ nat (- n)))
[PROOF STEP]
by (metis assms not_le of_int_of_nat powr_complexpow powr_minus)


[STATEMENT]
theorem pr_index_enumerator_is_pr: "pr_index_enumerator \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
define g where "g x = x" for x :: nat
[PROOF STATE]
proof (state)
this:
g ?x = ?x

goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
have g_is_pr: "g \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> PrimRec1
[PROOF STEP]
by (unfold g_def, rule pr_id1_1)
[PROOF STATE]
proof (state)
this:
g \<in> PrimRec1

goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
define h where "h a b c = comp_by_index index_of_id b" for a b c :: nat
[PROOF STATE]
proof (state)
this:
h ?a ?b ?c = comp_by_index index_of_id ?b

goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
from comp_by_index_is_pr
[PROOF STATE]
proof (chain)
picking this:
comp_by_index \<in> PrimRec2
[PROOF STEP]
have h_is_pr: "h \<in> PrimRec3"
[PROOF STATE]
proof (prove)
using this:
comp_by_index \<in> PrimRec2

goal (1 subgoal):
 1. h \<in> PrimRec3
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
using this:
comp_by_index \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>a b c. comp_by_index index_of_id b) \<in> PrimRec3
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
h \<in> PrimRec3

goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
let ?f = "pr_index_enumerator"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
from g_def
[PROOF STATE]
proof (chain)
picking this:
g ?x = ?x
[PROOF STEP]
have f_at_0: "\<forall> x. ?f x 0 = g x"
[PROOF STATE]
proof (prove)
using this:
g ?x = ?x

goal (1 subgoal):
 1. \<forall>x. pr_index_enumerator x 0 = g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. pr_index_enumerator x 0 = g x

goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
from h_def
[PROOF STATE]
proof (chain)
picking this:
h ?a ?b ?c = comp_by_index index_of_id ?b
[PROOF STEP]
have f_at_Suc: "\<forall> x y. ?f x (Suc y) = h x (?f x y) y"
[PROOF STATE]
proof (prove)
using this:
h ?a ?b ?c = comp_by_index index_of_id ?b

goal (1 subgoal):
 1. \<forall>x y. pr_index_enumerator x (Suc y) = h x (pr_index_enumerator x y) y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x y. pr_index_enumerator x (Suc y) = h x (pr_index_enumerator x y) y

goal (1 subgoal):
 1. pr_index_enumerator \<in> PrimRec2
[PROOF STEP]
from g_is_pr h_is_pr f_at_0 f_at_Suc
[PROOF STATE]
proof (chain)
picking this:
g \<in> PrimRec1
h \<in> PrimRec3
\<forall>x. pr_index_enumerator x 0 = g x
\<forall>x y. pr_index_enumerator x (Suc y) = h x (pr_index_enumerator x y) y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g \<in> PrimRec1
h \<in> PrimRec3
\<forall>x. pr_index_enumerator x 0 = g x
\<forall>x y. pr_index_enumerator x (Suc y) = h x (pr_index_enumerator x y) y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_inverse:
  assumes coprime: "coprime (e :: nat) ((P-1)*(Q-1))"
    and "prime P"
    and "prime Q"
    and "P \<noteq> Q"
  shows "\<exists> d. [e*d = 1] (mod (P-1)) \<and> d \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d. [e * d = 1] (mod P - 1) \<and> d \<noteq> 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>d. [e * d = 1] (mod P - 1) \<and> d \<noteq> 0
[PROOF STEP]
have "coprime e (P-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime e (P - 1)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
coprime e ((P - 1) * (Q - 1))

goal (1 subgoal):
 1. coprime e (P - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime e (P - 1)

goal (1 subgoal):
 1. \<exists>d. [e * d = 1] (mod P - 1) \<and> d \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coprime e (P - 1)
[PROOF STEP]
obtain d where d: "[e*d = 1] (mod (P-1))"
[PROOF STATE]
proof (prove)
using this:
coprime e (P - 1)

goal (1 subgoal):
 1. (\<And>d. [e * d = 1] (mod P - 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cong_solve_coprime_nat
[PROOF STATE]
proof (prove)
using this:
coprime e (P - 1)
coprime ?a ?n \<Longrightarrow> \<exists>x. [?a * x = Suc 0] (mod ?n)

goal (1 subgoal):
 1. (\<And>d. [e * d = 1] (mod P - 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[e * d = 1] (mod P - 1)

goal (1 subgoal):
 1. \<exists>d. [e * d = 1] (mod P - 1) \<and> d \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[e * d = 1] (mod P - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[e * d = 1] (mod P - 1)

goal (1 subgoal):
 1. \<exists>d. [e * d = 1] (mod P - 1) \<and> d \<noteq> 0
[PROOF STEP]
by (metis cong_0_1_nat cong_1 mult_0_right zero_neq_one)
[PROOF STATE]
proof (state)
this:
\<exists>d. [e * d = 1] (mod P - 1) \<and> d \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma absolutely_integrable_sin_product:
  assumes "f absolutely_integrable_on {-pi..pi}"
  shows "(\<lambda>x. sin(k * x) * f x) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sin (k * x) * f x) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
proof (rule absolutely_integrable_bounded_measurable_product_real)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<lambda>x. sin (k * x)) \<in> borel_measurable (lebesgue_on {- pi..pi})
 2. {- pi..pi} \<in> sets lebesgue
 3. bounded ((\<lambda>x. sin (k * x)) ` {- pi..pi})
 4. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
show "(\<lambda>x. sin (k * x)) \<in> borel_measurable (lebesgue_on {-pi..pi})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sin (k * x)) \<in> borel_measurable (lebesgue_on {- pi..pi})
[PROOF STEP]
by (metis borel_measurable_integrable integrable_sin_cx mult_commute_abs)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sin (k * x)) \<in> borel_measurable (lebesgue_on {- pi..pi})

goal (3 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. bounded ((\<lambda>x. sin (k * x)) ` {- pi..pi})
 3. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
show "bounded ((\<lambda>x. sin (k * x)) ` {-pi..pi})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded ((\<lambda>x. sin (k * x)) ` {- pi..pi})
[PROOF STEP]
by (metis (mono_tags, lifting) abs_sin_le_one bounded_iff imageE real_norm_def)
[PROOF STATE]
proof (state)
this:
bounded ((\<lambda>x. sin (k * x)) ` {- pi..pi})

goal (2 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
qed (auto simp: assms)


[STATEMENT]
lemma lower_bound:
    fixes b::nat
  assumes "b>0"
    shows "\<forall>(c::int) \<ge> -(2^(b-1)). (-c + 2^(b-1) - 1 < 2^b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>c\<ge>- (2 ^ (b - 1)). - c + 2 ^ (b - 1) - 1 < 2 ^ b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>c\<ge>- (2 ^ (b - 1)). - c + 2 ^ (b - 1) - 1 < 2 ^ b
[PROOF STEP]
have a1: "\<And>P. (\<forall>b::nat. P b) \<Longrightarrow> (\<forall>b>0. P ((b-1)::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<forall>b. P b \<Longrightarrow> \<forall>b>0. P (b - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>b. ?P b \<Longrightarrow> \<forall>b>0. ?P (b - 1)

goal (1 subgoal):
 1. \<forall>c\<ge>- (2 ^ (b - 1)). - c + 2 ^ (b - 1) - 1 < 2 ^ b
[PROOF STEP]
have b2: "\<forall>b::nat. \<forall>(c::int) \<ge> -(2^b). (-c + (2^b) - 1) < 2^(Suc b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b c. - (2 ^ b) \<le> c \<longrightarrow> - c + 2 ^ b - 1 < 2 ^ Suc b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>b c. - (2 ^ b) \<le> c \<longrightarrow> - c + 2 ^ b - 1 < 2 ^ Suc b

goal (1 subgoal):
 1. \<forall>c\<ge>- (2 ^ (b - 1)). - c + 2 ^ (b - 1) - 1 < 2 ^ b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>c\<ge>- (2 ^ (b - 1)). - c + 2 ^ (b - 1) - 1 < 2 ^ b
[PROOF STEP]
using a1[OF b2] assms
[PROOF STATE]
proof (prove)
using this:
\<forall>b>0. \<forall>c\<ge>- (2 ^ (b - 1)). - c + 2 ^ (b - 1) - 1 < 2 ^ Suc (b - 1)
0 < b

goal (1 subgoal):
 1. \<forall>c\<ge>- (2 ^ (b - 1)). - c + 2 ^ (b - 1) - 1 < 2 ^ b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>c\<ge>- (2 ^ (b - 1)). - c + 2 ^ (b - 1) - 1 < 2 ^ b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_sin_and_cos:
  fixes m n::int
  shows
  "integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. cos(m * x) * cos(n * x)) = (if \<bar>m\<bar> = \<bar>n\<bar> then if n = 0 then 2 * pi else pi else 0)"
  "integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. cos(m * x) * sin(n * x)) = 0"
  "integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. sin(m * x) * cos(n * x)) = 0"
  "\<lbrakk>m \<ge> 0; n \<ge> 0\<rbrakk> \<Longrightarrow> integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. sin (m * x) * sin (n * x)) = (if m = n \<and> n \<noteq> 0 then pi else 0)"
  "\<bar>integral\<^sup>L (lebesgue_on {-pi..pi}) (\<lambda>x. sin (m * x) * sin (n * x))\<bar> = (if \<bar>m\<bar> = \<bar>n\<bar> \<and> n \<noteq> 0 then pi else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LINT x|lebesgue_on {- pi..pi}. cos (real_of_int m * x) * cos (real_of_int n * x) = (if \<bar>m\<bar> = \<bar>n\<bar> then if n = 0 then 2 * pi else pi else 0) &&& LINT x|lebesgue_on {- pi..pi}. cos (real_of_int m * x) * sin (real_of_int n * x) = 0) &&& LINT x|lebesgue_on {- pi..pi}. sin (real_of_int m * x) * cos (real_of_int n * x) = 0 &&& (\<lbrakk>0 \<le> m; 0 \<le> n\<rbrakk> \<Longrightarrow> LINT x|lebesgue_on {- pi..pi}. sin (real_of_int m * x) * sin (real_of_int n * x) = (if m = n \<and> n \<noteq> 0 then pi else 0)) &&& \<bar>LINT x|lebesgue_on {- pi..pi}. sin (real_of_int m * x) * sin (real_of_int n * x)\<bar> = (if \<bar>m\<bar> = \<bar>n\<bar> \<and> n \<noteq> 0 then pi else 0)
[PROOF STEP]
by (simp_all add: abs_if sin_times_sin cos_times_sin sin_times_cos cos_times_cos
                    integrable_sin_cx integrable_cos_cx mult_ac
               flip: distrib_left distrib_right left_diff_distrib right_diff_distrib)


[STATEMENT]
lemma dirichlet_prod_assoc:
  "dirichlet_prod (dirichlet_prod f g) h = dirichlet_prod f (dirichlet_prod g h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod (dirichlet_prod f g) h = dirichlet_prod f (dirichlet_prod g h)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. dirichlet_prod (dirichlet_prod f g) h x = dirichlet_prod f (dirichlet_prod g h) x
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. dirichlet_prod (dirichlet_prod f g) h x = dirichlet_prod f (dirichlet_prod g h) x
[PROOF STEP]
show "dirichlet_prod (dirichlet_prod f g) h n = dirichlet_prod f (dirichlet_prod g h) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod (dirichlet_prod f g) h n = dirichlet_prod f (dirichlet_prod g h) n
[PROOF STEP]
by (cases "n = 0") (simp_all add: dirichlet_prod_assoc_aux1 dirichlet_prod_assoc_aux2)
[PROOF STATE]
proof (state)
this:
dirichlet_prod (dirichlet_prod f g) h n = dirichlet_prod f (dirichlet_prod g h) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_cos: "t \<noteq> 0 \<Longrightarrow> LBINT x=a..b. cos (t * x) = sin (t * b) / t - sin (t * a) / t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<noteq> 0 \<Longrightarrow> LBINT x=ereal a..ereal b. cos (t * x) = sin (t * b) / t - sin (t * a) / t
[PROOF STEP]
apply (intro interval_integral_FTC_finite continuous_intros)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>t \<noteq> 0; min a b \<le> x; x \<le> max a b\<rbrakk> \<Longrightarrow> ((\<lambda>a. sin (t * a) / t) has_vector_derivative cos (t * x)) (at x within {min a b..max a b})
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: has_real_derivative_iff_has_vector_derivative[symmetric])


[STATEMENT]
lemma limsup_root_powser:
  fixes f :: "nat \<Rightarrow> 'a :: {banach, real_normed_div_algebra}"
  shows "limsup (\<lambda>n. ereal (root n (norm (f n * z ^ n)))) =
             limsup (\<lambda>n. ereal (root n (norm (f n)))) * ereal (norm z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (root n (norm (f n * z ^ n)))) = limsup (\<lambda>n. ereal (root n (norm (f n)))) * ereal (norm z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (root n (norm (f n * z ^ n)))) = limsup (\<lambda>n. ereal (root n (norm (f n)))) * ereal (norm z)
[PROOF STEP]
have A: "(\<lambda>n. ereal (root n (norm (f n * z ^ n)))) =
              (\<lambda>n. ereal (root n (norm (f n))) * ereal (norm z))" (is "?g = ?h")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ereal (root n (norm (f n * z ^ n)))) = (\<lambda>n. ereal (root n (norm (f n))) * ereal (norm z))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ereal (root n (norm (f n * z ^ n))) = ereal (root n (norm (f n))) * ereal (norm z)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ereal (root n (norm (f n * z ^ n))) = ereal (root n (norm (f n))) * ereal (norm z)
[PROOF STEP]
show "?g n = ?h n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (root n (norm (f n * z ^ n))) = ereal (root n (norm (f n))) * ereal (norm z)
[PROOF STEP]
by (cases "n = 0") (simp_all add: norm_mult real_root_mult real_root_pos2 norm_power)
[PROOF STATE]
proof (state)
this:
ereal (root n (norm (f n * z ^ n))) = ereal (root n (norm (f n))) * ereal (norm z)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (root n (norm (f n * z ^ n)))) = (\<lambda>n. ereal (root n (norm (f n))) * ereal (norm z))

goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (root n (norm (f n * z ^ n)))) = limsup (\<lambda>n. ereal (root n (norm (f n)))) * ereal (norm z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (root n (norm (f n * z ^ n)))) = limsup (\<lambda>n. ereal (root n (norm (f n)))) * ereal (norm z)
[PROOF STEP]
by (subst A, subst limsup_ereal_mult_right) simp_all
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>n. ereal (root n (norm (f n * z ^ n)))) = limsup (\<lambda>n. ereal (root n (norm (f n)))) * ereal (norm z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Min_subset: "\<lbrakk> A \<noteq> {}; A \<subseteq> B; finite B \<rbrakk> \<Longrightarrow> Min B \<le> Min A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; A \<subseteq> B; finite B\<rbrakk> \<Longrightarrow> Min B \<le> Min A
[PROOF STEP]
by (rule linorder_class.Min_antimono)


[STATEMENT]
lemma pdevs_val_add: "pdevs_val (\<lambda>i. e i + f i) xs = pdevs_val e xs + pdevs_val f xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdevs_val (\<lambda>i. e i + f i) xs = pdevs_val e xs + pdevs_val f xs
[PROOF STEP]
by (auto simp: pdevs_val_pdevs_domain algebra_simps sum.distrib)


[STATEMENT]
lemma sinh_minus_cosh: "sinh x - cosh x = -exp (-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sinh x - cosh x = - exp (- x)
[PROOF STEP]
using cosh_minus_sinh[of x]
[PROOF STATE]
proof (prove)
using this:
cosh x - sinh x = exp (- x)

goal (1 subgoal):
 1. sinh x - cosh x = - exp (- x)
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma finite_Bounded_vec_Max:
  assumes A: "A \<subseteq> carrier_vec n"
    and fin: "finite A"
  shows "A \<subseteq> Bounded_vec (Max { abs (a $ i) | a i. a \<in> A \<and> i < n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n})
[PROOF STEP]
let ?B = "{ abs (a $ i) | a i. a \<in> A \<and> i < n}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n})
[PROOF STEP]
have fin: "finite ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n}
[PROOF STEP]
by (rule finite_subset[of _ "(\<lambda> (a,i). abs (a $ i)) ` (A \<times> {0 ..< n})"], insert fin, auto)
[PROOF STATE]
proof (state)
this:
finite {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n}

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n})
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n})
[PROOF STEP]
assume a: "a \<in> A"
[PROOF STATE]
proof (state)
this:
a \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<in> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n})
[PROOF STEP]
show "a \<in> Bounded_vec (Max ?B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n})
[PROOF STEP]
unfolding Bounded_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> {x. \<forall>i<dim_vec x. \<bar>x $ i\<bar> \<le> Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n}}
[PROOF STEP]
by (standard, intro allI impI Max_ge[OF fin], insert a A, force)
[PROOF STATE]
proof (state)
this:
a \<in> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> A \<and> i < n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_list: "finite {xs::('a::finite) list. length xs = k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. length xs = k}
[PROOF STEP]
apply (induct k)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {xs. length xs = 0}
 2. \<And>k. finite {xs. length xs = k} \<Longrightarrow> finite {xs. length xs = Suc k}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. finite {xs. length xs = k} \<Longrightarrow> finite {xs. length xs = Suc k}
[PROOF STEP]
apply (subgoal_tac "{xs::('a::finite) list. length xs = Suc k} = (\<Union>x. Cons x ` {xs. length xs = k})")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k. \<lbrakk>finite {xs. length xs = k}; {xs. length xs = Suc k} = (\<Union>x. (#) x ` {xs. length xs = k})\<rbrakk> \<Longrightarrow> finite {xs. length xs = Suc k}
 2. \<And>k. finite {xs. length xs = k} \<Longrightarrow> {xs. length xs = Suc k} = (\<Union>x. (#) x ` {xs. length xs = k})
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k x. \<lbrakk>finite {xs. length xs = k}; length x = Suc k\<rbrakk> \<Longrightarrow> \<exists>xa. x \<in> (#) xa ` {xs. length xs = k}
[PROOF STEP]
apply (case_tac x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k x. \<lbrakk>finite {xs. length xs = k}; length x = Suc k; x = []\<rbrakk> \<Longrightarrow> \<exists>xa. x \<in> (#) xa ` {xs. length xs = k}
 2. \<And>k x a list. \<lbrakk>finite {xs. length xs = k}; length x = Suc k; x = a # list\<rbrakk> \<Longrightarrow> \<exists>xa. x \<in> (#) xa ` {xs. length xs = k}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gbinomial_Suc: "a gchoose (Suc k) = prod (\<lambda>i. a - of_nat i) {0..k} div fact (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a gchoose Suc k = (\<Prod>i = 0..k. a - of_nat i) div fact (Suc k)
[PROOF STEP]
by (simp add: gbinomial_prod_rev atLeastLessThanSuc_atLeastAtMost)


[STATEMENT]
theorem empty_if_no_b_accessible:
  "ta_lang TA = {} \<longleftrightarrow> ta_initial TA \<inter> b_accessible (ta_rules TA) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ta_lang TA = {}) = (ta_initial TA \<inter> b_accessible (ta_rules TA) = {})
[PROOF STEP]
by (auto
    simp add: ta_lang_def
    intro: accs_is_b_accessible b_accessible_is_accs)


[STATEMENT]
lemma collinear_ex_real:
  shows "collinear z1 z2 z3 \<longleftrightarrow>
         (\<exists> k::real. z1 = z2 \<or> z3 - z1 = complex_of_real k * (z2 - z1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear z1 z2 z3 = (\<exists>k. z1 = z2 \<or> z3 - z1 = cor k * (z2 - z1))
[PROOF STEP]
unfolding collinear_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z1 = z2 \<or> is_real ((z3 - z1) / (z2 - z1))) = (\<exists>k. z1 = z2 \<or> z3 - z1 = cor k * (z2 - z1))
[PROOF STEP]
by (metis Im_complex_of_real add_diff_cancel_right' complex_eq diff_zero legacy_Complex_simps(15) nonzero_mult_div_cancel_right right_minus_eq times_divide_eq_left zero_complex.code)


[STATEMENT]
lemma transpose_matrix_mult: "transpose_matrix ((A::('a::comm_ring) matrix)*B) = (transpose_matrix B) * (transpose_matrix A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_matrix (A * B) = transpose_matrix B * transpose_matrix A
[PROOF STEP]
apply (simp add: times_matrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_matrix (mult_matrix (*) (+) A B) = mult_matrix (*) (+) (transpose_matrix B) (transpose_matrix A)
[PROOF STEP]
apply (subst transpose_mult_matrix)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<forall>a. (0::'a) * a = (0::'a)
 2. \<forall>a. a * (0::'a) = (0::'a)
 3. (0::'a) + (0::'a) = (0::'a)
 4. \<forall>x y. y * x = x * y
 5. mult_matrix (*) (+) (transpose_matrix B) (transpose_matrix A) = mult_matrix (*) (+) (transpose_matrix B) (transpose_matrix A)
[PROOF STEP]
apply (simp_all add: mult.commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_integral_mono_AE:
  fixes f g :: "_ \<Rightarrow> real"
  assumes "set_integrable M A f" "set_integrable M A g"
    "AE x \<in> A in M. f x \<le> g x"
  shows "(LINT x:A|M. f x) \<le> (LINT x:A|M. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_lebesgue_integral M A f \<le> set_lebesgue_integral M A g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set_integrable M A f
set_integrable M A g
AE x\<in>A in M. f x \<le> g x

goal (1 subgoal):
 1. set_lebesgue_integral M A f \<le> set_lebesgue_integral M A g
[PROOF STEP]
unfolding set_integrable_def set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)
integrable M (\<lambda>x. indicat_real A x *\<^sub>R g x)
AE x\<in>A in M. f x \<le> g x

goal (1 subgoal):
 1. LINT x|M. indicat_real A x *\<^sub>R f x \<le> LINT x|M. indicat_real A x *\<^sub>R g x
[PROOF STEP]
by (auto intro: integral_mono_AE split: split_indicator)


[STATEMENT]
lemma take_bit_Suc_bit1:
  \<open>take_bit (Suc n) (numeral (Num.Bit1 k)) = take_bit n (numeral k) * 2 + 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) (numeral (num.Bit1 k)) = take_bit n (numeral k) * (2::'a) + (1::'a)
[PROOF STEP]
by (simp add: take_bit_Suc numeral_Bit1_div_2 mod_2_eq_odd)


[STATEMENT]
lemma card_roots_unity_eq:
  assumes "n > 0"
  shows   "card {z::complex. z ^ n = 1} = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {z. z ^ n = 1} = n
[PROOF STEP]
using bij_betw_same_card [OF bij_betw_roots_unity [OF assms]]
[PROOF STATE]
proof (prove)
using this:
card {..<n} = card {z. z ^ n = 1}

goal (1 subgoal):
 1. card {z. z ^ n = 1} = n
[PROOF STEP]
by simp


[STATEMENT]
lemma GDERIV_mult:
    "\<lbrakk>GDERIV f x :> df; GDERIV g x :> dg\<rbrakk>
     \<Longrightarrow> GDERIV (\<lambda>x. f x * g x) x :> scaleR (f x) dg + scaleR (g x) df"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>GDERIV f x :> df; GDERIV g x :> dg\<rbrakk> \<Longrightarrow> GDERIV (\<lambda>x. f x * g x) x :> f x *\<^sub>R dg + g x *\<^sub>R df
[PROOF STEP]
unfolding gderiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative (\<lambda>h. inner h df)) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) has_derivative (\<lambda>h. inner h (f x *\<^sub>R dg + g x *\<^sub>R df))) (at x)
[PROOF STEP]
apply (rule has_derivative_subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(f has_derivative (\<lambda>h. inner h df)) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) has_derivative ?df) (at x)
 2. \<lbrakk>(f has_derivative (\<lambda>h. inner h df)) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> ?df = (\<lambda>h. inner h (f x *\<^sub>R dg + g x *\<^sub>R df))
[PROOF STEP]
apply (erule (1) has_derivative_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative (\<lambda>h. inner h df)) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> (\<lambda>h. f x * inner h dg + inner h df * g x) = (\<lambda>h. inner h (f x *\<^sub>R dg + g x *\<^sub>R df))
[PROOF STEP]
apply (simp add: inner_add ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma std_normal_distribution_even_moments:
  fixes k :: nat
  shows "(LINT x|std_normal_distribution. x^(2 * k)) = fact (2 * k) / (2^k * fact k)"
    and "integrable std_normal_distribution (\<lambda>x. x^(2 * k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|std_normal_distribution. x ^ (2 * k) = fact (2 * k) / (2 ^ k * fact k) &&& integrable std_normal_distribution (\<lambda>x. x ^ (2 * k))
[PROOF STEP]
using integral_std_normal_moment_even[of k]
[PROOF STATE]
proof (prove)
using this:
LBINT x. std_normal_density x * x ^ (2 * k) = fact (2 * k) / (2 ^ k * fact k)

goal (1 subgoal):
 1. LINT x|std_normal_distribution. x ^ (2 * k) = fact (2 * k) / (2 ^ k * fact k) &&& integrable std_normal_distribution (\<lambda>x. x ^ (2 * k))
[PROOF STEP]
by (subst integral_density)
     (auto simp: normal_density_nonneg integrable_density
           intro: integrable.intros std_normal_moment_even)


[STATEMENT]
lemma echelon_form_condition2:
  assumes r: "echelon_form A"
  shows "(\<forall>i. i<j \<and> \<not> (is_zero_row i A) \<and> \<not> (is_zero_row j A)
  \<longrightarrow> ((LEAST n. A $ i $ n \<noteq> 0) < (LEAST n. A $ j $ n \<noteq> 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. i < j \<and> \<not> is_zero_row i A \<and> \<not> is_zero_row j A \<longrightarrow> (LEAST n. A $ i $ n \<noteq> (0::'a)) < (LEAST n. A $ j $ n \<noteq> (0::'a))
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
echelon_form A

goal (1 subgoal):
 1. \<forall>i. i < j \<and> \<not> is_zero_row i A \<and> \<not> is_zero_row j A \<longrightarrow> (LEAST n. A $ i $ n \<noteq> (0::'a)) < (LEAST n. A $ j $ n \<noteq> (0::'a))
[PROOF STEP]
unfolding echelon_form_def
[PROOF STATE]
proof (prove)
using this:
echelon_form_upt_k A (ncols A)

goal (1 subgoal):
 1. \<forall>i. i < j \<and> \<not> is_zero_row i A \<and> \<not> is_zero_row j A \<longrightarrow> (LEAST n. A $ i $ n \<noteq> (0::'a)) < (LEAST n. A $ j $ n \<noteq> (0::'a))
[PROOF STEP]
by (metis echelon_form_upt_k_condition2 is_zero_row_def)


[STATEMENT]
lemma Im_Ln_tendsto_at_top: "((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi/2 ) at_top "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
proof (cases "a=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
 2. a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
 2. a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
define f where "f=(\<lambda>x. if a>0 then arctan (x/a) else arctan (x/a) + pi)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. if 0 < a then arctan (x / a) else arctan (x / a) + pi)

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
 2. a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
define g where "g=(\<lambda>x. Im (Ln (Complex a x)))"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. Im (Ln (Complex a x)))

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
 2. a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
have "(f \<longlongrightarrow> pi / 2) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
proof (cases "a>0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
 2. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 < a

goal (2 subgoals):
 1. 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
 2. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < a
[PROOF STEP]
have "(f \<longlongrightarrow> pi / 2) at_top \<longleftrightarrow> ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> pi / 2) at_top"
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. (f \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
unfolding f_def field_class.field_divide_inverse
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. ((\<lambda>x. if 0 < a then arctan (x * inverse a) else arctan (x * inverse a) + pi) \<longlongrightarrow> pi * inverse 2) at_top = ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> pi * inverse 2) at_top
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> pi / 2) at_top

goal (2 subgoals):
 1. 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
 2. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> pi / 2) at_top

goal (2 subgoals):
 1. 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
 2. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
have "... \<longleftrightarrow> (arctan \<longlongrightarrow> pi / 2) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> pi / 2) at_top = (arctan \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
apply (subst filterlim_at_top_linear_iff[of "inverse a" arctan 0 "nhds (pi/2)",simplified])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<noteq> 0
 2. (if 0 < a then (arctan \<longlongrightarrow> pi / 2) at_top else (arctan \<longlongrightarrow> pi / 2) at_bot) = (arctan \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (2 subgoals):
 1. a \<noteq> 0
 2. (if 0 < a then (arctan \<longlongrightarrow> pi / 2) at_top else (arctan \<longlongrightarrow> pi / 2) at_bot) = (arctan \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> pi / 2) at_top = (arctan \<longlongrightarrow> pi / 2) at_top

goal (2 subgoals):
 1. 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
 2. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> pi / 2) at_top = (arctan \<longlongrightarrow> pi / 2) at_top

goal (2 subgoals):
 1. 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
 2. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
have "..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arctan \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
using tendsto_arctan_at_top
[PROOF STATE]
proof (prove)
using this:
(arctan \<longlongrightarrow> pi / 2) at_top

goal (1 subgoal):
 1. (arctan \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(arctan \<longlongrightarrow> pi / 2) at_top

goal (2 subgoals):
 1. 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
 2. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> pi / 2) at_top

goal (1 subgoal):
 1. (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> pi / 2) at_top

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 < a

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> 0 < a
[PROOF STEP]
have "(f \<longlongrightarrow> pi / 2) at_top \<longleftrightarrow> ((\<lambda>x. arctan (x * inverse a) + pi) \<longlongrightarrow> pi / 2) at_top"
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < a

goal (1 subgoal):
 1. (f \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a) + pi) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
unfolding f_def field_class.field_divide_inverse
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < a

goal (1 subgoal):
 1. ((\<lambda>x. if 0 < a then arctan (x * inverse a) else arctan (x * inverse a) + pi) \<longlongrightarrow> pi * inverse 2) at_top = ((\<lambda>x. arctan (x * inverse a) + pi) \<longlongrightarrow> pi * inverse 2) at_top
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a) + pi) \<longlongrightarrow> pi / 2) at_top

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a) + pi) \<longlongrightarrow> pi / 2) at_top

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
have "... \<longleftrightarrow> ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> - pi / 2) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. arctan (x * inverse a) + pi) \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> - pi / 2) at_top
[PROOF STEP]
apply (subst tendsto_add_const_iff[of "-pi",symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - pi + (arctan (x * inverse a) + pi)) \<longlongrightarrow> - pi + pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> - pi / 2) at_top
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. arctan (x * inverse a) + pi) \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> - pi / 2) at_top

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. arctan (x * inverse a) + pi) \<longlongrightarrow> pi / 2) at_top = ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> - pi / 2) at_top

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
have "... \<longleftrightarrow> (arctan \<longlongrightarrow> - pi / 2) at_bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> - pi / 2) at_top = (arctan \<longlongrightarrow> - pi / 2) at_bot
[PROOF STEP]
apply (subst filterlim_at_top_linear_iff[of "inverse a" arctan 0,simplified])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<noteq> 0
 2. (if 0 < a then (arctan \<longlongrightarrow> - pi / 2) at_top else (arctan \<longlongrightarrow> - pi / 2) at_bot) = (arctan \<longlongrightarrow> - pi / 2) at_bot
[PROOF STEP]
using False \<open>a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < a
a \<noteq> 0

goal (2 subgoals):
 1. a \<noteq> 0
 2. (if 0 < a then (arctan \<longlongrightarrow> - pi / 2) at_top else (arctan \<longlongrightarrow> - pi / 2) at_bot) = (arctan \<longlongrightarrow> - pi / 2) at_bot
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> - pi / 2) at_top = (arctan \<longlongrightarrow> - pi / 2) at_bot

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. arctan (x * inverse a)) \<longlongrightarrow> - pi / 2) at_top = (arctan \<longlongrightarrow> - pi / 2) at_bot

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
have "..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arctan \<longlongrightarrow> - pi / 2) at_bot
[PROOF STEP]
using tendsto_arctan_at_bot
[PROOF STATE]
proof (prove)
using this:
(arctan \<longlongrightarrow> - (pi / 2)) at_bot

goal (1 subgoal):
 1. (arctan \<longlongrightarrow> - pi / 2) at_bot
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(arctan \<longlongrightarrow> - pi / 2) at_bot

goal (1 subgoal):
 1. \<not> 0 < a \<Longrightarrow> (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> pi / 2) at_top

goal (1 subgoal):
 1. (f \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> pi / 2) at_top

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> pi / 2) at_top

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
 2. a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> pi / 2) at_top

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
 2. a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
have "\<forall>\<^sub>F x in at_top. f x = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x = g x
[PROOF STEP]
unfolding f_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (if 0 < a then arctan (x / a) else arctan (x / a) + pi) = Im (Ln (Complex a x))
[PROOF STEP]
using \<open>a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (if 0 < a then arctan (x / a) else arctan (x / a) + pi) = Im (Ln (Complex a x))
[PROOF STEP]
apply (subst Im_Ln_eq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. a \<noteq> 0 \<Longrightarrow> Complex a x \<noteq> 0
 2. a \<noteq> 0 \<Longrightarrow> \<forall>\<^sub>F x in at_top. (if 0 < a then arctan (x / a) else arctan (x / a) + pi) = (if Re (Complex a x) \<noteq> 0 then if 0 < Re (Complex a x) then arctan (Im (Complex a x) / Re (Complex a x)) else if 0 \<le> Im (Complex a x) then arctan (Im (Complex a x) / Re (Complex a x)) + pi else arctan (Im (Complex a x) / Re (Complex a x)) - pi else if 0 < Im (Complex a x) then pi / 2 else - pi / 2)
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> Complex a x \<noteq> 0
[PROOF STEP]
using Complex_eq_0
[PROOF STATE]
proof (prove)
using this:
(Complex ?a ?b = 0) = (?a = 0 \<and> ?b = 0)

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> Complex a x \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> \<forall>\<^sub>F x in at_top. (if 0 < a then arctan (x / a) else arctan (x / a) + pi) = (if Re (Complex a x) \<noteq> 0 then if 0 < Re (Complex a x) then arctan (Im (Complex a x) / Re (Complex a x)) else if 0 \<le> Im (Complex a x) then arctan (Im (Complex a x) / Re (Complex a x)) + pi else arctan (Im (Complex a x) / Re (Complex a x)) - pi else if 0 < Im (Complex a x) then pi / 2 else - pi / 2)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> \<forall>\<^sub>F x in at_top. (if 0 < a then arctan (x / a) else arctan (x / a) + pi) = (if Re (Complex a x) \<noteq> 0 then if 0 < Re (Complex a x) then arctan (Im (Complex a x) / Re (Complex a x)) else if 0 \<le> Im (Complex a x) then arctan (Im (Complex a x) / Re (Complex a x)) + pi else arctan (Im (Complex a x) / Re (Complex a x)) - pi else if 0 < Im (Complex a x) then pi / 2 else - pi / 2)
[PROOF STEP]
unfolding eventually_at_top_linorder
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. (if 0 < a then arctan (n / a) else arctan (n / a) + pi) = (if Re (Complex a n) \<noteq> 0 then if 0 < Re (Complex a n) then arctan (Im (Complex a n) / Re (Complex a n)) else if 0 \<le> Im (Complex a n) then arctan (Im (Complex a n) / Re (Complex a n)) + pi else arctan (Im (Complex a n) / Re (Complex a n)) - pi else if 0 < Im (Complex a n) then pi / 2 else - pi / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. f x = g x

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
 2. a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> pi / 2) at_top
\<forall>\<^sub>F x in at_top. f x = g x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> pi / 2) at_top
\<forall>\<^sub>F x in at_top. f x = g x

goal (1 subgoal):
 1. ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
using tendsto_cong[of f g at_top]
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> pi / 2) at_top
\<forall>\<^sub>F x in at_top. f x = g x
\<forall>\<^sub>F x in at_top. f x = g x \<Longrightarrow> (f \<longlongrightarrow> ?c) at_top = (g \<longlongrightarrow> ?c) at_top

goal (1 subgoal):
 1. ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> pi / 2) at_top
\<forall>\<^sub>F x in at_top. f x = Im (Ln (Complex a x))
\<forall>\<^sub>F x in at_top. f x = Im (Ln (Complex a x)) \<Longrightarrow> (f \<longlongrightarrow> ?c) at_top = ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> ?c) at_top

goal (1 subgoal):
 1. ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top

goal (1 subgoal):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = 0

goal (1 subgoal):
 1. a = 0 \<Longrightarrow> ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top
[PROOF STEP]
apply (rule tendsto_eventually)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. Im (Ln (Complex a x)) = pi / 2
[PROOF STEP]
apply (rule eventually_at_top_linorderI[of 1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 1 \<le> x \<Longrightarrow> Im (Ln (Complex a x)) = pi / 2
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
a = 0

goal (1 subgoal):
 1. \<And>x. 1 \<le> x \<Longrightarrow> Im (Ln (Complex a x)) = pi / 2
[PROOF STEP]
by (subst Im_Ln_eq,auto simp add:Complex_eq_0)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Im (Ln (Complex a x))) \<longlongrightarrow> pi / 2) at_top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ceiling_one [simp]: "\<lceil>1\<rceil> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>1::'a\<rceil> = 1
[PROOF STEP]
using ceiling_of_int [of 1]
[PROOF STATE]
proof (prove)
using this:
\<lceil>of_int 1\<rceil> = 1

goal (1 subgoal):
 1. \<lceil>1::'a\<rceil> = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma continuous_on_real_range:
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
  shows "continuous_on s f \<longleftrightarrow>
    (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s f = (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e)
[PROOF STEP]
unfolding continuous_on_iff dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. norm (x' - x) < d \<longrightarrow> norm (f x' - f x) < e) = (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e)
[PROOF STEP]
by simp


[STATEMENT]
lemma CDERIV_quotient:
  "DERIV f x :> d \<Longrightarrow> DERIV g x :> e \<Longrightarrow> g(x) \<noteq> 0 \<Longrightarrow>
    DERIV (\<lambda>y. f y / g y) x :> (d * g x - (e * f x)) / (g x)\<^sup>2"
  for x :: complex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative d) (at x); (g has_field_derivative e) (at x); g x \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>y. f y / g y) has_field_derivative (d * g x - e * f x) / (g x)\<^sup>2) (at x)
[PROOF STEP]
unfolding numeral_2_eq_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative d) (at x); (g has_field_derivative e) (at x); g x \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>y. f y / g y) has_field_derivative (d * g x - e * f x) / g x ^ Suc (Suc 0)) (at x)
[PROOF STEP]
by (rule DERIV_quotient)


[STATEMENT]
lemma binomial_deriv1:
    "(\<Sum>k\<le>n. (of_nat k * of_nat (n choose k)) * a^(k-1) * b^(n-k)) = real_of_nat n * (a+b)^(n-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k * real (n choose k) * a ^ (k - 1) * b ^ (n - k)) = real n * (a + b) ^ (n - 1)
[PROOF STEP]
apply (rule DERIV_unique [where f = "\<lambda>a. (a+b)^n" and x=a])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>a. (a + b) ^ n) has_real_derivative (\<Sum>k\<le>n. real k * real (n choose k) * a ^ (k - 1) * b ^ (n - k))) (at a)
 2. ((\<lambda>a. (a + b) ^ n) has_real_derivative real n * (a + b) ^ (n - 1)) (at a)
[PROOF STEP]
apply (subst binomial_ring)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>a. \<Sum>k\<le>n. real (n choose k) * a ^ k * b ^ (n - k)) has_real_derivative (\<Sum>k\<le>n. real k * real (n choose k) * a ^ (k - 1) * b ^ (n - k))) (at a)
 2. ((\<lambda>a. (a + b) ^ n) has_real_derivative real n * (a + b) ^ (n - 1)) (at a)
[PROOF STEP]
apply (rule derivative_eq_intros sum.cong | simp add: atMost_atLeast0)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in strategic_space_2p) U\<^sub>A\<^sub>_is_gate:
  shows "gate 1 U\<^sub>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate 1 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]) = 2 ^ 1
 2. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
 3. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
show "dim_row U\<^sub>A = 2^1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]) = 2 ^ 1
[PROOF STEP]
using mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]) = 2 ^ 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]) = 2 ^ 1

goal (2 subgoals):
 1. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
 2. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]) = 2 ^ 1

goal (2 subgoals):
 1. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
 2. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
show "square_mat U\<^sub>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
using mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])

goal (1 subgoal):
 1. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]) = 2 ^ 1
square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
show "unitary U\<^sub>A"
[PROOF STATE]
proof (prove)
using this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]) = 2 ^ 1
square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])

goal (1 subgoal):
 1. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
using mat_of_cols_list_def unitary_def U\<^sub>A_cnj_times_U\<^sub>A U\<^sub>A_times_U\<^sub>A_cnj
[PROOF STATE]
proof (prove)
using this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]) = 2 ^ 1
square_mat (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)
unitary ?M \<equiv> ?M\<^sup>\<dagger> * ?M = 1\<^sub>m (dim_col ?M) \<and> ?M * ?M\<^sup>\<dagger> = 1\<^sub>m (dim_row ?M)
Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] = 1\<^sub>m 2
Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger> = 1\<^sub>m 2

goal (1 subgoal):
 1. unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
unitary (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])

goal:
No subgoals!
[PROOF STEP]
qed