[STATEMENT]
lemma scalar_product_distributivity:
"\<forall>v1 v2 w1 w2.((length v1 = length v2)\<and>(length v1 = n)\<and> (length w1 = length w2)
           \<longrightarrow>  (scalar_product v1 v2)*(scalar_product w1 w2)
      = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v1. \<forall>v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v1 v2. \<forall>w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v1 v2 w1. \<forall>w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
proof(induct "n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "((length v1 = length v2)\<and>(length v1 = 0)\<and> (length w1 = length w2))
           \<longrightarrow>length v1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v1 = 0
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v1 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v1 = 0

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v1 = 0
[PROOF STEP]
have 1:"((length v1 = length v2)
                 \<and>(length v1 = 0)
                 \<and>(length w1 = length w2))
                        \<longrightarrow>v1 = []"
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v1 = 0

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v1 = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v1 = []

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v1 = []

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "((length v1 = length v2)
                   \<and>(length v1 = 0)
                   \<and>(length w1 = length w2))
           \<longrightarrow>length v2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0
[PROOF STEP]
have 2:"((length v1 = length v2)
                          \<and>(length v1 = 0)
                          \<and>(length w1 = length w2))
                                    \<longrightarrow>v2 = []"
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v2 = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v2 = []

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v1 = []
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v2 = []
[PROOF STEP]
have 3:
         "((length v1 = length v2)\<and>(length v1 = 0)\<and> (length w1 = length w2))
           \<longrightarrow>scalar_product v1 v2 = zer"
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v1 = []
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v2 = []

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 = zer
[PROOF STEP]
unfolding scalar_product_def scalar_prodI_def
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v1 = []
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v2 = []

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip v1 v2) zer = zer
[PROOF STEP]
using zip_Nil
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v1 = []
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> length v2 = 0
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v2 = []
zip [] [] = []

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip v1 v2) zer = zer
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 = zer

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 = zer
[PROOF STEP]
have 4:"f zer (scalar_product w1 w2) = zer"
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 = zer

goal (1 subgoal):
 1. zer * scalar_product w1 w2 = zer
[PROOF STEP]
using zer_left_mult
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 = zer
zer * ?x = zer

goal (1 subgoal):
 1. zer * scalar_product w1 w2 = zer
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
zer * scalar_product w1 w2 = zer

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "((length v1 = length v2)\<and>(length v1 = 0)\<and> (length w1 = length w2))
           \<longrightarrow>vec_vec_Tensor v1 w1 = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v1 w1 = []
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v1 = []

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v1 w1 = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v1 w1 = []

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v1 w1 = []

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "((length v1 = length v2)
                   \<and>(length v1 = 0)
                   \<and>(length w1 = length w2))
                    \<longrightarrow>vec_vec_Tensor v2 w2 = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v2 w2 = []
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> v2 = []

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v2 w2 = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v2 w2 = []

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v1 w1 = []
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v2 w2 = []
[PROOF STEP]
have "((length v1 = length v2)
                      \<and>(length v1 = 0)
                      \<and>(length w1 = length w2))
                         \<longrightarrow> scalar_product
                                 (vec_vec_Tensor v1 w1)
                                 (vec_vec_Tensor v2 w2)  = zer"
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v1 w1 = []
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v2 w2 = []

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = zer
[PROOF STEP]
unfolding scalar_product_def scalar_prodI_def
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v1 w1 = []
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v2 w2 = []

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) zer = zer
[PROOF STEP]
using zip_Nil
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v1 w1 = []
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> vec_vec_Tensor v2 w2 = []
zip [] [] = []

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) zer = zer
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = zer

goal (2 subgoals):
 1. \<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
 2. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
with 3 4
[PROOF STATE]
proof (chain)
picking this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 = zer
zer * scalar_product w1 w2 = zer
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = zer
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 = zer
zer * scalar_product w1 w2 = zer
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = zer

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = 0 \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)

goal (1 subgoal):
 1. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
length ?v1.0 = length ?v2.0 \<and> length ?v1.0 = k \<and> length ?w1.0 = length ?w2.0 \<longrightarrow> scalar_product ?v1.0 ?v2.0 * scalar_product ?w1.0 ?w2.0 = scalar_product (vec_vec_Tensor ?v1.0 ?w1.0) (vec_vec_Tensor ?v2.0 ?w2.0)

goal (1 subgoal):
 1. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "((length v1 = length v2)\<and>(length v1 = Suc k)
                    \<and> (length w1 = length w2))
           \<Longrightarrow>  f (scalar_product v1 v2) (scalar_product w1 w2)
      = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
assume assms:"((length v1 = length v2)\<and>(length v1 = Suc k)
                    \<and> (length w1 = length w2))"
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "length v1 = Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v1 = Suc k
[PROOF STEP]
using Suc assms
[PROOF STATE]
proof (prove)
using this:
length ?v1.0 = length ?v2.0 \<and> length ?v1.0 = k \<and> length ?w1.0 = length ?w2.0 \<longrightarrow> scalar_product ?v1.0 ?v2.0 * scalar_product ?w1.0 ?w2.0 = scalar_product (vec_vec_Tensor ?v1.0 ?w1.0) (vec_vec_Tensor ?v2.0 ?w2.0)
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2

