[STATEMENT]
theorem unitary_schur_decomposition:
  assumes A: "(A::complex mat) \<in> carrier_mat n n"
      and c: "char_poly A = (\<Prod> (e :: complex) \<leftarrow> es. [:- e, 1:])"
      and B: "unitary_schur_decomposition A es = (B,P,Q)"
  shows "similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> (Q = adjoint P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:])
unitary_schur_decomposition A es = (B, P, Q)

goal (1 subgoal):
 1. similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
proof (induct es arbitrary: n A B P Q)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>[]. [:- e, 1:]); unitary_schur_decomposition A [] = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = [] \<and> unitary P \<and> Q = adjoint P
 2. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>[]. [:- e, 1:])
unitary_schur_decomposition A [] = (B, P, Q)

goal (2 subgoals):
 1. \<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>[]. [:- e, 1:]); unitary_schur_decomposition A [] = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = [] \<and> unitary P \<and> Q = adjoint P
 2. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
with degree_monic_char_poly[of A n]
[PROOF STATE]
proof (chain)
picking this:
A \<in> carrier_mat n n \<Longrightarrow> degree (char_poly A) = n \<and> coeff (char_poly A) n = 1
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>[]. [:- e, 1:])
unitary_schur_decomposition A [] = (B, P, Q)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n \<Longrightarrow> degree (char_poly A) = n \<and> coeff (char_poly A) n = 1
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>[]. [:- e, 1:])
unitary_schur_decomposition A [] = (B, P, Q)

goal (1 subgoal):
 1. similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = [] \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
by (auto intro: similar_mat_wit_refl simp: diag_mat_def unitary_zero)
[PROOF STATE]
proof (state)
this:
similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = [] \<and> unitary P \<and> Q = adjoint P

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
case (Cons e es n A C P Q)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; char_poly ?A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition ?A es = (?B, ?P, ?Q)\<rbrakk> \<Longrightarrow> similar_mat_wit ?A ?B ?P ?Q \<and> upper_triangular ?B \<and> diag_mat ?B = es \<and> unitary ?P \<and> ?Q = adjoint ?P
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1:])
unitary_schur_decomposition A (e # es) = (C, P, Q)

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
let ?n1 = "n - 1"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from Cons
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; char_poly ?A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition ?A es = (?B, ?P, ?Q)\<rbrakk> \<Longrightarrow> similar_mat_wit ?A ?B ?P ?Q \<and> upper_triangular ?B \<and> diag_mat ?B = es \<and> unitary ?P \<and> ?Q = adjoint ?P
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1:])
unitary_schur_decomposition A (e # es) = (C, P, Q)
[PROOF STEP]
have A: "A \<in> carrier_mat n n" and dim: "dim_row A = n"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; char_poly ?A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition ?A es = (?B, ?P, ?Q)\<rbrakk> \<Longrightarrow> similar_mat_wit ?A ?B ?P ?Q \<and> upper_triangular ?B \<and> diag_mat ?B = es \<and> unitary ?P \<and> ?Q = adjoint ?P
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1:])
unitary_schur_decomposition A (e # es) = (C, P, Q)

goal (1 subgoal):
 1. A \<in> carrier_mat n n &&& dim_row A = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n
dim_row A = n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
let ?cp = "char_poly A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1:])
[PROOF STEP]
have cp: "?cp = [: -e, 1 :] * (\<Prod>e \<leftarrow> es. [:- e, 1:])"
[PROOF STATE]
proof (prove)
using this:
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1:])

goal (1 subgoal):
 1. char_poly A = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
