[STATEMENT]
lemma div_3252:
  fixes a b c d m :: int and l :: nat
  defines "M \<equiv> mat a b c d"
  assumes "mat_21 M mod m = 0"
  shows "(mat_21 (mat_pow l M)) mod m = 0 " (is "?P l")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_21 (mat_pow l M) mod m = 0
[PROOF STEP]
proof(induction l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mat_21 (mat_pow 0 M) mod m = 0
 2. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
show "?P 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_21 (mat_pow 0 M) mod m = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_21 (mat_pow 0 M) mod m = 0

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
fix l
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
assume IH: "?P l"
[PROOF STATE]
proof (state)
this:
mat_21 (mat_pow l M) mod m = 0

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
define Ml where "Ml = mat_pow l M"
[PROOF STATE]
proof (state)
this:
Ml = mat_pow l M

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
have S1: "mat_pow (Suc(l)) M = mat_mul M (mat_pow l M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_pow (Suc l) M = mat_mul M (mat_pow l M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (Suc l) M = mat_mul M (mat_pow l M)

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
have S2: "mat_21 (mat_mul M Ml) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_21 (mat_mul M Ml) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml
[PROOF STEP]
by (rule_tac mat_mul.induct mat_plus.induct, auto)
[PROOF STATE]
proof (state)
this:
mat_21 (mat_mul M Ml) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
have S3: "mat_21 (mat_pow (Suc(l)) M) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_21 (mat_pow (Suc l) M) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml
[PROOF STEP]
using S1 S2 Ml_def
[PROOF STATE]
proof (prove)
using this:
mat_pow (Suc l) M = mat_mul M (mat_pow l M)
mat_21 (mat_mul M Ml) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml
Ml = mat_pow l M

goal (1 subgoal):
 1. mat_21 (mat_pow (Suc l) M) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_21 (mat_pow (Suc l) M) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
mat_21 M mod m = 0
[PROOF STEP]
have S4: "(mat_21 M * mat_11 Ml) mod m = 0"
[PROOF STATE]
proof (prove)
using this:
mat_21 M mod m = 0

goal (1 subgoal):
 1. mat_21 M * mat_11 Ml mod m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_21 M * mat_11 Ml mod m = 0

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
from IH Ml_def
[PROOF STATE]
proof (chain)
picking this:
mat_21 (mat_pow l M) mod m = 0
Ml = mat_pow l M
[PROOF STEP]
have S5: " mat_22 M * mat_21 Ml mod m = 0"
[PROOF STATE]
proof (prove)
using this:
mat_21 (mat_pow l M) mod m = 0
Ml = mat_pow l M

goal (1 subgoal):
 1. mat_22 M * mat_21 Ml mod m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_22 M * mat_21 Ml mod m = 0

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
from S4 S5
[PROOF STATE]
proof (chain)
picking this:
mat_21 M * mat_11 Ml mod m = 0
mat_22 M * mat_21 Ml mod m = 0
[PROOF STEP]
have S6: "(mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml) mod m = 0"
[PROOF STATE]
proof (prove)
using this:
mat_21 M * mat_11 Ml mod m = 0
mat_22 M * mat_21 Ml mod m = 0

goal (1 subgoal):
 1. (mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml) mod m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml) mod m = 0

goal (1 subgoal):
 1. \<And>l. mat_21 (mat_pow l M) mod m = 0 \<Longrightarrow> mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
from S3 S6
[PROOF STATE]
proof (chain)
picking this:
mat_21 (mat_pow (Suc l) M) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml
(mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml) mod m = 0
[PROOF STEP]
show "?P (Suc(l))"
[PROOF STATE]
proof (prove)
using this:
mat_21 (mat_pow (Suc l) M) = mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml
(mat_21 M * mat_11 Ml + mat_22 M * mat_21 Ml) mod m = 0

goal (1 subgoal):
 1. mat_21 (mat_pow (Suc l) M) mod m = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_21 (mat_pow (Suc l) M) mod m = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_root_strict_increasing:
  assumes "0 < n" "n < N" "0 < x" "x < 1"
  shows "root n x < root N x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root n x < root N x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. root n x < root N x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
n < N
0 < x
x < 1
[PROOF STEP]
have "root N (root n x) ^ N < root n (root N x) ^ n"
[PROOF STATE]
proof (prove)
using this:
0 < n
n < N
0 < x
x < 1

goal (1 subgoal):
 1. root N (root n x) ^ N < root n (root N x) ^ n
[PROOF STEP]
by (simp add: real_root_commute power_strict_decreasing del: real_root_pow_pos2)
[PROOF STATE]
proof (state)
this:
root N (root n x) ^ N < root n (root N x) ^ n

goal (1 subgoal):
 1. root n x < root N x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
n < N
0 < x
x < 1
root N (root n x) ^ N < root n (root N x) ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n
n < N
0 < x
x < 1
root N (root n x) ^ N < root n (root N x) ^ n

goal (1 subgoal):
 1. root n x < root N x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
root n x < root N x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cauchy_Schwarz_ineq2:
  "\<bar>inner x y\<bar> \<le> norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>inner x y\<bar> \<le> norm x * norm y
[PROOF STEP]
proof (rule power2_le_imp_le)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<bar>inner x y\<bar>\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
have "(inner x y)\<^sup>2 \<le> inner x x * inner y y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inner x y)\<^sup>2 \<le> inner x x * inner y y
[PROOF STEP]
using Cauchy_Schwarz_ineq
[PROOF STATE]
proof (prove)
using this:
(inner ?x ?y)\<^sup>2 \<le> inner ?x ?x * inner ?y ?y

goal (1 subgoal):
 1. (inner x y)\<^sup>2 \<le> inner x x * inner y y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(inner x y)\<^sup>2 \<le> inner x x * inner y y

goal (2 subgoals):
 1. \<bar>inner x y\<bar>\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
thus "\<bar>inner x y\<bar>\<^sup>2 \<le> (norm x * norm y)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(inner x y)\<^sup>2 \<le> inner x x * inner y y

goal (1 subgoal):
 1. \<bar>inner x y\<bar>\<^sup>2 \<le> (norm x * norm y)\<^sup>2