goal (1 subgoal):
 1. length v1 = Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = Suc k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v1 = Suc k
[PROOF STEP]
have "(\<exists>a1 u1.(v1 = a1#u1)\<and>(length u1 = k))"
[PROOF STATE]
proof (prove)
using this:
length v1 = Suc k

goal (1 subgoal):
 1. \<exists>a1 u1. v1 = a1 # u1 \<and> length u1 = k
[PROOF STEP]
using assms Suc_length_conv
[PROOF STATE]
proof (prove)
using this:
length v1 = Suc k
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2
(Suc ?n = length ?xs) = (\<exists>y ys. ?xs = y # ys \<and> length ys = ?n)

goal (1 subgoal):
 1. \<exists>a1 u1. v1 = a1 # u1 \<and> length u1 = k
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>a1 u1. v1 = a1 # u1 \<and> length u1 = k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>a1 u1. v1 = a1 # u1 \<and> length u1 = k
[PROOF STEP]
obtain a1 u1 where "(v1 = a1#u1)\<and>(length u1 = k)"
[PROOF STATE]
proof (prove)
using this:
\<exists>a1 u1. v1 = a1 # u1 \<and> length u1 = k

goal (1 subgoal):
 1. (\<And>a1 u1. v1 = a1 # u1 \<and> length u1 = k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>a1 u1. v1 = a1 # u1 \<and> length u1 = k
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2

goal (1 subgoal):
 1. (\<And>a1 u1. v1 = a1 # u1 \<and> length u1 = k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v1 = a1 # u1 \<and> length u1 = k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v1 = a1 # u1 \<and> length u1 = k
[PROOF STEP]
have Cons_1:"(v1 = a1#u1)\<and>(length u1 = k)"
[PROOF STATE]
proof (prove)
using this:
v1 = a1 # u1 \<and> length u1 = k

goal (1 subgoal):
 1. v1 = a1 # u1 \<and> length u1 = k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v1 = a1 # u1 \<and> length u1 = k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
v1 = a1 # u1 \<and> length u1 = k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "length v2 = Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v2 = Suc k
[PROOF STEP]
using assms Suc
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2
length ?v1.0 = length ?v2.0 \<and> length ?v1.0 = k \<and> length ?w1.0 = length ?w2.0 \<longrightarrow> scalar_product ?v1.0 ?v2.0 * scalar_product ?w1.0 ?w2.0 = scalar_product (vec_vec_Tensor ?v1.0 ?w1.0) (vec_vec_Tensor ?v2.0 ?w2.0)

goal (1 subgoal):
 1. length v2 = Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v2 = Suc k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v2 = Suc k
[PROOF STEP]
have "(\<exists>a2 u2.(v2 = a2#u2)\<and>(length u2 = k))"
[PROOF STATE]
proof (prove)
using this:
length v2 = Suc k

goal (1 subgoal):
 1. \<exists>a2 u2. v2 = a2 # u2 \<and> length u2 = k
[PROOF STEP]
using  Suc_length_conv
[PROOF STATE]
proof (prove)
using this:
length v2 = Suc k
(Suc ?n = length ?xs) = (\<exists>y ys. ?xs = y # ys \<and> length ys = ?n)

goal (1 subgoal):
 1. \<exists>a2 u2. v2 = a2 # u2 \<and> length u2 = k
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>a2 u2. v2 = a2 # u2 \<and> length u2 = k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>a2 u2. v2 = a2 # u2 \<and> length u2 = k
[PROOF STEP]
obtain a2 u2 where "(v2 = a2#u2)\<and>(length u2 = k)"
[PROOF STATE]
proof (prove)
using this:
\<exists>a2 u2. v2 = a2 # u2 \<and> length u2 = k

goal (1 subgoal):
 1. (\<And>a2 u2. v2 = a2 # u2 \<and> length u2 = k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v2 = a2 # u2 \<and> length u2 = k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v2 = a2 # u2 \<and> length u2 = k
[PROOF STEP]
have Cons_2: "(v2 = a2#u2)\<and>(length u2 = k)"
[PROOF STATE]
proof (prove)
using this:
v2 = a2 # u2 \<and> length u2 = k

goal (1 subgoal):
 1. v2 = a2 # u2 \<and> length u2 = k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
v2 = a2 # u2 \<and> length u2 = k

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v2 = a2 # u2 \<and> length u2 = k
[PROOF STEP]
have "length u1 = length u2"
[PROOF STATE]
proof (prove)
using this:
v2 = a2 # u2 \<and> length u2 = k

goal (1 subgoal):
 1. length u1 = length u2
[PROOF STEP]
using Cons_1
[PROOF STATE]
proof (prove)
using this:
v2 = a2 # u2 \<and> length u2 = k
v1 = a1 # u1 \<and> length u1 = k

goal (1 subgoal):
 1. length u1 = length u2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length u1 = length u2

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length u1 = length u2
[PROOF STEP]
have Cons_3:"(scalar_product u1 u2) * scalar_product w1 w2 =
         scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)"
[PROOF STATE]
proof (prove)
using this:
length u1 = length u2

goal (1 subgoal):
 1. scalar_product u1 u2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
using Suc Cons_1 Cons_2 assms
[PROOF STATE]
proof (prove)
using this:
length u1 = length u2
length ?v1.0 = length ?v2.0 \<and> length ?v1.0 = k \<and> length ?w1.0 = length ?w2.0 \<longrightarrow> scalar_product ?v1.0 ?v2.0 * scalar_product ?w1.0 ?w2.0 = scalar_product (vec_vec_Tensor ?v1.0 ?w1.0) (vec_vec_Tensor ?v2.0 ?w2.0)
v1 = a1 # u1 \<and> length u1 = k
v2 = a2 # u2 \<and> length u2 = k
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2

goal (1 subgoal):
 1. scalar_product u1 u2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product u1 u2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
scalar_product u1 u2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
have "zip v1 v2 = (a1,a2)#(zip u1 u2)"
[PROOF STATE]
proof (prove)
using this:
scalar_product u1 u2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. zip v1 v2 = (a1, a2) # zip u1 u2
[PROOF STEP]
using  zip_Cons Cons_1 Cons_2
[PROOF STATE]
proof (prove)
using this:
scalar_product u1 u2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
length ?v = length ?w \<Longrightarrow> zip (?a # ?v) (?b # ?w) = (?a, ?b) # zip ?v ?w
v1 = a1 # u1 \<and> length u1 = k
v2 = a2 # u2 \<and> length u2 = k

goal (1 subgoal):
 1. zip v1 v2 = (a1, a2) # zip u1 u2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
zip v1 v2 = (a1, a2) # zip u1 u2

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
zip v1 v2 = (a1, a2) # zip u1 u2
[PROOF STEP]
have Cons_4:"scalar_product v1 v2 =  (a1*a2)+ (scalar_product u1 u2)"
[PROOF STATE]
proof (prove)
using this:
zip v1 v2 = (a1, a2) # zip u1 u2

goal (1 subgoal):
 1. scalar_product v1 v2 = a1 * a2 + scalar_product u1 u2
[PROOF STEP]
unfolding scalar_product_def scalar_prodI_def
[PROOF STATE]
proof (prove)
using this:
zip v1 v2 = (a1, a2) # zip u1 u2

goal (1 subgoal):
 1. foldr (\<lambda>(x, y). (+) (x * y)) (zip v1 v2) zer = a1 * a2 + foldr (\<lambda>(x, y). (+) (x * y)) (zip u1 u2) zer
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product v1 v2 = a1 * a2 + scalar_product u1 u2

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
scalar_product v1 v2 = a1 * a2 + scalar_product u1 u2
[PROOF STEP]
have "f (scalar_product v1 v2) (scalar_product w1 w2)
                      = ((a1*a2)+ (scalar_product u1 u2))*(scalar_product w1 w2)"
[PROOF STATE]
proof (prove)
using this:
scalar_product v1 v2 = a1 * a2 + scalar_product u1 u2

goal (1 subgoal):
 1. scalar_product v1 v2 * scalar_product w1 w2 = a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product v1 v2 * scalar_product w1 w2 = a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
scalar_product v1 v2 * scalar_product w1 w2 = a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2
[PROOF STEP]
have "... = ((a1*a2)*(scalar_product w1 w2))
                                     + ((scalar_product u1 u2)*(scalar_product w1 w2))"
[PROOF STATE]
proof (prove)
using this:
scalar_product v1 v2 * scalar_product w1 w2 = a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2

goal (1 subgoal):
 1. a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2 = a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2)
[PROOF STEP]
using plus_right_distributivity
[PROOF STATE]
proof (prove)
using this:
scalar_product v1 v2 * scalar_product w1 w2 = a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2
?a + ?b * ?c = ?a * ?c + (?b * ?c)

goal (1 subgoal):
 1. a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2 = a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2 = a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2 = a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2)
[PROOF STEP]
have Cons_5:"... = ((a1*a2)*(scalar_product w1 w2))
                       + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)"
[PROOF STATE]
proof (prove)
using this:
a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2 = a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2)

goal (1 subgoal):
 1. a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2) = a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