char_poly A = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have mon: "monic (\<Prod>e\<leftarrow> es. [:- e, 1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monic (\<Prod>e\<leftarrow>es. [:- e, 1:])
[PROOF STEP]
by (rule monic_prod_list, auto)
[PROOF STATE]
proof (state)
this:
monic (\<Prod>e\<leftarrow>es. [:- e, 1:])

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have deg: "degree ?cp = Suc (degree (\<Prod>e\<leftarrow> es. [:- e, 1:]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (char_poly A) = Suc (degree (\<Prod>e\<leftarrow>es. [:- e, 1:]))
[PROOF STEP]
unfolding cp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])) = Suc (degree (\<Prod>e\<leftarrow>es. [:- e, 1:]))
[PROOF STEP]
by (subst degree_mult_eq, insert mon, auto)
[PROOF STATE]
proof (state)
this:
degree (char_poly A) = Suc (degree (\<Prod>e\<leftarrow>es. [:- e, 1:]))

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
with degree_monic_char_poly[OF A]
[PROOF STATE]
proof (chain)
picking this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = 1
degree (char_poly A) = Suc (degree (\<Prod>e\<leftarrow>es. [:- e, 1:]))
[PROOF STEP]
have n: "n \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = 1
degree (char_poly A) = Suc (degree (\<Prod>e\<leftarrow>es. [:- e, 1:]))

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
define v' where "v' = find_eigenvector A e"
[PROOF STATE]
proof (state)
this:
v' = find_eigenvector A e

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
define v where "v = vec_normalize v'"
[PROOF STATE]
proof (state)
this:
v = vec_normalize v'

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
define b where "b = basis_completion v"
[PROOF STATE]
proof (state)
this:
b = basis_completion v

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
define ws0 where "ws0 = gram_schmidt n b"
[PROOF STATE]
proof (state)
this:
ws0 = gram_schmidt n b

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
define ws where "ws = map vec_normalize ws0"
[PROOF STATE]
proof (state)
this:
ws = map vec_normalize ws0

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
define W where "W = mat_of_cols n ws"
[PROOF STATE]
proof (state)
this:
W = mat_of_cols n ws

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
define W' where "W' = corthogonal_inv W"
[PROOF STATE]
proof (state)
this:
W' = corthogonal_inv W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
define A' where "A' = W' * A * W"
[PROOF STATE]
proof (state)
this:
A' = W' * A * W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
obtain A1 A2 A0 A3 where splitA': "split_block A' 1 1 = (A1,A2,A0,A3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A1 A2 A0 A3. split_block A' 1 1 = (A1, A2, A0, A3) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "split_block A' 1 1", auto)
[PROOF STATE]
proof (state)
this:
split_block A' 1 1 = (A1, A2, A0, A3)

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
obtain B P' Q' where schur: "unitary_schur_decomposition A3 es = (B,P',Q')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B P' Q'. unitary_schur_decomposition A3 es = (B, P', Q') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "unitary_schur_decomposition A3 es", auto)
[PROOF STATE]
proof (state)
this:
unitary_schur_decomposition A3 es = (B, P', Q')

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
let ?P' = "four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 ?n1) (0\<^sub>m ?n1 1) P'"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
let ?Q' = "four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 ?n1) (0\<^sub>m ?n1 1) Q'"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have C: "C = four_block_mat A1 (A2 * P') A0 B" and P: "P = W * ?P'" and Q: "Q = ?Q' * W'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C = four_block_mat A1 (A2 * P') A0 B &&& P = W * four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P' &&& Q = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'
[PROOF STEP]
using Cons(4)
[PROOF STATE]
proof (prove)
using this:
unitary_schur_decomposition A (e # es) = (C, P, Q)

goal (1 subgoal):
 1. C = four_block_mat A1 (A2 * P') A0 B &&& P = W * four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P' &&& Q = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'
[PROOF STEP]
unfolding unitary_schur_decomposition.simps
    Let_def list.sel dim
    v'_def[symmetric] v_def[symmetric] b_def[symmetric] ws0_def[symmetric] ws_def[symmetric] W'_def[symmetric] W_def[symmetric]
    A'_def[symmetric] split splitA' schur
[PROOF STATE]
proof (prove)
using this:
(four_block_mat A1 (A2 * P') A0 B, W * four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P', four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W') = (C, P, Q)

goal (1 subgoal):
 1. C = four_block_mat A1 (A2 * P') A0 B &&& P = W * four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P' &&& Q = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C = four_block_mat A1 (A2 * P') A0 B
P = W * four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P'
Q = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have e: "eigenvalue A e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eigenvalue A e
[PROOF STEP]
unfolding eigenvalue_root_char_poly[OF A] cp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly ([:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])) e = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eigenvalue A e

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from find_eigenvector[OF A e]
[PROOF STATE]
proof (chain)
picking this:
eigenvector A (find_eigenvector A e) e
[PROOF STEP]
have ev': "eigenvector A v' e"
[PROOF STATE]
proof (prove)
using this:
eigenvector A (find_eigenvector A e) e

goal (1 subgoal):
 1. eigenvector A v' e
[PROOF STEP]
unfolding v'_def
[PROOF STATE]
proof (prove)
using this:
eigenvector A (find_eigenvector A e) e

goal (1 subgoal):
 1. eigenvector A (find_eigenvector A e) e
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
eigenvector A v' e

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eigenvector A v' e
[PROOF STEP]
have "v' \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
eigenvector A v' e

goal (1 subgoal):
 1. v' \<in> carrier_vec n
[PROOF STEP]
unfolding eigenvector_def
[PROOF STATE]
proof (prove)
using this:
v' \<in> carrier_vec (dim_row A) \<and> v' \<noteq> 0\<^sub>v (dim_row A) \<and> A *\<^sub>v v' = e \<cdot>\<^sub>v v'

goal (1 subgoal):
 1. v' \<in> carrier_vec n
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
v' \<in> carrier_vec (dim_row A) \<and> v' \<noteq> 0\<^sub>v (dim_row A) \<and> A *\<^sub>v v' = e \<cdot>\<^sub>v v'
A \<in> carrier_mat n n

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
with ev'
[PROOF STATE]
proof (chain)
picking this:
eigenvector A v' e
v' \<in> carrier_vec n
[PROOF STEP]
have ev: "eigenvector A v e"
[PROOF STATE]
proof (prove)
using this:
eigenvector A v' e
v' \<in> carrier_vec n

goal (1 subgoal):
 1. eigenvector A v e
[PROOF STEP]
unfolding v_def
[PROOF STATE]
proof (prove)
using this:
eigenvector A v' e
v' \<in> carrier_vec n

goal (1 subgoal):
 1. eigenvector A (vec_normalize v') e
[PROOF STEP]
using A dim normalize_keep_eigenvector
[PROOF STATE]
proof (prove)
using this:
eigenvector A v' e
v' \<in> carrier_vec n
A \<in> carrier_mat n n
dim_row A = n
\<lbrakk>eigenvector ?A ?v ?e; ?A \<in> carrier_mat ?n ?n; ?v \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> eigenvector ?A (vec_normalize ?v) ?e

goal (1 subgoal):
 1. eigenvector A (vec_normalize v') e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eigenvector A v e

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from this[unfolded eigenvector_def]
[PROOF STATE]
proof (chain)
picking this:
v \<in> carrier_vec (dim_row A) \<and> v \<noteq> 0\<^sub>v (dim_row A) \<and> A *\<^sub>v v = e \<cdot>\<^sub>v v
[PROOF STEP]
have v[simp]: "v \<in> carrier_vec n" and v0: "v \<noteq> 0\<^sub>v n"
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec (dim_row A) \<and> v \<noteq> 0\<^sub>v (dim_row A) \<and> A *\<^sub>v v = e \<cdot>\<^sub>v v

goal (1 subgoal):
 1. v \<in> carrier_vec n &&& v \<noteq> 0\<^sub>v n
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec (dim_row A) \<and> v \<noteq> 0\<^sub>v (dim_row A) \<and> A *\<^sub>v v = e \<cdot>\<^sub>v v
A \<in> carrier_mat n n

goal (1 subgoal):
 1. v \<in> carrier_vec n &&& v \<noteq> 0\<^sub>v n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec n
v \<noteq> 0\<^sub>v n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
interpret cof_vec_space n "TYPE(complex)"
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from basis_completion[OF v v0, folded b_def]
[PROOF STATE]
proof (chain)
picking this:
basis (set b)
set b \<subseteq> carrier_vec n
local.span (set b) = carrier_vec n
distinct b
lin_indpt (set b)
length b = n
hd b = v
[PROOF STEP]
have span_b: "span (set b) = carrier_vec n" and dist_b: "distinct b"
    and indep: "\<not> lin_dep (set b)" and b: "set b \<subseteq> carrier_vec n" and hdb: "hd b = v"
    and len_b: "length b = n"
[PROOF STATE]
proof (prove)
using this:
basis (set b)
set b \<subseteq> carrier_vec n
local.span (set b) = carrier_vec n
distinct b
lin_indpt (set b)
length b = n
hd b = v

goal (1 subgoal):
 1. (local.span (set b) = carrier_vec n &&& distinct b &&& lin_indpt (set b)) &&& set b \<subseteq> carrier_vec n &&& hd b = v &&& length b = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.span (set b) = carrier_vec n
distinct b
lin_indpt (set b)
set b \<subseteq> carrier_vec n
hd b = v
length b = n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from hdb len_b n
[PROOF STATE]
proof (chain)
picking this:
hd b = v
length b = n
n \<noteq> 0
[PROOF STEP]
obtain vs where bv: "b = v # vs"
[PROOF STATE]
proof (prove)
using this:
hd b = v
length b = n
n \<noteq> 0

goal (1 subgoal):
 1. (\<And>vs. b = v # vs \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases b, auto)
[PROOF STATE]
proof (state)
this:
b = v # vs

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from gram_schmidt_result[OF b dist_b indep refl, folded ws0_def]
[PROOF STATE]
proof (chain)
picking this:
local.span (set b) = local.span (set ws0)
corthogonal ws0
set ws0 \<subseteq> carrier_vec n
length ws0 = length b
distinct ws0
[PROOF STEP]
have ws0: "set ws0 \<subseteq> carrier_vec n" "corthogonal ws0" "length ws0 = n"
[PROOF STATE]
proof (prove)
using this:
local.span (set b) = local.span (set ws0)
corthogonal ws0
set ws0 \<subseteq> carrier_vec n
length ws0 = length b
distinct ws0

goal (1 subgoal):
 1. set ws0 \<subseteq> carrier_vec n &&& corthogonal ws0 &&& length ws0 = n
[PROOF STEP]
by (auto simp: len_b)
[PROOF STATE]
proof (state)
this:
set ws0 \<subseteq> carrier_vec n
corthogonal ws0
length ws0 = n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set ws0 \<subseteq> carrier_vec n
corthogonal ws0
length ws0 = n
[PROOF STEP]
have ws: "set ws \<subseteq> carrier_vec n" "corthogonal ws" "length ws = n"
[PROOF STATE]
proof (prove)
using this:
set ws0 \<subseteq> carrier_vec n
corthogonal ws0
length ws0 = n

goal (1 subgoal):
 1. set ws \<subseteq> carrier_vec n &&& corthogonal ws &&& length ws = n
[PROOF STEP]
unfolding ws_def
[PROOF STATE]
proof (prove)
using this:
set ws0 \<subseteq> carrier_vec n
corthogonal ws0
length ws0 = n

goal (1 subgoal):
 1. set (map vec_normalize ws0) \<subseteq> carrier_vec n &&& corthogonal (map vec_normalize ws0) &&& length (map vec_normalize ws0) = n
[PROOF STEP]
using normalize_keep_corthogonal
[PROOF STATE]
proof (prove)
using this:
set ws0 \<subseteq> carrier_vec n
corthogonal ws0
length ws0 = n
\<lbrakk>corthogonal ?vs; set ?vs \<subseteq> carrier_vec ?n\<rbrakk> \<Longrightarrow> corthogonal (map vec_normalize ?vs)

goal (1 subgoal):
 1. set (map vec_normalize ws0) \<subseteq> carrier_vec n &&& corthogonal (map vec_normalize ws0) &&& length (map vec_normalize ws0) = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ws \<subseteq> carrier_vec n
corthogonal ws
length ws = n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have ws0ne: "ws0 \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ws0 \<noteq> []
[PROOF STEP]
using \<open>length ws0 = n\<close> n
[PROOF STATE]
proof (prove)
using this:
length ws0 = n
n \<noteq> 0

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from gram_schmidt_hd[OF v, of vs, folded bv]
[PROOF STATE]
proof (chain)
picking this:
hd (gram_schmidt n b) = v
[PROOF STEP]
have hdws0: "hd ws0 = (vec_normalize v')"
[PROOF STATE]
proof (prove)
using this:
hd (gram_schmidt n b) = v

goal (1 subgoal):
 1. hd ws0 = vec_normalize v'
[PROOF STEP]
unfolding ws0_def v_def
[PROOF STATE]
proof (prove)
using this:
hd (gram_schmidt n b) = vec_normalize v'

goal (1 subgoal):
 1. hd (gram_schmidt n b) = vec_normalize v'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
hd ws0 = vec_normalize v'

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have "hd ws = vec_normalize (hd ws0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd ws = vec_normalize (hd ws0)
[PROOF STEP]
unfolding ws_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (map vec_normalize ws0) = vec_normalize (hd ws0)
[PROOF STEP]
using hd_map[OF ws0ne]
[PROOF STATE]
proof (prove)
using this:
hd (map ?f ws0) = ?f (hd ws0)

goal (1 subgoal):
 1. hd (map vec_normalize ws0) = vec_normalize (hd ws0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd ws = vec_normalize (hd ws0)

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hd ws = vec_normalize (hd ws0)
[PROOF STEP]
have hdws: "hd ws = v"
[PROOF STATE]
proof (prove)
using this:
hd ws = vec_normalize (hd ws0)

goal (1 subgoal):
 1. hd ws = v
[PROOF STEP]
unfolding v_def
[PROOF STATE]
proof (prove)
using this:
hd ws = vec_normalize (hd ws0)

goal (1 subgoal):
 1. hd ws = vec_normalize v'
[PROOF STEP]
using normalize_normalize[of v'] hdws0
[PROOF STATE]
proof (prove)
using this:
hd ws = vec_normalize (hd ws0)
vec_normalize (vec_normalize v') = vec_normalize v'
hd ws0 = vec_normalize v'

goal (1 subgoal):
 1. hd ws = vec_normalize v'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd ws = v

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have orth_W: "corthogonal_mat W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal_mat W
[PROOF STEP]
using orthogonal_mat_of_cols ws
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?ws \<subseteq> carrier_vec ?n; corthogonal ?ws; length ?ws = ?n\<rbrakk> \<Longrightarrow> corthogonal_mat (mat_of_cols ?n ?ws)
set ws \<subseteq> carrier_vec n
corthogonal ws
length ws = n

goal (1 subgoal):
 1. corthogonal_mat W
[PROOF STEP]
unfolding W_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?ws \<subseteq> carrier_vec ?n; corthogonal ?ws; length ?ws = ?n\<rbrakk> \<Longrightarrow> corthogonal_mat (mat_of_cols ?n ?ws)
set ws \<subseteq> carrier_vec n
corthogonal ws
length ws = n

goal (1 subgoal):
 1. corthogonal_mat (mat_of_cols n ws)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
corthogonal_mat W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have W: "W \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W \<in> carrier_mat n n
[PROOF STEP]
using ws
[PROOF STATE]
proof (prove)
using this:
set ws \<subseteq> carrier_vec n
corthogonal ws
length ws = n

goal (1 subgoal):
 1. W \<in> carrier_mat n n
[PROOF STEP]
unfolding W_def
[PROOF STATE]
proof (prove)
using this:
set ws \<subseteq> carrier_vec n
corthogonal ws
length ws = n

goal (1 subgoal):
 1. mat_of_cols n ws \<in> carrier_mat n n
[PROOF STEP]
using mat_of_cols_carrier(1)[of n ws]
[PROOF STATE]
proof (prove)
using this:
set ws \<subseteq> carrier_vec n
corthogonal ws
length ws = n
mat_of_cols n ws \<in> carrier_mat n (length ws)

goal (1 subgoal):
 1. mat_of_cols n ws \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
W \<in> carrier_mat n n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have W': "W' \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W' \<in> carrier_mat n n
[PROOF STEP]
unfolding W'_def corthogonal_inv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows (dim_row W) (map vec_inv (cols W)) \<in> carrier_mat n n
[PROOF STEP]
using W
[PROOF STATE]
proof (prove)
using this:
W \<in> carrier_mat n n

goal (1 subgoal):
 1. mat_of_rows (dim_row W) (map vec_inv (cols W)) \<in> carrier_mat n n
[PROOF STEP]
by (auto simp: mat_of_rows_def)
[PROOF STATE]
proof (state)
this:
W' \<in> carrier_mat n n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from corthogonal_inv_result[OF orth_W]
[PROOF STATE]
proof (chain)
picking this:
inverts_mat (corthogonal_inv W) W
[PROOF STEP]
have W'W: "inverts_mat W' W"
[PROOF STATE]
proof (prove)
using this:
inverts_mat (corthogonal_inv W) W

goal (1 subgoal):
 1. inverts_mat W' W
[PROOF STEP]
unfolding W'_def
[PROOF STATE]
proof (prove)
using this:
inverts_mat (corthogonal_inv W) W

goal (1 subgoal):
 1. inverts_mat (corthogonal_inv W) W
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
inverts_mat W' W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
hence WW': "inverts_mat W W'"
[PROOF STATE]
proof (prove)
using this:
inverts_mat W' W

goal (1 subgoal):
 1. inverts_mat W W'
[PROOF STEP]
using mat_mult_left_right_inverse[OF W' W] W' W
[PROOF STATE]
proof (prove)
using this:
inverts_mat W' W
W' * W = 1\<^sub>m n \<Longrightarrow> W * W' = 1\<^sub>m n
W' \<in> carrier_mat n n
W \<in> carrier_mat n n

goal (1 subgoal):
 1. inverts_mat W W'
[PROOF STEP]
unfolding inverts_mat_def
[PROOF STATE]
proof (prove)
using this:
W' * W = 1\<^sub>m (dim_row W')
W' * W = 1\<^sub>m n \<Longrightarrow> W * W' = 1\<^sub>m n
W' \<in> carrier_mat n n
W \<in> carrier_mat n n

goal (1 subgoal):
 1. W * W' = 1\<^sub>m (dim_row W)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inverts_mat W W'

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have A': "A' \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A' \<in> carrier_mat n n
[PROOF STEP]
using W W' A
[PROOF STATE]
proof (prove)
using this:
W \<in> carrier_mat n n
W' \<in> carrier_mat n n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. A' \<in> carrier_mat n n
[PROOF STEP]
unfolding A'_def
[PROOF STATE]
proof (prove)
using this:
W \<in> carrier_mat n n
W' \<in> carrier_mat n n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. W' * A * W \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' \<in> carrier_mat n n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have A'A_wit: "similar_mat_wit A' A W' W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat_wit A' A W' W
[PROOF STEP]
by (rule similar_mat_witI[of _ _ n], insert W W' A A' W'W WW', auto simp: A'_def
    inverts_mat_def)
[PROOF STATE]
proof (state)
this:
similar_mat_wit A' A W' W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
hence A'A: "similar_mat A' A"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A' A W' W

goal (1 subgoal):
 1. similar_mat A' A
[PROOF STEP]
unfolding similar_mat_def
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A' A W' W

goal (1 subgoal):
 1. \<exists>P. Ex (similar_mat_wit A' A P)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
similar_mat A' A

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from similar_mat_wit_sym[OF A'A_wit]
[PROOF STATE]
proof (chain)
picking this:
similar_mat_wit A A' W W'
[PROOF STEP]
have simAA': "similar_mat_wit A A' W W'"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A A' W W'

goal (1 subgoal):
 1. similar_mat_wit A A' W W'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
similar_mat_wit A A' W W'

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have eigen[simp]: "A *\<^sub>v v = e \<cdot>\<^sub>v v" and v0: "v \<noteq> 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v v = e \<cdot>\<^sub>v v &&& v \<noteq> 0\<^sub>v n
[PROOF STEP]
using v_def v'_def find_eigenvector[OF A e] A normalize_keep_eigenvector
[PROOF STATE]
proof (prove)
using this:
v = vec_normalize v'
v' = find_eigenvector A e
eigenvector A (find_eigenvector A e) e
A \<in> carrier_mat n n
\<lbrakk>eigenvector ?A ?v ?e; ?A \<in> carrier_mat ?n ?n; ?v \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> eigenvector ?A (vec_normalize ?v) ?e

goal (1 subgoal):
 1. A *\<^sub>v v = e \<cdot>\<^sub>v v &&& v \<noteq> 0\<^sub>v n
[PROOF STEP]
unfolding eigenvector_def
[PROOF STATE]
proof (prove)
using this:
v = vec_normalize v'
v' = find_eigenvector A e
find_eigenvector A e \<in> carrier_vec (dim_row A) \<and> find_eigenvector A e \<noteq> 0\<^sub>v (dim_row A) \<and> A *\<^sub>v find_eigenvector A e = e \<cdot>\<^sub>v find_eigenvector A e
A \<in> carrier_mat n n
\<lbrakk>?v \<in> carrier_vec (dim_row ?A) \<and> ?v \<noteq> 0\<^sub>v (dim_row ?A) \<and> ?A *\<^sub>v ?v = ?e \<cdot>\<^sub>v ?v; ?A \<in> carrier_mat ?n ?n; ?v \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> vec_normalize ?v \<in> carrier_vec (dim_row ?A) \<and> vec_normalize ?v \<noteq> 0\<^sub>v (dim_row ?A) \<and> ?A *\<^sub>v vec_normalize ?v = ?e \<cdot>\<^sub>v vec_normalize ?v

goal (1 subgoal):
 1. A *\<^sub>v v = e \<cdot>\<^sub>v v &&& v \<noteq> 0\<^sub>v n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A *\<^sub>v v = e \<cdot>\<^sub>v v
v \<noteq> 0\<^sub>v n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
let ?f = "(\<lambda> i. if i = 0 then e else 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have col0: "col A' 0 = vec n ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col A' 0 = vec n (\<lambda>i. if i = 0 then e else 0)
[PROOF STEP]
unfolding A'_def W'_def W_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (corthogonal_inv (mat_of_cols n ws) * A * mat_of_cols n ws) 0 = vec n (\<lambda>i. if i = 0 then e else 0)
[PROOF STEP]
using corthogonal_col_ev_0[OF A v v0 eigen n hdws ws]
[PROOF STATE]
proof (prove)
using this:
col (corthogonal_inv (mat_of_cols n ws) * A * mat_of_cols n ws) 0 = vec n (\<lambda>i. if i = 0 then e else 0)

goal (1 subgoal):
 1. col (corthogonal_inv (mat_of_cols n ws) * A * mat_of_cols n ws) 0 = vec n (\<lambda>i. if i = 0 then e else 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
col A' 0 = vec n (\<lambda>i. if i = 0 then e else 0)

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from A' n
[PROOF STATE]
proof (chain)
picking this:
A' \<in> carrier_mat n n
n \<noteq> 0
[PROOF STEP]
have "dim_row A' = 1 + ?n1" "dim_col A' = 1 + ?n1"
[PROOF STATE]
proof (prove)
using this:
A' \<in> carrier_mat n n
n \<noteq> 0

goal (1 subgoal):
 1. dim_row A' = 1 + (n - 1) &&& dim_col A' = 1 + (n - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row A' = 1 + (n - 1)
dim_col A' = 1 + (n - 1)

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from split_block[OF splitA' this]
[PROOF STATE]
proof (chain)
picking this:
A1 \<in> carrier_mat 1 1
A2 \<in> carrier_mat 1 (n - 1)
A0 \<in> carrier_mat (n - 1) 1
A3 \<in> carrier_mat (n - 1) (n - 1)
A' = four_block_mat A1 A2 A0 A3
[PROOF STEP]
have A2: "A2 \<in> carrier_mat 1 ?n1"
    and A3: "A3 \<in> carrier_mat ?n1 ?n1"
    and A'block: "A' = four_block_mat A1 A2 A0 A3"
[PROOF STATE]
proof (prove)
using this:
A1 \<in> carrier_mat 1 1
A2 \<in> carrier_mat 1 (n - 1)
A0 \<in> carrier_mat (n - 1) 1
A3 \<in> carrier_mat (n - 1) (n - 1)
A' = four_block_mat A1 A2 A0 A3

goal (1 subgoal):
 1. A2 \<in> carrier_mat 1 (n - 1) &&& A3 \<in> carrier_mat (n - 1) (n - 1) &&& A' = four_block_mat A1 A2 A0 A3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A2 \<in> carrier_mat 1 (n - 1)
A3 \<in> carrier_mat (n - 1) (n - 1)
A' = four_block_mat A1 A2 A0 A3

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have A1id: "A1 = mat 1 1 (\<lambda> _. e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A1 = mat 1 1 (\<lambda>_. e)
[PROOF STEP]
using splitA'[unfolded split_block_def Let_def] arg_cong[OF col0, of "\<lambda> v. v $ 0"] A' n
[PROOF STATE]
proof (prove)
using this:
(mat 1 1 (($$) A'), mat 1 (dim_col A' - 1) (\<lambda>(i, j). A' $$ (i, j + 1)), mat (dim_row A' - 1) 1 (\<lambda>(i, j). A' $$ (i + 1, j)), mat (dim_row A' - 1) (dim_col A' - 1) (\<lambda>(i, j). A' $$ (i + 1, j + 1))) = (A1, A2, A0, A3)
col A' 0 $ 0 = vec n (\<lambda>i. if i = 0 then e else 0) $ 0
A' \<in> carrier_mat n n
n \<noteq> 0

goal (1 subgoal):
 1. A1 = mat 1 1 (\<lambda>_. e)
[PROOF STEP]
by (auto simp: col_def)
[PROOF STATE]
proof (state)
this:
A1 = mat 1 1 (\<lambda>_. e)

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have A1: "A1 \<in> carrier_mat 1 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A1 \<in> carrier_mat 1 1
[PROOF STEP]
unfolding A1id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 1 1 (\<lambda>_. e) \<in> carrier_mat 1 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A1 \<in> carrier_mat 1 1

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
A1 \<in> carrier_mat 1 1

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
assume "i < ?n1"
[PROOF STATE]
proof (state)
this:
i < n - 1

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
with arg_cong[OF col0, of "\<lambda> v. v $ Suc i"] A'
[PROOF STATE]
proof (chain)
picking this:
col A' 0 $ Suc i = vec n (\<lambda>i. if i = 0 then e else 0) $ Suc i
A' \<in> carrier_mat n n
i < n - 1
[PROOF STEP]
have "A' $$ (Suc i, 0) = 0"
[PROOF STATE]
proof (prove)
using this:
col A' 0 $ Suc i = vec n (\<lambda>i. if i = 0 then e else 0) $ Suc i
A' \<in> carrier_mat n n
i < n - 1

goal (1 subgoal):
 1. A' $$ (Suc i, 0) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' $$ (Suc i, 0) = 0

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i4 < n - 1 \<Longrightarrow> A' $$ (Suc ?i4, 0) = 0

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
note A'0 = this
[PROOF STATE]
proof (state)
this:
?i4 < n - 1 \<Longrightarrow> A' $$ (Suc ?i4, 0) = 0

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have A0id: "A0 = 0\<^sub>m ?n1 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A0 = 0\<^sub>m (n - 1) 1
[PROOF STEP]
using splitA'[unfolded split_block_def Let_def] A'0 A'
[PROOF STATE]
proof (prove)
using this:
(mat 1 1 (($$) A'), mat 1 (dim_col A' - 1) (\<lambda>(i, j). A' $$ (i, j + 1)), mat (dim_row A' - 1) 1 (\<lambda>(i, j). A' $$ (i + 1, j)), mat (dim_row A' - 1) (dim_col A' - 1) (\<lambda>(i, j). A' $$ (i + 1, j + 1))) = (A1, A2, A0, A3)
?i4 < n - 1 \<Longrightarrow> A' $$ (Suc ?i4, 0) = 0
A' \<in> carrier_mat n n

goal (1 subgoal):
 1. A0 = 0\<^sub>m (n - 1) 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A0 = 0\<^sub>m (n - 1) 1

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have A0: "A0 \<in> carrier_mat ?n1 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A0 \<in> carrier_mat (n - 1) 1
[PROOF STEP]
unfolding A0id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>m (n - 1) 1 \<in> carrier_mat (n - 1) 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A0 \<in> carrier_mat (n - 1) 1

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from cp char_poly_similar[OF A'A]
[PROOF STATE]
proof (chain)
picking this:
char_poly A = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])
char_poly A' = char_poly A
[PROOF STEP]
have cp: "char_poly A' = [: -e,1 :] * (\<Prod> e \<leftarrow> es. [:- e, 1:])"
[PROOF STATE]
proof (prove)
using this:
char_poly A = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])
char_poly A' = char_poly A

goal (1 subgoal):
 1. char_poly A' = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
char_poly A' = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
char_poly A' = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have "char_poly A' = char_poly A1 * char_poly A3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A' = char_poly A1 * char_poly A3
[PROOF STEP]
unfolding A'block A0id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly (four_block_mat A1 A2 (0\<^sub>m (n - 1) 1) A3) = char_poly A1 * char_poly A3
[PROOF STEP]
by (rule char_poly_four_block_zeros_col[OF A1 A2 A3])
[PROOF STATE]
proof (state)
this:
char_poly A' = char_poly A1 * char_poly A3

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
char_poly A' = char_poly A1 * char_poly A3

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have "char_poly A1 = [: -e,1 :]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A1 = [:- e, 1:]
[PROOF STEP]
by (simp add: A1id char_poly_defs det_def)
[PROOF STATE]
proof (state)
this:
char_poly A1 = [:- e, 1:]

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[:- e, 1:] * char_poly A3 = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])
[PROOF STEP]
have cp: "char_poly A3 = (\<Prod> e \<leftarrow> es. [:- e, 1:])"
[PROOF STATE]
proof (prove)
using this:
[:- e, 1:] * char_poly A3 = [:- e, 1:] * (\<Prod>e\<leftarrow>es. [:- e, 1:])

goal (1 subgoal):
 1. char_poly A3 = (\<Prod>e\<leftarrow>es. [:- e, 1:])
[PROOF STEP]
by (metis mult_cancel_left pCons_eq_0_iff zero_neq_one)
[PROOF STATE]
proof (state)
this:
char_poly A3 = (\<Prod>e\<leftarrow>es. [:- e, 1:])

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from Cons(1)[OF A3 cp schur]
[PROOF STATE]
proof (chain)
picking this:
similar_mat_wit A3 B P' Q' \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P' \<and> Q' = adjoint P'
[PROOF STEP]
have simIH: "similar_mat_wit A3 B P' Q'" and ut: "upper_triangular B" and diag: "diag_mat B = es"
    and uP': "unitary P'" and Q'P': "Q' = adjoint P'"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A3 B P' Q' \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P' \<and> Q' = adjoint P'

goal (1 subgoal):
 1. (similar_mat_wit A3 B P' Q' &&& upper_triangular B) &&& diag_mat B = es &&& unitary P' &&& Q' = adjoint P'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
similar_mat_wit A3 B P' Q'
upper_triangular B
diag_mat B = es
unitary P'
Q' = adjoint P'

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from similar_mat_witD2[OF A3 simIH]
[PROOF STATE]
proof (chain)
picking this:
P' * Q' = 1\<^sub>m (n - 1)
Q' * P' = 1\<^sub>m (n - 1)
A3 = P' * B * Q'
A3 \<in> carrier_mat (n - 1) (n - 1)
B \<in> carrier_mat (n - 1) (n - 1)
P' \<in> carrier_mat (n - 1) (n - 1)
Q' \<in> carrier_mat (n - 1) (n - 1)
[PROOF STEP]
have B: "B \<in> carrier_mat ?n1 ?n1" and P': "P' \<in> carrier_mat ?n1 ?n1" and Q': "Q' \<in> carrier_mat ?n1 ?n1"
    and PQ': "P' * Q' = 1\<^sub>m ?n1"
[PROOF STATE]
proof (prove)
using this:
P' * Q' = 1\<^sub>m (n - 1)
Q' * P' = 1\<^sub>m (n - 1)
A3 = P' * B * Q'
A3 \<in> carrier_mat (n - 1) (n - 1)
B \<in> carrier_mat (n - 1) (n - 1)
P' \<in> carrier_mat (n - 1) (n - 1)
Q' \<in> carrier_mat (n - 1) (n - 1)

goal (1 subgoal):
 1. (B \<in> carrier_mat (n - 1) (n - 1) &&& P' \<in> carrier_mat (n - 1) (n - 1)) &&& Q' \<in> carrier_mat (n - 1) (n - 1) &&& P' * Q' = 1\<^sub>m (n - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat (n - 1) (n - 1)
P' \<in> carrier_mat (n - 1) (n - 1)
Q' \<in> carrier_mat (n - 1) (n - 1)
P' * Q' = 1\<^sub>m (n - 1)

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have A0_eq: "A0 = P' * A0 * 1\<^sub>m 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A0 = P' * A0 * 1\<^sub>m 1
[PROOF STEP]
unfolding A0id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>m (n - 1) 1 = P' * 0\<^sub>m (n - 1) 1 * 1\<^sub>m 1
[PROOF STEP]
using P'
[PROOF STATE]
proof (prove)
using this:
P' \<in> carrier_mat (n - 1) (n - 1)

goal (1 subgoal):
 1. 0\<^sub>m (n - 1) 1 = P' * 0\<^sub>m (n - 1) 1 * 1\<^sub>m 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A0 = P' * A0 * 1\<^sub>m 1

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have simA'C: "similar_mat_wit A' C ?P' ?Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat_wit A' C (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q')
[PROOF STEP]
unfolding A'block C
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat_wit (four_block_mat A1 A2 A0 A3) (four_block_mat A1 (A2 * P') A0 B) (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q')
[PROOF STEP]
by (rule similar_mat_wit_four_block[OF similar_mat_wit_refl[OF A1] simIH _ A0_eq A1 A3 A0],
    insert PQ' A2 P' Q', auto)
[PROOF STATE]
proof (state)
this:
similar_mat_wit A' C (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q')

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have ut1: "upper_triangular A1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular A1
[PROOF STEP]
unfolding A1id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular (mat 1 1 (\<lambda>_. e))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
upper_triangular A1

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have ut: "upper_triangular C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular C
[PROOF STEP]
unfolding C A0id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular (four_block_mat A1 (A2 * P') (0\<^sub>m (n - 1) 1) B)
[PROOF STEP]
by (intro upper_triangular_four_block[OF _ B ut1 ut], auto simp: A1id)
[PROOF STATE]
proof (state)
this:
upper_triangular C

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from A1id
[PROOF STATE]
proof (chain)
picking this:
A1 = mat 1 1 (\<lambda>_. e)
[PROOF STEP]
have diagA1: "diag_mat A1 = [e]"
[PROOF STATE]
proof (prove)
using this:
A1 = mat 1 1 (\<lambda>_. e)

goal (1 subgoal):
 1. diag_mat A1 = [e]
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
using this:
A1 = mat 1 1 (\<lambda>_. e)

goal (1 subgoal):
 1. map (\<lambda>i. A1 $$ (i, i)) [0..<dim_row A1] = [e]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
diag_mat A1 = [e]

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from diag_four_block_mat[OF A1 B]
[PROOF STATE]
proof (chain)
picking this:
diag_mat (four_block_mat A1 ?B ?C B) = diag_mat A1 @ diag_mat B
[PROOF STEP]
have diag: "diag_mat C = e # es"
[PROOF STATE]
proof (prove)
using this:
diag_mat (four_block_mat A1 ?B ?C B) = diag_mat A1 @ diag_mat B

goal (1 subgoal):
 1. diag_mat C = e # es
[PROOF STEP]
unfolding diag diagA1 C
[PROOF STATE]
proof (prove)
using this:
diag_mat (four_block_mat A1 ?B ?C B) = [e] @ es

goal (1 subgoal):
 1. diag_mat (four_block_mat A1 (A2 * P') A0 B) = e # es
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_mat C = e # es

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have aW: "adjoint W \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint W \<in> carrier_mat n n
[PROOF STEP]
using W
[PROOF STATE]
proof (prove)
using this:
W \<in> carrier_mat n n

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have aW': "adjoint W' \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint W' \<in> carrier_mat n n
[PROOF STEP]
using W'
[PROOF STATE]
proof (prove)
using this:
W' \<in> carrier_mat n n

goal (1 subgoal):
 1. adjoint W' \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint W' \<in> carrier_mat n n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have "unitary W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary W
[PROOF STEP]
using W_def ws_def ws0 normalized_corthogonal_mat_is_unitary
[PROOF STATE]
proof (prove)
using this:
W = mat_of_cols n ws
ws = map vec_normalize ws0
set ws0 \<subseteq> carrier_vec n
corthogonal ws0
length ws0 = n
\<lbrakk>set ?ws \<subseteq> carrier_vec ?n; corthogonal ?ws; length ?ws = ?n\<rbrakk> \<Longrightarrow> unitary (mat_of_cols ?n (map vec_normalize ?ws))

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
unitary W
[PROOF STEP]
have ivWaW: "inverts_mat W (adjoint W)"
[PROOF STATE]
proof (prove)
using this:
unitary W

goal (1 subgoal):
 1. inverts_mat W (adjoint W)
[PROOF STEP]
using unitary_def W aW
[PROOF STATE]
proof (prove)
using this:
unitary W
unitary ?A = (?A \<in> carrier_mat (dim_row ?A) (dim_row ?A) \<and> inverts_mat ?A (adjoint ?A))
W \<in> carrier_mat n n
adjoint W \<in> carrier_mat n n

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
with WW'
[PROOF STATE]
proof (chain)
picking this:
inverts_mat W W'
inverts_mat W (adjoint W)
[PROOF STEP]
have W'aW: "W' = (adjoint W)"
[PROOF STATE]
proof (prove)
using this:
inverts_mat W W'
inverts_mat W (adjoint W)

goal (1 subgoal):
 1. W' = adjoint W
[PROOF STEP]
using inverts_mat_unique W W' aW
[PROOF STATE]
proof (prove)
using this:
inverts_mat W W'
inverts_mat W (adjoint W)
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n; ?C \<in> carrier_mat ?n ?n; inverts_mat ?A ?B; inverts_mat ?A ?C\<rbrakk> \<Longrightarrow> ?B = ?C
W \<in> carrier_mat n n
W' \<in> carrier_mat n n
adjoint W \<in> carrier_mat n n

goal (1 subgoal):
 1. W' = adjoint W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
W' = adjoint W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
W' = adjoint W
[PROOF STEP]
have "adjoint W' = W"
[PROOF STATE]
proof (prove)
using this:
W' = adjoint W

goal (1 subgoal):
 1. adjoint W' = W
[PROOF STEP]
using adjoint_adjoint
[PROOF STATE]
proof (prove)
using this:
W' = adjoint W
adjoint (adjoint ?A) = ?A

goal (1 subgoal):
 1. adjoint W' = W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint W' = W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
with ivWaW
[PROOF STATE]
proof (chain)
picking this:
inverts_mat W (adjoint W)
adjoint W' = W
[PROOF STEP]
have "inverts_mat W' (adjoint W')"
[PROOF STATE]
proof (prove)
using this:
inverts_mat W (adjoint W)
adjoint W' = W

goal (1 subgoal):
 1. inverts_mat W' (adjoint W')
[PROOF STEP]
using inverts_mat_symm W aW W'aW
[PROOF STATE]
proof (prove)
using this:
inverts_mat W (adjoint W)
adjoint W' = W
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n; inverts_mat ?A ?B\<rbrakk> \<Longrightarrow> inverts_mat ?B ?A
W \<in> carrier_mat n n
adjoint W \<in> carrier_mat n n
W' = adjoint W

goal (1 subgoal):
 1. inverts_mat W' (adjoint W')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inverts_mat W' (adjoint W')

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inverts_mat W' (adjoint W')
[PROOF STEP]
have "unitary W'"
[PROOF STATE]
proof (prove)
using this:
inverts_mat W' (adjoint W')

goal (1 subgoal):
 1. unitary W'
[PROOF STEP]
using unitary_def W'
[PROOF STATE]
proof (prove)
using this:
inverts_mat W' (adjoint W')
unitary ?A = (?A \<in> carrier_mat (dim_row ?A) (dim_row ?A) \<and> inverts_mat ?A (adjoint ?A))
W' \<in> carrier_mat n n

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have newP': "P' \<in> carrier_mat (n - Suc 0) (n - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P' \<in> carrier_mat (n - Suc 0) (n - Suc 0)
[PROOF STEP]
using P'
[PROOF STATE]
proof (prove)
using this:
P' \<in> carrier_mat (n - 1) (n - 1)

goal (1 subgoal):
 1. P' \<in> carrier_mat (n - Suc 0) (n - Suc 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P' \<in> carrier_mat (n - Suc 0) (n - Suc 0)

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have rl: "\<And> x1 x2 x3 x4 y1 y2 y3 y4 f. x1 = y1 \<Longrightarrow> x2 = y2 \<Longrightarrow> x3 = y3 \<Longrightarrow> x4 = y4 \<Longrightarrow> f x1 x2 x3 x4 = f y1 y2 y3 y4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2 x3 x4 y1 y2 y3 y4 f. \<lbrakk>x1 = y1; x2 = y2; x3 = y3; x4 = y4\<rbrakk> \<Longrightarrow> f x1 x2 x3 x4 = f y1 y2 y3 y4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x1.2 = ?y1.2; ?x2.2 = ?y2.2; ?x3.2 = ?y3.2; ?x4.2 = ?y4.2\<rbrakk> \<Longrightarrow> ?f2 ?x1.2 ?x2.2 ?x3.2 ?x4.2 = ?f2 ?y1.2 ?y2.2 ?y3.2 ?y4.2

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have Q'aP': "?Q' = adjoint ?P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' = adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P')
[PROOF STEP]
apply (subst four_block_mat_adjoint, auto simp add: newP')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. four_block_mat (1\<^sub>m (Suc 0)) (0\<^sub>m (Suc 0) (n - Suc 0)) (0\<^sub>m (n - Suc 0) (Suc 0)) Q' = four_block_mat (adjoint (1\<^sub>m (Suc 0))) (adjoint (0\<^sub>m (n - Suc 0) (Suc 0))) (adjoint (0\<^sub>m (Suc 0) (n - Suc 0))) (adjoint P')
[PROOF STEP]
apply (rule rl[where f2 = four_block_mat])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. 1\<^sub>m (Suc 0) = adjoint (1\<^sub>m (Suc 0))
 2. 0\<^sub>m (Suc 0) (n - Suc 0) = adjoint (0\<^sub>m (n - Suc 0) (Suc 0))
 3. 0\<^sub>m (n - Suc 0) (Suc 0) = adjoint (0\<^sub>m (Suc 0) (n - Suc 0))
 4. Q' = adjoint P'
[PROOF STEP]
apply (auto simp add: eq_matI adjoint_eval Q'P')
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' = adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P')

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have "adjoint P = adjoint ?P' * adjoint W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint P = adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') * adjoint W
[PROOF STEP]
using W newP' n
[PROOF STATE]
proof (prove)
using this:
W \<in> carrier_mat n n
P' \<in> carrier_mat (n - Suc 0) (n - Suc 0)
n \<noteq> 0

goal (1 subgoal):
 1. adjoint P = adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') * adjoint W
[PROOF STEP]
apply (simp add: P)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>W \<in> carrier_mat n n; P' \<in> carrier_mat (n - Suc 0) (n - Suc 0); 0 < n\<rbrakk> \<Longrightarrow> adjoint (W * four_block_mat (1\<^sub>m (Suc 0)) (0\<^sub>m (Suc 0) (n - Suc 0)) (0\<^sub>m (n - Suc 0) (Suc 0)) P') = adjoint (four_block_mat (1\<^sub>m (Suc 0)) (0\<^sub>m (Suc 0) (n - Suc 0)) (0\<^sub>m (n - Suc 0) (Suc 0)) P') * adjoint W
[PROOF STEP]
apply (subst adjoint_mult[of W, symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>W \<in> carrier_mat n n; P' \<in> carrier_mat (n - Suc 0) (n - Suc 0); 0 < n\<rbrakk> \<Longrightarrow> W \<in> carrier_mat ?n3 ?m3
 2. \<lbrakk>W \<in> carrier_mat n n; P' \<in> carrier_mat (n - Suc 0) (n - Suc 0); 0 < n\<rbrakk> \<Longrightarrow> four_block_mat (1\<^sub>m (Suc 0)) (0\<^sub>m (Suc 0) (n - Suc 0)) (0\<^sub>m (n - Suc 0) (Suc 0)) P' \<in> carrier_mat ?m3 ?l3
 3. \<lbrakk>W \<in> carrier_mat n n; P' \<in> carrier_mat (n - Suc 0) (n - Suc 0); 0 < n\<rbrakk> \<Longrightarrow> adjoint (W * four_block_mat (1\<^sub>m (Suc 0)) (0\<^sub>m (Suc 0) (n - Suc 0)) (0\<^sub>m (n - Suc 0) (Suc 0)) P') = adjoint (W * four_block_mat (1\<^sub>m (Suc 0)) (0\<^sub>m (Suc 0) (n - Suc 0)) (0\<^sub>m (n - Suc 0) (Suc 0)) P')
[PROOF STEP]
apply (auto simp add: W P' carrier_matD[of W n n])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
adjoint P = adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') * adjoint W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
adjoint P = adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') * adjoint W

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have "\<dots> = ?Q' * W'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') * adjoint W = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'
[PROOF STEP]
using Q'aP' W'aW
[PROOF STATE]
proof (prove)
using this:
four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' = adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P')
W' = adjoint W

goal (1 subgoal):
 1. adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') * adjoint W = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') * adjoint W = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
adjoint (four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) P') * adjoint W = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
have "\<dots> = Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W' = Q
[PROOF STEP]
using Q
[PROOF STATE]
proof (prove)
using this:
Q = four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W'

goal (1 subgoal):
 1. four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W' = Q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
four_block_mat (1\<^sub>m 1) (0\<^sub>m 1 (n - 1)) (0\<^sub>m (n - 1) 1) Q' * W' = Q

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
adjoint P = Q
[PROOF STEP]
have QaP: "Q = adjoint P"
[PROOF STATE]
proof (prove)
using this:
adjoint P = Q

goal (1 subgoal):
 1. Q = adjoint P
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Q = adjoint P

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from similar_mat_wit_trans[OF simAA' simA'C, folded P Q]
[PROOF STATE]
proof (chain)
picking this:
similar_mat_wit A C P Q
[PROOF STEP]
have smw: "similar_mat_wit A C P Q"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A C P Q

goal (1 subgoal):
 1. similar_mat_wit A C P Q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
similar_mat_wit A C P Q

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
similar_mat_wit A C P Q
[PROOF STEP]
have dimP: "P \<in> carrier_mat n n" and dimQ: "Q \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A C P Q

goal (1 subgoal):
 1. P \<in> carrier_mat n n &&& Q \<in> carrier_mat n n
[PROOF STEP]
unfolding similar_mat_wit_def
[PROOF STATE]
proof (prove)
using this:
let n = dim_row A in {A, C, P, Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> A = P * C * Q

goal (1 subgoal):
 1. P \<in> carrier_mat n n &&& Q \<in> carrier_mat n n
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
let n = dim_row A in {A, C, P, Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> A = P * C * Q
A \<in> carrier_mat n n

goal (1 subgoal):
 1. P \<in> carrier_mat n n &&& Q \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat n n
Q \<in> carrier_mat n n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from smw
[PROOF STATE]
proof (chain)
picking this:
similar_mat_wit A C P Q
[PROOF STEP]
have "P * Q = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A C P Q

goal (1 subgoal):
 1. P * Q = 1\<^sub>m n
[PROOF STEP]
unfolding similar_mat_wit_def
[PROOF STATE]
proof (prove)
using this:
let n = dim_row A in {A, C, P, Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> A = P * C * Q

goal (1 subgoal):
 1. P * Q = 1\<^sub>m n
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
let n = dim_row A in {A, C, P, Q} \<subseteq> carrier_mat n n \<and> P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n \<and> A = P * C * Q
A \<in> carrier_mat n n

goal (1 subgoal):
 1. P * Q = 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P * Q = 1\<^sub>m n

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P * Q = 1\<^sub>m n
[PROOF STEP]
have "inverts_mat P Q"
[PROOF STATE]
proof (prove)
using this:
P * Q = 1\<^sub>m n

goal (1 subgoal):
 1. inverts_mat P Q
[PROOF STEP]
using inverts_mat_def dimP
[PROOF STATE]
proof (prove)
using this:
P * Q = 1\<^sub>m n
inverts_mat ?A ?B \<equiv> ?A * ?B = 1\<^sub>m (dim_row ?A)
P \<in> carrier_mat n n

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inverts_mat P Q
[PROOF STEP]
have uP: "unitary P"
[PROOF STATE]
proof (prove)
using this:
inverts_mat P Q

goal (1 subgoal):
 1. unitary P
[PROOF STEP]
using QaP unitary_def dimP
[PROOF STATE]
proof (prove)
using this:
inverts_mat P Q
Q = adjoint P
unitary ?A = (?A \<in> carrier_mat (dim_row ?A) (dim_row ?A) \<and> inverts_mat ?A (adjoint ?A))
P \<in> carrier_mat n n

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

goal (1 subgoal):
 1. \<And>a es n A B P Q. \<lbrakk>\<And>n A B P Q. \<lbrakk>A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es \<and> unitary P \<and> Q = adjoint P; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1:]); unitary_schur_decomposition A (a # es) = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = a # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
from ut similar_mat_wit_trans[OF simAA' simA'C, folded P Q] diag uP QaP
[PROOF STATE]
proof (chain)
picking this:
upper_triangular C
similar_mat_wit A C P Q
diag_mat C = e # es
unitary P
Q = adjoint P
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
upper_triangular C
similar_mat_wit A C P Q
diag_mat C = e # es
unitary P
Q = adjoint P

goal (1 subgoal):
 1. similar_mat_wit A C P Q \<and> upper_triangular C \<and> diag_mat C = e # es \<and> unitary P \<and> Q = adjoint P
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
similar_mat_wit A C P Q \<and> upper_triangular C \<and> diag_mat C = e # es \<and> unitary P \<and> Q = adjoint P

goal:
No subgoals!
[PROOF STEP]
qed