[PROOF STEP]
by (simp add: power_mult_distrib power2_norm_eq_inner)
[PROOF STATE]
proof (state)
this:
\<bar>inner x y\<bar>\<^sup>2 \<le> (norm x * norm y)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> norm x * norm y
[PROOF STEP]
show "0 \<le> norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> norm x * norm y
[PROOF STEP]
unfolding norm_eq_sqrt_inner
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sqrt (inner x x) * sqrt (inner y y)
[PROOF STEP]
by (intro mult_nonneg_nonneg real_sqrt_ge_zero inner_ge_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> norm x * norm y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma radical_ideal_eq_UNIV_iff: "\<surd>ideal F = UNIV \<longleftrightarrow> ideal F = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<surd>ideal F = UNIV) = (ideal F = UNIV)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<surd>ideal F = UNIV \<Longrightarrow> ideal F = UNIV
 2. ideal F = UNIV \<Longrightarrow> \<surd>ideal F = UNIV
[PROOF STEP]
assume "\<surd>ideal F = UNIV"
[PROOF STATE]
proof (state)
this:
\<surd>ideal F = UNIV

goal (2 subgoals):
 1. \<surd>ideal F = UNIV \<Longrightarrow> ideal F = UNIV
 2. ideal F = UNIV \<Longrightarrow> \<surd>ideal F = UNIV
[PROOF STEP]
hence "1 \<in> \<surd>ideal F"
[PROOF STATE]
proof (prove)
using this:
\<surd>ideal F = UNIV

goal (1 subgoal):
 1. (1::'a) \<in> \<surd>ideal F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1::'a) \<in> \<surd>ideal F

goal (2 subgoals):
 1. \<surd>ideal F = UNIV \<Longrightarrow> ideal F = UNIV
 2. ideal F = UNIV \<Longrightarrow> \<surd>ideal F = UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1::'a) \<in> \<surd>ideal F
[PROOF STEP]
obtain m where "1 ^ m \<in> ideal F"
[PROOF STATE]
proof (prove)
using this:
(1::'a) \<in> \<surd>ideal F

goal (1 subgoal):
 1. (\<And>m. (1::'a) ^ m \<in> ideal F \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule radicalE)
[PROOF STATE]
proof (state)
this:
(1::'a) ^ m \<in> ideal F

goal (2 subgoals):
 1. \<surd>ideal F = UNIV \<Longrightarrow> ideal F = UNIV
 2. ideal F = UNIV \<Longrightarrow> \<surd>ideal F = UNIV
[PROOF STEP]
thus "ideal F = UNIV"
[PROOF STATE]
proof (prove)
using this:
(1::'a) ^ m \<in> ideal F

goal (1 subgoal):
 1. ideal F = UNIV
[PROOF STEP]
by (simp add: ideal_eq_UNIV_iff_contains_one)
[PROOF STATE]
proof (state)
this:
ideal F = UNIV

goal (1 subgoal):
 1. ideal F = UNIV \<Longrightarrow> \<surd>ideal F = UNIV
[PROOF STEP]
qed simp


[STATEMENT]
lemma span_self: assumes [simp]: "v : carrier V" shows "v : span {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> span {v}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<in> span {v}
[PROOF STEP]
have "v = lincomb (\<lambda>x. one K) {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = lincomb (\<lambda>x. \<one>\<^bsub>K\<^esub>) {v}
[PROOF STEP]
unfolding lincomb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = finsum V ((\<odot>\<^bsub>V\<^esub>) \<one>\<^bsub>K\<^esub>) {v}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v = lincomb (\<lambda>x. \<one>\<^bsub>K\<^esub>) {v}

goal (1 subgoal):
 1. v \<in> span {v}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
v = lincomb (\<lambda>x. \<one>\<^bsub>K\<^esub>) {v}

goal (1 subgoal):
 1. v \<in> span {v}
[PROOF STEP]
using finite_span
[PROOF STATE]
proof (prove)
using this:
v = lincomb (\<lambda>x. \<one>\<^bsub>K\<^esub>) {v}
\<lbrakk>finite ?S; ?S \<subseteq> carrier V\<rbrakk> \<Longrightarrow> span ?S = {lincomb a ?S |a. a \<in> ?S \<rightarrow> carrier K}

goal (1 subgoal):
 1. v \<in> span {v}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> span {v}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_plus_cong:
  fixes b b' :: int
  assumes 1: "b = b'"
    and 2: "x mod b' = x' mod b'"
    and 3: "y mod b' = y' mod b'"
    and 4: "x' + y' = z'"
  shows "(x + y) mod b = z' mod b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) mod b = z' mod b'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x + y) mod b = z' mod b'
[PROOF STEP]
from 1 2[symmetric] 3[symmetric]
[PROOF STATE]
proof (chain)
picking this:
b = b'
x' mod b' = x mod b'
y' mod b' = y mod b'
[PROOF STEP]
have "(x + y) mod b = (x' mod b' + y' mod b') mod b'"
[PROOF STATE]
proof (prove)
using this:
b = b'
x' mod b' = x mod b'
y' mod b' = y mod b'

goal (1 subgoal):
 1. (x + y) mod b = (x' mod b' + y' mod b') mod b'
[PROOF STEP]
by (simp add: mod_add_eq)
[PROOF STATE]
proof (state)
this:
(x + y) mod b = (x' mod b' + y' mod b') mod b'

goal (1 subgoal):
 1. (x + y) mod b = z' mod b'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y) mod b = (x' mod b' + y' mod b') mod b'

goal (1 subgoal):
 1. (x + y) mod b = z' mod b'
[PROOF STEP]
have "\<dots> = (x' + y') mod b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x' mod b' + y' mod b') mod b' = (x' + y') mod b'
[PROOF STEP]
by (simp add: mod_add_eq)
[PROOF STATE]
proof (state)
this:
(x' mod b' + y' mod b') mod b' = (x' + y') mod b'

goal (1 subgoal):
 1. (x + y) mod b = z' mod b'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x + y) mod b = (x' + y') mod b'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x + y) mod b = (x' + y') mod b'

goal (1 subgoal):
 1. (x + y) mod b = z' mod b'
[PROOF STEP]
by (simp add: 4)
[PROOF STATE]
proof (state)
this:
(x + y) mod b = z' mod b'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sort_map_eq_sort:
  fixes f :: "nat \<Rightarrow> ('b :: linorder)"
  shows "map (sort_map f n) [0..<n] = sort (map f [0..<n])" (is "?A = ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
have "mset ?A = mset ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (map (sort_map f n) [0..<n]) = mset (sort (map f [0..<n]))
[PROOF STEP]
using sort_map_perm[where f="f" and n="n"]
[PROOF STATE]
proof (prove)
using this:
image_mset (sort_map f n) (mset [0..<n]) = image_mset f (mset [0..<n])

goal (1 subgoal):
 1. mset (map (sort_map f n) [0..<n]) = mset (sort (map f [0..<n]))
[PROOF STEP]
by (simp del:sort_map.simps)
[PROOF STATE]
proof (state)
this:
mset (map (sort_map f n) [0..<n]) = mset (sort (map f [0..<n]))

goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mset (map (sort_map f n) [0..<n]) = mset (sort (map f [0..<n]))

goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
have "sorted ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (sort (map f [0..<n]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (sort (map f [0..<n]))

goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sorted (sort (map f [0..<n]))

goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
have "sorted ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map (sort_map f n) [0..<n])
[PROOF STEP]
apply (subst sorted_wrt_iff_nth_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i j. i < j \<longrightarrow> j < length (map (sort_map f n) [0..<n]) \<longrightarrow> map (sort_map f n) [0..<n] ! i \<le> map (sort_map f n) [0..<n] ! j
[PROOF STEP]
apply (simp del:sort_map.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i j. i < j \<longrightarrow> j < n \<longrightarrow> sort_map f n i \<le> sort_map f n j
[PROOF STEP]
by (metis sort_map_mono nat_less_le)
[PROOF STATE]
proof (state)
this:
sorted (map (sort_map f n) [0..<n])

goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mset (map (sort_map f n) [0..<n]) = mset (sort (map f [0..<n]))
sorted (sort (map f [0..<n]))
sorted (map (sort_map f n) [0..<n])
[PROOF STEP]
show "?A = ?B"
[PROOF STATE]
proof (prove)
using this:
mset (map (sort_map f n) [0..<n]) = mset (sort (map f [0..<n]))
sorted (sort (map f [0..<n]))
sorted (map (sort_map f n) [0..<n])

goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
using list_eq_iff
[PROOF STATE]
proof (prove)
using this:
mset (map (sort_map f n) [0..<n]) = mset (sort (map f [0..<n]))
sorted (sort (map f [0..<n]))
sorted (map (sort_map f n) [0..<n])
\<lbrakk>mset ?xs = mset ?ys; sorted ?xs; sorted ?ys\<rbrakk> \<Longrightarrow> ?xs = ?ys

goal (1 subgoal):
 1. map (sort_map f n) [0..<n] = sort (map f [0..<n])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
map (sort_map f n) [0..<n] = sort (map f [0..<n])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma EM_remainder'_bounded_linear:
  assumes "bounded_linear h"
  assumes "continuous_on {a..b} f"
  shows   "EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)
[PROOF STEP]
have "integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R h (f t)) =
           integral {a..b} (\<lambda>t. h (pbernpoly n t *\<^sub>R f t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R h (f t)) = integral {a..b} (\<lambda>t. h (pbernpoly n t *\<^sub>R f t))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded_linear h
continuous_on {a..b} f

goal (1 subgoal):
 1. integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R h (f t)) = integral {a..b} (\<lambda>t. h (pbernpoly n t *\<^sub>R f t))
[PROOF STEP]
by (simp add: linear_simps)
[PROOF STATE]
proof (state)
this:
integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R h (f t)) = integral {a..b} (\<lambda>t. h (pbernpoly n t *\<^sub>R f t))

goal (1 subgoal):
 1. EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R h (f t)) = integral {a..b} (\<lambda>t. h (pbernpoly n t *\<^sub>R f t))

goal (1 subgoal):
 1. EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)
[PROOF STEP]
have "\<dots> = h (integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R f t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a..b} (\<lambda>t. h (pbernpoly n t *\<^sub>R f t)) = h (integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R f t))
[PROOF STEP]
by (subst integral_linear [OF _ assms(1), symmetric])
       (auto intro!: integrable_EM_remainder' assms(2) simp: o_def)
[PROOF STATE]
proof (state)
this:
integral {a..b} (\<lambda>t. h (pbernpoly n t *\<^sub>R f t)) = h (integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R f t))

goal (1 subgoal):
 1. EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R h (f t)) = h (integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R f t))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R h (f t)) = h (integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R f t))

goal (1 subgoal):
 1. EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R h (f t)) = h (integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R f t))
bounded_linear h

goal (1 subgoal):
 1. EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)
