[STATEMENT]
lemma mk_projector_orthog_correct:
  fixes S :: "'a::onb_enum list"
  defines "d \<equiv> length (canonical_basis :: 'a list)"
  assumes ortho: "is_ortho_set (set S)" and distinct: "distinct S"
  shows "mk_projector_orthog d (map vec_of_basis_enum S)
       = mat_of_cblinfun (Proj (ccspan (set S)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
define Snorm where "Snorm = map (\<lambda>s. s /\<^sub>R norm s) S"
[PROOF STATE]
proof (state)
this:
Snorm = map (\<lambda>s. s /\<^sub>R norm s) S

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have "distinct Snorm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct Snorm
[PROOF STEP]
proof (insert ortho distinct, unfold Snorm_def, induction S)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>is_ortho_set (set []); distinct []\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) [])
 2. \<And>a S. \<lbrakk>\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S); is_ortho_set (set (a # S)); distinct (a # S)\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) (a # S))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
is_ortho_set (set [])
distinct []

goal (2 subgoals):
 1. \<lbrakk>is_ortho_set (set []); distinct []\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) [])
 2. \<And>a S. \<lbrakk>\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S); is_ortho_set (set (a # S)); distinct (a # S)\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) (a # S))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map (\<lambda>s. s /\<^sub>R norm s) [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (map (\<lambda>s. s /\<^sub>R norm s) [])

goal (1 subgoal):
 1. \<And>a S. \<lbrakk>\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S); is_ortho_set (set (a # S)); distinct (a # S)\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) (a # S))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a S. \<lbrakk>\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S); is_ortho_set (set (a # S)); distinct (a # S)\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) (a # S))
[PROOF STEP]
case (Cons s S)
[PROOF STATE]
proof (state)
this:
\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S)
is_ortho_set (set (s # S))
distinct (s # S)

goal (1 subgoal):
 1. \<And>a S. \<lbrakk>\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S); is_ortho_set (set (a # S)); distinct (a # S)\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) (a # S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S)
is_ortho_set (set (s # S))
distinct (s # S)
[PROOF STEP]
have "is_ortho_set (set S)" and "distinct S"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S)
is_ortho_set (set (s # S))
distinct (s # S)

goal (1 subgoal):
 1. is_ortho_set (set S) &&& distinct S
[PROOF STEP]
unfolding is_ortho_set_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(\<forall>x\<in>set S. \<forall>y\<in>set S. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> set S; distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S)
(\<forall>x\<in>set (s # S). \<forall>y\<in>set (s # S). x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> set (s # S)
distinct (s # S)

goal (1 subgoal):
 1. (\<forall>x\<in>set S. \<forall>y\<in>set S. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> set S &&& distinct S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_ortho_set (set S)
distinct S

goal (1 subgoal):
 1. \<And>a S. \<lbrakk>\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S); is_ortho_set (set (a # S)); distinct (a # S)\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) (a # S))
[PROOF STEP]
note IH = Cons.IH[OF this]
[PROOF STATE]
proof (state)
this:
distinct (map (\<lambda>s. s /\<^sub>R norm s) S)

goal (1 subgoal):
 1. \<And>a S. \<lbrakk>\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S); is_ortho_set (set (a # S)); distinct (a # S)\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) (a # S))
[PROOF STEP]
have "s /\<^sub>R norm s \<notin> (\<lambda>s. s /\<^sub>R norm s) ` set S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s /\<^sub>R norm s \<notin> (\<lambda>s. s /\<^sub>R norm s) ` set S
[PROOF STEP]
proof auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix s'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "s' \<in> set S" and same: "s /\<^sub>R norm s = s' /\<^sub>R norm s'"
[PROOF STATE]
proof (state)
this:
s' \<in> set S
s /\<^sub>R norm s = s' /\<^sub>R norm s'

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with Cons.prems
[PROOF STATE]
proof (chain)
picking this:
is_ortho_set (set (s # S))
distinct (s # S)
s' \<in> set S
s /\<^sub>R norm s = s' /\<^sub>R norm s'
[PROOF STEP]
have "s \<noteq> s'"
[PROOF STATE]
proof (prove)
using this:
is_ortho_set (set (s # S))
distinct (s # S)
s' \<in> set S
s /\<^sub>R norm s = s' /\<^sub>R norm s'

goal (1 subgoal):
 1. s \<noteq> s'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s \<noteq> s'

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "s \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<noteq> (0::'a)
[PROOF STEP]
by (metis Cons.prems(1) is_ortho_set_def list.set_intros(1))
[PROOF STATE]
proof (state)
this:
s \<noteq> (0::'a)

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s \<noteq> (0::'a)
[PROOF STEP]
have "0 \<noteq> (s /\<^sub>R norm s) \<bullet>\<^sub>C (s /\<^sub>R norm s)"
[PROOF STATE]
proof (prove)
using this:
s \<noteq> (0::'a)

goal (1 subgoal):
 1. 0 \<noteq> (s /\<^sub>R norm s) \<bullet>\<^sub>C (s /\<^sub>R norm s)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<noteq> (s /\<^sub>R norm s) \<bullet>\<^sub>C (s /\<^sub>R norm s)

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 \<noteq> (s /\<^sub>R norm s) \<bullet>\<^sub>C (s /\<^sub>R norm s)

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have \<open>(s /\<^sub>R norm s) \<bullet>\<^sub>C (s /\<^sub>R norm s) = (s /\<^sub>R norm s) \<bullet>\<^sub>C (s' /\<^sub>R norm s')\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s /\<^sub>R norm s) \<bullet>\<^sub>C (s /\<^sub>R norm s) = (s /\<^sub>R norm s) \<bullet>\<^sub>C (s' /\<^sub>R norm s')
[PROOF STEP]
by (simp add: same)
[PROOF STATE]
proof (state)
this:
(s /\<^sub>R norm s) \<bullet>\<^sub>C (s /\<^sub>R norm s) = (s /\<^sub>R norm s) \<bullet>\<^sub>C (s' /\<^sub>R norm s')

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(s /\<^sub>R norm s) \<bullet>\<^sub>C (s /\<^sub>R norm s) = (s /\<^sub>R norm s) \<bullet>\<^sub>C (s' /\<^sub>R norm s')

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have \<open>(s /\<^sub>R norm s) \<bullet>\<^sub>C (s' /\<^sub>R norm s') = (s \<bullet>\<^sub>C s') / (norm s * norm s')\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s /\<^sub>R norm s) \<bullet>\<^sub>C (s' /\<^sub>R norm s') = s \<bullet>\<^sub>C s' / complex_of_real (norm s * norm s')
[PROOF STEP]
by (simp add: scaleR_scaleC divide_inverse_commute)
[PROOF STATE]
proof (state)
this:
(s /\<^sub>R norm s) \<bullet>\<^sub>C (s' /\<^sub>R norm s') = s \<bullet>\<^sub>C s' / complex_of_real (norm s * norm s')

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(s /\<^sub>R norm s) \<bullet>\<^sub>C (s' /\<^sub>R norm s') = s \<bullet>\<^sub>C s' / complex_of_real (norm s * norm s')

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from \<open>s' \<in> set S\<close> \<open>s \<noteq> s'\<close>
[PROOF STATE]
proof (chain)
picking this:
s' \<in> set S
s \<noteq> s'
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
using this:
s' \<in> set S
s \<noteq> s'

goal (1 subgoal):
 1. s \<bullet>\<^sub>C s' / complex_of_real (norm s * norm s') = 0
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
s' \<in> set S
s \<noteq> s'
is_ortho_set (set (s # S))
distinct (s # S)

goal (1 subgoal):
 1. s \<bullet>\<^sub>C s' / complex_of_real (norm s * norm s') = 0
[PROOF STEP]
unfolding is_ortho_set_def
[PROOF STATE]
proof (prove)
using this:
s' \<in> set S
s \<noteq> s'
(\<forall>x\<in>set (s # S). \<forall>y\<in>set (s # S). x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> set (s # S)
distinct (s # S)

goal (1 subgoal):
 1. s \<bullet>\<^sub>C s' / complex_of_real (norm s * norm s') = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s \<bullet>\<^sub>C s' / complex_of_real (norm s * norm s') = 0

goal (1 subgoal):
 1. \<And>sa. \<lbrakk>s /\<^sub>R norm s = sa /\<^sub>R norm sa; sa \<in> set S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> 0

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
s /\<^sub>R norm s \<notin> (\<lambda>s. s /\<^sub>R norm s) ` set S

goal (1 subgoal):
 1. \<And>a S. \<lbrakk>\<lbrakk>is_ortho_set (set S); distinct S\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) S); is_ortho_set (set (a # S)); distinct (a # S)\<rbrakk> \<Longrightarrow> distinct (map (\<lambda>s. s /\<^sub>R norm s) (a # S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s /\<^sub>R norm s \<notin> (\<lambda>s. s /\<^sub>R norm s) ` set S
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
s /\<^sub>R norm s \<notin> (\<lambda>s. s /\<^sub>R norm s) ` set S

goal (1 subgoal):
 1. distinct (map (\<lambda>s. s /\<^sub>R norm s) (s # S))
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
s /\<^sub>R norm s \<notin> (\<lambda>s. s /\<^sub>R norm s) ` set S
distinct (map (\<lambda>s. s /\<^sub>R norm s) S)

goal (1 subgoal):
 1. distinct (map (\<lambda>s. s /\<^sub>R norm s) (s # S))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (map (\<lambda>s. s /\<^sub>R norm s) (s # S))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
distinct Snorm

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have norm_Snorm: "norm s = 1" if "s \<in> set Snorm" for s
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm s = 1
[PROOF STEP]
using that ortho
[PROOF STATE]
proof (prove)
using this:
s \<in> set Snorm
is_ortho_set (set S)

goal (1 subgoal):
 1. norm s = 1
[PROOF STEP]
unfolding Snorm_def is_ortho_set_def
[PROOF STATE]
proof (prove)
using this:
s \<in> set (map (\<lambda>s. s /\<^sub>R norm s) S)
(\<forall>x\<in>set S. \<forall>y\<in>set S. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> set S

goal (1 subgoal):
 1. norm s = 1
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>sa. \<lbrakk>sa \<in> set S; s = sa /\<^sub>R norm sa; \<forall>x\<in>set S. \<forall>y\<in>set S. x \<noteq> y \<longrightarrow> is_orthogonal x y; (0::'a) \<notin> set S\<rbrakk> \<Longrightarrow> inverse (norm sa) * norm sa = 1
[PROOF STEP]
by (metis left_inverse norm_eq_zero)
[PROOF STATE]
proof (state)
this:
?s \<in> set Snorm \<Longrightarrow> norm ?s = 1

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have ortho_Snorm: "is_ortho_set (set Snorm)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_ortho_set (set Snorm)
[PROOF STEP]
unfolding is_ortho_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>set Snorm. \<forall>y\<in>set Snorm. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> set Snorm
[PROOF STEP]
proof (intro conjI ballI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; x \<noteq> y\<rbrakk> \<Longrightarrow> is_orthogonal x y
 2. (0::'a) \<notin> set Snorm
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; x \<noteq> y\<rbrakk> \<Longrightarrow> is_orthogonal x y
 2. (0::'a) \<notin> set Snorm
[PROOF STEP]
show "0 \<notin> set Snorm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<notin> set Snorm
[PROOF STEP]
using norm_Snorm[of 0]
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<in> set Snorm \<Longrightarrow> norm (0::'a) = 1

goal (1 subgoal):
 1. (0::'a) \<notin> set Snorm
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) \<notin> set Snorm

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; x \<noteq> y\<rbrakk> \<Longrightarrow> is_orthogonal x y
[PROOF STEP]
assume "x \<in> set Snorm" and "y \<in> set Snorm" and "x \<noteq> y"
[PROOF STATE]
proof (state)
this:
x \<in> set Snorm
y \<in> set Snorm
x \<noteq> y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; x \<noteq> y\<rbrakk> \<Longrightarrow> is_orthogonal x y
[PROOF STEP]
from \<open>x \<in> set Snorm\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> set Snorm
[PROOF STEP]
obtain x' where x: "x = x' /\<^sub>R norm x'" and x': "x' \<in> set S"
[PROOF STATE]
proof (prove)
using this:
x \<in> set Snorm

goal (1 subgoal):
 1. (\<And>x'. \<lbrakk>x = x' /\<^sub>R norm x'; x' \<in> set S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Snorm_def
[PROOF STATE]
proof (prove)
using this:
x \<in> set (map (\<lambda>s. s /\<^sub>R norm s) S)

goal (1 subgoal):
 1. (\<And>x'. \<lbrakk>x = x' /\<^sub>R norm x'; x' \<in> set S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = x' /\<^sub>R norm x'
x' \<in> set S

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; x \<noteq> y\<rbrakk> \<Longrightarrow> is_orthogonal x y
[PROOF STEP]
from \<open>y \<in> set Snorm\<close>
[PROOF STATE]
proof (chain)
picking this:
y \<in> set Snorm
[PROOF STEP]
obtain y' where y: "y = y' /\<^sub>R norm y'" and y': "y' \<in> set S"
[PROOF STATE]
proof (prove)
using this:
y \<in> set Snorm

goal (1 subgoal):
 1. (\<And>y'. \<lbrakk>y = y' /\<^sub>R norm y'; y' \<in> set S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Snorm_def
[PROOF STATE]
proof (prove)
using this:
y \<in> set (map (\<lambda>s. s /\<^sub>R norm s) S)

goal (1 subgoal):
 1. (\<And>y'. \<lbrakk>y = y' /\<^sub>R norm y'; y' \<in> set S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y = y' /\<^sub>R norm y'
y' \<in> set S

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; x \<noteq> y\<rbrakk> \<Longrightarrow> is_orthogonal x y
[PROOF STEP]
from \<open>x \<noteq> y\<close> x y
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
x = x' /\<^sub>R norm x'
y = y' /\<^sub>R norm y'
[PROOF STEP]
have \<open>x' \<noteq> y'\<close>
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
x = x' /\<^sub>R norm x'
y = y' /\<^sub>R norm y'

goal (1 subgoal):
 1. x' \<noteq> y'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x' \<noteq> y'

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; x \<noteq> y\<rbrakk> \<Longrightarrow> is_orthogonal x y
[PROOF STEP]
with x' y' ortho
[PROOF STATE]
proof (chain)
picking this:
x' \<in> set S
y' \<in> set S
is_ortho_set (set S)
x' \<noteq> y'
[PROOF STEP]
have "cinner x' y' = 0"
[PROOF STATE]
proof (prove)
using this:
x' \<in> set S
y' \<in> set S
is_ortho_set (set S)
x' \<noteq> y'

goal (1 subgoal):
 1. is_orthogonal x' y'
[PROOF STEP]
unfolding is_ortho_set_def
[PROOF STATE]
proof (prove)
using this:
x' \<in> set S
y' \<in> set S
(\<forall>x\<in>set S. \<forall>y\<in>set S. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> set S
x' \<noteq> y'

goal (1 subgoal):
 1. is_orthogonal x' y'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_orthogonal x' y'

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; x \<noteq> y\<rbrakk> \<Longrightarrow> is_orthogonal x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_orthogonal x' y'
[PROOF STEP]
show "cinner x y = 0"
[PROOF STATE]
proof (prove)
using this:
is_orthogonal x' y'

goal (1 subgoal):
 1. is_orthogonal x y
[PROOF STEP]
unfolding x y scaleR_scaleC
[PROOF STATE]
proof (prove)
using this:
is_orthogonal x' y'

goal (1 subgoal):
 1. is_orthogonal (complex_of_real (inverse (norm x')) *\<^sub>C x') (complex_of_real (inverse (norm y')) *\<^sub>C y')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_orthogonal x y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_ortho_set (set Snorm)

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have inj_butter: "inj_on selfbutter (set Snorm)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on selfbutter (set Snorm)
[PROOF STEP]
proof (rule inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "x \<in> set Snorm" and "y \<in> set Snorm"
[PROOF STATE]
proof (state)
this:
x \<in> set Snorm
y \<in> set Snorm

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "selfbutter x = selfbutter y"
[PROOF STATE]
proof (state)
this:
selfbutter x = selfbutter y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
selfbutter x = selfbutter y
[PROOF STEP]
obtain c where xcy: "x = c *\<^sub>C y" and "cmod c = 1"
[PROOF STATE]
proof (prove)
using this:
selfbutter x = selfbutter y

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>x = c *\<^sub>C y; cmod c = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using inj_selfbutter_upto_phase
[PROOF STATE]
proof (prove)
using this:
selfbutter x = selfbutter y
selfbutter ?x = selfbutter ?y \<Longrightarrow> \<exists>c. cmod c = 1 \<and> ?x = c *\<^sub>C ?y

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>x = c *\<^sub>C y; cmod c = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = c *\<^sub>C y
cmod c = 1

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "0 \<noteq> cmod (cinner x x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<noteq> cmod (x \<bullet>\<^sub>C x)
[PROOF STEP]
using \<open>x \<in> set Snorm\<close> norm_Snorm
[PROOF STATE]
proof (prove)
using this:
x \<in> set Snorm
?s \<in> set Snorm \<Longrightarrow> norm ?s = 1

goal (1 subgoal):
 1. 0 \<noteq> cmod (x \<bullet>\<^sub>C x)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 \<noteq> cmod (x \<bullet>\<^sub>C x)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 \<noteq> cmod (x \<bullet>\<^sub>C x)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "cmod (cinner x x) = cmod (c * (x \<bullet>\<^sub>C y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (x \<bullet>\<^sub>C x) = cmod (c * (x \<bullet>\<^sub>C y))
[PROOF STEP]
apply (subst (2) xcy)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (x \<bullet>\<^sub>C c *\<^sub>C y) = cmod (c * (x \<bullet>\<^sub>C y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (x \<bullet>\<^sub>C x) = cmod (c * (x \<bullet>\<^sub>C y))

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (x \<bullet>\<^sub>C x) = cmod (c * (x \<bullet>\<^sub>C y))

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "\<dots> = cmod (x \<bullet>\<^sub>C y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (c * (x \<bullet>\<^sub>C y)) = cmod (x \<bullet>\<^sub>C y)
[PROOF STEP]
using \<open>cmod c = 1\<close>
[PROOF STATE]
proof (prove)
using this:
cmod c = 1

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

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> cmod (x \<bullet>\<^sub>C y)
[PROOF STEP]
have "(x \<bullet>\<^sub>C y) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> cmod (x \<bullet>\<^sub>C y)

goal (1 subgoal):
 1. x \<bullet>\<^sub>C y \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<bullet>\<^sub>C y \<noteq> 0

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set Snorm; y \<in> set Snorm; selfbutter x = selfbutter y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<bullet>\<^sub>C y \<noteq> 0
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
x \<bullet>\<^sub>C y \<noteq> 0

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using ortho_Snorm \<open>x \<in> set Snorm\<close> \<open>y \<in> set Snorm\<close>
[PROOF STATE]
proof (prove)
using this:
x \<bullet>\<^sub>C y \<noteq> 0
is_ortho_set (set Snorm)
x \<in> set Snorm
y \<in> set Snorm

goal (1 subgoal):
 1. x = y
[PROOF STEP]
unfolding is_ortho_set_def
[PROOF STATE]
proof (prove)
using this:
x \<bullet>\<^sub>C y \<noteq> 0
(\<forall>x\<in>set Snorm. \<forall>y\<in>set Snorm. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> set Snorm
x \<in> set Snorm
y \<in> set Snorm

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on selfbutter (set Snorm)

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
from \<open>distinct Snorm\<close> inj_butter
[PROOF STATE]
proof (chain)
picking this:
distinct Snorm
inj_on selfbutter (set Snorm)
[PROOF STEP]
have distinct': "distinct (map selfbutter Snorm)"
[PROOF STATE]
proof (prove)
using this:
distinct Snorm
inj_on selfbutter (set Snorm)

goal (1 subgoal):
 1. distinct (map selfbutter Snorm)
[PROOF STEP]
unfolding distinct_map
[PROOF STATE]
proof (prove)
using this:
distinct Snorm
inj_on selfbutter (set Snorm)

goal (1 subgoal):
 1. distinct Snorm \<and> inj_on selfbutter (set Snorm)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (map selfbutter Snorm)

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have Span_Snorm: "ccspan (set Snorm) = ccspan (set S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan (set Snorm) = ccspan (set S)
[PROOF STEP]
apply (transfer fixing: Snorm S)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (cspan (set Snorm)) = closure (cspan (set S))
[PROOF STEP]
apply (simp add: scaleR_scaleC Snorm_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cspan ((\<lambda>s. s /\<^sub>C complex_of_real (norm s)) ` set S) = cspan (set S)
[PROOF STEP]
apply (subst complex_vector.span_image_scale)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite (set S)
 2. \<And>x. x \<in> set S \<Longrightarrow> inverse (complex_of_real (norm x)) \<noteq> 0
 3. cspan (set S) = cspan (set S)
[PROOF STEP]
using is_ortho_set_def ortho
[PROOF STATE]
proof (prove)
using this:
is_ortho_set ?S = ((\<forall>x\<in>?S. \<forall>y\<in>?S. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::?'a) \<notin> ?S)
is_ortho_set (set S)

goal (3 subgoals):
 1. finite (set S)
 2. \<And>x. x \<in> set S \<Longrightarrow> inverse (complex_of_real (norm x)) \<noteq> 0
 3. cspan (set S) = cspan (set S)
[PROOF STEP]
by fastforce+
[PROOF STATE]
proof (state)
this:
ccspan (set Snorm) = ccspan (set S)

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have "mk_projector_orthog d (map vec_of_basis_enum S)
      = mat_of_cblinfun (sum_list (map selfbutter Snorm))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter Snorm))
[PROOF STEP]
unfolding Snorm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S)))
[PROOF STEP]
proof (induction S)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mk_projector_orthog d (map vec_of_basis_enum []) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) [])))
 2. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. mk_projector_orthog d (map vec_of_basis_enum []) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) [])))
 2. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum []) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) [])))
[PROOF STEP]
by (simp add: d_def mat_of_cblinfun_zero)
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum []) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) [])))

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
case (Cons a S)
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S)))

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
define sumS where "sumS = sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))"
[PROOF STATE]
proof (state)
this:
sumS = sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S)))
sumS = sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))
[PROOF STEP]
have IH: "mk_projector_orthog d (map vec_of_basis_enum S)
                  = mat_of_cblinfun sumS"
[PROOF STATE]
proof (prove)
using this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S)))
sumS = sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun sumS
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun sumS

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
define factor where "factor = inverse ((complex_of_real (norm a))\<^sup>2)"
[PROOF STATE]
proof (state)
this:
factor = inverse ((complex_of_real (norm a))\<^sup>2)

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
have factor': "factor = 1 / (vec_of_basis_enum a \<bullet>c vec_of_basis_enum a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. factor = 1 / (vec_of_basis_enum a \<bullet>c vec_of_basis_enum a)
[PROOF STEP]
unfolding factor_def cscalar_prod_vec_of_basis_enum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse ((complex_of_real (norm a))\<^sup>2) = 1 / (a \<bullet>\<^sub>C a)
[PROOF STEP]
by (simp add: inverse_eq_divide power2_norm_eq_cinner)
[PROOF STATE]
proof (state)
this:
factor = 1 / (vec_of_basis_enum a \<bullet>c vec_of_basis_enum a)

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
have "mk_projector_orthog d (map vec_of_basis_enum (a # S))
          = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a]
                    * mat_of_rows d [conjugate (vec_of_basis_enum a)])
            + mat_of_cblinfun sumS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum (a # S)) = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS
[PROOF STEP]
apply (cases S)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S = [] \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS
 2. \<And>aa list. S = aa # list \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS
[PROOF STEP]
apply (auto simp add: factor' sumS_def d_def mat_of_cblinfun_zero)[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa list. S = aa # list \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS
[PROOF STEP]
by (auto simp add: IH[symmetric] factor' d_def)
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum (a # S)) = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum (a # S)) = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
have "\<dots> = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] *
         mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) + mat_of_cblinfun sumS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) + mat_of_cblinfun sumS
[PROOF STEP]
apply (rule arg_cong[where f="\<lambda>x. _ \<cdot>\<^sub>m (_ * x) + _"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows d [conjugate (vec_of_basis_enum a)] = mat_adjoint (mat_of_cols d [vec_of_basis_enum a])
[PROOF STEP]
apply (rule mat_eq_iff[THEN iffD2])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_of_rows d [conjugate (vec_of_basis_enum a)]) = dim_row (mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) \<and> dim_col (mat_of_rows d [conjugate (vec_of_basis_enum a)]) = dim_col (mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) \<and> (\<forall>i j. i < dim_row (mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) \<longrightarrow> j < dim_col (mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) \<longrightarrow> mat_of_rows d [conjugate (vec_of_basis_enum a)] $$ (i, j) = mat_adjoint (mat_of_cols d [vec_of_basis_enum a]) $$ (i, j))
[PROOF STEP]
apply (auto simp add: mat_adjoint_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < d \<Longrightarrow> mat_of_rows d [conjugate (vec_of_basis_enum a)] $$ (0, j) = mat_of_rows d (map conjugate (cols (mat_of_cols d [vec_of_basis_enum a]))) $$ (0, j)
[PROOF STEP]
apply (subst mat_of_rows_index)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>j. j < d \<Longrightarrow> 0 < length [conjugate (vec_of_basis_enum a)]
 2. \<And>j. j < d \<Longrightarrow> j < d
 3. \<And>j. j < d \<Longrightarrow> [conjugate (vec_of_basis_enum a)] ! 0 $ j = mat_of_rows d (map conjugate (cols (mat_of_cols d [vec_of_basis_enum a]))) $$ (0, j)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < d \<Longrightarrow> conjugate (vec_of_basis_enum a) $ j = mat_of_rows d (map conjugate (cols (mat_of_cols d [vec_of_basis_enum a]))) $$ (0, j)
[PROOF STEP]
apply (subst mat_of_rows_index)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>j. j < d \<Longrightarrow> 0 < length (map conjugate (cols (mat_of_cols d [vec_of_basis_enum a])))
 2. \<And>j. j < d \<Longrightarrow> j < d
 3. \<And>j. j < d \<Longrightarrow> conjugate (vec_of_basis_enum a) $ j = map conjugate (cols (mat_of_cols d [vec_of_basis_enum a])) ! 0 $ j
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < d \<Longrightarrow> conjugate (vec_of_basis_enum a) $ j = cnj (mat_of_cols d [vec_of_basis_enum a] $$ (j, 0))
[PROOF STEP]
apply (subst mat_of_cols_index)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>j. j < d \<Longrightarrow> j < d
 2. \<And>j. j < d \<Longrightarrow> 0 < length [vec_of_basis_enum a]
 3. \<And>j. j < d \<Longrightarrow> conjugate (vec_of_basis_enum a) $ j = cnj ([vec_of_basis_enum a] ! 0 $ j)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < d \<Longrightarrow> conjugate (vec_of_basis_enum a) $ j = cnj (vec_of_basis_enum a $ j)
[PROOF STEP]
by (simp add: assms(1) dim_vec_of_basis_enum')
[PROOF STATE]
proof (state)
this:
factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) + mat_of_cblinfun sumS

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_of_rows d [conjugate (vec_of_basis_enum a)]) + mat_of_cblinfun sumS = factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) + mat_of_cblinfun sumS

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
have "\<dots> = mat_of_cblinfun (selfbutter (a /\<^sub>R norm a)) + mat_of_cblinfun sumS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) + mat_of_cblinfun sumS = mat_of_cblinfun (selfbutter (a /\<^sub>R norm a)) + mat_of_cblinfun sumS
[PROOF STEP]
apply (simp add: butterfly_scaleR_left butterfly_scaleR_right power_inverse mat_of_cblinfun_scaleR factor_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse ((complex_of_real (norm a))\<^sup>2) \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) + mat_of_cblinfun sumS = mat_of_cblinfun ((inverse (complex_of_real (norm a)) * inverse (complex_of_real (norm a))) *\<^sub>C selfbutter a) + mat_of_cblinfun sumS
[PROOF STEP]
apply (simp add: butterfly_def mat_of_cblinfun_compose
          mat_of_cblinfun_adj mat_of_cblinfun_vector_to_cblinfun d_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse ((complex_of_real (norm a))\<^sup>2) \<cdot>\<^sub>m (mat_of_cols (length canonical_basis) [vec_of_basis_enum a] * mat_adjoint (mat_of_cols (length canonical_basis) [vec_of_basis_enum a])) + mat_of_cblinfun sumS = mat_of_cblinfun ((inverse (complex_of_real (norm a)) * inverse (complex_of_real (norm a))) *\<^sub>C (vector_to_cblinfun a o\<^sub>C\<^sub>L vector_to_cblinfun a*)) + mat_of_cblinfun sumS
[PROOF STEP]
by (simp add: mat_of_cblinfun_compose mat_of_cblinfun_adj mat_of_cblinfun_vector_to_cblinfun mat_of_cblinfun_scaleC power2_eq_square)
[PROOF STATE]
proof (state)
this:
factor \<cdot>\<^sub>m (mat_of_cols d [vec_of_basis_enum a] * mat_adjoint (mat_of_cols d [vec_of_basis_enum a])) + mat_of_cblinfun sumS = mat_of_cblinfun (selfbutter (a /\<^sub>R norm a)) + mat_of_cblinfun sumS

goal (1 subgoal):
 1. \<And>a S. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) S))) \<Longrightarrow> mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (selfbutter (a /\<^sub>R norm a)) + mat_of_cblinfun sumS
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (selfbutter (a /\<^sub>R norm a)) + mat_of_cblinfun sumS

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))
[PROOF STEP]
by (simp add: mat_of_cblinfun_plus sumS_def)
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum (a # S)) = mat_of_cblinfun (sum_list (map selfbutter (map (\<lambda>s. s /\<^sub>R norm s) (a # S))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter Snorm))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (sum_list (map selfbutter Snorm))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have "\<dots> = mat_of_cblinfun (\<Sum>s\<in>set Snorm. selfbutter s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (sum_list (map selfbutter Snorm)) = mat_of_cblinfun (sum selfbutter (set Snorm))
[PROOF STEP]
by (metis distinct' distinct_map sum.distinct_set_conv_list)
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (sum_list (map selfbutter Snorm)) = mat_of_cblinfun (sum selfbutter (set Snorm))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (sum_list (map selfbutter Snorm)) = mat_of_cblinfun (sum selfbutter (set Snorm))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have "\<dots> = mat_of_cblinfun (\<Sum>s\<in>set Snorm. proj s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (sum selfbutter (set Snorm)) = mat_of_cblinfun (sum proj (set Snorm))
[PROOF STEP]
apply (rule arg_cong[where f="mat_of_cblinfun"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum selfbutter (set Snorm) = sum proj (set Snorm)
[PROOF STEP]
apply (rule sum.cong[OF refl])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set Snorm \<Longrightarrow> selfbutter x = proj x
[PROOF STEP]
apply (rule butterfly_eq_proj)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set Snorm \<Longrightarrow> norm x = 1
[PROOF STEP]
using norm_Snorm
[PROOF STATE]
proof (prove)
using this:
?s \<in> set Snorm \<Longrightarrow> norm ?s = 1

goal (1 subgoal):
 1. \<And>x. x \<in> set Snorm \<Longrightarrow> norm x = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (sum selfbutter (set Snorm)) = mat_of_cblinfun (sum proj (set Snorm))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (sum selfbutter (set Snorm)) = mat_of_cblinfun (sum proj (set Snorm))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have "\<dots> = mat_of_cblinfun (Proj (ccspan (set Snorm)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (sum proj (set Snorm)) = mat_of_cblinfun (Proj (ccspan (set Snorm)))
[PROOF STEP]
apply (rule arg_cong[of _ _ mat_of_cblinfun])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum proj (set Snorm) = Proj (ccspan (set Snorm))
[PROOF STEP]
proof (insert ortho_Snorm, insert \<open>distinct Snorm\<close>, induction Snorm)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>is_ortho_set (set []); distinct []\<rbrakk> \<Longrightarrow> sum proj (set []) = Proj (ccspan (set []))
 2. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
is_ortho_set (set [])
distinct []

goal (2 subgoals):
 1. \<lbrakk>is_ortho_set (set []); distinct []\<rbrakk> \<Longrightarrow> sum proj (set []) = Proj (ccspan (set []))
 2. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum proj (set []) = Proj (ccspan (set []))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum proj (set []) = Proj (ccspan (set []))

goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
case (Cons a Snorm)
[PROOF STATE]
proof (state)
this:
\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm))
is_ortho_set (set (a # Snorm))
distinct (a # Snorm)

goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
from Cons.prems
[PROOF STATE]
proof (chain)
picking this:
is_ortho_set (set (a # Snorm))
distinct (a # Snorm)
[PROOF STEP]
have [simp]: "a \<notin> set Snorm"
[PROOF STATE]
proof (prove)
using this:
is_ortho_set (set (a # Snorm))
distinct (a # Snorm)

goal (1 subgoal):
 1. a \<notin> set Snorm
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<notin> set Snorm

goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
have "sum proj (set (a # Snorm))
        = proj a + sum proj (set Snorm)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum proj (set (a # Snorm)) = proj a + sum proj (set Snorm)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum proj (set (a # Snorm)) = proj a + sum proj (set Snorm)

goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum proj (set (a # Snorm)) = proj a + sum proj (set Snorm)

goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
have "\<dots> = proj a + Proj (ccspan (set Snorm))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj a + sum proj (set Snorm) = proj a + Proj (ccspan (set Snorm))
[PROOF STEP]
apply (subst Cons.IH)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. is_ortho_set (set Snorm)
 2. distinct Snorm
 3. proj a + Proj (ccspan (set Snorm)) = proj a + Proj (ccspan (set Snorm))
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
is_ortho_set (set (a # Snorm))
distinct (a # Snorm)

goal (3 subgoals):
 1. is_ortho_set (set Snorm)
 2. distinct Snorm
 3. proj a + Proj (ccspan (set Snorm)) = proj a + Proj (ccspan (set Snorm))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_ortho_set (insert a (set Snorm)); distinct Snorm\<rbrakk> \<Longrightarrow> is_ortho_set (set Snorm)
[PROOF STEP]
by (meson Cons.prems(1) is_ortho_set_antimono set_subset_Cons)
[PROOF STATE]
proof (state)
this:
proj a + sum proj (set Snorm) = proj a + Proj (ccspan (set Snorm))

goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proj a + sum proj (set Snorm) = proj a + Proj (ccspan (set Snorm))

goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
have "\<dots> = Proj (ccspan ({a} \<union> set Snorm))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj a + Proj (ccspan (set Snorm)) = Proj (ccspan ({a} \<union> set Snorm))
[PROOF STEP]
apply (rule Proj_orthog_ccspan_union[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {a}; y \<in> set Snorm\<rbrakk> \<Longrightarrow> is_orthogonal x y
[PROOF STEP]
by (metis Cons.prems(1) \<open>a \<notin> set Snorm\<close> is_ortho_set_def list.set_intros(1) list.set_intros(2) singleton_iff)
[PROOF STATE]
proof (state)
this:
proj a + Proj (ccspan (set Snorm)) = Proj (ccspan ({a} \<union> set Snorm))

goal (1 subgoal):
 1. \<And>a Snorm. \<lbrakk>\<lbrakk>is_ortho_set (set Snorm); distinct Snorm\<rbrakk> \<Longrightarrow> sum proj (set Snorm) = Proj (ccspan (set Snorm)); is_ortho_set (set (a # Snorm)); distinct (a # Snorm)\<rbrakk> \<Longrightarrow> sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum proj (set (a # Snorm)) = Proj (ccspan ({a} \<union> set Snorm))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sum proj (set (a # Snorm)) = Proj (ccspan ({a} \<union> set Snorm))

goal (1 subgoal):
 1. sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum proj (set (a # Snorm)) = Proj (ccspan (set (a # Snorm)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (sum proj (set Snorm)) = mat_of_cblinfun (Proj (ccspan (set Snorm)))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (sum proj (set Snorm)) = mat_of_cblinfun (Proj (ccspan (set Snorm)))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
have "\<dots> = mat_of_cblinfun (Proj (ccspan (set S)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (Proj (ccspan (set Snorm))) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
unfolding Span_Snorm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (Proj (ccspan (set S))) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (Proj (ccspan (set Snorm))) = mat_of_cblinfun (Proj (ccspan (set S)))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))

goal (1 subgoal):
 1. mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))
[PROOF STEP]
by -
[PROOF STATE]
proof (state)
this:
mk_projector_orthog d (map vec_of_basis_enum S) = mat_of_cblinfun (Proj (ccspan (set S)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fcompose_pCons:
  "fcompose (pCons a p) q1 q2 = smult a (q2^(degree (pCons a p))) + q1 * fcompose p q1 q2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
proof (cases "p=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
define ff where "ff=(\<lambda>a (c, d). (d * [:a:] + q1 * c, q2 * d))"
[PROOF STATE]
proof (state)
this:
ff = (\<lambda>a (c, d). (d * [:a:] + q1 * c, q2 * d))

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
define fc where "fc=fold_coeffs ff p (0, 1)"
[PROOF STATE]
proof (state)
this:
fc = fold_coeffs ff p (0, 1)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
have snd_ff:"snd fc = (if p=0 then 1 else q2^(degree p + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd fc = (if p = 0 then 1 else q2 ^ (degree p + 1))
[PROOF STEP]
unfolding fc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (fold_coeffs ff p (0, 1)) = (if p = 0 then 1 else q2 ^ (degree p + 1))
[PROOF STEP]
apply (induct p)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. snd (fold_coeffs ff 0 (0, 1)) = (if 0 = 0 then 1 else q2 ^ (degree 0 + 1))
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; snd (fold_coeffs ff p (0, 1)) = (if p = 0 then 1 else q2 ^ (degree p + 1))\<rbrakk> \<Longrightarrow> snd (fold_coeffs ff (pCons a p) (0, 1)) = (if pCons a p = 0 then 1 else q2 ^ (degree (pCons a p) + 1))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (fold_coeffs ff 0 (0, 1)) = (if 0 = 0 then 1 else q2 ^ (degree 0 + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; snd (fold_coeffs ff p (0, 1)) = (if p = 0 then 1 else q2 ^ (degree p + 1))\<rbrakk> \<Longrightarrow> snd (fold_coeffs ff (pCons a p) (0, 1)) = (if pCons a p = 0 then 1 else q2 ^ (degree (pCons a p) + 1))
[PROOF STEP]
subgoal for a p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; snd (fold_coeffs ff p (0, 1)) = (if p = 0 then 1 else q2 ^ (degree p + 1))\<rbrakk> \<Longrightarrow> snd (fold_coeffs ff (pCons a p) (0, 1)) = (if pCons a p = 0 then 1 else q2 ^ (degree (pCons a p) + 1))
[PROOF STEP]
by (auto simp add:ff_def split:if_splits prod.splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
snd fc = (if p = 0 then 1 else q2 ^ (degree p + 1))

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
have "fcompose (pCons a p) q1 q2 = fst (fold_coeffs ff (pCons a p) (0, 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcompose (pCons a p) q1 q2 = fst (fold_coeffs ff (pCons a p) (0, 1))
[PROOF STEP]
unfolding fcompose_def ff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (fold_coeffs (\<lambda>a (c, d). (d * [:a:] + q1 * c, q2 * d)) (pCons a p) (0, 1)) = fst (fold_coeffs (\<lambda>a (c, d). (d * [:a:] + q1 * c, q2 * d)) (pCons a p) (0, 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fcompose (pCons a p) q1 q2 = fst (fold_coeffs ff (pCons a p) (0, 1))

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fcompose (pCons a p) q1 q2 = fst (fold_coeffs ff (pCons a p) (0, 1))

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
have "... = fst (ff a fc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (fold_coeffs ff (pCons a p) (0, 1)) = fst (ff a fc)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. fst (fold_coeffs ff (pCons a p) (0, 1)) = fst (ff a fc)
[PROOF STEP]
unfolding fc_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. fst (fold_coeffs ff (pCons a p) (0, 1)) = fst (ff a (fold_coeffs ff p (0, 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst (fold_coeffs ff (pCons a p) (0, 1)) = fst (ff a fc)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fst (fold_coeffs ff (pCons a p) (0, 1)) = fst (ff a fc)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
have "... = snd fc * [:a:] + q1 * fst fc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (ff a fc) = snd fc * [:a:] + q1 * fst fc
[PROOF STEP]
unfolding ff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (case fc of (c, d) \<Rightarrow> (d * [:a:] + q1 * c, q2 * d)) = snd fc * [:a:] + q1 * fst fc
[PROOF STEP]
by (auto split:prod.splits)
[PROOF STATE]
proof (state)
this:
fst (ff a fc) = snd fc * [:a:] + q1 * fst fc

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fst (ff a fc) = snd fc * [:a:] + q1 * fst fc

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
have "... = smult a (q2^(degree (pCons a p))) + q1 * fst fc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd fc * [:a:] + q1 * fst fc = smult a (q2 ^ degree (pCons a p)) + q1 * fst fc
[PROOF STEP]
using snd_ff False
[PROOF STATE]
proof (prove)
using this:
snd fc = (if p = 0 then 1 else q2 ^ (degree p + 1))
p \<noteq> 0

goal (1 subgoal):
 1. snd fc * [:a:] + q1 * fst fc = smult a (q2 ^ degree (pCons a p)) + q1 * fst fc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd fc * [:a:] + q1 * fst fc = smult a (q2 ^ degree (pCons a p)) + q1 * fst fc

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
snd fc * [:a:] + q1 * fst fc = smult a (q2 ^ degree (pCons a p)) + q1 * fst fc

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
have "... = smult a (q2^(degree (pCons a p))) + q1 * fcompose p q1 q2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a (q2 ^ degree (pCons a p)) + q1 * fst fc = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
unfolding fc_def ff_def fcompose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a (q2 ^ degree (pCons a p)) + q1 * fst (fold_coeffs (\<lambda>a (c, d). (d * [:a:] + q1 * c, q2 * d)) p (0, 1)) = smult a (q2 ^ degree (pCons a p)) + q1 * fst (fold_coeffs (\<lambda>a (c, d). (d * [:a:] + q1 * c, q2 * d)) p (0, 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
smult a (q2 ^ degree (pCons a p)) + q1 * fst fc = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
 2. p \<noteq> 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2

goal (1 subgoal):
 1. fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2

goal (1 subgoal):
 1. p = 0 \<Longrightarrow> fcompose (pCons a p) q1 q2 = smult a (q2 ^ degree (pCons a p)) + q1 * fcompose p q1 q2
[PROOF STEP]
qed simp


[STATEMENT]
lemma bounded_nat_encoding: "is_encoding (Nb\<^sub>e l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_encoding (Nb\<^sub>e l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_encoding (Nb\<^sub>e l)
[PROOF STEP]
have "x < l \<Longrightarrow> x < 2 ^ floorlog 2 (l-1)" for x :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < l \<Longrightarrow> x < 2 ^ floorlog 2 (l - 1)
[PROOF STEP]
by (intro floorlog_leD floorlog_mono, auto)
[PROOF STATE]
proof (state)
this:
?x < l \<Longrightarrow> ?x < 2 ^ floorlog 2 (l - 1)

goal (1 subgoal):
 1. is_encoding (Nb\<^sub>e l)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?x < l \<Longrightarrow> ?x < 2 ^ floorlog 2 (l - 1)

goal (1 subgoal):
 1. is_encoding (Nb\<^sub>e l)
[PROOF STEP]
using encode_bounded_nat_prefix_free
[PROOF STATE]
proof (prove)
using this:
?x < l \<Longrightarrow> ?x < 2 ^ floorlog 2 (l - 1)
\<lbrakk>?u < 2 ^ ?l; ?v < 2 ^ ?l; prefix (encode_bounded_nat ?l ?u) (encode_bounded_nat ?l ?v)\<rbrakk> \<Longrightarrow> ?u = ?v

goal (1 subgoal):
 1. is_encoding (Nb\<^sub>e l)
[PROOF STEP]
by (intro is_encodingI, simp add:Nb\<^sub>e_def split:if_splits, blast)
[PROOF STATE]
proof (state)
this:
is_encoding (Nb\<^sub>e l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma combine_sorted_pivot:
  assumes "l\<le>i" "i<h"
  assumes "ran_sorted a l i"
  assumes "ran_sorted a (i+1) h"
  assumes "\<forall>k\<in>{l..<i}. a k < a i"
  assumes "\<forall>k\<in>{i+1..<h}. a k \<ge> a i"
  shows "ran_sorted a l h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ran_sorted a l h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l \<le> i
i < h
ran_sorted a l i
ran_sorted a (i + 1) h
\<forall>k\<in>{l..<i}. a k < a i
\<forall>k\<in>{i + 1..<h}. a i \<le> a k

goal (1 subgoal):
 1. ran_sorted a l h
[PROOF STEP]
unfolding ran_sorted_def Ball_def
[PROOF STATE]
proof (prove)
using this:
l \<le> i
i < h
\<forall>x. x \<in> {l..<i} \<longrightarrow> (\<forall>xa. xa \<in> {l..<i} \<longrightarrow> x \<le> xa \<longrightarrow> a x \<le> a xa)
\<forall>x. x \<in> {i + 1..<h} \<longrightarrow> (\<forall>xa. xa \<in> {i + 1..<h} \<longrightarrow> x \<le> xa \<longrightarrow> a x \<le> a xa)
\<forall>x. x \<in> {l..<i} \<longrightarrow> a x < a i
\<forall>x. x \<in> {i + 1..<h} \<longrightarrow> a i \<le> a x

goal (1 subgoal):
 1. \<forall>x. x \<in> {l..<h} \<longrightarrow> (\<forall>xa. xa \<in> {l..<h} \<longrightarrow> x \<le> xa \<longrightarrow> a x \<le> a xa)
[PROOF STEP]
by clarsimp smt


[STATEMENT]
lemma inv_to_set:
  "(\<forall> i < length ss. ss ! i \<in> S) \<longleftrightarrow> set ss \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<length ss. ss ! i \<in> S) = (set ss \<subseteq> S)
[PROOF STEP]
by (induct ss) (auto simp: nth_Cons split: nat.splits)


[STATEMENT]
lemma preimg_img_on_card :
  assumes "x \<in> preimg_img_on A \<phi>"
  shows "1 \<le> card x \<and> card x \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> card x \<and> card x \<le> 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> preimg_img_on A \<phi>

goal (1 subgoal):
 1. 1 \<le> card x \<and> card x \<le> 2
[PROOF STEP]
by(fastforce simp: preimg_img_on_def card2)


[STATEMENT]
lemma sorted_RBT_Set_keys:
  "ID CCOMPARE('a :: ccompare) = Some c
  \<Longrightarrow> linorder.sorted (le_of_comp c) (RBT_Set2.keys rbt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ID ccompare = Some c \<Longrightarrow> sorted_wrt (le_of_comp c) (keys rbt)
[PROOF STEP]
by transfer(auto simp add: RBT_Set2.keys.rep_eq RBT_Impl.keys_def linorder.rbt_sorted_entries[OF ID_ccompare] ord.is_rbt_rbt_sorted)


[STATEMENT]
lemma splitAt_distinct: "distinct vs \<Longrightarrow> set (fst (splitAt ram vs)) \<inter> set (snd (splitAt ram vs)) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct vs \<Longrightarrow> set (fst (splitAt ram vs)) \<inter> set (snd (splitAt ram vs)) = {}
[PROOF STEP]
by (simp add: splitAt_def splitAtRec_distinct)


[STATEMENT]
lemma stirling_Suc_n_n: "stirling (Suc n) n = Suc n choose 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stirling (Suc n) n = Suc n choose 2
[PROOF STEP]
by (induct n) (auto simp add: numerals(2))


[STATEMENT]
lemma deg_minus_eq:
  assumes "p \<in> carrier P" "q \<in> carrier P" "deg R q \<noteq> deg R p"
  shows "deg R (p \<ominus>\<^bsub>P\<^esub> q) = max (deg R p) (deg R q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg R (p \<ominus>\<^bsub>P\<^esub> q) = max (deg R p) (deg R q)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P
q \<in> carrier P
deg R q \<noteq> deg R p

goal (1 subgoal):
 1. deg R (p \<ominus>\<^bsub>P\<^esub> q) = max (deg R p) (deg R q)
[PROOF STEP]
by (simp add: deg_add_eq a_minus_def)


[STATEMENT]
lemma br_set_rel_alt: "(s',s)\<in>\<langle>br \<alpha> I\<rangle>set_rel \<longleftrightarrow> (s=\<alpha>`s' \<and> (\<forall>x\<in>s'. I x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((s', s) \<in> \<langle>br \<alpha> I\<rangle>set_rel) = (s = \<alpha> ` s' \<and> (\<forall>x\<in>s'. I x))
[PROOF STEP]
by (auto simp: set_rel_def br_def)


[STATEMENT]
lemma TBOUND_replicate: "\<lbrakk>TBOUND x c\<rbrakk> \<Longrightarrow> TBOUND (replicatei n x) (1+(1+c)*n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TBOUND x c \<Longrightarrow> TBOUND (replicatei n x) (1 + (1 + c) * n)
[PROOF STEP]
by (meson TBOUND_def time_replicate)


[STATEMENT]
lemma exp_pi_i' [simp]: "exp (\<i> * of_real pi) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (\<i> * complex_of_real pi) = - 1
[PROOF STEP]
using cis_conv_exp cis_pi
[PROOF STATE]
proof (prove)
using this:
cis ?b = exp (\<i> * complex_of_real ?b)
cis pi = - 1

goal (1 subgoal):
 1. exp (\<i> * complex_of_real pi) = - 1
[PROOF STEP]
by auto


[STATEMENT]
lemma powreal_inject_base_less_one [simp]:
  "0 < a \<Longrightarrow> a < 1 \<Longrightarrow> (a pow\<^sub>\<real> r = a pow\<^sub>\<real> s) = (s = r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a < 1\<rbrakk> \<Longrightarrow> (a pow\<^sub>\<real> r = a pow\<^sub>\<real> s) = (s = r)
[PROOF STEP]
by (metis linorder_neq_iff order_less_imp_not_eq2 powreal_less_anti_mono)


[STATEMENT]
lemma AR_imp_absolute_retract_UNIV:
  fixes S :: "'a::euclidean_space set" and S' :: "'b::euclidean_space set"
  assumes "AR S" "S homeomorphic S'" "closed S'"
    shows "S' retract_of UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S' retract_of UNIV
[PROOF STEP]
using AR_imp_absolute_retract assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>AR ?S; ?S homeomorphic ?S'; closedin (top_of_set ?U) ?S'\<rbrakk> \<Longrightarrow> ?S' retract_of ?U
AR S
S homeomorphic S'
closed S'

goal (1 subgoal):
 1. S' retract_of UNIV
[PROOF STEP]
by fastforce


[STATEMENT]
lemma mset_ran_xfer_pointwise:
  assumes "mset_ran a r = mset_ran a' r"
  assumes "finite r"
  shows "(\<forall>i\<in>r. P (a i)) \<longleftrightarrow> (\<forall>i\<in>r. P (a' i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>r. P (a i)) = (\<forall>i\<in>r. P (a' i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mset_ran a r = mset_ran a' r
finite r

goal (1 subgoal):
 1. (\<forall>i\<in>r. P (a i)) = (\<forall>i\<in>r. P (a' i))
[PROOF STEP]
unfolding mset_ran_def
[PROOF STATE]
proof (prove)
using this:
image_mset a (mset_set r) = image_mset a' (mset_set r)
finite r

goal (1 subgoal):
 1. (\<forall>i\<in>r. P (a i)) = (\<forall>i\<in>r. P (a' i))
[PROOF STEP]
by (auto;force dest: image_mset_eq_imp_set_eq)


[STATEMENT]
lemma homeomorphic_convex_compact_sets_eq:
  assumes "convex S" "compact S" "convex T" "compact T"
  shows "S homeomorphic T \<longleftrightarrow> aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
by (meson assms homeomorphic_convex_compact_sets homeomorphic_convex_sets)


[STATEMENT]
lemma det_Gauss_Jordan_in_ij:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}" and i j::"'n"
defines A': "A'== mult_row (interchange_rows A i (LEAST n. A $ n $ j \<noteq> 0 \<and> i \<le> n)) i (1 / (interchange_rows A i (LEAST n. A $ n $ j \<noteq> 0 \<and> i \<le> n)) $ i $ j)"
shows "det (Gauss_Jordan_in_ij A i j) = det A' "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
have nrows_eq: "nrows A' = nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows A' = nrows A
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) = CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nrows A' = nrows A

goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
have "row_add_iterate A' (nrows A - 1) i j  =  Gauss_Jordan_in_ij A i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add_iterate A' (nrows A - 1) i j = Gauss_Jordan_in_ij A i j
[PROOF STEP]
using row_add_iterate_eq_Gauss_Jordan_in_ij
[PROOF STATE]
proof (prove)
using this:
row_add_iterate (mult_row (interchange_rows ?A ?i (LEAST n. ?A $ n $ ?j \<noteq> (0::?'a) \<and> ?i \<le> n)) ?i ((1::?'a) / interchange_rows ?A ?i (LEAST n. ?A $ n $ ?j \<noteq> (0::?'a) \<and> ?i \<le> n) $ ?i $ ?j)) (nrows ?A - 1) ?i ?j = Gauss_Jordan_in_ij ?A ?i ?j

goal (1 subgoal):
 1. row_add_iterate A' (nrows A - 1) i j = Gauss_Jordan_in_ij A i j
[PROOF STEP]
unfolding A'
[PROOF STATE]
proof (prove)
using this:
row_add_iterate (mult_row (interchange_rows ?A ?i (LEAST n. ?A $ n $ ?j \<noteq> (0::?'a) \<and> ?i \<le> n)) ?i ((1::?'a) / interchange_rows ?A ?i (LEAST n. ?A $ n $ ?j \<noteq> (0::?'a) \<and> ?i \<le> n) $ ?i $ ?j)) (nrows ?A - 1) ?i ?j = Gauss_Jordan_in_ij ?A ?i ?j

goal (1 subgoal):
 1. row_add_iterate (mult_row (interchange_rows A i (LEAST n. A $ n $ j \<noteq> (0::'a) \<and> i \<le> n)) i ((1::'a) / interchange_rows A i (LEAST n. A $ n $ j \<noteq> (0::'a) \<and> i \<le> n) $ i $ j)) (nrows A - 1) i j = Gauss_Jordan_in_ij A i j
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
row_add_iterate A' (nrows A - 1) i j = Gauss_Jordan_in_ij A i j

goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
hence "det (Gauss_Jordan_in_ij A i j) = det (row_add_iterate A' (nrows A - 1) i j)"
[PROOF STATE]
proof (prove)
using this:
row_add_iterate A' (nrows A - 1) i j = Gauss_Jordan_in_ij A i j

goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det (row_add_iterate A' (nrows A - 1) i j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (Gauss_Jordan_in_ij A i j) = det (row_add_iterate A' (nrows A - 1) i j)

goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (Gauss_Jordan_in_ij A i j) = det (row_add_iterate A' (nrows A - 1) i j)

goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
have "... = det A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add_iterate A' (nrows A - 1) i j) = det A'
[PROOF STEP]
by (rule det_row_add_iterate[of A', unfolded nrows_eq])
[PROOF STATE]
proof (state)
this:
det (row_add_iterate A' (nrows A - 1) i j) = det A'

goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det (Gauss_Jordan_in_ij A i j) = det A'

goal (1 subgoal):
 1. det (Gauss_Jordan_in_ij A i j) = det A'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det (Gauss_Jordan_in_ij A i j) = det A'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma supset_mono_inductive[mono]:
    assumes "\<And> x. x \<in> B \<longrightarrow> x \<in> C"
    shows "A \<subseteq> B \<longrightarrow> A \<subseteq> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<longrightarrow> A \<subseteq> C
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> B \<longrightarrow> ?x \<in> C

goal (1 subgoal):
 1. A \<subseteq> B \<longrightarrow> A \<subseteq> C
[PROOF STEP]
by auto


[STATEMENT]
lemma preal_add_less2_mono1: "r < (s::preal) \<Longrightarrow> r + t < s + t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r < s \<Longrightarrow> r + t < s + t
[PROOF STEP]
by (metis add.assoc add.commute less_add_left preal_self_less_add_left)


[STATEMENT]
lemma s_delayed_has_vector_derivative[derivative_intros]:
  assumes "\<delta> < t" "0 \<le> v" "a < 0"
  shows  "((\<lambda>x. s (x - \<delta>)) has_vector_derivative s' (t - \<delta>)) (at t within {\<delta><..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. s (x - \<delta>)) has_vector_derivative s' (t - \<delta>)) (at t within {\<delta><..})
[PROOF STEP]
using s_delayed_has_field_derivative[OF assms]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. s (x - \<delta>)) has_real_derivative s' (t - \<delta>)) (at t within {\<delta><..})

goal (1 subgoal):
 1. ((\<lambda>x. s (x - \<delta>)) has_vector_derivative s' (t - \<delta>)) (at t within {\<delta><..})
[PROOF STEP]
by(simp add:has_real_derivative_iff_has_vector_derivative)


[STATEMENT]
lemma vifunion_vrange_VLambda: "(\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i) = \<Union>\<^sub>\<circ>(\<R>\<^sub>\<circ> (\<lambda>a\<in>\<^sub>\<circ>I. f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I) = \<Union>\<^sub>\<circ> (\<R>\<^sub>\<circ> (VLambda I f))
[PROOF STEP]
using vimage_VLambda_vrange_rep
[PROOF STATE]
proof (prove)
using this:
VLambda ?A ?f `\<^sub>\<circ> ?A = \<R>\<^sub>\<circ> (VLambda ?A ?f)

goal (1 subgoal):
 1. \<Union>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I) = \<Union>\<^sub>\<circ> (\<R>\<^sub>\<circ> (VLambda I f))
[PROOF STEP]
by auto


[STATEMENT]
lemma trans_VWO: "trans VWO"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans VWO
[PROOF STEP]
using VWO
[PROOF STATE]
proof (prove)
using this:
{(x, y). x \<in> elts y} \<subseteq> VWO \<and> Well_order VWO \<and> Field VWO = UNIV

goal (1 subgoal):
 1. trans VWO
[PROOF STEP]
by (simp add: VWO wo_rel.TRANS wo_rel_def)


[STATEMENT]
lemma image_func1: "(`) (f \<circ> g) = (`) f \<circ> (`) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (`) (f \<circ> g) = (`) f \<circ> (`) g
[PROOF STEP]
unfolding fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (f \<circ> g) ` x = ((`) f \<circ> (`) g) x
[PROOF STEP]
by (simp add: image_comp)


[STATEMENT]
lemma closed_ccpo: "closed A \<longleftrightarrow> (\<forall>C. chain C \<longrightarrow> C \<noteq> {} \<longrightarrow> C \<subseteq> A \<longrightarrow> Sup C \<in> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed A = (\<forall>C. chain C \<longrightarrow> C \<noteq> {} \<longrightarrow> C \<subseteq> A \<longrightarrow> \<Squnion> C \<in> A)
[PROOF STEP]
unfolding closed_def open_ccpo
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>C. chain C \<longrightarrow> C \<noteq> {} \<longrightarrow> \<Squnion> C \<in> - A \<longrightarrow> C \<inter> - A \<noteq> {}) = (\<forall>C. chain C \<longrightarrow> C \<noteq> {} \<longrightarrow> C \<subseteq> A \<longrightarrow> \<Squnion> C \<in> A)
[PROOF STEP]
by auto


[STATEMENT]
lemma unit_vectors_is_genset [simp]:
  "module.gen_set cpx_rng (module_cpx_vec n) (unit_vectors n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n) = carrier (module_cpx_vec n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n) \<subseteq> carrier (module_cpx_vec n)
 2. carrier (module_cpx_vec n) \<subseteq> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
show "module.span cpx_rng (module_cpx_vec n) (unit_vectors n) \<subseteq> carrier (module_cpx_vec n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n) \<subseteq> carrier (module_cpx_vec n)
[PROOF STEP]
using module.span_def dim_vec_lincomb carrier_vec_def cpx_rng_def
[PROOF STATE]
proof (prove)
using this:
Module.module ?R ?M \<Longrightarrow> LinearCombinations.module.span ?R ?M ?S = {module.lincomb ?M a A |a A. finite A \<and> A \<subseteq> ?S \<and> a \<in> A \<rightarrow> carrier ?R}
\<lbrakk>finite ?F; ?f \<in> ?F \<rightarrow> UNIV; ?F \<subseteq> carrier_vec ?n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec ?n) ?f ?F) = ?n
carrier_vec ?n = {v. dim_vec v = ?n}
cpx_rng \<equiv> \<lparr>carrier = UNIV, monoid.mult = (*), one = 1, zero = 0, add = (+)\<rparr>

goal (1 subgoal):
 1. LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n) \<subseteq> carrier (module_cpx_vec n)
[PROOF STEP]
by (smt Collect_mono index_unit_vec(3) module.span_is_subset2 module_cpx_vec module_cpx_vec_def
        module_vec_simps(3) unit_vectors_def)
[PROOF STATE]
proof (state)
this:
LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n) \<subseteq> carrier (module_cpx_vec n)

goal (1 subgoal):
 1. carrier (module_cpx_vec n) \<subseteq> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. carrier (module_cpx_vec n) \<subseteq> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
show "carrier (module_cpx_vec n) \<subseteq> module.span cpx_rng (module_cpx_vec n) (unit_vectors n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (module_cpx_vec n) \<subseteq> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
assume a1:"v \<in> carrier (module_cpx_vec n)"
[PROOF STATE]
proof (state)
this:
v \<in> carrier (module_cpx_vec n)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
define A a lc where "A = {unit_vec n i ::complex vec| i::nat. i < n \<and> v $ i \<noteq> 0}" and
      "a = (\<lambda>u\<in>A. u \<bullet> v)" and "lc = module.lincomb (module_cpx_vec n) a A"
[PROOF STATE]
proof (state)
this:
A = {unit_vec n i |i. i < n \<and> v $ i \<noteq> 0}
a = (\<lambda>u\<in>A. u \<bullet> v)
lc = module.lincomb (module_cpx_vec n) a A

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = {unit_vec n i |i. i < n \<and> v $ i \<noteq> 0}
a = (\<lambda>u\<in>A. u \<bullet> v)
lc = module.lincomb (module_cpx_vec n) a A
[PROOF STEP]
have f1:"finite A"
[PROOF STATE]
proof (prove)
using this:
A = {unit_vec n i |i. i < n \<and> v $ i \<noteq> 0}
a = (\<lambda>u\<in>A. u \<bullet> v)
lc = module.lincomb (module_cpx_vec n) a A

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

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
have f2:"A \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> carrier_vec n
[PROOF STEP]
using carrier_vec_def A_def
[PROOF STATE]
proof (prove)
using this:
carrier_vec ?n = {v. dim_vec v = ?n}
A = {unit_vec n i |i. i < n \<and> v $ i \<noteq> 0}

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

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
have f3:"a \<in> A \<rightarrow> UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> A \<rightarrow> UNIV
[PROOF STEP]
using a_def
[PROOF STATE]
proof (prove)
using this:
a = (\<lambda>u\<in>A. u \<bullet> v)

goal (1 subgoal):
 1. a \<in> A \<rightarrow> UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<in> A \<rightarrow> UNIV

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> A \<rightarrow> UNIV
[PROOF STEP]
have f4:"dim_vec v = dim_vec lc"
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<rightarrow> UNIV

goal (1 subgoal):
 1. dim_vec v = dim_vec lc
[PROOF STEP]
using f1 f2 f3 a1 module_cpx_vec_def dim_vec_lincomb lc_def
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<rightarrow> UNIV
finite A
A \<subseteq> carrier_vec n
a \<in> A \<rightarrow> UNIV
v \<in> carrier (module_cpx_vec n)
module_cpx_vec ?n \<equiv> module_vec TYPE(complex) ?n
\<lbrakk>finite ?F; ?f \<in> ?F \<rightarrow> UNIV; ?F \<subseteq> carrier_vec ?n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec ?n) ?f ?F) = ?n
lc = module.lincomb (module_cpx_vec n) a A

goal (1 subgoal):
 1. dim_vec v = dim_vec lc
[PROOF STEP]
by (simp add: module_vec_simps(3))
[PROOF STATE]
proof (state)
this:
dim_vec v = dim_vec lc

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_vec v = dim_vec lc
[PROOF STEP]
have f5:"i < n \<Longrightarrow> lc $ i = (\<Sum>u\<in>A. u \<bullet> v * u $ i)" for i
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec lc

goal (1 subgoal):
 1. i < n \<Longrightarrow> lc $ i = (\<Sum>u\<in>A. u \<bullet> v * u $ i)
[PROOF STEP]
using lincomb_vec_index lc_def a_def f1 f2 f3
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_vec lc
\<lbrakk>finite ?F; ?i < ?n; ?F \<subseteq> carrier_vec ?n; ?f \<in> ?F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec ?n) ?f ?F $ ?i = (\<Sum>v\<in>?F. ?f v * v $ ?i)
lc = module.lincomb (module_cpx_vec n) a A
a = (\<lambda>u\<in>A. u \<bullet> v)
finite A
A \<subseteq> carrier_vec n
a \<in> A \<rightarrow> UNIV

goal (1 subgoal):
 1. i < n \<Longrightarrow> lc $ i = (\<Sum>u\<in>A. u \<bullet> v * u $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> lc $ ?i = (\<Sum>u\<in>A. u \<bullet> v * u $ ?i)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < n \<Longrightarrow> lc $ ?i = (\<Sum>u\<in>A. u \<bullet> v * u $ ?i)
[PROOF STEP]
have "i < n \<Longrightarrow> j < n \<Longrightarrow> j \<noteq> i \<Longrightarrow> unit_vec n j \<bullet> v * unit_vec n j $ i = 0" for i j
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> lc $ ?i = (\<Sum>u\<in>A. u \<bullet> v * u $ ?i)

goal (1 subgoal):
 1. \<lbrakk>i < n; j < n; j \<noteq> i\<rbrakk> \<Longrightarrow> unit_vec n j \<bullet> v * unit_vec n j $ i = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < n; ?j < n; ?j \<noteq> ?i\<rbrakk> \<Longrightarrow> unit_vec n ?j \<bullet> v * unit_vec n ?j $ ?i = 0

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?i < n; ?j < n; ?j \<noteq> ?i\<rbrakk> \<Longrightarrow> unit_vec n ?j \<bullet> v * unit_vec n ?j $ ?i = 0
[PROOF STEP]
have "i < n \<Longrightarrow> lc $ i = (\<Sum>u\<in>A. if u = unit_vec n i then v $ i else 0)" for i
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < n; ?j < n; ?j \<noteq> ?i\<rbrakk> \<Longrightarrow> unit_vec n ?j \<bullet> v * unit_vec n ?j $ ?i = 0

goal (1 subgoal):
 1. i < n \<Longrightarrow> lc $ i = (\<Sum>u\<in>A. if u = unit_vec n i then v $ i else 0)
[PROOF STEP]
using a1 A_def f5 scalar_prod_left_unit
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < n; ?j < n; ?j \<noteq> ?i\<rbrakk> \<Longrightarrow> unit_vec n ?j \<bullet> v * unit_vec n ?j $ ?i = 0
v \<in> carrier (module_cpx_vec n)
A = {unit_vec n i |i. i < n \<and> v $ i \<noteq> 0}
?i < n \<Longrightarrow> lc $ ?i = (\<Sum>u\<in>A. u \<bullet> v * u $ ?i)
\<lbrakk>?v \<in> carrier_vec ?n; ?i < ?n\<rbrakk> \<Longrightarrow> unit_vec ?n ?i \<bullet> ?v = ?v $ ?i

goal (1 subgoal):
 1. i < n \<Longrightarrow> lc $ i = (\<Sum>u\<in>A. if u = unit_vec n i then v $ i else 0)
[PROOF STEP]
by (smt f4 carrier_vecI dim_vec_lincomb f1 f2 f3 index_unit_vec(2) lc_def
          mem_Collect_eq mult.right_neutral sum.cong)
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> lc $ ?i = (\<Sum>u\<in>A. if u = unit_vec n ?i then v $ ?i else 0)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < n \<Longrightarrow> lc $ ?i = (\<Sum>u\<in>A. if u = unit_vec n ?i then v $ ?i else 0)
[PROOF STEP]
have "i < n \<Longrightarrow> lc $ i = v $ i" for i
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> lc $ ?i = (\<Sum>u\<in>A. if u = unit_vec n ?i then v $ ?i else 0)

goal (1 subgoal):
 1. i < n \<Longrightarrow> lc $ i = v $ i
[PROOF STEP]
using abelian_monoid.finsum_singleton[of cpx_rng i] A_def cpx_rng_def
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> lc $ ?i = (\<Sum>u\<in>A. if u = unit_vec n ?i then v $ ?i else 0)
\<lbrakk>abelian_monoid cpx_rng; i \<in> ?A; finite ?A; ?f \<in> ?A \<rightarrow> carrier cpx_rng\<rbrakk> \<Longrightarrow> (\<Oplus>\<^bsub>cpx_rng\<^esub>j\<in>?A. if i = j then ?f j else \<zero>\<^bsub>cpx_rng\<^esub>) = ?f i
A = {unit_vec n i |i. i < n \<and> v $ i \<noteq> 0}
cpx_rng \<equiv> \<lparr>carrier = UNIV, monoid.mult = (*), one = 1, zero = 0, add = (+)\<rparr>

goal (1 subgoal):
 1. i < n \<Longrightarrow> lc $ i = v $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> lc $ ?i = v $ ?i

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < n \<Longrightarrow> lc $ ?i = v $ ?i
[PROOF STEP]
have f6:"v = lc"
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> lc $ ?i = v $ ?i

goal (1 subgoal):
 1. v = lc
[PROOF STEP]
using eq_vecI f4 dim_vec_lincomb f1 f2 lc_def
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> lc $ ?i = v $ ?i
\<lbrakk>\<And>i. i < dim_vec ?w \<Longrightarrow> ?v $ i = ?w $ i; dim_vec ?v = dim_vec ?w\<rbrakk> \<Longrightarrow> ?v = ?w
dim_vec v = dim_vec lc
\<lbrakk>finite ?F; ?f \<in> ?F \<rightarrow> UNIV; ?F \<subseteq> carrier_vec ?n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec ?n) ?f ?F) = ?n
finite A
A \<subseteq> carrier_vec n
lc = module.lincomb (module_cpx_vec n) a A

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

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
have "A \<subseteq> unit_vectors n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> unit_vectors n
[PROOF STEP]
using A_def unit_vectors_def
[PROOF STATE]
proof (prove)
using this:
A = {unit_vec n i |i. i < n \<and> v $ i \<noteq> 0}
unit_vectors ?n \<equiv> {unit_vec ?n i |i. 0 \<le> i \<and> i < ?n}

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

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (module_cpx_vec n) \<Longrightarrow> x \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
thus "v \<in> module.span cpx_rng (module_cpx_vec n) (unit_vectors n)"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> unit_vectors n

goal (1 subgoal):
 1. v \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
using f6 module.span_def[of cpx_rng "module_cpx_vec n"] lc_def f1 f2 cpx_rng_def module_cpx_vec
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> unit_vectors n
v = lc
Module.module cpx_rng (module_cpx_vec n) \<Longrightarrow> LinearCombinations.module.span cpx_rng (module_cpx_vec n) ?S = {module.lincomb (module_cpx_vec n) a A |a A. finite A \<and> A \<subseteq> ?S \<and> a \<in> A \<rightarrow> carrier cpx_rng}
lc = module.lincomb (module_cpx_vec n) a A
finite A
A \<subseteq> carrier_vec n
cpx_rng \<equiv> \<lparr>carrier = UNIV, monoid.mult = (*), one = 1, zero = 0, add = (+)\<rparr>
Module.module cpx_rng (module_cpx_vec ?n)

goal (1 subgoal):
 1. v \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)
[PROOF STEP]
by (smt Pi_I' UNIV_I mem_Collect_eq partial_object.select_convs(1))
[PROOF STATE]
proof (state)
this:
v \<in> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
carrier (module_cpx_vec n) \<subseteq> LinearCombinations.module.span cpx_rng (module_cpx_vec n) (unit_vectors n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Corps) f_inv_unique:"\<lbrakk> x \<in> carrier K - {\<zero>}; x' \<in> carrier K;
      x'' \<in> carrier K; x' \<cdot>\<^sub>r  x = 1\<^sub>r; x'' \<cdot>\<^sub>r x = 1\<^sub>r \<rbrakk> \<Longrightarrow> x' = x''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier K - {\<zero>}; x' \<in> carrier K; x'' \<in> carrier K; x' \<cdot>\<^sub>r x = 1\<^sub>r; x'' \<cdot>\<^sub>r x = 1\<^sub>r\<rbrakk> \<Longrightarrow> x' = x''
[PROOF STEP]
apply (cut_tac  f_is_ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier K - {\<zero>}; x' \<in> carrier K; x'' \<in> carrier K; x' \<cdot>\<^sub>r x = 1\<^sub>r; x'' \<cdot>\<^sub>r x = 1\<^sub>r; Ring K\<rbrakk> \<Longrightarrow> x' = x''
[PROOF STEP]
apply (cut_tac x = x' and y = x and z = x'' in Ring.ring_tOp_assoc[of K],
        assumption+, simp, assumption, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier K \<and> x \<noteq> \<zero>; x' \<in> carrier K; x'' \<in> carrier K; x' \<cdot>\<^sub>r x = 1\<^sub>r; x'' \<cdot>\<^sub>r x = 1\<^sub>r; Ring K; 1\<^sub>r \<cdot>\<^sub>r x'' = x' \<cdot>\<^sub>r (x \<cdot>\<^sub>r x'')\<rbrakk> \<Longrightarrow> x' = x''
[PROOF STEP]
apply (simp add:Ring.ring_l_one[of K],
        simp add:Ring.ring_tOp_commute[of K x x''] Ring.ring_r_one[of K])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done