using Cons_3
[PROOF STATE]
proof (prove)
using this:
a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2 = a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2)
scalar_product u1 u2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2) = a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2) = a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2) = a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
have Cons_6:"... = (scalar_product (times a1 w1) (times a2 w2))
                    +  scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)"
[PROOF STATE]
proof (prove)
using this:
a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2) = a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
using assms effective_scalar_product_times
[PROOF STATE]
proof (prove)
using this:
a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2) = a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2
length ?w1.0 = length ?w2.0 \<Longrightarrow> ?x * ?y * scalar_product ?w1.0 ?w2.0 = scalar_product (local.times ?x ?w1.0) (local.times ?y ?w2.0)

goal (1 subgoal):
 1. a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
have "scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
                        = scalar_product (vec_vec_Tensor (a1#u1) w1) (vec_vec_Tensor (a2#u2) w2)"
[PROOF STATE]
proof (prove)
using this:
a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (vec_vec_Tensor (a1 # u1) w1) (vec_vec_Tensor (a2 # u2) w2)
[PROOF STEP]
using Cons_1 Cons_2
[PROOF STATE]
proof (prove)
using this:
a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
v1 = a1 # u1 \<and> length u1 = k
v2 = a2 # u2 \<and> length u2 = k

goal (1 subgoal):
 1. scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (vec_vec_Tensor (a1 # u1) w1) (vec_vec_Tensor (a2 # u2) w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (vec_vec_Tensor (a1 # u1) w1) (vec_vec_Tensor (a2 # u2) w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (vec_vec_Tensor (a1 # u1) w1) (vec_vec_Tensor (a2 # u2) w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "(vec_vec_Tensor (a1#u1) w1) = (times a1 w1)@(vec_vec_Tensor u1 w1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_vec_Tensor (a1 # u1) w1 = local.times a1 w1 @ vec_vec_Tensor u1 w1
[PROOF STEP]
using vec_vec_Tensor.simps
[PROOF STATE]
proof (prove)
using this:
vec_vec_Tensor [] ?ys = []
vec_vec_Tensor (?x # ?xs) ?ys = local.times ?x ?ys @ vec_vec_Tensor ?xs ?ys

goal (1 subgoal):
 1. vec_vec_Tensor (a1 # u1) w1 = local.times a1 w1 @ vec_vec_Tensor u1 w1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_vec_Tensor (a1 # u1) w1 = local.times a1 w1 @ vec_vec_Tensor u1 w1

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vec_vec_Tensor (a1 # u1) w1 = local.times a1 w1 @ vec_vec_Tensor u1 w1

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "(vec_vec_Tensor (a2#u2) w2) = (times a2 w2)@(vec_vec_Tensor u2 w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_vec_Tensor (a2 # u2) w2 = local.times a2 w2 @ vec_vec_Tensor u2 w2
[PROOF STEP]
using vec_vec_Tensor.simps
[PROOF STATE]
proof (prove)
using this:
vec_vec_Tensor [] ?ys = []
vec_vec_Tensor (?x # ?xs) ?ys = local.times ?x ?ys @ vec_vec_Tensor ?xs ?ys

goal (1 subgoal):
 1. vec_vec_Tensor (a2 # u2) w2 = local.times a2 w2 @ vec_vec_Tensor u2 w2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_vec_Tensor (a2 # u2) w2 = local.times a2 w2 @ vec_vec_Tensor u2 w2

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
v1 = a1 # u1 \<and> length u1 = k
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (vec_vec_Tensor (a1 # u1) w1) (vec_vec_Tensor (a2 # u2) w2)
vec_vec_Tensor (a1 # u1) w1 = local.times a1 w1 @ vec_vec_Tensor u1 w1
vec_vec_Tensor (a2 # u2) w2 = local.times a2 w2 @ vec_vec_Tensor u2 w2
[PROOF STEP]
have Cons_7:"scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
                      = scalar_product ((times a1 w1)@(vec_vec_Tensor u1 w1))
                                ((times a2 w2)@(vec_vec_Tensor u2 w2))"
[PROOF STATE]
proof (prove)
using this:
v1 = a1 # u1 \<and> length u1 = k
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (vec_vec_Tensor (a1 # u1) w1) (vec_vec_Tensor (a2 # u2) w2)
vec_vec_Tensor (a1 # u1) w1 = local.times a1 w1 @ vec_vec_Tensor u1 w1
vec_vec_Tensor (a2 # u2) w2 = local.times a2 w2 @ vec_vec_Tensor u2 w2

goal (1 subgoal):
 1. scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "length (vec_vec_Tensor u2 w2) = length (vec_vec_Tensor u1 w1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (vec_vec_Tensor u2 w2) = length (vec_vec_Tensor u1 w1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2

goal (1 subgoal):
 1. length (vec_vec_Tensor u2 w2) = length (vec_vec_Tensor u1 w1)
[PROOF STEP]
by (metis Cons_1 Cons_2 vec_vec_Tensor_length)
[PROOF STATE]
proof (state)
this:
length (vec_vec_Tensor u2 w2) = length (vec_vec_Tensor u1 w1)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (vec_vec_Tensor u2 w2) = length (vec_vec_Tensor u1 w1)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
have "length (times a1 w1) = (length (times a2 w2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (local.times a1 w1) = length (local.times a2 w2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2

goal (1 subgoal):
 1. length (local.times a1 w1) = length (local.times a2 w2)
[PROOF STEP]
by (metis preserving_length)
[PROOF STATE]
proof (state)
this:
length (local.times a1 w1) = length (local.times a2 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2)
length (vec_vec_Tensor u2 w2) = length (vec_vec_Tensor u1 w1)
length (local.times a1 w1) = length (local.times a2 w2)
[PROOF STEP]
have "scalar_product ((times a1 w1)@(vec_vec_Tensor u1 w1))
                                ((times a2 w2)@(vec_vec_Tensor u2 w2)) =
                    (scalar_product (times a1 w1) (times a2 w2))
                    +  scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)"
[PROOF STATE]
proof (prove)
using this:
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2)
length (vec_vec_Tensor u2 w2) = length (vec_vec_Tensor u1 w1)
length (local.times a1 w1) = length (local.times a2 w2)

goal (1 subgoal):
 1. scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
using effective_scalar_product_append
[PROOF STATE]
proof (prove)
using this:
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2)
length (vec_vec_Tensor u2 w2) = length (vec_vec_Tensor u1 w1)
length (local.times a1 w1) = length (local.times a2 w2)
\<lbrakk>length ?zs = length ?ws; length ?xs = length ?ys\<rbrakk> \<Longrightarrow> scalar_product (?xs @ ?zs) (?ys @ ?ws) = scalar_product ?xs ?ys + scalar_product ?zs ?ws

goal (1 subgoal):
 1. scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)

goal (1 subgoal):
 1. scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
using Cons_6 Cons_7 \<open>a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2
                 = a1 * a2 * scalar_product w1 w2
                  + (scalar_product u1 u2 * scalar_product w1 w2)\<close>
[PROOF STATE]
proof (prove)
using this:
scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
a1 * a2 * scalar_product w1 w2 + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2) = scalar_product (local.times a1 w1) (local.times a2 w2) + scalar_product (vec_vec_Tensor u1 w1) (vec_vec_Tensor u2 w2)
scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) = scalar_product (local.times a1 w1 @ vec_vec_Tensor u1 w1) (local.times a2 w2 @ vec_vec_Tensor u2 w2)
a1 * a2 + scalar_product u1 u2 * scalar_product w1 w2 = a1 * a2 * scalar_product w1 w2 + (scalar_product u1 u2 * scalar_product w1 w2)

goal (1 subgoal):
 1. scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
by (metis Cons_3 Cons_4 )
[PROOF STATE]
proof (state)
this:
scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)

goal (1 subgoal):
 1. \<And>n v1 v2 w1 w2. (\<And>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)) \<Longrightarrow> length v1 = length v2 \<and> length v1 = Suc n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<Longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)

goal (1 subgoal):
 1. length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v1 = length v2 \<and> length v1 = Suc k \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trace_adjoint_positive:
  fixes A :: "complex mat"
  shows "trace (A * adjoint A) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> trace (A * adjoint A)
[PROOF STEP]
apply (auto simp add: trace_def adjoint_col)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>i = 0..<dim_row A. inner_prod (row A i) (row A i))
[PROOF STEP]
apply (rule sum_nonneg)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> 0 \<le> inner_prod (row A x) (row A x)
[PROOF STEP]
by auto


[STATEMENT]
theorem sum_of_odds:
  "(\<Sum>i::nat=0..<n. 2 * i + 1) = n^Suc (Suc 0)"
  (is "?P n" is "?S n = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>i = 0..<0. 2 * i + 1) = 0 ^ Suc (Suc 0)
 2. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
show "?P 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<0. 2 * i + 1) = 0 ^ Suc (Suc 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<0. 2 * i + 1) = 0 ^ Suc (Suc 0)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
have "?S (n + 1) = ?S n + 2 * n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. 2 * i + 1) = (\<Sum>i = 0..<n. 2 * i + 1) + 2 * n + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n + 1. 2 * i + 1) = (\<Sum>i = 0..<n. 2 * i + 1) + 2 * n + 1

goal (1 subgoal):
 1. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n + 1. 2 * i + 1) = (\<Sum>i = 0..<n. 2 * i + 1) + 2 * n + 1

goal (1 subgoal):
 1. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
assume "?S n = n^Suc (Suc 0)"
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
have "\<dots> + 2 * n + 1 = (n + 1)^Suc (Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n ^ Suc (Suc 0) + 2 * n + 1 = (n + 1) ^ Suc (Suc 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n ^ Suc (Suc 0) + 2 * n + 1 = (n + 1) ^ Suc (Suc 0)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i = 0..<n. 2 * i + 1) = n ^ Suc (Suc 0) \<Longrightarrow> (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 0..<n + 1. 2 * i + 1) = (n + 1) ^ Suc (Suc 0)
[PROOF STEP]
show "?P (Suc n)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<n + 1. 2 * i + 1) = (n + 1) ^ Suc (Suc 0)

goal (1 subgoal):
 1. (\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<Suc n. 2 * i + 1) = Suc n ^ Suc (Suc 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_works:
  assumes lf: "Vector_Spaces.linear (*s) (*s) f"
  shows "matrix f *v x = f (x::'a::field ^ 'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix f *v x = f x
[PROOF STEP]
apply (simp add: matrix_def matrix_vector_mult_def vec_eq_iff mult.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. (\<Sum>j\<in>UNIV. x $ j * f (axis j (1::'a)) $ i) = f x $ i
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. (\<Sum>j\<in>UNIV. x $ j * f (axis j (1::'a)) $ i) = f x $ i
[PROOF STEP]
apply (rule linear_componentwise[OF lf, symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cauchy_schwarz_ineq:
  assumes "dim_vec v = dim_vec w"
  shows "(cmod(\<langle>v|w\<rangle>))\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
proof (cases "\<langle>v|v\<rangle> = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
case c0:True
[PROOF STATE]
proof (state)
this:
\<langle>v|v\<rangle> = 0

goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<langle>v|v\<rangle> = 0
[PROOF STEP]
have "\<And>i. i < dim_vec v \<Longrightarrow> v $ i = 0"
[PROOF STATE]
proof (prove)
using this:
\<langle>v|v\<rangle> = 0

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> v $ i = 0
[PROOF STEP]
by(metis index_zero_vec(1) inner_prod_with_itself_nonneg_reals_non0)
[PROOF STATE]
proof (state)
this:
?i < dim_vec v \<Longrightarrow> v $ ?i = 0

goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < dim_vec v \<Longrightarrow> v $ ?i = 0
[PROOF STEP]
have "(cmod(\<langle>v|w\<rangle>))\<^sup>2 = 0"
[PROOF STATE]
proof (prove)
using this:
?i < dim_vec v \<Longrightarrow> v $ ?i = 0

goal (1 subgoal):
 1. (cmod \<langle>v|w\<rangle>)\<^sup>2 = 0
[PROOF STEP]
by (simp add: assms inner_prod_def)
[PROOF STATE]
proof (state)
this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 = 0

goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 = 0

goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
have "Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>) = 0
[PROOF STEP]
by (simp add: c0)
[PROOF STATE]
proof (state)
this:
Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>) = 0

goal (2 subgoals):
 1. \<langle>v|v\<rangle> = 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
 2. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 = 0
Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 = 0
Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>) = 0

goal (1 subgoal):
 1. (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
case c1:False
[PROOF STATE]
proof (state)
this:
\<langle>v|v\<rangle> \<noteq> 0

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
have "dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)
[PROOF STEP]
have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> +
\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>"
[PROOF STATE]
proof (prove)
using this:
dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
[PROOF STEP]
using inner_prod_expand[of "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v"]
[PROOF STATE]
proof (prove)
using this:
dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)
\<lbrakk>dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v); dim_vec w = dim_vec w; dim_vec w = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v)\<rbrakk> \<Longrightarrow> \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
have "\<langle>w|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> * \<langle>w|v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
[PROOF STEP]
using assms inner_prod_distrib_right[of "w" "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec w
dim_vec w = dim_vec v \<Longrightarrow> \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>

goal (1 subgoal):
 1. \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
have "\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj(-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * \<langle>v|w\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
[PROOF STEP]
using assms inner_prod_distrib_left[of "v" "w" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec w
dim_vec v = dim_vec w \<Longrightarrow> \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>

goal (1 subgoal):
 1. \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
have "\<langle>-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj(-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * (-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>) * \<langle>v|v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>
[PROOF STEP]
using inner_prod_distrib_left[of "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
inner_prod_distrib_right[of "v" "v" "-\<langle>v|w\<rangle>/\<langle>v|v\<rangle>"]
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v) \<Longrightarrow> \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
dim_vec v = dim_vec v \<Longrightarrow> \<langle>v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>
[PROOF STEP]
have "\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> -  cmod(\<langle>v|w\<rangle>)^2 / \<langle>v|v\<rangle>"
[PROOF STATE]
proof (prove)
using this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
[PROOF STEP]
using assms inner_prod_cnj[of "w" "v"] inner_prod_cnj[of "v" "v"] complex_norm_square
[PROOF STATE]
proof (prove)
using this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> + \<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> + \<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
\<langle>w|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> * \<langle>w|v\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|w\<rangle>
\<langle>- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|- \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = cnj (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * (- \<langle>v|w\<rangle> / \<langle>v|v\<rangle>) * \<langle>v|v\<rangle>
dim_vec v = dim_vec w
dim_vec w = dim_vec v \<Longrightarrow> \<langle>v|w\<rangle> = cnj \<langle>w|v\<rangle>
dim_vec v = dim_vec v \<Longrightarrow> \<langle>v|v\<rangle> = cnj \<langle>v|v\<rangle>
complex_of_real ((cmod ?z)\<^sup>2) = ?z * cnj ?z

goal (1 subgoal):
 1. \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
have "Re(\<langle>w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + -\<langle>v|w\<rangle>/\<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Re \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
[PROOF STEP]
using inner_prod_with_itself_Re
[PROOF STATE]
proof (prove)
using this:
0 \<le> Re \<langle>?u|?u\<rangle>

goal (1 subgoal):
 1. 0 \<le> Re \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 \<le> Re \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
0 \<le> Re \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
[PROOF STEP]
have "Re(\<langle>w|w\<rangle>) \<ge> cmod(\<langle>v|w\<rangle>)^2/Re(\<langle>v|v\<rangle>)"
[PROOF STATE]
proof (prove)
using this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
0 \<le> Re \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>

goal (1 subgoal):
 1. (cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle>
[PROOF STEP]
using inner_prod_with_itself_real
[PROOF STATE]
proof (prove)
using this:
\<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle> = \<langle>w|w\<rangle> - complex_of_real ((cmod \<langle>v|w\<rangle>)\<^sup>2) / \<langle>v|v\<rangle>
0 \<le> Re \<langle>w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v|w + - \<langle>v|w\<rangle> / \<langle>v|v\<rangle> \<cdot>\<^sub>v v\<rangle>
\<langle>?u|?u\<rangle> \<in> \<real>

goal (1 subgoal):
 1. (cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
have c2:"Re(\<langle>v|v\<rangle>) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re \<langle>v|v\<rangle>
[PROOF STEP]
using inner_prod_with_itself_Re_non0 inner_prod_with_itself_eq0 c1
[PROOF STATE]
proof (prove)
using this:
?u \<noteq> 0\<^sub>v (dim_vec ?u) \<Longrightarrow> 0 < Re \<langle>?u|?u\<rangle>
?u = 0\<^sub>v (dim_vec ?u) \<Longrightarrow> \<langle>?u|?u\<rangle> = 0
\<langle>v|v\<rangle> \<noteq> 0

goal (1 subgoal):
 1. 0 < Re \<langle>v|v\<rangle>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < Re \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle>
0 < Re \<langle>v|v\<rangle>
[PROOF STEP]
have "Re(\<langle>w|w\<rangle>) * Re(\<langle>v|v\<rangle>) \<ge> cmod(\<langle>v|w\<rangle>)^2/Re(\<langle>v|v\<rangle>) * Re(\<langle>v|v\<rangle>)"
[PROOF STATE]
proof (prove)
using this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle>
0 < Re \<langle>v|v\<rangle>

goal (1 subgoal):
 1. (cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> * Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle> * Re \<langle>v|v\<rangle>
[PROOF STEP]
by (metis less_numeral_extra(3) nonzero_divide_eq_eq pos_divide_le_eq)
[PROOF STATE]
proof (state)
this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> * Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle> * Re \<langle>v|v\<rangle>

goal (1 subgoal):
 1. \<langle>v|v\<rangle> \<noteq> 0 \<Longrightarrow> (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> * Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle> * Re \<langle>v|v\<rangle>

goal (1 subgoal):
 1. (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
using inner_prod_with_itself_Im c2
[PROOF STATE]
proof (prove)
using this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 / Re \<langle>v|v\<rangle> * Re \<langle>v|v\<rangle> \<le> Re \<langle>w|w\<rangle> * Re \<langle>v|v\<rangle>
Im \<langle>?u|?u\<rangle> = 0
0 < Re \<langle>v|v\<rangle>

goal (1 subgoal):
 1. (cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
(cmod \<langle>v|w\<rangle>)\<^sup>2 \<le> Re (\<langle>v|v\<rangle> * \<langle>w|w\<rangle>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powreal_mult_base_lemma3:
  assumes "0 < a"
  and "a < 1"
  and "0 < b"
  and "b < 1"
shows "(a * b) pow\<^sub>\<real> x = (a pow\<^sub>\<real> x) * (b pow\<^sub>\<real> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x * b pow\<^sub>\<real> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a * b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x * b pow\<^sub>\<real> x
[PROOF STEP]
have "a * b < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * b < 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a
a < 1
0 < b
b < 1

goal (1 subgoal):
 1. a * b < 1
[PROOF STEP]
by (metis less_trans mult.left_neutral mult_less_cancel_right_disj)
[PROOF STATE]
proof (state)
this:
a * b < 1

goal (1 subgoal):
 1. (a * b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x * b pow\<^sub>\<real> x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a * b < 1

goal (1 subgoal):
 1. (a * b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x * b pow\<^sub>\<real> x
[PROOF STEP]
have "(inverse a * inverse b) powa - x =
                   inverse a powa - x * inverse b powa - x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inverse a * inverse b) powa - x = inverse a powa - x * inverse b powa - x
[PROOF STEP]
by (simp add: assms powa_mult_base real_inverse_ge_one_lemma)
[PROOF STATE]
proof (state)
this:
(inverse a * inverse b) powa - x = inverse a powa - x * inverse b powa - x

goal (1 subgoal):
 1. (a * b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x * b pow\<^sub>\<real> x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a * b < 1
(inverse a * inverse b) powa - x = inverse a powa - x * inverse b powa - x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a * b < 1
(inverse a * inverse b) powa - x = inverse a powa - x * inverse b powa - x

goal (1 subgoal):
 1. (a * b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x * b pow\<^sub>\<real> x
[PROOF STEP]
using powreal_def assms
[PROOF STATE]
proof (prove)
using this:
a * b < 1
(inverse a * inverse b) powa - x = inverse a powa - x * inverse b powa - x
?a pow\<^sub>\<real> ?x = (if 0 < ?a \<and> ?a < 1 then inverse ?a powa - ?x else if 1 \<le> ?a then ?a powa ?x else 0)
0 < a
a < 1
0 < b
b < 1

goal (1 subgoal):
 1. (a * b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x * b pow\<^sub>\<real> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(a * b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x * b pow\<^sub>\<real> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_Suc_reindex:
  fixes f :: "nat \<Rightarrow> 'a::ab_group_add"
    shows  "sum f {0..n} = f 0 - f (Suc n) + sum (\<lambda>i. f (Suc i)) {0..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..n} = f 0 - f (Suc n) + (\<Sum>i = 0..n. f (Suc i))
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma col_space_eq_range:
  fixes f::"('a::field^'n::{finite, wellorder}) \<Rightarrow> ('a^'m)"
  assumes lf: "Vector_Spaces.linear (*s) (*s) f"
  shows "col_space (matrix f) = range f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col_space (matrix f) = range f
[PROOF STEP]
unfolding col_space_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x. matrix f *v x = y} = range f
[PROOF STEP]
unfolding matrix_works[OF lf]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x. f x = y} = range f
[PROOF STEP]
by blast


[STATEMENT]
lemma complex_vector_affinity_eq:
  fixes x :: "'a :: complex_vector"
  assumes m0: "m \<noteq> 0"
  shows "m *\<^sub>C x + c = y \<longleftrightarrow> x = inverse m *\<^sub>C y - (inverse m *\<^sub>C c)"
    (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m *\<^sub>C x + c = y) = (x = y /\<^sub>C m - c /\<^sub>C m)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m *\<^sub>C x + c = y \<Longrightarrow> x = y /\<^sub>C m - c /\<^sub>C m
 2. x = y /\<^sub>C m - c /\<^sub>C m \<Longrightarrow> m *\<^sub>C x + c = y
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
m *\<^sub>C x + c = y

goal (2 subgoals):
 1. m *\<^sub>C x + c = y \<Longrightarrow> x = y /\<^sub>C m - c /\<^sub>C m
 2. x = y /\<^sub>C m - c /\<^sub>C m \<Longrightarrow> m *\<^sub>C x + c = y
[PROOF STEP]
hence "m *\<^sub>C x = y - c"
[PROOF STATE]
proof (prove)
using this:
m *\<^sub>C x + c = y

goal (1 subgoal):
 1. m *\<^sub>C x = y - c
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
m *\<^sub>C x = y - c

goal (2 subgoals):
 1. m *\<^sub>C x + c = y \<Longrightarrow> x = y /\<^sub>C m - c /\<^sub>C m
 2. x = y /\<^sub>C m - c /\<^sub>C m \<Longrightarrow> m *\<^sub>C x + c = y
[PROOF STEP]
hence "inverse m *\<^sub>C (m *\<^sub>C x) = inverse m *\<^sub>C (y - c)"
[PROOF STATE]
proof (prove)
using this:
m *\<^sub>C x = y - c

goal (1 subgoal):
 1. m *\<^sub>C x /\<^sub>C m = (y - c) /\<^sub>C m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m *\<^sub>C x /\<^sub>C m = (y - c) /\<^sub>C m

goal (2 subgoals):
 1. m *\<^sub>C x + c = y \<Longrightarrow> x = y /\<^sub>C m - c /\<^sub>C m
 2. x = y /\<^sub>C m - c /\<^sub>C m \<Longrightarrow> m *\<^sub>C x + c = y
[PROOF STEP]
thus "x = inverse m *\<^sub>C y - (inverse m *\<^sub>C c)"
[PROOF STATE]
proof (prove)
using this:
m *\<^sub>C x /\<^sub>C m = (y - c) /\<^sub>C m

goal (1 subgoal):
 1. x = y /\<^sub>C m - c /\<^sub>C m
[PROOF STEP]
using m0
[PROOF STATE]
proof (prove)
using this:
m *\<^sub>C x /\<^sub>C m = (y - c) /\<^sub>C m
m \<noteq> 0

goal (1 subgoal):
 1. x = y /\<^sub>C m - c /\<^sub>C m
[PROOF STEP]
by (simp add: complex_vector.scale_right_diff_distrib)
[PROOF STATE]
proof (state)
this:
x = y /\<^sub>C m - c /\<^sub>C m

goal (1 subgoal):
 1. x = y /\<^sub>C m - c /\<^sub>C m \<Longrightarrow> m *\<^sub>C x + c = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y /\<^sub>C m - c /\<^sub>C m \<Longrightarrow> m *\<^sub>C x + c = y
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
x = y /\<^sub>C m - c /\<^sub>C m

goal (1 subgoal):
 1. x = y /\<^sub>C m - c /\<^sub>C m \<Longrightarrow> m *\<^sub>C x + c = y
[PROOF STEP]
with m0
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> 0
x = y /\<^sub>C m - c /\<^sub>C m
[PROOF STEP]
show "m *\<^sub>C x + c = y"
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0
x = y /\<^sub>C m - c /\<^sub>C m

goal (1 subgoal):
 1. m *\<^sub>C x + c = y
[PROOF STEP]
by (simp add: complex_vector.scale_right_diff_distrib)
[PROOF STATE]
proof (state)
this:
m *\<^sub>C x + c = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma null_space_eq_ker:
  fixes f::"('a::field^'n) => ('a^'m)"
  assumes lf: "Vector_Spaces.linear (*s) (*s) f"
  shows "null_space (matrix f) = {x. f x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_space (matrix f) = {x. f x = 0}
[PROOF STEP]
unfolding null_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. matrix f *v x = 0} = {x. f x = 0}
[PROOF STEP]
using matrix_works [OF lf]
[PROOF STATE]
proof (prove)
using this:
matrix f *v ?x = f ?x

goal (1 subgoal):
 1. {x. matrix f *v x = 0} = {x. f x = 0}
[PROOF STEP]
by auto


[STATEMENT]
lemma ListSum_disj_union:
  "distinct A \<Longrightarrow> distinct B \<Longrightarrow> distinct C \<Longrightarrow>
  set C = set A \<union> set B  \<Longrightarrow>
  set A \<inter> set B = {} \<Longrightarrow>
  (\<Sum>\<^bsub>a \<in> C\<^esub> (f a)) = (\<Sum>\<^bsub>a \<in> A\<^esub> f a) + (\<Sum>\<^bsub>a \<in> B\<^esub> (f a::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct A; distinct B; distinct C; set C = set A \<union> set B; set A \<inter> set B = {}\<rbrakk> \<Longrightarrow> ListSum C f = ListSum A f + ListSum B f
[PROOF STEP]
by (simp add: ListSum_conv_sum sum.union_disjoint)