[PROOF STEP]
by (simp add: EM_remainder'_def linear_simps)
[PROOF STATE]
proof (state)
this:
EM_remainder' n (\<lambda>x. h (f x)) a b = h (EM_remainder' n f a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Polygamma_LIMSEQ:
  fixes z :: "'a :: {banach,real_normed_field}"
  assumes "z \<noteq> 0" and "n > 0"
  shows   "(\<lambda>k. inverse ((z + of_nat k)^Suc n)) sums ((-1) ^ Suc n * Polygamma n z / fact n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. inverse ((z + of_nat k) ^ Suc n)) sums ((- (1::'a)) ^ Suc n * Polygamma n z / fact n)
[PROOF STEP]
using Polygamma_converges'[OF assms(1), of "Suc n"] assms(2)
[PROOF STATE]
proof (prove)
using this:
2 \<le> Suc n \<Longrightarrow> summable (\<lambda>k. inverse ((z + of_nat k) ^ Suc n))
0 < n

goal (1 subgoal):
 1. (\<lambda>k. inverse ((z + of_nat k) ^ Suc n)) sums ((- (1::'a)) ^ Suc n * Polygamma n z / fact n)
[PROOF STEP]
by (simp add: sums_iff Polygamma_def)


[STATEMENT]
lemma nat_neq_4k3: "of_nat m \<noteq> (4 * of_nat k + 3) / (2 * 2^n :: 'a::field_char_0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat m \<noteq> ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
assume "of_nat m = (4 * of_nat k + 3) / (2 * 2^n :: 'a)"
[PROOF STATE]
proof (state)
this:
of_nat m = ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n)

goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_nat m = ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n)
[PROOF STEP]
have "of_nat (m * (2 * 2^n)) = (of_nat (4 * k + 3) :: 'a)"
[PROOF STATE]
proof (prove)
using this:
of_nat m = ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n)

goal (1 subgoal):
 1. of_nat (m * (2 * 2 ^ n)) = of_nat (4 * k + 3)
[PROOF STEP]
by (simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
of_nat (m * (2 * 2 ^ n)) = of_nat (4 * k + 3)

goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_nat (m * (2 * 2 ^ n)) = of_nat (4 * k + 3)
[PROOF STEP]
have "m * (2 * 2^n) = (4 * k) + 3"
[PROOF STATE]
proof (prove)
using this:
of_nat (m * (2 * 2 ^ n)) = of_nat (4 * k + 3)

goal (1 subgoal):
 1. m * (2 * 2 ^ n) = 4 * k + 3
[PROOF STEP]
using of_nat_eq_iff
[PROOF STATE]
proof (prove)
using this:
of_nat (m * (2 * 2 ^ n)) = of_nat (4 * k + 3)
(of_nat ?m = of_nat ?n) = (?m = ?n)

goal (1 subgoal):
 1. m * (2 * 2 ^ n) = 4 * k + 3
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
m * (2 * 2 ^ n) = 4 * k + 3

goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m * (2 * 2 ^ n) = 4 * k + 3
[PROOF STEP]
have "odd (m * (2 * 2^n))"
[PROOF STATE]
proof (prove)
using this:
m * (2 * 2 ^ n) = 4 * k + 3

goal (1 subgoal):
 1. odd (m * (2 * 2 ^ n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
odd (m * (2 * 2 ^ n))

goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (3::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
odd (m * (2 * 2 ^ n))
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
odd (m * (2 * 2 ^ n))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_function_tuple_comp_eq:
  assumes "is_function_tuple R n fs"
  assumes "f \<in> carrier (coord_ring R (length fs))"
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "poly_function_tuple_comp R n fs f a = eval_at_poly R f ( function_tuple_eval R n fs a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_function_tuple_comp R n fs f a = eval_at_point R (function_tuple_eval R n fs a) f
[PROOF STEP]
unfolding poly_function_tuple_comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>as. eval_at_point R as f) \<circ> function_tuple_eval R n fs) a = eval_at_point R (function_tuple_eval R n fs a) f
[PROOF STEP]
using comp_apply
[PROOF STATE]
proof (prove)
using this:
(?f \<circ> ?g) ?x = ?f (?g ?x)

goal (1 subgoal):
 1. ((\<lambda>as. eval_at_point R as f) \<circ> function_tuple_eval R n fs) a = eval_at_point R (function_tuple_eval R n fs a) f
[PROOF STEP]
by metis


[STATEMENT]
lemma mono_upclosed_iff:
  fixes f :: "'a::order_with_dual \<Rightarrow> 'b::order_with_dual"
  shows "mono f = (\<forall>Y. upclosed_set Y \<longrightarrow> upclosed_set (f -` Y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f = (\<forall>Y. upclosed_set Y \<longrightarrow> upclosed_set (f -` Y))
[PROOF STEP]
using mono_upclosed upclosed_mono
[PROOF STATE]
proof (prove)
using this:
mono ?f \<Longrightarrow> \<forall>Y. upclosed_set Y \<longrightarrow> upclosed_set (?f -` Y)
\<forall>Y. upclosed_set Y \<longrightarrow> upclosed_set (?f -` Y) \<Longrightarrow> mono ?f

goal (1 subgoal):
 1. mono f = (\<forall>Y. upclosed_set Y \<longrightarrow> upclosed_set (f -` Y))
[PROOF STEP]
by auto


[STATEMENT]
lemma zero_spaceN_iff:
  "x \<in> zero_space\<^sub>N N \<longleftrightarrow> eNorm N x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> zero_space\<^sub>N N) = (eNorm N x = 0)
[PROOF STEP]
unfolding zero_space\<^sub>N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> {f. eNorm N f = 0}) = (eNorm N x = 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma real_sqrt_sum_squares_mult_squared_eq [simp]:
  "(sqrt ((x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2)))\<^sup>2 = (x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt ((x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2)))\<^sup>2 = (x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2)
[PROOF STEP]
by (simp add: zero_le_mult_iff)


[STATEMENT]
lemma nat_le_power_trans:
  fixes n :: nat
  shows "\<lbrakk>n \<le> 2 ^ (m - k); k \<le> m\<rbrakk> \<Longrightarrow> 2 ^ k * n \<le> 2 ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> 2 ^ (m - k); k \<le> m\<rbrakk> \<Longrightarrow> 2 ^ k * n \<le> 2 ^ m
[PROOF STEP]
by (metis le_add_diff_inverse mult_le_mono2 semiring_normalization_rules(26))


[STATEMENT]
lemma encode1_replicate_2:
  "partial_state.encode1 (replicate (Suc k) 2) {0..<k} i = i mod (2 ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_state.encode1 (replicate (Suc k) 2) {0..<k} i = i mod 2 ^ k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partial_state.encode1 (replicate (Suc k) 2) {0..<k} i = i mod 2 ^ k
[PROOF STEP]
have take_Suc: "take k (replicate (Suc k) 2) = replicate k 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take k (replicate (Suc k) (2::'a)) = replicate k (2::'a)
[PROOF STEP]
apply (subst take_replicate)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replicate (min k (Suc k)) (2::'a) = replicate k (2::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
take k (replicate (Suc k) (2::?'a3)) = replicate k (2::?'a3)

goal (1 subgoal):
 1. partial_state.encode1 (replicate (Suc k) 2) {0..<k} i = i mod 2 ^ k
[PROOF STEP]
have take_encode: "take k (digit_encode (replicate (Suc k) 2) i) = digit_encode (replicate k 2) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take k (digit_encode (replicate (Suc k) 2) i) = digit_encode (replicate k 2) i
[PROOF STEP]
apply (subst digit_encode_take)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. digit_encode (take k (replicate (Suc k) 2)) i = digit_encode (replicate k 2) i
[PROOF STEP]
using take_Suc
[PROOF STATE]
proof (prove)
using this:
take k (replicate (Suc k) (2::?'a3)) = replicate k (2::?'a3)

goal (1 subgoal):
 1. digit_encode (take k (replicate (Suc k) 2)) i = digit_encode (replicate k 2) i
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
take k (digit_encode (replicate (Suc k) 2) i) = digit_encode (replicate k 2) i

goal (1 subgoal):
 1. partial_state.encode1 (replicate (Suc k) 2) {0..<k} i = i mod 2 ^ k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_state.encode1 (replicate (Suc k) 2) {0..<k} i = i mod 2 ^ k
[PROOF STEP]
unfolding partial_state.encode1_def partial_state.dims1_def
      nths_upt_eq_take[simplified lessThan_atLeast0] take_Suc take_encode
      digit_decode_encode prod_list_replicate
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i mod 2 ^ k = i mod 2 ^ k
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
partial_state.encode1 (replicate (Suc k) 2) {0..<k} i = i mod 2 ^ k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma polar_convergence:
  fixes R::real
  assumes "\<And>j. r j > 0" "R > 0"
  shows "((\<lambda>j. r j * exp (\<i> * \<theta> j)) \<longlonglongrightarrow> (R * exp (\<i> * \<Theta>))) \<longleftrightarrow>
         (r \<longlonglongrightarrow> R) \<and> (\<exists>k. (\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)"    (is "(?z \<longlonglongrightarrow> ?Z) = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>) = (r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>) \<Longrightarrow> r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)
 2. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>) \<Longrightarrow> (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
assume L: "?z \<longlonglongrightarrow> ?Z"
[PROOF STATE]
proof (state)
this:
(\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)

goal (2 subgoals):
 1. (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>) \<Longrightarrow> r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)
 2. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>) \<Longrightarrow> (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
have rR: "r \<longlonglongrightarrow> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<longlonglongrightarrow> R
[PROOF STEP]
using tendsto_norm [OF L] assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. cmod (complex_of_real (r x) * exp (\<i> * complex_of_real (\<theta> x)))) \<longlonglongrightarrow> cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>))
0 < r ?j
0 < R

goal (1 subgoal):
 1. r \<longlonglongrightarrow> R
[PROOF STEP]
by (auto simp: norm_mult abs_of_pos)
[PROOF STATE]
proof (state)
this:
r \<longlonglongrightarrow> R

goal (2 subgoals):
 1. (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>) \<Longrightarrow> r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)
 2. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>) \<Longrightarrow> (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r \<longlonglongrightarrow> R

goal (2 subgoals):
 1. (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>) \<Longrightarrow> r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)
 2. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>) \<Longrightarrow> (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
obtain k where "(\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "cos (\<theta> j - \<Theta>) = ((r j)\<^sup>2 + R\<^sup>2 - (norm(?z j - ?Z))\<^sup>2) / (2 * R * r j)" for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (\<theta> j - \<Theta>) = ((r j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r j)
[PROOF STEP]
apply (subst cmod_diff_squared)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 \<le> r j
 2. 0 \<le> R
 3. cos (\<theta> j - \<Theta>) = ((r j)\<^sup>2 + R\<^sup>2 - ((r j)\<^sup>2 + R\<^sup>2 - 2 * r j * R * cos (\<theta> j - \<Theta>))) / (2 * R * r j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < r ?j
0 < R

goal (3 subgoals):
 1. 0 \<le> r j
 2. 0 \<le> R
 3. cos (\<theta> j - \<Theta>) = ((r j)\<^sup>2 + R\<^sup>2 - ((r j)\<^sup>2 + R\<^sup>2 - 2 * r j * R * cos (\<theta> j - \<Theta>))) / (2 * R * r j)
[PROOF STEP]
by (auto simp: field_split_simps less_le)
[PROOF STATE]
proof (state)
this:
cos (\<theta> ?j - \<Theta>) = ((r ?j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r ?j) * exp (\<i> * complex_of_real (\<theta> ?j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r ?j)

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cos (\<theta> ?j - \<Theta>) = ((r ?j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r ?j) * exp (\<i> * complex_of_real (\<theta> ?j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r ?j)

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "(\<lambda>j. ((r j)\<^sup>2 + R\<^sup>2 - (norm(?z j - ?Z))\<^sup>2) / (2 * R * r j)) \<longlonglongrightarrow> ((R\<^sup>2 + R\<^sup>2 - (norm(?Z - ?Z))\<^sup>2) / (2 * R * R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>j. ((r j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r j)) \<longlonglongrightarrow> (R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R)
[PROOF STEP]
by (intro L rR tendsto_intros) (use \<open>R > 0\<close> in force)
[PROOF STATE]
proof (state)
this:
(\<lambda>j. ((r j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r j)) \<longlonglongrightarrow> (R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R)

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>j. ((r j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r j)) \<longlonglongrightarrow> (R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R)

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "((R\<^sup>2 + R\<^sup>2 - (norm(?Z - ?Z))\<^sup>2) / (2 * R * R)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R) = 1
[PROOF STEP]
using \<open>R > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < R

goal (1 subgoal):
 1. (R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R) = 1
[PROOF STEP]
by (simp add: power2_eq_square field_split_simps)
[PROOF STATE]
proof (state)
this:
(R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R) = 1

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cos (\<theta> ?j - \<Theta>) = ((r ?j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r ?j) * exp (\<i> * complex_of_real (\<theta> ?j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r ?j)
(\<lambda>j. ((r j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r j)) \<longlonglongrightarrow> (R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R)
(R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R) = 1
[PROOF STEP]
have "(\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
using this:
cos (\<theta> ?j - \<Theta>) = ((r ?j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r ?j) * exp (\<i> * complex_of_real (\<theta> ?j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r ?j)
(\<lambda>j. ((r j)\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j)) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * r j)) \<longlonglongrightarrow> (R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R)
(R\<^sup>2 + R\<^sup>2 - (cmod (complex_of_real R * exp (\<i> * complex_of_real \<Theta>) - complex_of_real R * exp (\<i> * complex_of_real \<Theta>)))\<^sup>2) / (2 * R * R) = 1

goal (1 subgoal):
 1. (\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that cos_diff_limit_1
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1
(\<lambda>j. \<theta> j - real_of_int (?k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis
\<lbrakk>(\<lambda>j. cos (?\<theta> j - ?\<Theta>)) \<longlonglongrightarrow> 1; \<And>k. (\<lambda>j. ?\<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> ?\<Theta> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>

goal (2 subgoals):
 1. (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>) \<Longrightarrow> r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)
 2. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>) \<Longrightarrow> (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r \<longlonglongrightarrow> R
(\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
r \<longlonglongrightarrow> R
(\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>

goal (1 subgoal):
 1. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)

goal (1 subgoal):
 1. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>) \<Longrightarrow> (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>) \<Longrightarrow> (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
assume R: ?rhs
[PROOF STATE]
proof (state)
this:
r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)

goal (1 subgoal):
 1. r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>) \<Longrightarrow> (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
show "?z \<longlonglongrightarrow> ?Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
proof (rule tendsto_mult)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. complex_of_real (r x)) \<longlonglongrightarrow> complex_of_real R
 2. (\<lambda>x. exp (\<i> * complex_of_real (\<theta> x))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
show "(\<lambda>x. complex_of_real (r x)) \<longlonglongrightarrow> of_real R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. complex_of_real (r x)) \<longlonglongrightarrow> complex_of_real R
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)

goal (1 subgoal):
 1. (\<lambda>x. complex_of_real (r x)) \<longlonglongrightarrow> complex_of_real R
[PROOF STEP]
by (auto simp: tendsto_of_real_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. complex_of_real (r x)) \<longlonglongrightarrow> complex_of_real R

goal (1 subgoal):
 1. (\<lambda>x. exp (\<i> * complex_of_real (\<theta> x))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
obtain k where "(\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
r \<longlonglongrightarrow> R \<and> (\<exists>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>)

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>

goal (1 subgoal):
 1. (\<lambda>x. exp (\<i> * complex_of_real (\<theta> x))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>
[PROOF STEP]
have "(\<lambda>j. complex_of_real (\<theta> j - of_int (k j) * (2 * pi))) \<longlonglongrightarrow> of_real \<Theta>"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>

goal (1 subgoal):
 1. (\<lambda>j. complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> complex_of_real \<Theta>
[PROOF STEP]
using tendsto_of_real_iff
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>
((\<lambda>x. of_real (?f x)) \<longlongrightarrow> of_real ?c) ?F = (?f \<longlongrightarrow> ?c) ?F

goal (1 subgoal):
 1. (\<lambda>j. complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> complex_of_real \<Theta>
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>j. complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> complex_of_real \<Theta>

goal (1 subgoal):
 1. (\<lambda>x. exp (\<i> * complex_of_real (\<theta> x))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>j. complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> complex_of_real \<Theta>
[PROOF STEP]
have "(\<lambda>j.  exp (\<i> * of_real (\<theta> j - of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * \<Theta>)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> complex_of_real \<Theta>

goal (1 subgoal):
 1. (\<lambda>j. exp (\<i> * complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
using tendsto_mult [OF tendsto_const] isCont_exp isCont_tendsto_compose
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> complex_of_real \<Theta>
(?g \<longlongrightarrow> ?b) ?F \<Longrightarrow> ((\<lambda>x. ?a * ?g x) \<longlongrightarrow> ?a * ?b) ?F
isCont exp ?x
\<lbrakk>isCont ?g ?l; (?f \<longlongrightarrow> ?l) ?F\<rbrakk> \<Longrightarrow> ((\<lambda>x. ?g (?f x)) \<longlongrightarrow> ?g ?l) ?F

goal (1 subgoal):
 1. (\<lambda>j. exp (\<i> * complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>j. exp (\<i> * complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)

goal (1 subgoal):
 1. (\<lambda>x. exp (\<i> * complex_of_real (\<theta> x))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>j. exp (\<i> * complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)

goal (1 subgoal):
 1. (\<lambda>x. exp (\<i> * complex_of_real (\<theta> x))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
have "exp (\<i> * of_real (\<theta> j - of_int (k j) * (2 * pi))) = exp (\<i> * \<theta> j)" for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (\<i> * complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi))) = exp (\<i> * complex_of_real (\<theta> j))
[PROOF STEP]
unfolding exp_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. \<i> * complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi)) = \<i> * complex_of_real (\<theta> j) + complex_of_real (real_of_int (2 * n) * pi) * \<i>
[PROOF STEP]
by (rule_tac x="- k j" in exI) (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
exp (\<i> * complex_of_real (\<theta> ?j - real_of_int (k ?j) * (2 * pi))) = exp (\<i> * complex_of_real (\<theta> ?j))

goal (1 subgoal):
 1. (\<lambda>x. exp (\<i> * complex_of_real (\<theta> x))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>j. exp (\<i> * complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
exp (\<i> * complex_of_real (\<theta> ?j - real_of_int (k ?j) * (2 * pi))) = exp (\<i> * complex_of_real (\<theta> ?j))
[PROOF STEP]
show "(\<lambda>j. exp (\<i> * \<theta> j)) \<longlonglongrightarrow> exp (\<i> * \<Theta>)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. exp (\<i> * complex_of_real (\<theta> j - real_of_int (k j) * (2 * pi)))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
exp (\<i> * complex_of_real (\<theta> ?j - real_of_int (k ?j) * (2 * pi))) = exp (\<i> * complex_of_real (\<theta> ?j))

goal (1 subgoal):
 1. (\<lambda>j. exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>j. exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> exp (\<i> * complex_of_real \<Theta>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>j. complex_of_real (r j) * exp (\<i> * complex_of_real (\<theta> j))) \<longlonglongrightarrow> complex_of_real R * exp (\<i> * complex_of_real \<Theta>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_word_size: "CARD('a word) = 2 ^ size x"
  for x :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a word) = 2 ^ size x
[PROOF STEP]
unfolding word_size
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a word) = 2 ^ LENGTH('a)
[PROOF STEP]
by (rule card_word)


[STATEMENT]
lemma sumUnionDisjoint1:
  assumes "\<forall>A\<in>C. finite A" "\<forall>A\<in>C. \<forall>B\<in>C. A \<noteq> B \<longrightarrow> A Int B = {}"
  shows "sum f (Union C) = sum (sum f) C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (\<Union> C) = sum (sum f) C
[PROOF STEP]
using assms sum.Union_disjoint
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>C. finite A
\<forall>A\<in>C. \<forall>B\<in>C. A \<noteq> B \<longrightarrow> A \<inter> B = {}
\<lbrakk>\<forall>A\<in>?C. finite A; \<forall>A\<in>?C. \<forall>B\<in>?C. A \<noteq> B \<longrightarrow> A \<inter> B = {}\<rbrakk> \<Longrightarrow> sum ?g (\<Union> ?C) = (sum \<circ> sum) ?g ?C

goal (1 subgoal):
 1. sum f (\<Union> C) = sum (sum f) C
[PROOF STEP]
by fastforce


[STATEMENT]
lemma hlp1: "{i. i < 4 \<and> \<not> (f(0 := a0, 1 := a1, 2 := a2, 3 := a3)) i} =
  (if a0 then {} else {0::nat})
\<union> (if a1 then {} else {1})
\<union> (if a2 then {} else {2})
\<union> (if a3 then {} else {3})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < 4 \<and> \<not> (f(0 := a0, 1 := a1, 2 := a2, 3 := a3)) i} = (if a0 then {} else {0}) \<union> (if a1 then {} else {1}) \<union> (if a2 then {} else {2}) \<union> (if a3 then {} else {3})
[PROOF STEP]
by auto


[STATEMENT]
theorem sum_of_squares: "real (\<Sum>k\<le>n::nat. k ^ 2) = real (2 * n ^ 3 + 3 * n ^ 2 + n) / 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (sum power2 {..n}) = real (2 * n ^ 3 + 3 * n\<^sup>2 + n) / 6
[PROOF STEP]
by (simp only: of_nat_sum of_nat_power sum_of_powers)
     (simp add: bernoulli_unroll_all field_simps power2_eq_square power_numeral_reduce)


[STATEMENT]
lemma lm13: assumes "inj_on f A" "inj_on f B"
             shows   "inj_on f (A \<union> B)  =  (f`(A-B) \<inter> (f`(B-A)) = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (A \<union> B) = (f ` (A - B) \<inter> f ` (B - A) = {})
[PROOF STEP]
using assms inj_on_Un
[PROOF STATE]
proof (prove)
using this:
inj_on f A
inj_on f B
inj_on ?f (?A \<union> ?B) = (inj_on ?f ?A \<and> inj_on ?f ?B \<and> ?f ` (?A - ?B) \<inter> ?f ` (?B - ?A) = {})

goal (1 subgoal):
 1. inj_on f (A \<union> B) = (f ` (A - B) \<inter> f ` (B - A) = {})
[PROOF STEP]
by (metis)


[STATEMENT]
lemma [vector_add_divide_simps]:
  "v + (b / z) *\<^sub>R w = (if z = 0 then v else (z *\<^sub>R v + b *\<^sub>R w) /\<^sub>R z)"
  "a *\<^sub>R v + (b / z) *\<^sub>R w = (if z = 0 then a *\<^sub>R v else ((a * z) *\<^sub>R v + b *\<^sub>R w) /\<^sub>R z)"
  "(a / z) *\<^sub>R v + w = (if z = 0 then w else (a *\<^sub>R v + z *\<^sub>R w) /\<^sub>R z)"
  "(a / z) *\<^sub>R v + b *\<^sub>R w = (if z = 0 then b *\<^sub>R w else (a *\<^sub>R v + (b * z) *\<^sub>R w) /\<^sub>R z)"
  "v - (b / z) *\<^sub>R w = (if z = 0 then v else (z *\<^sub>R v - b *\<^sub>R w) /\<^sub>R z)"
  "a *\<^sub>R v - (b / z) *\<^sub>R w = (if z = 0 then a *\<^sub>R v else ((a * z) *\<^sub>R v - b *\<^sub>R w) /\<^sub>R z)"
  "(a / z) *\<^sub>R v - w = (if z = 0 then -w else (a *\<^sub>R v - z *\<^sub>R w) /\<^sub>R z)"
  "(a / z) *\<^sub>R v - b *\<^sub>R w = (if z = 0 then -b *\<^sub>R w else (a *\<^sub>R v - (b * z) *\<^sub>R w) /\<^sub>R z)"
  for v :: "'a :: real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((v + (b / z) *\<^sub>R w = (if z = 0 then v else (z *\<^sub>R v + b *\<^sub>R w) /\<^sub>R z) &&& a *\<^sub>R v + (b / z) *\<^sub>R w = (if z = 0 then a *\<^sub>R v else ((a * z) *\<^sub>R v + b *\<^sub>R w) /\<^sub>R z)) &&& (a / z) *\<^sub>R v + w = (if z = 0 then w else (a *\<^sub>R v + z *\<^sub>R w) /\<^sub>R z) &&& (a / z) *\<^sub>R v + b *\<^sub>R w = (if z = 0 then b *\<^sub>R w else (a *\<^sub>R v + (b * z) *\<^sub>R w) /\<^sub>R z)) &&& (v - (b / z) *\<^sub>R w = (if z = 0 then v else (z *\<^sub>R v - b *\<^sub>R w) /\<^sub>R z) &&& a *\<^sub>R v - (b / z) *\<^sub>R w = (if z = 0 then a *\<^sub>R v else ((a * z) *\<^sub>R v - b *\<^sub>R w) /\<^sub>R z)) &&& (a / z) *\<^sub>R v - w = (if z = 0 then - w else (a *\<^sub>R v - z *\<^sub>R w) /\<^sub>R z) &&& (a / z) *\<^sub>R v - b *\<^sub>R w = (if z = 0 then - b *\<^sub>R w else (a *\<^sub>R v - (b * z) *\<^sub>R w) /\<^sub>R z)
[PROOF STEP]
by (simp_all add: divide_inverse_commute scaleR_add_right scaleR_diff_right)


[STATEMENT]
lemma quasi_isometry_onI [intro]:
  assumes "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> dist (f x) (f y) \<le> lambda * dist x y + C"
          "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> dist (f x) (f y) \<ge> (1/lambda) * dist x y - C"
          "lambda \<ge> 1" "C \<ge> 0"
  shows "lambda C-quasi_isometry_on X f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lambda C -quasi_isometry_on X f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> dist (f ?x) (f ?y) \<le> lambda * dist ?x ?y + C
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> 1 / lambda * dist ?x ?y - C \<le> dist (f ?x) (f ?y)
1 \<le> lambda
0 \<le> C

goal (1 subgoal):
 1. lambda C -quasi_isometry_on X f
[PROOF STEP]
unfolding quasi_isometry_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> dist (f ?x) (f ?y) \<le> lambda * dist ?x ?y + C
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> 1 / lambda * dist ?x ?y - C \<le> dist (f ?x) (f ?y)
1 \<le> lambda
0 \<le> C

goal (1 subgoal):
 1. 1 \<le> lambda \<and> 0 \<le> C \<and> (\<forall>x\<in>X. \<forall>y\<in>X. dist (f x) (f y) \<le> lambda * dist x y + C \<and> 1 / lambda * dist x y - C \<le> dist (f x) (f y))
[PROOF STEP]
by auto


[STATEMENT]
lemma uniqButlastNotUniqListImpliesLastMemButlast:
  assumes "uniq (butlast l)" "\<not> uniq l"
  shows "last l \<in> set (butlast l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last l \<in> set (butlast l)
[PROOF STEP]
proof (cases "l = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. l = [] \<Longrightarrow> last l \<in> set (butlast l)
 2. l \<noteq> [] \<Longrightarrow> last l \<in> set (butlast l)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
l = []

goal (2 subgoals):
 1. l = [] \<Longrightarrow> last l \<in> set (butlast l)
 2. l \<noteq> [] \<Longrightarrow> last l \<in> set (butlast l)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
l = []

goal (1 subgoal):
 1. last l \<in> set (butlast l)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l = []
uniq (butlast l)
\<not> uniq l

goal (1 subgoal):
 1. last l \<in> set (butlast l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
last l \<in> set (butlast l)

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> last l \<in> set (butlast l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> last l \<in> set (butlast l)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
l \<noteq> []

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> last l \<in> set (butlast l)
[PROOF STEP]
hence "l = butlast l @ [(last l)]"
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []

goal (1 subgoal):
 1. l = butlast l @ [last l]
[PROOF STEP]
by (rule listEqualsButlastAppendLast)
[PROOF STATE]
proof (state)
this:
l = butlast l @ [last l]

goal (1 subgoal):
 1. l \<noteq> [] \<Longrightarrow> last l \<in> set (butlast l)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
l = butlast l @ [last l]

goal (1 subgoal):
 1. last l \<in> set (butlast l)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l = butlast l @ [last l]
uniq (butlast l)
\<not> uniq l

goal (1 subgoal):
 1. last l \<in> set (butlast l)
[PROOF STEP]
using uniqAppendElement[of "butlast l" "last l"]
[PROOF STATE]
proof (prove)
using this:
l = butlast l @ [last l]
uniq (butlast l)
\<not> uniq l
uniq (butlast l) \<Longrightarrow> (last l \<notin> set (butlast l)) = uniq (butlast l @ [last l])

goal (1 subgoal):
 1. last l \<in> set (butlast l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
last l \<in> set (butlast l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma std_normal_distribution_even_moments_abs:
  fixes k :: nat
  shows "(LINT x|std_normal_distribution. \<bar>x\<bar>^(2 * k)) = fact (2 * k) / (2^k * fact k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|std_normal_distribution. \<bar>x\<bar> ^ (2 * k) = fact (2 * k) / (2 ^ k * fact 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. \<bar>x\<bar> ^ (2 * k) = fact (2 * k) / (2 ^ k * fact k)
[PROOF STEP]
by (subst integral_density) (auto simp: normal_density_nonneg power_even_abs)


[STATEMENT]
lemma compact_negations:
  fixes s :: "'a::real_normed_vector set"
  assumes "compact s"
  shows "compact ((\<lambda>x. - x) ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (uminus ` s)
[PROOF STEP]
using compact_scaling [OF assms, of "- 1"]
[PROOF STATE]
proof (prove)
using this:
compact ((*\<^sub>R) (- 1) ` s)

goal (1 subgoal):
 1. compact (uminus ` s)
[PROOF STEP]
by auto


[STATEMENT]
lemma power_less_top_ennreal: fixes x :: ennreal shows "x ^ n < top \<longleftrightarrow> x < top \<or> n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x ^ n < top) = (x < top \<or> n = 0)
[PROOF STEP]
using power_eq_top_ennreal[of x n]
[PROOF STATE]
proof (prove)
using this:
(x ^ n = top) = (n \<noteq> 0 \<and> x = top)

goal (1 subgoal):
 1. (x ^ n < top) = (x < top \<or> n = 0)
[PROOF STEP]
by (auto simp: less_top)


[STATEMENT]
lemma octo_trad_cnj : "cnj q = (Ree q) *\<^sub>R e0 - (Im1 q) *\<^sub>R e1 - (Im2 q)*\<^sub>R e2  - (Im3 q) *\<^sub>R e3  -
 (Im4 q) *\<^sub>R e4 -  (Im5 q) *\<^sub>R e5 -  (Im6 q) *\<^sub>R e6  -  (Im7 q)*\<^sub>R e7 " for q::octo
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Octonions.cnj q = Ree q *\<^sub>R e0 - Im1 q *\<^sub>R e1 - Im2 q *\<^sub>R e2 - Im3 q *\<^sub>R e3 - Im4 q *\<^sub>R e4 - Im5 q *\<^sub>R e5 - Im6 q *\<^sub>R e6 - Im7 q *\<^sub>R e7
[PROOF STEP]
using cnj_cnj octo_unfold octo_trad cnj_def Octonions.cnj.code
[PROOF STATE]
proof (prove)
using this:
Octonions.cnj (Octonions.cnj ?q) = ?q
?q = Ree ?q *\<^sub>R e0 + Im1 ?q *\<^sub>R e1 + Im2 ?q *\<^sub>R e2 + Im3 ?q *\<^sub>R e3 + Im4 ?q *\<^sub>R e4 + Im5 ?q *\<^sub>R e5 + Im6 ?q *\<^sub>R e6 + Im7 ?q *\<^sub>R e7
Octo ?x ?y ?z ?w ?u ?v ?q ?g = ?x *\<^sub>R e0 + ?y *\<^sub>R e1 + ?z *\<^sub>R e2 + ?w *\<^sub>R e3 + ?u *\<^sub>R e4 + ?v *\<^sub>R e5 + ?q *\<^sub>R e6 + ?g *\<^sub>R e7
Octonions.cnj \<equiv> corec_octo Ree (\<lambda>z. - Im1 z) (\<lambda>z. - Im2 z) (\<lambda>z. - Im3 z) (\<lambda>z. - Im4 z) (\<lambda>z. - Im5 z) (\<lambda>z. - Im6 z) (\<lambda>z. - Im7 z)
Octonions.cnj ?z = Octo (Ree ?z) (- Im1 ?z) (- Im2 ?z) (- Im3 ?z) (- Im4 ?z) (- Im5 ?z) (- Im6 ?z) (- Im7 ?z)

goal (1 subgoal):
 1. Octonions.cnj q = Ree q *\<^sub>R e0 - Im1 q *\<^sub>R e1 - Im2 q *\<^sub>R e2 - Im3 q *\<^sub>R e3 - Im4 q *\<^sub>R e4 - Im5 q *\<^sub>R e5 - Im6 q *\<^sub>R e6 - Im7 q *\<^sub>R e7
[PROOF STEP]
by auto


[STATEMENT]
lemma fSup_unfold: "(f::nat \<Rightarrow> 'a) 0 \<squnion> (\<Squnion>n. f (Suc n)) = (\<Squnion>n. f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 \<squnion> (\<Squnion>n. f (Suc n)) = \<Squnion> range f
[PROOF STEP]
apply (intro order.antisym sup_least)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. f 0 \<le> \<Squnion> range f
 2. (\<Squnion>n. f (Suc n)) \<le> \<Squnion> range f
 3. \<Squnion> range f \<le> f 0 \<squnion> (\<Squnion>n. f (Suc n))
[PROOF STEP]
apply (rule Sup_upper, force)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<Squnion>n. f (Suc n)) \<le> \<Squnion> range f
 2. \<Squnion> range f \<le> f 0 \<squnion> (\<Squnion>n. f (Suc n))
[PROOF STEP]
apply (rule Sup_mono, force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> range f \<le> f 0 \<squnion> (\<Squnion>n. f (Suc n))
[PROOF STEP]
apply (safe intro!: Sup_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x n. n \<in> UNIV \<Longrightarrow> f n \<le> f 0 \<squnion> (\<Squnion>n. f (Suc n))
[PROOF STEP]
by (case_tac n, simp_all add: Sup_upper le_supI2)


[STATEMENT]
lemma interval_lebesgue_integral_diff [intro, simp]:
  fixes M a b f
  assumes "interval_lebesgue_integrable M a b f"
    "interval_lebesgue_integrable M a b g"
  shows "interval_lebesgue_integrable M a b (\<lambda>x. f x - g x)" and
    "interval_lebesgue_integral M a b (\<lambda>x. f x - g x) =
   interval_lebesgue_integral M a b f - interval_lebesgue_integral M a b g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integrable M a b (\<lambda>x. f x - g x) &&& LINT x=a..b|M. (f x - g x) = interval_lebesgue_integral M a b f - interval_lebesgue_integral M a b g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
interval_lebesgue_integrable M a b f
interval_lebesgue_integrable M a b g

goal (1 subgoal):
 1. interval_lebesgue_integrable M a b (\<lambda>x. f x - g x) &&& LINT x=a..b|M. (f x - g x) = interval_lebesgue_integral M a b f - interval_lebesgue_integral M a b g
[PROOF STEP]
by (auto simp: interval_lebesgue_integral_def interval_lebesgue_integrable_def
    field_simps)


[STATEMENT]
lemma mat_minus_limit:
  fixes X :: "nat \<Rightarrow> complex mat" and A :: "complex mat" and m :: nat and B :: "complex mat"
  assumes dimB: "B \<in> carrier_mat m m" and limX: "limit_mat X A m"
  shows "limit_mat (\<lambda>n. B - X n) (B - A) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (\<lambda>n. B - X n) (B - A) m
[PROOF STEP]
using limit_mat_minus limit_mat_const[OF dimB] limX
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>limit_mat ?X ?A ?m; limit_mat ?Y ?B ?m\<rbrakk> \<Longrightarrow> limit_mat (\<lambda>k. ?X k - ?Y k) (?A - ?B) ?m
limit_mat (\<lambda>k. B) B m
limit_mat X A m

goal (1 subgoal):
 1. limit_mat (\<lambda>n. B - X n) (B - A) m
[PROOF STEP]
by auto


[STATEMENT]
lemma poly_eval_times: "poly_eval a (p * q) = poly_eval a p * poly_eval a q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_eval a (p * q) = poly_eval a p * poly_eval a q
[PROOF STEP]
by (simp only: poly_eval_def poly_subst_times lookup_times_zero)


[STATEMENT]
lemma subst_pp_plus: "subst_pp f (s + t) = subst_pp f s * subst_pp f t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subst_pp f (s + t) = subst_pp f s * subst_pp f t
[PROOF STEP]
by (simp add: subst_pp_alt lookup_add power_add, rule Prod_any.distrib, (fact finite_power_lookup_not_one)+)


[STATEMENT]
lemma sqrt_series:
  "\<bar>z\<bar> < 1 \<Longrightarrow> (\<lambda>n. ((1/2) gchoose n) * z ^ n) sums sqrt (1 + z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>z\<bar> < 1 \<Longrightarrow> (\<lambda>n. (1 / 2 gchoose n) * z ^ n) sums sqrt (1 + z)
[PROOF STEP]
using gen_binomial_real[of z "1/2"]
[PROOF STATE]
proof (prove)
using this:
\<bar>z\<bar> < 1 \<Longrightarrow> (\<lambda>n. (1 / 2 gchoose n) * z ^ n) sums (1 + z) powr (1 / 2)

goal (1 subgoal):
 1. \<bar>z\<bar> < 1 \<Longrightarrow> (\<lambda>n. (1 / 2 gchoose n) * z ^ n) sums sqrt (1 + z)
[PROOF STEP]
by (simp add: powr_half_sqrt)


[STATEMENT]
lemma unitary_vec_norm:
  assumes "v\<in> carrier_vec n"
  and "U \<in> carrier_mat n n"
  and "Complex_Matrix.unitary U"
shows "vec_norm (U *\<^sub>v v) = vec_norm v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_norm (U *\<^sub>v v) = vec_norm v
[PROOF STEP]
using unitary_inner_prod assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?n; ?U \<in> carrier_mat ?n ?n; Complex_Matrix.unitary ?U\<rbrakk> \<Longrightarrow> Complex_Matrix.inner_prod (?U *\<^sub>v ?v) (?U *\<^sub>v ?w) = Complex_Matrix.inner_prod ?v ?w
v \<in> carrier_vec n
U \<in> carrier_mat n n
Complex_Matrix.unitary U

goal (1 subgoal):
 1. vec_norm (U *\<^sub>v v) = vec_norm v
[PROOF STEP]
unfolding vec_norm_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?n; ?U \<in> carrier_mat ?n ?n; Complex_Matrix.unitary ?U\<rbrakk> \<Longrightarrow> Complex_Matrix.inner_prod (?U *\<^sub>v ?v) (?U *\<^sub>v ?w) = Complex_Matrix.inner_prod ?v ?w
v \<in> carrier_vec n
U \<in> carrier_mat n n
Complex_Matrix.unitary U

goal (1 subgoal):
 1. csqrt (Complex_Matrix.inner_prod (U *\<^sub>v v) (U *\<^sub>v v)) = csqrt (Complex_Matrix.inner_prod v v)
[PROOF STEP]
by metis


[STATEMENT]
lemma Hilbert_fun_cone_empty:
  assumes "h \<in> P[X]" and "h \<noteq> 0" and "homogeneous (h::_ \<Rightarrow>\<^sub>0 'a::field)"
  shows "Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)
[PROOF STEP]
have "Hilbert_fun (cone (h, {})) z = card {t \<in> .[{}::'x set]. deg_pm t + poly_deg h = z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hilbert_fun (cone (h, {})) z = card {t \<in> .[{}]. deg_pm t + poly_deg h = z}
[PROOF STEP]
using assms(1, 2) empty_subsetI assms(3)
[PROOF STATE]
proof (prove)
using this:
h \<in> P[X]
h \<noteq> 0
{} \<subseteq> ?A
homogeneous h

goal (1 subgoal):
 1. Hilbert_fun (cone (h, {})) z = card {t \<in> .[{}]. deg_pm t + poly_deg h = z}
[PROOF STEP]
by (rule Hilbert_fun_cone_aux)
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, {})) z = card {t \<in> .[{}]. deg_pm t + poly_deg h = z}

goal (1 subgoal):
 1. Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, {})) z = card {t \<in> .[{}]. deg_pm t + poly_deg h = z}

goal (1 subgoal):
 1. Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)
[PROOF STEP]
have "\<dots> = (if poly_deg h = z then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {t \<in> .[{}]. deg_pm t + poly_deg h = z} = (if poly_deg h = z then 1 else 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {t \<in> .[{}]. deg_pm t + poly_deg h = z} = (if poly_deg h = z then 1 else 0)

goal (1 subgoal):
 1. Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)

