[STATEMENT]
theorem CauchySchwarzReal:
  fixes x::vector
  assumes "vlen x = vlen y"
  shows "\<bar>x\<cdot>y\<bar> \<le> \<parallel>x\<parallel>*\<parallel>y\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar> \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar> \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>
[PROOF STEP]
have "\<bar>x\<cdot>y\<bar>^2 \<le> (\<parallel>x\<parallel>*\<parallel>y\<parallel>)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar>\<^sup>2 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar>\<^sup>2 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2
[PROOF STEP]
txt \<open>We can rewrite the goal in the following form ...\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar>\<^sup>2 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2
[PROOF STEP]
have "(\<parallel>x\<parallel>*\<parallel>y\<parallel>)^2 - \<bar>x\<cdot>y\<bar>^2 \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
obtain n where nx: "n = vlen x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. n = vlen x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = vlen x

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
with \<open>vlen x = vlen y\<close>
[PROOF STATE]
proof (chain)
picking this:
vlen x = vlen y
n = vlen x
[PROOF STEP]
have ny: "n = vlen y"
[PROOF STATE]
proof (prove)
using this:
vlen x = vlen y
n = vlen x

goal (1 subgoal):
 1. n = vlen y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = vlen y

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
n = vlen y

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
txt \<open>Some preliminary simplification rules.\<close>
[PROOF STATE]
proof (state)
this:
n = vlen y

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have "(\<Sum>j\<in>{1..n}. x\<^bsub>j\<^esub>^2) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
by (simp add: sum_nonneg)
[PROOF STATE]
proof (state)
this:
0 \<le> (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
hence xp: "(sqrt (\<Sum>j\<in>{1..n}. x\<^bsub>j\<^esub>^2))^2 = (\<Sum>j\<in>{1..n}. x\<^bsub>j\<^esub>^2)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. (sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
by (rule real_sqrt_pow2)
[PROOF STATE]
proof (state)
this:
(sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have "(\<Sum>j\<in>{1..n}. y\<^bsub>j\<^esub>^2) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
by (simp add: sum_nonneg)
[PROOF STATE]
proof (state)
this:
0 \<le> (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
hence yp: "(sqrt (\<Sum>j\<in>{1..n}. y\<^bsub>j\<^esub>^2))^2 = (\<Sum>j\<in>{1..n}. y\<^bsub>j\<^esub>^2)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. (sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
by (rule real_sqrt_pow2)
[PROOF STATE]
proof (state)
this:
(sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
txt \<open>The main result of this section is that \<open>(\<parallel>x\<parallel>*\<parallel>y\<parallel>)^2\<close> can be written as a double sum.\<close>
[PROOF STATE]
proof (state)
this:
(sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
          "(\<parallel>x\<parallel>*\<parallel>y\<parallel>)^2 = \<parallel>x\<parallel>^2 * \<parallel>y\<parallel>^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<parallel>x\<parallel>)\<^sup>2 * (\<parallel>y\<parallel>)\<^sup>2
[PROOF STEP]
by (simp add: real_sq_exp)
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<parallel>x\<parallel>)\<^sup>2 * (\<parallel>y\<parallel>)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<parallel>x\<parallel>)\<^sup>2 * (\<parallel>y\<parallel>)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
from nx ny
[PROOF STATE]
proof (chain)
picking this:
n = vlen x
n = vlen y
[PROOF STEP]
have
          "\<dots> = (sqrt (\<Sum>j\<in>{1..n}. x\<^bsub>j\<^esub>^2))^2 * (sqrt (\<Sum>j\<in>{1..n}. y\<^bsub>j\<^esub>^2))^2"
[PROOF STATE]
proof (prove)
using this:
n = vlen x
n = vlen y

goal (1 subgoal):
 1. (\<parallel>x\<parallel>)\<^sup>2 * (\<parallel>y\<parallel>)\<^sup>2 = (sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 * (sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2
[PROOF STEP]
unfolding norm_def
[PROOF STATE]
proof (prove)
using this:
n = vlen x
n = vlen y

goal (1 subgoal):
 1. (sqrt (\<Sum>j = 1..vlen x. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 * (sqrt (\<Sum>j = 1..vlen y. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 * (sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel>)\<^sup>2 * (\<parallel>y\<parallel>)\<^sup>2 = (sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 * (sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel>)\<^sup>2 * (\<parallel>y\<parallel>)\<^sup>2 = (sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 * (sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
from xp yp
[PROOF STATE]
proof (chain)
picking this:
(sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2)
(sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
have
          "\<dots> = (\<Sum>j\<in>{1..n}. x\<^bsub>j\<^esub>^2)*(\<Sum>j\<in>{1..n}. y\<^bsub>j\<^esub>^2)"
[PROOF STATE]
proof (prove)
using this:
(sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2)
(sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. (sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 * (sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2) * (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 * (sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2) * (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(sqrt (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 * (sqrt (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2))\<^sup>2 = (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2) * (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
from sum_product
[PROOF STATE]
proof (chain)
picking this:
sum ?f ?A * sum ?g ?B = (\<Sum>i\<in>?A. \<Sum>j\<in>?B. ?f i * ?g j)
[PROOF STEP]
have
          "\<dots> = (\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>^2)*(y\<^bsub>j\<^esub>^2)))"
[PROOF STATE]
proof (prove)
using this:
sum ?f ?A * sum ?g ?B = (\<Sum>i\<in>?A. \<Sum>j\<in>?B. ?f i * ?g j)

goal (1 subgoal):
 1. (\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2) * (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2) = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 1..n. (x\<^bsub>j\<^esub>)\<^sup>2) * (\<Sum>j = 1..n. (y\<^bsub>j\<^esub>)\<^sup>2) = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
have
          "(\<parallel>x\<parallel>*\<parallel>y\<parallel>)^2 = (\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>^2)*(y\<^bsub>j\<^esub>^2)))"
[PROOF STATE]
proof (prove)
using this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
txt \<open>We also show that \<open>\<bar>x\<cdot>y\<bar>^2\<close> can be expressed as a double sum.\<close>
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
          "\<bar>x\<cdot>y\<bar>^2 = (x\<cdot>y)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar>\<^sup>2 = (x \<cdot> y)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>x \<cdot> y\<bar>\<^sup>2 = (x \<cdot> y)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>x \<cdot> y\<bar>\<^sup>2 = (x \<cdot> y)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
from nx
[PROOF STATE]
proof (chain)
picking this:
n = vlen x
[PROOF STEP]
have
          "\<dots> = (\<Sum>j\<in>{1..n}. x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)^2"
[PROOF STATE]
proof (prove)
using this:
n = vlen x

goal (1 subgoal):
 1. (x \<cdot> y)\<^sup>2 = (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)\<^sup>2
[PROOF STEP]
unfolding dot_def
[PROOF STATE]
proof (prove)
using this:
n = vlen x

goal (1 subgoal):
 1. (\<Sum>j = 1..vlen x. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)\<^sup>2 = (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<cdot> y)\<^sup>2 = (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<cdot> y)\<^sup>2 = (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
from real_sq
[PROOF STATE]
proof (chain)
picking this:
?a * ?a = ?a\<^sup>2
[PROOF STEP]
have
          "\<dots> = (\<Sum>j\<in>{1..n}. x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)*(\<Sum>j\<in>{1..n}. x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
?a * ?a = ?a\<^sup>2

goal (1 subgoal):
 1. (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)\<^sup>2 = (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>) * (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)\<^sup>2 = (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>) * (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)\<^sup>2 = (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>) * (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
from sum_product
[PROOF STATE]
proof (chain)
picking this:
sum ?f ?A * sum ?g ?B = (\<Sum>i\<in>?A. \<Sum>j\<in>?B. ?f i * ?g j)
[PROOF STEP]
have
          "\<dots> = (\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)))"
[PROOF STATE]
proof (prove)
using this:
sum ?f ?A * sum ?g ?B = (\<Sum>i\<in>?A. \<Sum>j\<in>?B. ?f i * ?g j)

goal (1 subgoal):
 1. (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>) * (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>) = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>) * (\<Sum>j = 1..n. x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>) = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))
[PROOF STEP]
have
          "\<bar>x\<cdot>y\<bar>^2 = (\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)))"
[PROOF STATE]
proof (prove)
using this:
\<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
txt \<open>We now manipulate the double sum expressions to get the
      required inequality.\<close>
[PROOF STATE]
proof (state)
this:
\<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)
\<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))
[PROOF STEP]
have
        "(\<parallel>x\<parallel>*\<parallel>y\<parallel>)^2 - \<bar>x\<cdot>y\<bar>^2 =
         (\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>^2)*(y\<^bsub>j\<^esub>^2))) -
         (\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)))"
[PROOF STATE]
proof (prove)
using this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2)
\<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2 = (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
        "\<dots> =
         (\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. ((x\<^bsub>k\<^esub>^2*y\<^bsub>j\<^esub>^2) + (x\<^bsub>j\<^esub>^2*y\<^bsub>k\<^esub>^2))/2)) -
         (\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))
[PROOF STEP]
by (simp only: double_sum_aux)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
        "\<dots> =
         (\<Sum>k\<in>{1..n}.  (\<Sum>j\<in>{1..n}. ((x\<^bsub>k\<^esub>^2*y\<^bsub>j\<^esub>^2) + (x\<^bsub>j\<^esub>^2*y\<^bsub>k\<^esub>^2))/2 - (x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2 - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))
[PROOF STEP]
by (auto simp add: sum_subtractf)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2 - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2) - (\<Sum>k = 1..n. \<Sum>j = 1..n. x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2 - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
        "\<dots> =
         (\<Sum>k\<in>{1..n}.  (\<Sum>j\<in>{1..n}. (inverse 2)*2*
         (((x\<^bsub>k\<^esub>^2*y\<^bsub>j\<^esub>^2) + (x\<^bsub>j\<^esub>^2*y\<^bsub>k\<^esub>^2))*(1/2) - (x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2 - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2 - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) / 2 - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
        "\<dots> =
         (\<Sum>k\<in>{1..n}.  (\<Sum>j\<in>{1..n}. (inverse 2)*(2*
        (((x\<^bsub>k\<^esub>^2*y\<^bsub>j\<^esub>^2) + (x\<^bsub>j\<^esub>^2*y\<^bsub>k\<^esub>^2))*(1/2) - (x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))))
[PROOF STEP]
by (simp only: mult.assoc)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
        "\<dots> =
         (\<Sum>k\<in>{1..n}.  (\<Sum>j\<in>{1..n}. (inverse 2)*
        ((((x\<^bsub>k\<^esub>^2*y\<^bsub>j\<^esub>^2) + (x\<^bsub>j\<^esub>^2*y\<^bsub>k\<^esub>^2))*2*(inverse 2) - 2*(x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * 2 * inverse 2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))
[PROOF STEP]
by (auto simp add: distrib_right mult.assoc ac_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * 2 * inverse 2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * (1 / 2) - x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub> * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * 2 * inverse 2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
        "\<dots> =
        (\<Sum>k\<in>{1..n}.  (\<Sum>j\<in>{1..n}. (inverse 2)*
        ((((x\<^bsub>k\<^esub>^2*y\<^bsub>j\<^esub>^2) + (x\<^bsub>j\<^esub>^2*y\<^bsub>k\<^esub>^2)) - 2*(x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * 2 * inverse 2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))
[PROOF STEP]
by (simp only: mult.assoc, simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * 2 * inverse 2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * (((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2) * 2 * inverse 2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
        "\<dots> =
         (inverse 2)*(\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}.
         (((x\<^bsub>k\<^esub>^2*y\<^bsub>j\<^esub>^2) + (x\<^bsub>j\<^esub>^2*y\<^bsub>k\<^esub>^2)) - 2*(x\<^bsub>k\<^esub>*y\<^bsub>k\<^esub>)*(x\<^bsub>j\<^esub>*y\<^bsub>j\<^esub>))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))
[PROOF STEP]
by (simp only: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. \<Sum>j = 1..n. inverse 2 * ((x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))) = inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>))

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have
        "\<dots> =
         (inverse 2)*(\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>*y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub>*y\<^bsub>k\<^esub>)^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)
[PROOF STEP]
by (simp only: power2_diff real_sq_exp, auto simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub>)\<^sup>2 * (y\<^bsub>j\<^esub>)\<^sup>2 + (x\<^bsub>j\<^esub>)\<^sup>2 * (y\<^bsub>k\<^esub>)\<^sup>2 - 2 * (x\<^bsub>k\<^esub> * y\<^bsub>k\<^esub>) * (x\<^bsub>j\<^esub> * y\<^bsub>j\<^esub>)) = inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
have "\<dots> \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)
[PROOF STEP]
have "(\<Sum>k\<in>{1..n}. (\<Sum>j\<in>{1..n}. (x\<^bsub>k\<^esub>*y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub>*y\<^bsub>k\<^esub>)^2)) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)
[PROOF STEP]
by (simp add: sum_nonneg)
[PROOF STATE]
proof (state)
this:
0 \<le> (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> inverse 2 * (\<Sum>k = 1..n. \<Sum>j = 1..n. (x\<^bsub>k\<^esub> * y\<^bsub>j\<^esub> - x\<^bsub>j\<^esub> * y\<^bsub>k\<^esub>)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2
[PROOF STEP]
show "(\<parallel>x\<parallel>*\<parallel>y\<parallel>)^2 - \<bar>x\<cdot>y\<bar>^2 \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2

goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar>\<^sup>2 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2 - \<bar>x \<cdot> y\<bar>\<^sup>2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>x \<cdot> y\<bar>\<^sup>2 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2

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

goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar> \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>
[PROOF STEP]
have "0 \<le> \<parallel>x\<parallel>*\<parallel>y\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>
[PROOF STEP]
by (auto simp add: norm_pos)
[PROOF STATE]
proof (state)
this:
0 \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>

goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar> \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<bar>x \<cdot> y\<bar>\<^sup>2 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2
0 \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>x \<cdot> y\<bar>\<^sup>2 \<le> (\<parallel>x\<parallel> * \<parallel>y\<parallel>)\<^sup>2
0 \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>

goal (1 subgoal):
 1. \<bar>x \<cdot> y\<bar> \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>
[PROOF STEP]
by (rule power2_le_imp_le)
[PROOF STATE]
proof (state)
this:
\<bar>x \<cdot> y\<bar> \<le> \<parallel>x\<parallel> * \<parallel>y\<parallel>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_at_right_to_0:
  "eventually P (at_right a) \<longleftrightarrow> eventually (\<lambda>x. P (x + a)) (at_right 0)"
  for a :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_right a) = (\<forall>\<^sub>F x in at_right 0. P (x + a))
[PROOF STEP]
unfolding at_right_to_0[of a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (filtermap (\<lambda>x. x + a) (at_right 0)) = (\<forall>\<^sub>F x in at_right 0. P (x + a))
[PROOF STEP]
by (simp add: eventually_filtermap)


[STATEMENT]
lemma birkhoff_sum_mono:
  fixes f g::"_ \<Rightarrow> real"
  assumes "\<And>x. f x \<le> g x"
  shows "birkhoff_sum f n x \<le> birkhoff_sum g n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum f n x \<le> birkhoff_sum g n x
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. f ((T ^^ i) x)) \<le> (\<Sum>i<n. g ((T ^^ i) x))
[PROOF STEP]
by (simp add: assms sum_mono)


[STATEMENT]
lemma finite_natarray1: "finite {x. x < (n::nat)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x. x < n}
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {x. x < 0}
 2. \<And>n. finite {x. x < n} \<Longrightarrow> finite {x. x < Suc n}
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. finite {x. x < n} \<Longrightarrow> finite {x. x < Suc n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. finite {x. x < n} \<Longrightarrow> finite {x. x < Suc n}
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. finite {x. x < n} \<Longrightarrow> finite {x. x < Suc n}
[PROOF STEP]
have "{x. x < Suc n} = insert n {x. x < n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x < Suc n} = insert n {x. x < n}
[PROOF STEP]
by (rule set_eqI, simp, arith)
[PROOF STATE]
proof (state)
this:
{x. x < Suc n} = insert n {x. x < n}

goal (1 subgoal):
 1. \<And>n. finite {x. x < n} \<Longrightarrow> finite {x. x < Suc n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{x. x < Suc n} = insert n {x. x < n}

goal (1 subgoal):
 1. \<And>n. finite {x. x < n} \<Longrightarrow> finite {x. x < Suc n}
[PROOF STEP]
assume "finite {x. x < n}"
[PROOF STATE]
proof (state)
this:
finite {x. x < n}

goal (1 subgoal):
 1. \<And>n. finite {x. x < n} \<Longrightarrow> finite {x. x < Suc n}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{x. x < Suc n} = insert n {x. x < n}
finite {x. x < n}
[PROOF STEP]
show "finite {x. x < Suc n}"
[PROOF STATE]
proof (prove)
using this:
{x. x < Suc n} = insert n {x. x < n}
finite {x. x < n}

goal (1 subgoal):
 1. finite {x. x < Suc n}
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
finite {x. x < Suc n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_mset_dvd_prod_mset_primes_iff:
  assumes "\<And>x. x \<in># A \<Longrightarrow> prime x" "\<And>x. x \<in># B \<Longrightarrow> prime x"
  shows   "prod_mset A dvd prod_mset B \<longleftrightarrow> A \<subseteq># B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>\<^sub># A dvd \<Prod>\<^sub># B) = (A \<subseteq># B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x1 \<in># A \<Longrightarrow> prime ?x1
?x1 \<in># B \<Longrightarrow> prime ?x1

goal (1 subgoal):
 1. (\<Prod>\<^sub># A dvd \<Prod>\<^sub># B) = (A \<subseteq># B)
[PROOF STEP]
by (auto intro: prod_mset_subset_imp_dvd prod_mset_primes_dvd_imp_subset)


[STATEMENT]
lemma quadratic_eq_zeroes_iff:
  assumes D : "D = b\<^sup>2 - 4 * a * c"
  assumes x1: "x\<^sub>1 = (-b + sqrt D) / (2 * a)"
  assumes x2: "x\<^sub>2 = (-b - sqrt D) / (2 * a)"
  assumes a : "a \<noteq> 0"
  shows "a * x\<^sup>2 + b * x + c = 0 \<longleftrightarrow> (D \<ge> 0 \<and> (x = x\<^sub>1 \<or> x = x\<^sub>2))" (is "?z \<longleftrightarrow> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * x\<^sup>2 + b * x + c = 0) = (0 \<le> D \<and> (x = x\<^sub>1 \<or> x = x\<^sub>2))
[PROOF STEP]
using quadratic_eq_factoring[OF D _ x1 x2 a, of x] discriminant[of a x b c] a
[PROOF STATE]
proof (prove)
using this:
0 \<le> D \<Longrightarrow> a * x\<^sup>2 + b * x + c = a * (x - x\<^sub>1) * (x - x\<^sub>2)
a * x\<^sup>2 + b * x + c = 0 \<Longrightarrow> 0 \<le> b\<^sup>2 - 4 * a * c
a \<noteq> 0

goal (1 subgoal):
 1. (a * x\<^sup>2 + b * x + c = 0) = (0 \<le> D \<and> (x = x\<^sub>1 \<or> x = x\<^sub>2))
[PROOF STEP]
by (auto simp: D)


[STATEMENT]
lemma fixes V W :: "'a vec set"
  shows
    card_le_dim_span:
    "V \<subseteq> carrier_vec n \<Longrightarrow> V \<subseteq> span W \<Longrightarrow> lin_indpt V \<Longrightarrow> card V \<le> dim_span W" and
    card_eq_dim_span_imp_same_span:
    "W \<subseteq> carrier_vec n \<Longrightarrow> V \<subseteq> span W \<Longrightarrow> lin_indpt V \<Longrightarrow> card V = dim_span W \<Longrightarrow> span V = span W" and
    same_span_imp_card_eq_dim_span:
    "V \<subseteq> carrier_vec n \<Longrightarrow> W \<subseteq> carrier_vec n \<Longrightarrow> span V = span W \<Longrightarrow> lin_indpt V \<Longrightarrow> card V = dim_span W" and
    dim_span_cong:
    "span V = span W \<Longrightarrow> dim_span V = dim_span W" and
    ex_basis_span:
    "V \<subseteq> carrier_vec n \<Longrightarrow> \<exists> W. W \<subseteq> carrier_vec n \<and> lin_indpt W \<and> span V = span W \<and> dim_span V = card W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W) &&& (\<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W)) &&& (\<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W) &&& (local.span V = local.span W \<Longrightarrow> dim_span V = dim_span W) &&& (V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. local.span V = local.span W \<Longrightarrow> dim_span V = dim_span W
 5. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
show cong: "\<And> V W. span V = span W \<Longrightarrow> dim_span V = dim_span W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>V W. local.span V = local.span W \<Longrightarrow> dim_span V = dim_span W
[PROOF STEP]
unfolding dim_span_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>V W. local.span V = local.span W \<Longrightarrow> Max (card ` {Va. Va \<subseteq> carrier_vec n \<and> Va \<subseteq> local.span V \<and> lin_indpt Va}) = Max (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.span ?V1 = local.span ?W1 \<Longrightarrow> dim_span ?V1 = dim_span ?W1

goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
local.span ?V1 = local.span ?W1 \<Longrightarrow> dim_span ?V1 = dim_span ?W1

goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
fix W :: "'a vec set"
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
let ?M = "{V. V \<subseteq> carrier_vec n \<and> V \<subseteq> span W \<and> lin_indpt V}"
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
have "card ` ?M \<subseteq> {0 .. n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<subseteq> {0..n}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<Longrightarrow> x \<in> {0..n}
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<Longrightarrow> x \<in> {0..n}
[PROOF STEP]
assume "k \<in> card ` ?M"
[PROOF STATE]
proof (state)
this:
k \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}

goal (1 subgoal):
 1. \<And>x. x \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<Longrightarrow> x \<in> {0..n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}
[PROOF STEP]
obtain V where V: "V \<subseteq> carrier_vec n \<and> V \<subseteq> span W \<and> lin_indpt V"
        and k: "k = card V"
[PROOF STATE]
proof (prove)
using this:
k \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}

goal (1 subgoal):
 1. (\<And>V. \<lbrakk>V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V; k = card V\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V
k = card V

goal (1 subgoal):
 1. \<And>x. x \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<Longrightarrow> x \<in> {0..n}
[PROOF STEP]
from V
[PROOF STATE]
proof (chain)
picking this:
V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V
[PROOF STEP]
have "card V \<le> n"
[PROOF STATE]
proof (prove)
using this:
V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V

goal (1 subgoal):
 1. card V \<le> n
[PROOF STEP]
using dim_is_n li_le_dim
[PROOF STATE]
proof (prove)
using this:
V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V
local.dim = n
\<lbrakk>fin_dim; ?A \<subseteq> carrier_vec n; lin_indpt ?A\<rbrakk> \<Longrightarrow> finite ?A
\<lbrakk>fin_dim; ?A \<subseteq> carrier_vec n; lin_indpt ?A\<rbrakk> \<Longrightarrow> card ?A \<le> local.dim

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

goal (1 subgoal):
 1. \<And>x. x \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<Longrightarrow> x \<in> {0..n}
[PROOF STEP]
with k
[PROOF STATE]
proof (chain)
picking this:
k = card V
card V \<le> n
[PROOF STEP]
show "k \<in> {0 .. n}"
[PROOF STATE]
proof (prove)
using this:
k = card V
card V \<le> n

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<subseteq> {0..n}

goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
from finite_subset[OF this]
[PROOF STATE]
proof (chain)
picking this:
finite {0..n} \<Longrightarrow> finite (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V})
[PROOF STEP]
have fin: "finite (card ` ?M)"
[PROOF STATE]
proof (prove)
using this:
finite {0..n} \<Longrightarrow> finite (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V})

goal (1 subgoal):
 1. finite (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V})

goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
have "{} \<in> ?M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {} \<in> {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}
[PROOF STEP]
by (auto simp: span_empty span_zero)
[PROOF STATE]
proof (state)
this:
{} \<in> {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}

goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
from imageI[OF this, of card]
[PROOF STATE]
proof (chain)
picking this:
card {} \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}
[PROOF STEP]
have "0 \<in> card ` ?M"
[PROOF STATE]
proof (prove)
using this:
card {} \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}

goal (1 subgoal):
 1. 0 \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}

goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
hence Mempty: "card ` ?M \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
0 \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}

goal (1 subgoal):
 1. card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<noteq> {}

goal (4 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
 2. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 3. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 4. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
from Max_ge[OF fin, folded dim_span_def]
[PROOF STATE]
proof (chain)
picking this:
?x \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<Longrightarrow> ?x \<le> dim_span W
[PROOF STEP]
show "\<And> V :: 'a vec set. V \<subseteq> carrier_vec n \<Longrightarrow> V \<subseteq> span W \<Longrightarrow> lin_indpt V \<Longrightarrow> card V \<le> dim_span W"
[PROOF STATE]
proof (prove)
using this:
?x \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<Longrightarrow> ?x \<le> dim_span W

goal (1 subgoal):
 1. \<And>V. \<lbrakk>V \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V \<le> dim_span W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?V1 \<subseteq> carrier_vec n; ?V1 \<subseteq> local.span W; lin_indpt ?V1\<rbrakk> \<Longrightarrow> card ?V1 \<le> dim_span W

goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
note this fin Mempty
[PROOF STATE]
proof (state)
this:
\<lbrakk>?V1 \<subseteq> carrier_vec n; ?V1 \<subseteq> local.span W; lin_indpt ?V1\<rbrakk> \<Longrightarrow> card ?V1 \<le> dim_span W
finite (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V})
card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V} \<noteq> {}

goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?V1 \<subseteq> carrier_vec n; ?V1 \<subseteq> local.span ?Wa4; lin_indpt ?V1\<rbrakk> \<Longrightarrow> card ?V1 \<le> dim_span ?Wa4
finite (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span ?Wa4 \<and> lin_indpt V})
card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span ?Wa4 \<and> lin_indpt V} \<noteq> {}

goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
note part1 = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?V1 \<subseteq> carrier_vec n; ?V1 \<subseteq> local.span ?Wa4; lin_indpt ?V1\<rbrakk> \<Longrightarrow> card ?V1 \<le> dim_span ?Wa4
finite (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span ?Wa4 \<and> lin_indpt V})
card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span ?Wa4 \<and> lin_indpt V} \<noteq> {}

goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?V1 \<subseteq> carrier_vec n; ?V1 \<subseteq> local.span ?Wa4; lin_indpt ?V1\<rbrakk> \<Longrightarrow> card ?V1 \<le> dim_span ?Wa4
finite (card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span ?Wa4 \<and> lin_indpt V})
card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span ?Wa4 \<and> lin_indpt V} \<noteq> {}

goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
fix V W :: "'a vec set"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
assume  W: "W \<subseteq> carrier_vec n"
      and VsW: "V \<subseteq> span W" and linV: "lin_indpt V" and card: "card V = dim_span W"
[PROOF STATE]
proof (state)
this:
W \<subseteq> carrier_vec n
V \<subseteq> local.span W
lin_indpt V
card V = dim_span W

goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
from W VsW
[PROOF STATE]
proof (chain)
picking this:
W \<subseteq> carrier_vec n
V \<subseteq> local.span W
[PROOF STEP]
have V: "V \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
W \<subseteq> carrier_vec n
V \<subseteq> local.span W

goal (1 subgoal):
 1. V \<subseteq> carrier_vec n
[PROOF STEP]
using span_mem[OF W]
[PROOF STATE]
proof (prove)
using this:
W \<subseteq> carrier_vec n
V \<subseteq> local.span W
?u \<in> W \<Longrightarrow> ?u \<in> local.span W

goal (1 subgoal):
 1. V \<subseteq> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V \<subseteq> carrier_vec n

goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
from Max_in[OF part1(2,3), folded dim_span_def, of W]
[PROOF STATE]
proof (chain)
picking this:
dim_span W \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}
[PROOF STEP]
obtain WW where WW: "WW \<subseteq> carrier_vec n" "WW \<subseteq> span W" "lin_indpt WW"
      and id: "dim_span W = card WW"
[PROOF STATE]
proof (prove)
using this:
dim_span W \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}

goal (1 subgoal):
 1. (\<And>WW. \<lbrakk>WW \<subseteq> carrier_vec n; WW \<subseteq> local.span W; lin_indpt WW; dim_span W = card WW\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
WW \<subseteq> carrier_vec n
WW \<subseteq> local.span W
lin_indpt WW
dim_span W = card WW

goal (3 subgoals):
 1. \<lbrakk>W \<subseteq> carrier_vec n; V \<subseteq> local.span W; lin_indpt V; card V = dim_span W\<rbrakk> \<Longrightarrow> local.span V = local.span W
 2. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 3. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
show "span V = span W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span V = local.span W
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
from VsW V W
[PROOF STATE]
proof (chain)
picking this:
V \<subseteq> local.span W
V \<subseteq> carrier_vec n
W \<subseteq> carrier_vec n
[PROOF STEP]
have sub: "span V \<subseteq> span W"
[PROOF STATE]
proof (prove)
using this:
V \<subseteq> local.span W
V \<subseteq> carrier_vec n
W \<subseteq> carrier_vec n

goal (1 subgoal):
 1. local.span V \<subseteq> local.span W
[PROOF STEP]
using span_subsetI
[PROOF STATE]
proof (prove)
using this:
V \<subseteq> local.span W
V \<subseteq> carrier_vec n
W \<subseteq> carrier_vec n
\<lbrakk>?ws \<subseteq> carrier_vec n; ?us \<subseteq> local.span ?ws\<rbrakk> \<Longrightarrow> local.span ?us \<subseteq> local.span ?ws

goal (1 subgoal):
 1. local.span V \<subseteq> local.span W
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
local.span V \<subseteq> local.span W

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
assume "span V \<noteq> span W"
[PROOF STATE]
proof (state)
this:
local.span V \<noteq> local.span W

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
with sub
[PROOF STATE]
proof (chain)
picking this:
local.span V \<subseteq> local.span W
local.span V \<noteq> local.span W
[PROOF STEP]
obtain w where wW: "w \<in> span W" and wsV: "w \<notin> span V"
[PROOF STATE]
proof (prove)
using this:
local.span V \<subseteq> local.span W
local.span V \<noteq> local.span W

goal (1 subgoal):
 1. (\<And>w. \<lbrakk>w \<in> local.span W; w \<notin> local.span V\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<in> local.span W
w \<notin> local.span V

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
from wW W
[PROOF STATE]
proof (chain)
picking this:
w \<in> local.span W
W \<subseteq> carrier_vec n
[PROOF STEP]
have w: "w \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
w \<in> local.span W
W \<subseteq> carrier_vec n

goal (1 subgoal):
 1. w \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<in> carrier_vec n

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
from linV V
[PROOF STATE]
proof (chain)
picking this:
lin_indpt V
V \<subseteq> carrier_vec n
[PROOF STEP]
have finV: "finite V"
[PROOF STATE]
proof (prove)
using this:
lin_indpt V
V \<subseteq> carrier_vec n

goal (1 subgoal):
 1. finite V
[PROOF STEP]
using fin_dim fin_dim_li_fin
[PROOF STATE]
proof (prove)
using this:
lin_indpt V
V \<subseteq> carrier_vec n
fin_dim
\<lbrakk>fin_dim; lin_indpt ?A; ?A \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> finite ?A

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

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
from wsV span_mem[OF V, of w]
[PROOF STATE]
proof (chain)
picking this:
w \<notin> local.span V
w \<in> V \<Longrightarrow> w \<in> local.span V
[PROOF STEP]
have wV: "w \<notin> V"
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span V
w \<in> V \<Longrightarrow> w \<in> local.span V

goal (1 subgoal):
 1. w \<notin> V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<notin> V

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
let ?X = "insert w V"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
have "card ?X = Suc (card V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert w V) = Suc (card V)
[PROOF STEP]
using wV finV
[PROOF STATE]
proof (prove)
using this:
w \<notin> V
finite V

goal (1 subgoal):
 1. card (insert w V) = Suc (card V)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (insert w V) = Suc (card V)

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
hence gt: "card ?X > dim_span W"
[PROOF STATE]
proof (prove)
using this:
card (insert w V) = Suc (card V)

goal (1 subgoal):
 1. dim_span W < card (insert w V)
[PROOF STEP]
unfolding card
[PROOF STATE]
proof (prove)
using this:
card (insert w V) = Suc (dim_span W)

goal (1 subgoal):
 1. dim_span W < card (insert w V)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_span W < card (insert w V)

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
have linX: "lin_indpt ?X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (insert w V)
[PROOF STEP]
using lin_dep_iff_in_span[OF V linV w wV] wsV
[PROOF STATE]
proof (prove)
using this:
(w \<in> local.span V) = lin_dep (V \<union> {w})
w \<notin> local.span V

goal (1 subgoal):
 1. lin_indpt (insert w V)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lin_indpt (insert w V)

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
have XW: "?X \<subseteq> span W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert w V \<subseteq> local.span W
[PROOF STEP]
using wW VsW
[PROOF STATE]
proof (prove)
using this:
w \<in> local.span W
V \<subseteq> local.span W

goal (1 subgoal):
 1. insert w V \<subseteq> local.span W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert w V \<subseteq> local.span W

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
from part1(1)[OF _ XW linX] w V
[PROOF STATE]
proof (chain)
picking this:
insert w V \<subseteq> carrier_vec n \<Longrightarrow> card (insert w V) \<le> dim_span W
w \<in> carrier_vec n
V \<subseteq> carrier_vec n
[PROOF STEP]
have "card ?X \<le> dim_span W"
[PROOF STATE]
proof (prove)
using this:
insert w V \<subseteq> carrier_vec n \<Longrightarrow> card (insert w V) \<le> dim_span W
w \<in> carrier_vec n
V \<subseteq> carrier_vec n

goal (1 subgoal):
 1. card (insert w V) \<le> dim_span W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (insert w V) \<le> dim_span W

goal (1 subgoal):
 1. local.span V \<noteq> local.span W \<Longrightarrow> False
[PROOF STEP]
with gt
[PROOF STATE]
proof (chain)
picking this:
dim_span W < card (insert w V)
card (insert w V) \<le> dim_span W
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
dim_span W < card (insert w V)
card (insert w V) \<le> dim_span W

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.span V = local.span W

goal (2 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 2. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?Wa3 \<subseteq> carrier_vec n; ?Va3 \<subseteq> local.span ?Wa3; lin_indpt ?Va3; card ?Va3 = dim_span ?Wa3\<rbrakk> \<Longrightarrow> local.span ?Va3 = local.span ?Wa3

goal (2 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 2. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
note card_dim_span = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?Wa3 \<subseteq> carrier_vec n; ?Va3 \<subseteq> local.span ?Wa3; lin_indpt ?Va3; card ?Va3 = dim_span ?Wa3\<rbrakk> \<Longrightarrow> local.span ?Va3 = local.span ?Wa3

goal (2 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 2. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?Wa3 \<subseteq> carrier_vec n; ?Va3 \<subseteq> local.span ?Wa3; lin_indpt ?Va3; card ?Va3 = dim_span ?Wa3\<rbrakk> \<Longrightarrow> local.span ?Va3 = local.span ?Wa3

goal (2 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 2. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
fix V :: "'a vec set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 2. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
assume V: "V \<subseteq> carrier_vec n"
[PROOF STATE]
proof (state)
this:
V \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 2. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
from Max_in[OF part1(2,3), folded dim_span_def, of V]
[PROOF STATE]
proof (chain)
picking this:
dim_span V \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span V \<and> lin_indpt V}
[PROOF STEP]
obtain W where W: "W \<subseteq> carrier_vec n" "W \<subseteq> span V" "lin_indpt W"
      and idW: "card W = dim_span V"
[PROOF STATE]
proof (prove)
using this:
dim_span V \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span V \<and> lin_indpt V}

goal (1 subgoal):
 1. (\<And>W. \<lbrakk>W \<subseteq> carrier_vec n; W \<subseteq> local.span V; lin_indpt W; card W = dim_span V\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
W \<subseteq> carrier_vec n
W \<subseteq> local.span V
lin_indpt W
card W = dim_span V

goal (2 subgoals):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
 2. V \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
show "\<exists> W. W \<subseteq> carrier_vec n \<and> lin_indpt W \<and> span V = span W \<and> dim_span V = card W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W
[PROOF STEP]
proof (intro exI[of _ W] conjI W idW[symmetric])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span V = local.span W
[PROOF STEP]
from card_dim_span[OF V(1) W(2-3) idW]
[PROOF STATE]
proof (chain)
picking this:
local.span W = local.span V
[PROOF STEP]
show "span V = span W"
[PROOF STATE]
proof (prove)
using this:
local.span W = local.span V

goal (1 subgoal):
 1. local.span V = local.span W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.span V = local.span W

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span V = local.span W \<and> dim_span V = card W

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?Va3 \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span ?Va3 = local.span W \<and> dim_span ?Va3 = card W

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?Va3 \<subseteq> carrier_vec n \<Longrightarrow> \<exists>W\<subseteq>carrier_vec n. lin_indpt W \<and> local.span ?Va3 = local.span W \<and> dim_span ?Va3 = card W

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
fix V W
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
assume V: "V \<subseteq> carrier_vec n"
      and W: "W \<subseteq> carrier_vec n"
      and span: "span V = span W"
      and lin: "lin_indpt V"
[PROOF STATE]
proof (state)
this:
V \<subseteq> carrier_vec n
W \<subseteq> carrier_vec n
local.span V = local.span W
lin_indpt V

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
from Max_in[OF part1(2,3), folded dim_span_def, of W]
[PROOF STATE]
proof (chain)
picking this:
dim_span W \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}
[PROOF STEP]
obtain WW where WW: "WW \<subseteq> carrier_vec n" "WW \<subseteq> span W" "lin_indpt WW"
      and idWW: "card WW = dim_span W"
[PROOF STATE]
proof (prove)
using this:
dim_span W \<in> card ` {V. V \<subseteq> carrier_vec n \<and> V \<subseteq> local.span W \<and> lin_indpt V}

goal (1 subgoal):
 1. (\<And>WW. \<lbrakk>WW \<subseteq> carrier_vec n; WW \<subseteq> local.span W; lin_indpt WW; card WW = dim_span W\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
WW \<subseteq> carrier_vec n
WW \<subseteq> local.span W
lin_indpt WW
card WW = dim_span W

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
from card_dim_span[OF W WW(2-3) idWW] span
[PROOF STATE]
proof (chain)
picking this:
local.span WW = local.span W
local.span V = local.span W
[PROOF STEP]
have spanWW: "span WW = span V"
[PROOF STATE]
proof (prove)
using this:
local.span WW = local.span W
local.span V = local.span W

goal (1 subgoal):
 1. local.span WW = local.span V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.span WW = local.span V

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
from span
[PROOF STATE]
proof (chain)
picking this:
local.span V = local.span W
[PROOF STEP]
have "V \<subseteq> span W"
[PROOF STATE]
proof (prove)
using this:
local.span V = local.span W

goal (1 subgoal):
 1. V \<subseteq> local.span W
[PROOF STEP]
using span_mem[OF V]
[PROOF STATE]
proof (prove)
using this:
local.span V = local.span W
?u \<in> V \<Longrightarrow> ?u \<in> local.span V

goal (1 subgoal):
 1. V \<subseteq> local.span W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V \<subseteq> local.span W

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
from part1(1)[OF V this lin]
[PROOF STATE]
proof (chain)
picking this:
card V \<le> dim_span W
[PROOF STEP]
have VW: "card V \<le> dim_span W"
[PROOF STATE]
proof (prove)
using this:
card V \<le> dim_span W

goal (1 subgoal):
 1. card V \<le> dim_span W
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card V \<le> dim_span W

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
have finWW: "finite WW"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite WW
[PROOF STEP]
using WW
[PROOF STATE]
proof (prove)
using this:
WW \<subseteq> carrier_vec n
WW \<subseteq> local.span W
lin_indpt WW

goal (1 subgoal):
 1. finite WW
[PROOF STEP]
by (simp add: fin_dim_li_fin)
[PROOF STATE]
proof (state)
this:
finite WW

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
have finV: "finite V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite V
[PROOF STEP]
using lin V
[PROOF STATE]
proof (prove)
using this:
lin_indpt V
V \<subseteq> carrier_vec n

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

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
from replacement[OF finWW finV V WW(3) WW(2)[folded span], unfolded idWW]
[PROOF STATE]
proof (chain)
picking this:
\<exists>C. finite C \<and> C \<subseteq> carrier_vec n \<and> C \<subseteq> local.span V \<and> C \<inter> WW = {} \<and> int (card C) \<le> int (card V) - int (dim_span W) \<and> local.span (WW \<union> C) = local.span V
[PROOF STEP]
obtain C :: "'a vec set"
      where le: "int (card C) \<le> int (card V) - int (dim_span W)"
[PROOF STATE]
proof (prove)
using this:
\<exists>C. finite C \<and> C \<subseteq> carrier_vec n \<and> C \<subseteq> local.span V \<and> C \<inter> WW = {} \<and> int (card C) \<le> int (card V) - int (dim_span W) \<and> local.span (WW \<union> C) = local.span V

goal (1 subgoal):
 1. (\<And>C. int (card C) \<le> int (card V) - int (dim_span W) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (card C) \<le> int (card V) - int (dim_span W)

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
from le
[PROOF STATE]
proof (chain)
picking this:
int (card C) \<le> int (card V) - int (dim_span W)
[PROOF STEP]
have "int (dim_span W) + int (card C) \<le> int (card V)"
[PROOF STATE]
proof (prove)
using this:
int (card C) \<le> int (card V) - int (dim_span W)

goal (1 subgoal):
 1. int (dim_span W) + int (card C) \<le> int (card V)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
int (dim_span W) + int (card C) \<le> int (card V)

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
hence "dim_span W + card C \<le> card V"
[PROOF STATE]
proof (prove)
using this:
int (dim_span W) + int (card C) \<le> int (card V)

goal (1 subgoal):
 1. dim_span W + card C \<le> card V
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
dim_span W + card C \<le> card V

goal (1 subgoal):
 1. \<lbrakk>V \<subseteq> carrier_vec n; W \<subseteq> carrier_vec n; local.span V = local.span W; lin_indpt V\<rbrakk> \<Longrightarrow> card V = dim_span W
[PROOF STEP]
with VW
[PROOF STATE]
proof (chain)
picking this:
card V \<le> dim_span W
dim_span W + card C \<le> card V
[PROOF STEP]
show "card V = dim_span W"
[PROOF STATE]
proof (prove)
using this:
card V \<le> dim_span W
dim_span W + card C \<le> card V

goal (1 subgoal):
 1. card V = dim_span W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card V = dim_span W

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?Va3 \<subseteq> carrier_vec n; ?Wa3 \<subseteq> carrier_vec n; local.span ?Va3 = local.span ?Wa3; lin_indpt ?Va3\<rbrakk> \<Longrightarrow> card ?Va3 = dim_span ?Wa3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_minus: "x powr (- a) = inverse (x powr a)"
      for a x :: "'a::{ln,real_normed_field}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr - a = inverse (x powr a)
[PROOF STEP]
by (simp add: powr_def exp_minus [symmetric])


[STATEMENT]
lemma approx_minus_iff2: "x \<approx> y \<longleftrightarrow> - y + x \<approx> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<approx> y) = (- y + x \<approx> 0)
[PROOF STEP]
by (simp add: approx_def add.commute)


[STATEMENT]
lemma map_matrix_rat_of_int_mult:
  shows "map_matrix rat_of_int (A**B) = (map_matrix rat_of_int A)**(map_matrix rat_of_int B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_matrix rat_of_int (A ** B) = map_matrix rat_of_int A ** map_matrix rat_of_int B
[PROOF STEP]
unfolding map_matrix_def matrix_matrix_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. rat_of_int ((\<chi>i j. \<Sum>k\<in>UNIV. A $ i $ k * B $ k $ j) $ i $ j)) = (\<chi>i j. \<Sum>k\<in>UNIV. (\<chi>i j. rat_of_int (A $ i $ j)) $ i $ k * (\<chi>i j. rat_of_int (B $ i $ j)) $ k $ j)
[PROOF STEP]
by auto


[STATEMENT]
lemma Collect_split_Suc:
    "\<not> P 0 \<Longrightarrow> {i. P i} = Suc ` {i. P (Suc i)}"
    "P 0 \<Longrightarrow> {i. P i} = {0} \<union> Suc ` {i. P (Suc i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> P 0 \<Longrightarrow> {i. P i} = Suc ` {i. P (Suc i)}) &&& (P 0 \<Longrightarrow> {i. P i} = {0} \<union> Suc ` {i. P (Suc i)})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> P 0 \<Longrightarrow> {i. P i} = Suc ` {i. P (Suc i)}
 2. P 0 \<Longrightarrow> {i. P i} = {0} \<union> Suc ` {i. P (Suc i)}
[PROOF STEP]
assume "\<not> P 0"
[PROOF STATE]
proof (state)
this:
\<not> P 0

goal (2 subgoals):
 1. \<not> P 0 \<Longrightarrow> {i. P i} = Suc ` {i. P (Suc i)}
 2. P 0 \<Longrightarrow> {i. P i} = {0} \<union> Suc ` {i. P (Suc i)}
[PROOF STEP]
thus "{i. P i} = Suc ` {i. P (Suc i)}"
[PROOF STATE]
proof (prove)
using this:
\<not> P 0

goal (1 subgoal):
 1. {i. P i} = Suc ` {i. P (Suc i)}
[PROOF STEP]
by (auto, metis image_eqI mem_Collect_eq nat.exhaust)
[PROOF STATE]
proof (state)
this:
{i. P i} = Suc ` {i. P (Suc i)}

goal (1 subgoal):
 1. P 0 \<Longrightarrow> {i. P i} = {0} \<union> Suc ` {i. P (Suc i)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P 0 \<Longrightarrow> {i. P i} = {0} \<union> Suc ` {i. P (Suc i)}
[PROOF STEP]
assume "P 0"
[PROOF STATE]
proof (state)
this:
P 0

goal (1 subgoal):
 1. P 0 \<Longrightarrow> {i. P i} = {0} \<union> Suc ` {i. P (Suc i)}
[PROOF STEP]
thus "{i. P i} = {0} \<union> Suc ` {i. P (Suc i)}"
[PROOF STATE]
proof (prove)
using this:
P 0

goal (1 subgoal):
 1. {i. P i} = {0} \<union> Suc ` {i. P (Suc i)}
[PROOF STEP]
by (auto, metis imageI mem_Collect_eq not0_implies_Suc)
[PROOF STATE]
proof (state)
this:
{i. P i} = {0} \<union> Suc ` {i. P (Suc i)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filterlim_at_top_add_at_top:
  assumes f: "LIM x F. f x :> at_top"
    and g: "LIM x F. g x :> at_top"
  shows "LIM x F. (f x + g x :: real) :> at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. f x + g x :> at_top
[PROOF STEP]
unfolding filterlim_at_top_gt[where c=0]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>Z>0. \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
fix Z :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
assume "0 < Z"
[PROOF STATE]
proof (state)
this:
0 < Z

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
from f
[PROOF STATE]
proof (chain)
picking this:
filterlim f at_top F
[PROOF STEP]
have "eventually (\<lambda>x. 0 \<le> f x) F"
[PROOF STATE]
proof (prove)
using this:
filterlim f at_top F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. 0 \<le> f x
[PROOF STEP]
unfolding filterlim_at_top
[PROOF STATE]
proof (prove)
using this:
\<forall>Z. \<forall>\<^sub>F x in F. Z \<le> f x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. 0 \<le> f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. 0 \<le> f x

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. 0 \<le> f x

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
from g
[PROOF STATE]
proof (chain)
picking this:
filterlim g at_top F
[PROOF STEP]
have "eventually (\<lambda>x. Z \<le> g x) F"
[PROOF STATE]
proof (prove)
using this:
filterlim g at_top F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. Z \<le> g x
[PROOF STEP]
unfolding filterlim_at_top
[PROOF STATE]
proof (prove)
using this:
\<forall>Z. \<forall>\<^sub>F x in F. Z \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. Z \<le> g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. Z \<le> g x

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. 0 \<le> f x
\<forall>\<^sub>F x in F. Z \<le> g x
[PROOF STEP]
show "eventually (\<lambda>x. Z \<le> f x + g x) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. 0 \<le> f x
\<forall>\<^sub>F x in F. Z \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. Z \<le> f x + g x

goal:
No subgoals!
[PROOF STEP]
qed