goal (1 subgoal):
 1. Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, {})) z = (if poly_deg h = z then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uniform_limit_add[uniform_limit_intros]:
  fixes f g::"'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_vector"
  assumes "uniform_limit X f l F"
  assumes "uniform_limit X g m F"
  shows "uniform_limit X (\<lambda>a b. f a b + g a b) (\<lambda>a. l a + m a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit X (\<lambda>a b. f a b + g a b) (\<lambda>a. l a + m a) F
[PROOF STEP]
proof (rule uniform_limitI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x + g n x) (l x + m x) < e
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x + g n x) (l x + m x) < e
[PROOF STEP]
assume "0 < e"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x + g n x) (l x + m x) < e
[PROOF STEP]
hence "0 < e / 2"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 < e / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x + g n x) (l x + m x) < e
[PROOF STEP]
from
    uniform_limitD[OF assms(1) this]
    uniform_limitD[OF assms(2) this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x) (l x) < e / 2
\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (g n x) (m x) < e / 2
[PROOF STEP]
show "\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x + g n x) (l x + m x) < e"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x) (l x) < e / 2
\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (g n x) (m x) < e / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x + g n x) (l x + m x) < e
[PROOF STEP]
by eventually_elim (simp add: dist_triangle_add_half)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x + g n x) (l x + m x) < e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_compact_sums:
  fixes S T :: "'a::real_normed_vector set"
  assumes "closed S" "compact T"
  shows "closed (\<Union>x\<in> S. \<Union>y \<in> T. {x + y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
have "(\<Union>x\<in> T. \<Union>y \<in> S. {x + y}) = (\<Union>x\<in> S. \<Union>y \<in> T. {x + y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>T. \<Union>y\<in>S. {x + y}) = (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>x\<in>T. \<Union>y\<in>S. {x + y}) = (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})

goal (1 subgoal):
 1. closed (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Union>x\<in>T. \<Union>y\<in>S. {x + y}) = (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Union>x\<in>T. \<Union>y\<in>S. {x + y}) = (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})

goal (1 subgoal):
 1. closed (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
using compact_closed_sums[OF assms(2,1)]
[PROOF STATE]
proof (prove)
using this:
(\<Union>x\<in>T. \<Union>y\<in>S. {x + y}) = (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
closed (\<Union>x\<in>T. \<Union>y\<in>S. {x + y})

goal (1 subgoal):
 1. closed (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closed (\<Union>x\<in>S. \<Union>y\<in>T. {x + y})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma euler_theorem:
  fixes a m :: nat
  assumes "coprime a m"
  shows "[a ^ totient m = 1] (mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ totient m = 1] (mod m)
[PROOF STEP]
proof (cases "m = 0 \<or> m = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<or> m = 1 \<Longrightarrow> [a ^ totient m = 1] (mod m)
 2. \<not> (m = 0 \<or> m = 1) \<Longrightarrow> [a ^ totient m = 1] (mod m)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
m = 0 \<or> m = 1

goal (2 subgoals):
 1. m = 0 \<or> m = 1 \<Longrightarrow> [a ^ totient m = 1] (mod m)
 2. \<not> (m = 0 \<or> m = 1) \<Longrightarrow> [a ^ totient m = 1] (mod m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = 0 \<or> m = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = 0 \<or> m = 1

goal (1 subgoal):
 1. [a ^ totient m = 1] (mod m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[a ^ totient m = 1] (mod m)

goal (1 subgoal):
 1. \<not> (m = 0 \<or> m = 1) \<Longrightarrow> [a ^ totient m = 1] (mod m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (m = 0 \<or> m = 1) \<Longrightarrow> [a ^ totient m = 1] (mod m)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (m = 0 \<or> m = 1)

goal (1 subgoal):
 1. \<not> (m = 0 \<or> m = 1) \<Longrightarrow> [a ^ totient m = 1] (mod m)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
coprime a m
\<not> (m = 0 \<or> m = 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime a m
\<not> (m = 0 \<or> m = 1)

goal (1 subgoal):
 1. [a ^ totient m = 1] (mod m)
[PROOF STEP]
using residues.euler_theorem [of "int m" "int a"] cong_int_iff
[PROOF STATE]
proof (prove)
using this:
coprime a m
\<not> (m = 0 \<or> m = 1)
\<lbrakk>residues (int m); coprime (int a) (int m)\<rbrakk> \<Longrightarrow> [int a ^ totient (nat (int m)) = 1] (mod int m)
[int ?m = int ?q] (mod int ?n) = [?m = ?q] (mod ?n)

goal (1 subgoal):
 1. [a ^ totient m = 1] (mod m)
[PROOF STEP]
by (auto simp add: residues_def gcd_int_def) fastforce
[PROOF STATE]
proof (state)
this:
[a ^ totient m = 1] (mod m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lt_set_card_lt:
  fixes A :: "nat set"
  assumes "finite A" and "x \<in> A"
  shows "card {y. y \<in> A \<and> y < x} < card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {y \<in> A. y < x} < card A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {y \<in> A. y < x} < card A
[PROOF STEP]
have "x \<notin> {y. y \<in> A \<and> y < x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> {y \<in> A. y < x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<notin> {y \<in> A. y < x}

goal (1 subgoal):
 1. card {y \<in> A. y < x} < card A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> {y \<in> A. y < x}
[PROOF STEP]
have "{y. y \<in> A \<and> y < x} \<subseteq> A - {x}"
[PROOF STATE]
proof (prove)
using this:
x \<notin> {y \<in> A. y < x}

goal (1 subgoal):
 1. {y \<in> A. y < x} \<subseteq> A - {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y \<in> A. y < x} \<subseteq> A - {x}

goal (1 subgoal):
 1. card {y \<in> A. y < x} < card A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{y \<in> A. y < x} \<subseteq> A - {x}
[PROOF STEP]
have "card {y. y \<in> A \<and> y < x} \<le> card (A - {x})"
[PROOF STATE]
proof (prove)
using this:
{y \<in> A. y < x} \<subseteq> A - {x}

goal (1 subgoal):
 1. card {y \<in> A. y < x} \<le> card (A - {x})
[PROOF STEP]
using card_mono finite_Diff[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
{y \<in> A. y < x} \<subseteq> A - {x}
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B
finite (A - ?B)

goal (1 subgoal):
 1. card {y \<in> A. y < x} \<le> card (A - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {y \<in> A. y < x} \<le> card (A - {x})

goal (1 subgoal):
 1. card {y \<in> A. y < x} < card A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {y \<in> A. y < x} \<le> card (A - {x})

goal (1 subgoal):
 1. card {y \<in> A. y < x} < card A
[PROOF STEP]
have "\<dots> < card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A - {x}) < card A
[PROOF STEP]
using card_Diff1_less[OF assms]
[PROOF STATE]
proof (prove)
using this:
card (A - {x}) < card A

goal (1 subgoal):
 1. card (A - {x}) < card A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (A - {x}) < card A

goal (1 subgoal):
 1. card {y \<in> A. y < x} < card A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {y \<in> A. y < x} < card A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {y \<in> A. y < x} < card A

goal (1 subgoal):
 1. card {y \<in> A. y < x} < card A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {y \<in> A. y < x} < card A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_wrt_linorder_imp_index_le:
  assumes "linorder_on A R" "set xs \<subseteq> A" "sorted_wrt R xs"
          "x \<in> set xs" "y \<in> set xs" "(x,y) \<in> R"
  shows   "index xs x \<le> index xs y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
define i j where "i = index xs x" and "j = index xs y"
[PROOF STATE]
proof (state)
this:
i = index xs x
j = index xs y

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
i = index xs x
j = index xs y

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
assume "j < i"
[PROOF STATE]
proof (state)
this:
j < i

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
j < i

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
linorder_on A R
set xs \<subseteq> A
Linorder_Relations.sorted_wrt R xs
x \<in> set xs
y \<in> set xs
(x, y) \<in> R
[PROOF STEP]
have "i < length xs"
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
set xs \<subseteq> A
Linorder_Relations.sorted_wrt R xs
x \<in> set xs
y \<in> set xs
(x, y) \<in> R

goal (1 subgoal):
 1. i < length xs
[PROOF STEP]
by (simp add: i_def)
[PROOF STATE]
proof (state)
this:
i < length xs

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
j < i
i < length xs
[PROOF STEP]
have "(xs!j,xs!i) \<in> R"
[PROOF STATE]
proof (prove)
using this:
j < i
i < length xs

goal (1 subgoal):
 1. (xs ! j, xs ! i) \<in> R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j < i
i < length xs
linorder_on A R
set xs \<subseteq> A
Linorder_Relations.sorted_wrt R xs
x \<in> set xs
y \<in> set xs
(x, y) \<in> R

goal (1 subgoal):
 1. (xs ! j, xs ! i) \<in> R
[PROOF STEP]
by (auto simp: sorted_wrt_conv_nth)
[PROOF STATE]
proof (state)
this:
(xs ! j, xs ! i) \<in> R

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
linorder_on A R
set xs \<subseteq> A
Linorder_Relations.sorted_wrt R xs
x \<in> set xs
y \<in> set xs
(x, y) \<in> R
(xs ! j, xs ! i) \<in> R
[PROOF STEP]
have "x = y"
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
set xs \<subseteq> A
Linorder_Relations.sorted_wrt R xs
x \<in> set xs
y \<in> set xs
(x, y) \<in> R
(xs ! j, xs ! i) \<in> R

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (auto simp: linorder_on_def antisym_def i_def j_def)
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
j < i \<Longrightarrow> x = y

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
hence "i \<le> j \<or> x = y"
[PROOF STATE]
proof (prove)
using this:
j < i \<Longrightarrow> x = y

goal (1 subgoal):
 1. i \<le> j \<or> x = y
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
i \<le> j \<or> x = y

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i \<le> j \<or> x = y

goal (1 subgoal):
 1. index xs x \<le> index xs y
[PROOF STEP]
by (auto simp: i_def j_def)
[PROOF STATE]
proof (state)
this:
index xs x \<le> index xs y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_masks_asso:
  "add_masks (add_masks a b) c = add_masks a (add_masks b c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_masks (add_masks a b) c = add_masks a (add_masks b c)
[PROOF STEP]
proof (rule ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. add_masks (add_masks a b) c x = add_masks a (add_masks b c) x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. add_masks (add_masks a b) c x = add_masks a (add_masks b c) x
[PROOF STEP]
show "add_masks (add_masks a b) c x = add_masks a (add_masks b c) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_masks (add_masks a b) c x = add_masks a (add_masks b c) x
[PROOF STEP]
by (metis Rep_prat_inverse add.assoc add_masks.simps padd.rep_eq)
[PROOF STATE]
proof (state)
this:
add_masks (add_masks a b) c x = add_masks a (add_masks b c) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_col_of_one_mat_less_pow:
  assumes "gate m G1" and "gate n G2" and "j < dim_col (1\<^sub>m(dim_col G1 * dim_col G2))"
  shows "j < 2^(m+n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < 2 ^ (m + n)
[PROOF STEP]
using assms gate_def
[PROOF STATE]
proof (prove)
using this:
gate m G1
gate n G2
j < dim_col (1\<^sub>m (dim_col G1 * dim_col G2))
gate ?n ?A \<equiv> dim_row ?A = 2 ^ ?n \<and> square_mat ?A \<and> unitary ?A

goal (1 subgoal):
 1. j < 2 ^ (m + n)
[PROOF STEP]
by (simp add: power_add)


[STATEMENT]
lemma totient_primorial':
  "totient (primorial' k) = primorial' k * (\<Prod>i<k. 1 - 1 / nth_prime i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient (primorial' k)) = real (primorial' k) * (\<Prod>i<k. 1 - 1 / real (nth_prime i))
[PROOF STEP]
unfolding totient_formula2 prime_factors_primorial'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (primorial' k) * (\<Prod>p\<in>nth_prime ` {..<k}. 1 - 1 / real p) = real (primorial' k) * (\<Prod>i<k. 1 - 1 / real (nth_prime i))
[PROOF STEP]
by (subst prod.reindex) (auto intro: inj_onI)


[STATEMENT]
theorem gs: "\<lbrakk> Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a \<rbrakk> \<Longrightarrow>
 \<exists>A. Gale_Shapley P\<^sub>a P\<^sub>b = Some A
   \<and> Pref.matching P\<^sub>a (list A) {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b (list A) {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b (list A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. Gale_Shapley2.Gale_Shapley P\<^sub>a P\<^sub>b = Some A \<and> Pref.matching P\<^sub>a (list A) {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b (list A) {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b (list A)
[PROOF STEP]
unfolding Gale_Shapley_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. (if Pref P\<^sub>a P\<^sub>b then Some (fst (Gale_Shapley2.gs (length P\<^sub>a) (pref_array P\<^sub>a) (rank_array P\<^sub>b))) else None) = Some A \<and> Pref.matching P\<^sub>a (list A) {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b (list A) {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b (list A)
[PROOF STEP]
using Pref.gs
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Pref ?P\<^sub>a ?P\<^sub>b; ?R = rank_array ?P\<^sub>b\<rbrakk> \<Longrightarrow> Gale_Shapley2.gs (length ?P\<^sub>a) (pref_array ?P\<^sub>a) ?R = (?A, ?B, ?M, ?ai) \<longrightarrow> Pref.matching ?P\<^sub>a (list ?A) {<length ?P\<^sub>a} \<and> Pref.stable ?P\<^sub>a ?P\<^sub>b (list ?A) {<length ?P\<^sub>a} \<and> Pref.opti\<^sub>a ?P\<^sub>a ?P\<^sub>b (list ?A)

goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. (if Pref P\<^sub>a P\<^sub>b then Some (fst (Gale_Shapley2.gs (length P\<^sub>a) (pref_array P\<^sub>a) (rank_array P\<^sub>b))) else None) = Some A \<and> Pref.matching P\<^sub>a (list A) {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b (list A) {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b (list A)
[PROOF STEP]
by (metis fst_conv surj_pair)


[STATEMENT]
lemma smallo_power: "n > 0 \<Longrightarrow> f \<in> o[F](g) \<Longrightarrow> (\<lambda>x. f x ^ n) \<in> o[F](\<lambda>x. g x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; f \<in> o[F](g)\<rbrakk> \<Longrightarrow> (\<lambda>x. f x ^ n) \<in> o[F](\<lambda>x. g x ^ n)
[PROOF STEP]
by (induction n rule: nat_induct_non_zero) (auto intro: landau_o.small.mult)


[STATEMENT]
lemma (in prob_space) exponential_distributed_variance:
  "0 < l \<Longrightarrow> distributed M lborel X (exponential_density l) \<Longrightarrow> variance X = 1 / l\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; distributed M lborel X (\<lambda>x. ennreal (exponential_density l x))\<rbrakk> \<Longrightarrow> expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = 1 / l\<^sup>2
[PROOF STEP]
using erlang_distributed_variance[of l X 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < l; distributed M lborel X (\<lambda>x. ennreal (exponential_density l x))\<rbrakk> \<Longrightarrow> expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = real (0 + 1) / l\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>0 < l; distributed M lborel X (\<lambda>x. ennreal (exponential_density l x))\<rbrakk> \<Longrightarrow> expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = 1 / l\<^sup>2
[PROOF STEP]
by simp


[STATEMENT]
lemma append_rows_mult_left_id2:
 assumes A: "(A::'a::comm_semiring_1 mat) \<in> carrier_mat a n"
   and B: "B \<in> carrier_mat b n"
   and C: "C = four_block_mat D (0\<^sub>m a b) (0\<^sub>m b a) (1\<^sub>m b)"
   and D: "D \<in> carrier_mat a a"
 shows "C * (A @\<^sub>r B) = (D * A) @\<^sub>r B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
have "(C * (A @\<^sub>r B))\<^sup>T = (A @\<^sub>r B)\<^sup>T * C\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (C * (A @\<^sub>r B))\<^sup>T = (A @\<^sub>r B)\<^sup>T * C\<^sup>T
[PROOF STEP]
by (rule transpose_mult, insert assms, auto)
[PROOF STATE]
proof (state)
this:
(C * (A @\<^sub>r B))\<^sup>T = (A @\<^sub>r B)\<^sup>T * C\<^sup>T

goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(C * (A @\<^sub>r B))\<^sup>T = (A @\<^sub>r B)\<^sup>T * C\<^sup>T

goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
have "... = (A\<^sup>T @\<^sub>c B\<^sup>T) * C\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A @\<^sub>r B)\<^sup>T * C\<^sup>T = (A\<^sup>T @\<^sub>c B\<^sup>T) * C\<^sup>T
[PROOF STEP]
by (metis A B transpose_mat_append_rows)
[PROOF STATE]
proof (state)
this:
(A @\<^sub>r B)\<^sup>T * C\<^sup>T = (A\<^sup>T @\<^sub>c B\<^sup>T) * C\<^sup>T

goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A @\<^sub>r B)\<^sup>T * C\<^sup>T = (A\<^sup>T @\<^sub>c B\<^sup>T) * C\<^sup>T

goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
have "... = (A\<^sup>T * D\<^sup>T @\<^sub>c B\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A\<^sup>T @\<^sub>c B\<^sup>T) * C\<^sup>T = A\<^sup>T * D\<^sup>T @\<^sub>c B\<^sup>T
[PROOF STEP]
by (rule append_cols_mult_right_id2, insert assms, auto)
[PROOF STATE]
proof (state)
this:
(A\<^sup>T @\<^sub>c B\<^sup>T) * C\<^sup>T = A\<^sup>T * D\<^sup>T @\<^sub>c B\<^sup>T

goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A\<^sup>T @\<^sub>c B\<^sup>T) * C\<^sup>T = A\<^sup>T * D\<^sup>T @\<^sub>c B\<^sup>T

goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
have "...\<^sup>T = (D * A) @\<^sub>r B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A\<^sup>T * D\<^sup>T @\<^sub>c B\<^sup>T)\<^sup>T = D * A @\<^sub>r B
[PROOF STEP]
by (metis A B D transpose_mult transpose_transpose mult_carrier_mat transpose_mat_append_rows)
[PROOF STATE]
proof (state)
this:
(A\<^sup>T * D\<^sup>T @\<^sub>c B\<^sup>T)\<^sup>T = D * A @\<^sub>r B

goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(C * (A @\<^sub>r B))\<^sup>T\<^sup>T = D * A @\<^sub>r B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(C * (A @\<^sub>r B))\<^sup>T\<^sup>T = D * A @\<^sub>r B

goal (1 subgoal):
 1. C * (A @\<^sub>r B) = D * A @\<^sub>r B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C * (A @\<^sub>r B) = D * A @\<^sub>r B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_over_degree_insertion :
  assumes lLength : "length L > var"
  assumes deg : "MPoly_Type.degree (p::real mpoly) var = d"
  shows "(\<Sum>i = 0..<(d+1). insertion (nth_default 0 (list_update L var x)) (isolate_variable_sparse p var i) * (x^i))
          = insertion (nth_default 0 (list_update L var x)) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i) * x ^ i) = insertion (nth_default 0 (L[var := x])) p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i) * x ^ i) = insertion (nth_default 0 (L[var := x])) p
[PROOF STEP]
have h1: "(p::real mpoly) = (\<Sum>i::nat \<le>(MPoly_Type.degree p var). isolate_variable_sparse p var i * (Var var)^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = (\<Sum>i\<le>MPoly_Type.degree p var. isolate_variable_sparse p var i * Var var ^ i)
[PROOF STEP]
using sum_over_zero
[PROOF STATE]
proof (prove)
using this:
?mp = (\<Sum>i\<le>MPoly_Type.degree ?mp ?x. isolate_variable_sparse ?mp ?x i * Var ?x ^ i)

goal (1 subgoal):
 1. p = (\<Sum>i\<le>MPoly_Type.degree p var. isolate_variable_sparse p var i * Var var ^ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = (\<Sum>i\<le>MPoly_Type.degree p var. isolate_variable_sparse p var i * Var var ^ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i) * x ^ i) = insertion (nth_default 0 (L[var := x])) p
[PROOF STEP]
have h2: "insertion (nth_default 0 (list_update L var x)) p =
    insertion (nth_default 0 (list_update L var x)) ((\<Sum>i::nat \<le> d. isolate_variable_sparse p var i * (Var var)^i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion (nth_default 0 (L[var := x])) p = insertion (nth_default 0 (L[var := x])) (\<Sum>i\<le>d. isolate_variable_sparse p var i * Var var ^ i)
[PROOF STEP]
using h1 deg
[PROOF STATE]
proof (prove)
using this:
p = (\<Sum>i\<le>MPoly_Type.degree p var. isolate_variable_sparse p var i * Var var ^ i)
MPoly_Type.degree p var = d

goal (1 subgoal):
 1. insertion (nth_default 0 (L[var := x])) p = insertion (nth_default 0 (L[var := x])) (\<Sum>i\<le>d. isolate_variable_sparse p var i * Var var ^ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insertion (nth_default 0 (L[var := x])) p = insertion (nth_default 0 (L[var := x])) (\<Sum>i\<le>d. isolate_variable_sparse p var i * Var var ^ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i) * x ^ i) = insertion (nth_default 0 (L[var := x])) p
[PROOF STEP]
have h3:  "insertion (nth_default 0 (list_update L var x)) p = (\<Sum>i = 0..<(d+1).  insertion (nth_default 0 (list_update L var x)) (isolate_variable_sparse p var i * (Var var)^i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion (nth_default 0 (L[var := x])) p = (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))
[PROOF STEP]
using h2 insertion_add_ind nth_default_def
[PROOF STATE]
proof (prove)
using this:
insertion (nth_default 0 (L[var := x])) p = insertion (nth_default 0 (L[var := x])) (\<Sum>i\<le>d. isolate_variable_sparse p var i * Var var ^ i)
insertion (nth_default (0::?'a) (?L[?var := ?x])) (\<Sum>i\<le>?d. isolate_variable_sparse ?p ?var i * Var ?var ^ i) = (\<Sum>i = 0..<?d + 1. insertion (nth_default (0::?'a) (?L[?var := ?x])) (isolate_variable_sparse ?p ?var i * Var ?var ^ i))
nth_default ?dflt ?xs ?n = (if ?n < length ?xs then ?xs ! ?n else ?dflt)

goal (1 subgoal):
 1. insertion (nth_default 0 (L[var := x])) p = (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
insertion (nth_default 0 (L[var := x])) p = (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i) * x ^ i) = insertion (nth_default 0 (L[var := x])) p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i) * x ^ i) = insertion (nth_default 0 (L[var := x])) p
[PROOF STEP]
using h3 insertion_var insertion_pow
[PROOF STATE]
proof (prove)
using this:
insertion (nth_default 0 (L[var := x])) p = (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i * Var var ^ i))
?var < length ?L \<Longrightarrow> insertion (nth_default (0::?'a) (?L[?var := ?x])) (Var ?var) = ?x
insertion ?f (?p ^ ?i) = insertion ?f ?p ^ ?i

goal (1 subgoal):
 1. (\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i) * x ^ i) = insertion (nth_default 0 (L[var := x])) p
[PROOF STEP]
by (metis (no_types, lifting) insertion_mult lLength sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<d + 1. insertion (nth_default 0 (L[var := x])) (isolate_variable_sparse p var i) * x ^ i) = insertion (nth_default 0 (L[var := x])) p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neq_funs_neq_images:
  fixes s
  assumes "\<forall>x. x \<in> s \<longrightarrow> (\<forall>y. y \<in> s \<longrightarrow> f1 x \<noteq> f2 y)" "\<exists>x. x \<in> s"
  shows "f1 ` s \<noteq> f2 ` s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f1 ` s \<noteq> f2 ` s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> s \<longrightarrow> (\<forall>y. y \<in> s \<longrightarrow> f1 x \<noteq> f2 y)
\<exists>x. x \<in> s

goal (1 subgoal):
 1. f1 ` s \<noteq> f2 ` s
[PROOF STEP]
by blast


[STATEMENT]
lemma transpose_four_block_mat: assumes *: "A \<in> carrier_mat nr1 nc1" "B \<in> carrier_mat nr1 nc2"
  "C \<in> carrier_mat nr2 nc1" "D \<in> carrier_mat nr2 nc2"
  shows "transpose_mat (four_block_mat A B C D) =
    four_block_mat (transpose_mat A) (transpose_mat C) (transpose_mat B) (transpose_mat D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_mat (four_block_mat A B C D) = four_block_mat (transpose_mat A) (transpose_mat C) (transpose_mat B) (transpose_mat D)
[PROOF STEP]
by (rule eq_matI, insert *, auto)


[STATEMENT]
lemma open_Collect_positive:
  fixes f :: "'a::topological_space \<Rightarrow> real"
  assumes f: "continuous_on s f"
  shows "\<exists>A. open A \<and> A \<inter> s = {x\<in>s. 0 < f x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A. open A \<and> A \<inter> s = {x \<in> s. 0 < f x}
[PROOF STEP]
using continuous_on_open_invariant[THEN iffD1, OF f, rule_format, of "{0 <..}"]
[PROOF STATE]
proof (prove)
using this:
open {0<..} \<Longrightarrow> \<exists>A. open A \<and> A \<inter> s = f -` {0<..} \<inter> s

goal (1 subgoal):
 1. \<exists>A. open A \<and> A \<inter> s = {x \<in> s. 0 < f x}
[PROOF STEP]
by (auto simp: Int_def field_simps)