[STATEMENT]
theorem schur_decomposition:
  assumes A: "(A::'a::conjugatable_ordered_field mat) \<in> carrier_mat n n"
      and c: "char_poly A = (\<Prod> (e :: 'a) \<leftarrow> es. [:- e, 1:])"
      and B: "schur_decomposition A es = (B,P,Q)"
  shows "similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = es
[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::'a:])
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
[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::'a:]); schur_decomposition A [] = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = []
 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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>[]. [:- e, 1::'a:])
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::'a:]); schur_decomposition A [] = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat B = []
 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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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)
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>[]. [:- e, 1::'a:])
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)
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>[]. [:- e, 1::'a:])
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 = []
[PROOF STEP]
by (auto intro: similar_mat_wit_refl simp: diag_mat_def)
[PROOF STATE]
proof (state)
this:
similar_mat_wit A B P Q \<and> upper_triangular B \<and> diag_mat 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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1::'a:])
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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1::'a:])
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::'a:]); 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
A \<in> carrier_mat n n
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1::'a:])
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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
char_poly A = (\<Prod>e\<leftarrow>e # es. [:- e, 1::'a:])
[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::'a:])

goal (1 subgoal):
 1. char_poly A = [:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
char_poly A = [:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:])
[PROOF STEP]
by (rule monic_prod_list, auto)
[PROOF STATE]
proof (state)
this:
monic (\<Prod>e\<leftarrow>es. [:- e, 1::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]))
[PROOF STEP]
unfolding cp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])) = Suc (degree (\<Prod>e\<leftarrow>es. [:- e, 1::'a:]))
[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::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a)
degree (char_poly A) = Suc (degree (\<Prod>e\<leftarrow>es. [:- e, 1::'a:]))
[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::'a)
degree (char_poly A) = Suc (degree (\<Prod>e\<leftarrow>es. [:- e, 1::'a:]))

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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
define ws where "ws = gram_schmidt n b"
[PROOF STATE]
proof (state)
this:
ws = 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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
obtain B P' Q' where schur: "schur_decomposition A3 es = (B,P',Q')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B P' Q'. schur_decomposition A3 es = (B, P', Q') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "schur_decomposition A3 es", auto)
[PROOF STATE]
proof (state)
this:
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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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:
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 schur_decomposition.simps
    Let_def list.sel dim
    v_def[symmetric] b_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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])) e = (0::'a)
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
interpret cof_vec_space n "TYPE('a)"
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
from gram_schmidt_result[OF b dist_b indep refl, folded ws_def]
[PROOF STATE]
proof (chain)
picking this:
local.span (set b) = local.span (set ws)
corthogonal ws
set ws \<subseteq> carrier_vec n
length ws = length b
distinct ws
[PROOF STEP]
have ws: "set ws \<subseteq> carrier_vec n" "corthogonal ws" "length ws = n"
[PROOF STATE]
proof (prove)
using this:
local.span (set b) = local.span (set ws)
corthogonal ws
set ws \<subseteq> carrier_vec n
length ws = length b
distinct ws

goal (1 subgoal):
 1. set ws \<subseteq> carrier_vec n &&& corthogonal ws &&& length ws = n
[PROOF STEP]
by (auto simp: len_b)
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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 hdws: "hd ws = v"
[PROOF STATE]
proof (prove)
using this:
hd (gram_schmidt n b) = v

goal (1 subgoal):
 1. hd ws = v
[PROOF STEP]
unfolding ws_def
[PROOF STATE]
proof (prove)
using this:
hd (gram_schmidt n b) = v

goal (1 subgoal):
 1. hd (gram_schmidt n b) = v
[PROOF STEP]
.
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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 find_eigenvector[OF A e] A
[PROOF STATE]
proof (prove)
using this:
v = find_eigenvector A e
eigenvector A (find_eigenvector A e) e
A \<in> carrier_mat n n

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 = 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

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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a))
[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::'a))
[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::'a))

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::'a))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
col A' 0 = vec n (\<lambda>i. if i = 0 then e else (0::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a)) $ 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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a)) $ 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::'a)) $ Suc i
A' \<in> carrier_mat n n
i < n - 1

goal (1 subgoal):
 1. A' $$ (Suc i, 0) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' $$ (Suc i, 0) = (0::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i4 < n - 1 \<Longrightarrow> A' $$ (Suc ?i4, 0) = (0::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
note A'0 = this
[PROOF STATE]
proof (state)
this:
?i4 < n - 1 \<Longrightarrow> A' $$ (Suc ?i4, 0) = (0::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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)
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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
from cp char_poly_similar[OF A'A]
[PROOF STATE]
proof (chain)
picking this:
char_poly A = [:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])
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::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])
char_poly A' = char_poly A

goal (1 subgoal):
 1. char_poly A' = [:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
char_poly A' = [:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
char_poly A' = [:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
have "char_poly A1 = [: -e,1 :]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A1 = [:- e, 1::'a:]
[PROOF STEP]
by (simp add: A1id char_poly_defs det_def sign_def)
[PROOF STATE]
proof (state)
this:
char_poly A1 = [:- e, 1::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[:- e, 1::'a:] * char_poly A3 = [:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])
[PROOF STEP]
have cp: "char_poly A3 = (\<Prod> e \<leftarrow> es. [:- e, 1:])"
[PROOF STATE]
proof (prove)
using this:
[:- e, 1::'a:] * char_poly A3 = [:- e, 1::'a:] * (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])

goal (1 subgoal):
 1. char_poly A3 = (\<Prod>e\<leftarrow>es. [:- e, 1::'a:])
[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::'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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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
[PROOF STEP]
have simIH: "similar_mat_wit A3 B P' Q'" and ut: "upper_triangular B" and diag: "diag_mat B = es"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A3 B P' Q' \<and> upper_triangular B \<and> diag_mat B = es

goal (1 subgoal):
 1. similar_mat_wit A3 B P' Q' &&& upper_triangular B &&& diag_mat B = es
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
similar_mat_wit A3 B P' Q'
upper_triangular B
diag_mat B = 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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[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::'a:]); 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; A \<in> carrier_mat n n; char_poly A = (\<Prod>e\<leftarrow>a # es. [:- e, 1::'a:]); 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
[PROOF STEP]
from ut similar_mat_wit_trans[OF simAA' simA'C, folded P Q] diag
[PROOF STATE]
proof (chain)
picking this:
upper_triangular C
similar_mat_wit A C P Q
diag_mat C = e # es
[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

goal (1 subgoal):
 1. similar_mat_wit A C P Q \<and> upper_triangular C \<and> diag_mat C = e # es
[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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measure_restricted:
  "S \<in> sets M \<Longrightarrow> X \<in> sets M \<Longrightarrow> measure (density M (indicator S)) X = measure M (S \<inter> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<in> sets M; X \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure (density M (indicator S)) X = Sigma_Algebra.measure M (S \<inter> X)
[PROOF STEP]
by (simp add: emeasure_restricted measure_def)


[STATEMENT]
lemma nat_list_from_vertex:
  assumes "finite l"
  shows "set (nat_list_from_vertex l) = {i . i \<in> l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (nat_list_from_vertex l) = {i. i \<in> l}
[PROOF STEP]
unfolding nat_list_from_vertex_def sorted_list_of_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (sorted_key_list_of_set (\<lambda>x. x) l) = {i. i \<in> l}
[PROOF STEP]
by auto (metis assms set_sorted_list_of_set sorted_list_of_set_def)+


[STATEMENT]
lemma subset_replicate [intro?]: "set (replicate n x) \<subseteq> {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (replicate n x) \<subseteq> {x}
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma RSD_extends_RD:
  assumes wf: "is_pref_profile R" and unique: "has_unique_favorites R"
  shows   "RSD R = RD R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
from wf
[PROOF STATE]
proof (chain)
picking this:
is_pref_profile R
[PROOF STEP]
interpret pref_profile_wf agents alts R
[PROOF STATE]
proof (prove)
using this:
is_pref_profile R

goal (1 subgoal):
 1. is_pref_profile R
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
from unique
[PROOF STATE]
proof (chain)
picking this:
has_unique_favorites R
[PROOF STEP]
interpret pref_profile_unique_favorites
[PROOF STATE]
proof (prove)
using this:
has_unique_favorites R

goal (1 subgoal):
 1. pref_profile_unique_favorites agents alts R
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
have "RSD R = pmf_of_set agents \<bind>
                  (\<lambda>i. random_serial_dictatorship (agents - {i}) (favorites R i) R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RSD R = pmf_of_set agents \<bind> (\<lambda>i. random_serial_dictatorship (agents - {i}) (favorites R i) R)
[PROOF STEP]
by (simp add: random_serial_dictatorship_nonempty favorites_altdef Max_wrt_def)
[PROOF STATE]
proof (state)
this:
RSD R = pmf_of_set agents \<bind> (\<lambda>i. random_serial_dictatorship (agents - {i}) (favorites R i) R)

goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
RSD R = pmf_of_set agents \<bind> (\<lambda>i. random_serial_dictatorship (agents - {i}) (favorites R i) R)

goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_pref_profile R
has_unique_favorites R
[PROOF STEP]
have "\<dots> = pmf_of_set agents \<bind> (\<lambda>i. return_pmf (favorite R i))"
[PROOF STATE]
proof (prove)
using this:
is_pref_profile R
has_unique_favorites R

goal (1 subgoal):
 1. pmf_of_set agents \<bind> (\<lambda>i. random_serial_dictatorship (agents - {i}) (favorites R i) R) = pmf_of_set agents \<bind> (\<lambda>i. return_pmf (favorite R i))
[PROOF STEP]
by (intro bind_pmf_cong refl, subst random_serial_dictatorship_singleton [symmetric])
       (auto simp: unique_favorites favorite_in_alts)
[PROOF STATE]
proof (state)
this:
pmf_of_set agents \<bind> (\<lambda>i. random_serial_dictatorship (agents - {i}) (favorites R i) R) = pmf_of_set agents \<bind> (\<lambda>i. return_pmf (favorite R i))

goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf_of_set agents \<bind> (\<lambda>i. random_serial_dictatorship (agents - {i}) (favorites R i) R) = pmf_of_set agents \<bind> (\<lambda>i. return_pmf (favorite R i))

goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_pref_profile R
has_unique_favorites R
[PROOF STEP]
have "\<dots> = RD R"
[PROOF STATE]
proof (prove)
using this:
is_pref_profile R
has_unique_favorites R

goal (1 subgoal):
 1. pmf_of_set agents \<bind> (\<lambda>i. return_pmf (favorite R i)) = RD R
[PROOF STEP]
by (simp add: random_dictatorship_unique_favorites map_pmf_def)
[PROOF STATE]
proof (state)
this:
pmf_of_set agents \<bind> (\<lambda>i. return_pmf (favorite R i)) = RD R

goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
RSD R = RD R
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
RSD R = RD R

goal (1 subgoal):
 1. RSD R = RD R
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
RSD R = RD R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_gcd_int [simp]:
  "\<bar>gcd x y\<bar> = gcd x y"
  for x y :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>gcd x y\<bar> = gcd x y
[PROOF STEP]
by (simp only: gcd_int_def)


[STATEMENT]
lemma iMOD_trans: "
  \<lbrakk> y \<in> [x, mod m]; z \<in> [y, mod m] \<rbrakk> \<Longrightarrow> z \<in> [x, mod m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> [ x, mod m ]; z \<in> [ y, mod m ]\<rbrakk> \<Longrightarrow> z \<in> [ x, mod m ]
[PROOF STEP]
by (rule subsetD[OF iMOD_subset[OF iMOD_geD iMOD_modD mod_self]])


[STATEMENT]
lemma fixedpoint_invariant_correct:
     "fixedpoint \<inter> reach_invariant = { %v. (init, v) \<in> edges\<^sup>* }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fixedpoint \<inter> reach_invariant = {\<lambda>v. (init, v) \<in> edges\<^sup>*}
[PROOF STEP]
apply (unfold fixedpoint_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {s. \<forall>(u, v)\<in>edges. s u \<longrightarrow> s v} \<inter> reach_invariant = {\<lambda>v. (init, v) \<in> edges\<^sup>*}
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {s. \<forall>(u, v)\<in>edges. s u \<longrightarrow> s v} \<inter> reach_invariant \<subseteq> {\<lambda>v. (init, v) \<in> edges\<^sup>*}
 2. {\<lambda>v. (init, v) \<in> edges\<^sup>*} \<subseteq> {s. \<forall>(u, v)\<in>edges. s u \<longrightarrow> s v} \<inter> reach_invariant
[PROOF STEP]
apply (auto intro!: ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x v. \<lbrakk>\<forall>xa\<in>edges. case xa of (u, v) \<Rightarrow> x u \<longrightarrow> x v; (init, v) \<in> edges\<^sup>*; \<forall>v. x v \<longrightarrow> (init, v) \<in> edges\<^sup>*; x init\<rbrakk> \<Longrightarrow> x v
[PROOF STEP]
apply (erule rtrancl_induct, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma NSLIMSEQ_sin_pi: "(\<lambda>n. real n * sin (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real n * sin (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S pi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. real n * sin (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S pi
[PROOF STEP]
have *: "hypreal_of_hypnat N * (*f* sin) ((*f* (\<lambda>x. pi / real x)) N) \<approx> hypreal_of_real pi"
    if "N \<in> HNatInfinite"
    for N :: "nat star"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hypreal_of_hypnat N * (*f* sin) ((*f* (\<lambda>x. pi / real x)) N) \<approx> hypreal_of_real pi
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
N \<in> HNatInfinite

goal (1 subgoal):
 1. hypreal_of_hypnat N * (*f* sin) ((*f* (\<lambda>x. pi / real x)) N) \<approx> hypreal_of_real pi
[PROOF STEP]
by simp (metis STAR_sin_pi_divide_HNatInfinite_approx_pi2 starfunNat_real_of_nat)
[PROOF STATE]
proof (state)
this:
?N \<in> HNatInfinite \<Longrightarrow> hypreal_of_hypnat ?N * (*f* sin) ((*f* (\<lambda>x. pi / real x)) ?N) \<approx> hypreal_of_real pi

goal (1 subgoal):
 1. (\<lambda>n. real n * sin (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real n * sin (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S pi
[PROOF STEP]
by (simp add: NSLIMSEQ_def starfunNat_real_of_nat) (metis * starfun_o2)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real n * sin (pi / real n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prv_imp_neg_neg:
  assumes "\<phi> \<in> fmla"
  shows "prv (imp \<phi> (neg (neg \<phi>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<phi> (neg (neg \<phi>)))
[PROOF STEP]
using assms prv_imp_neg_fls neg_def
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> fmla
?\<phi> \<in> fmla \<Longrightarrow> prv (imp ?\<phi> (imp (neg ?\<phi>) fls))
neg ?\<phi> = imp ?\<phi> fls

goal (1 subgoal):
 1. prv (imp \<phi> (neg (neg \<phi>)))
[PROOF STEP]
by auto


[STATEMENT]
lemma has_integral_const [intro]:
  fixes a b :: "'a::euclidean_space"
  shows "((\<lambda>x. c) has_integral (content (cbox a b) *\<^sub>R c)) (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c) has_integral content (cbox a b) *\<^sub>R c) (cbox a b)
[PROOF STEP]
using eventually_division_filter_tagged_division[of "cbox a b"]
     additive_content_tagged_division[of _ a b]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F p in division_filter (cbox a b). p tagged_division_of cbox a b
?d tagged_division_of cbox a b \<Longrightarrow> (\<Sum>(x, y)\<in>?d. content y) = content (cbox a b)

goal (1 subgoal):
 1. ((\<lambda>x. c) has_integral content (cbox a b) *\<^sub>R c) (cbox a b)
[PROOF STEP]
by (auto simp: has_integral_cbox split_beta' scaleR_sum_left[symmetric]
           elim!: eventually_mono intro!: tendsto_cong[THEN iffD1, OF _ tendsto_const])


[STATEMENT]
lemma equiv_P2R[simp]: "equiv (Collect P) (P2R \<phi>) \<longleftrightarrow> equivP P \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equiv (Collect P) (P2R \<phi>) = equivP P \<phi>
[PROOF STEP]
unfolding equivP_def equiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (refl_on (Collect P) (P2R \<phi>) \<and> sym (P2R \<phi>) \<and> trans (P2R \<phi>)) = (reflP P \<phi> \<and> symP \<phi> \<and> transP \<phi>)
[PROOF STEP]
by auto


[STATEMENT]
lemma USUP_image_eq [simp]: "USUP (\<lambda>i. \<guillemotleft>i\<guillemotright> \<in>\<^sub>u \<guillemotleft>f ` A\<guillemotright>) g = (\<Squnion> i\<in>A \<bullet> g(f(i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> i \<in> f ` A \<bullet> g i) = (\<Squnion> i \<in> A \<bullet> g (f i))
[PROOF STEP]
by (pred_simp, rule_tac cong[of Inf Inf], auto)


[STATEMENT]
lemma supset_poset: "ordering (\<supseteq>) (\<supset>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordering (\<lambda>x y. y \<subseteq> x) (\<lambda>x y. y \<subset> x)
[PROOF STEP]
..


[STATEMENT]
lemma divide_ell2_code'[code]:
  \<comment> \<open>Code equation for the product in the algebra of one-dimensional vectors\<close>
  fixes \<psi> \<phi> :: "'a::{CARD_1,enum} ell2"
  shows "vec_of_ell2 (\<psi> / \<phi>)
   = vec_of_list [vec_index (vec_of_ell2 \<psi>) 0 / vec_index (vec_of_ell2 \<phi>) 0]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_ell2 (\<psi> / \<phi>) = vec_of_list [vec_of_ell2 \<psi> $ 0 / vec_of_ell2 \<phi> $ 0]
[PROOF STEP]
by (simp add: vec_of_ell2_def vec_of_basis_enum_divide)


[STATEMENT]
lemma iMOD_inext: "t \<in> [r, mod m] \<Longrightarrow> inext t [r, mod m] = t + m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> [ r, mod m ] \<Longrightarrow> inext t [ r, mod m ] = t + m
[PROOF STEP]
by (clarsimp simp add: inext_def iMOD_cut_greater iT_iff iT_Min iT_not_empty mod_eq_imp_diff_mod_0)


[STATEMENT]
lemma length_inf_prefix_append[simp]: "
  length ((zs @ xs) \<sqinter> (zs @ ys)) =
  length zs + length (xs \<sqinter> ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ((zs @ xs) \<sqinter> (zs @ ys)) = length zs + length (xs \<sqinter> ys)
[PROOF STEP]
by (simp add: length_inf_prefix)


[STATEMENT]
lemma e_b_c_a: "e_aux b c a = e_aux a b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e_aux b c a = e_aux a b c
[PROOF STEP]
by (simp add: e_aux_def ac_simps)


[STATEMENT]
lemma keys_rbt_baldL: "RBT_Impl.keys (rbt_baldL l a b r) = RBT_Impl.keys l @ a # RBT_Impl.keys r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (rbt_baldL l a b r) = keys l @ a # keys r
[PROOF STEP]
by (cases "(l,a,b,r)" rule: rbt_baldL.cases) (auto simp: keys_rbt_baliL keys_rbt_baliR)


[STATEMENT]
lemma FIN_not_closed_under_union: "\<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN
[PROOF STEP]
have "{0\<^sup>\<infinity>} \<in> FIN"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0\<^sup>\<infinity>} \<in> FIN
[PROOF STEP]
using singleton_in_FIN const_in_Prim1
[PROOF STATE]
proof (prove)
using this:
?f \<in> \<R> \<Longrightarrow> {?f} \<in> FIN
(\<lambda>_. Some ?c) \<in> Prim1

goal (1 subgoal):
 1. {0\<^sup>\<infinity>} \<in> FIN
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{0\<^sup>\<infinity>} \<in> FIN

goal (1 subgoal):
 1. \<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{0\<^sup>\<infinity>} \<in> FIN

goal (1 subgoal):
 1. \<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN
[PROOF STEP]
have "U_single \<in> FIN"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U_single \<in> FIN
[PROOF STEP]
using U_single_in_FIN
[PROOF STATE]
proof (prove)
using this:
U_single \<in> FIN

goal (1 subgoal):
 1. U_single \<in> FIN
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U_single \<in> FIN

goal (1 subgoal):
 1. \<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{0\<^sup>\<infinity>} \<in> FIN
U_single \<in> FIN
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{0\<^sup>\<infinity>} \<in> FIN
U_single \<in> FIN

goal (1 subgoal):
 1. \<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN
[PROOF STEP]
using zero_U_single_not_in_FIN
[PROOF STATE]
proof (prove)
using this:
{0\<^sup>\<infinity>} \<in> FIN
U_single \<in> FIN
{0\<^sup>\<infinity>} \<union> U_single \<notin> FIN

goal (1 subgoal):
 1. \<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>U V. U \<in> FIN \<and> V \<in> FIN \<and> U \<union> V \<notin> FIN

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [code]: "m < n \<longleftrightarrow> integer_of_natural m < integer_of_natural n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m < n) = (integer_of_natural m < integer_of_natural n)
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma map_length_ci:
  "(map (length \<circ> (\<lambda>(xa, y). ci (layout_of xs @ [length_of x]) xa y)) (tpairs_of xs)) =
  (map (length \<circ> (\<lambda>(x, y). ci (layout_of xs) x y)) (tpairs_of xs)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (length \<circ> (\<lambda>(xa, y). ci (layout_of xs @ [length_of x]) xa y)) (tpairs_of xs) = map (length \<circ> (\<lambda>(x, y). ci (layout_of xs) x y)) (tpairs_of xs)
[PROOF STEP]
apply(auto simp: ci.simps adjust.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> set (tpairs_of xs) \<Longrightarrow> length (ci (layout_of xs @ [length_of x]) a b) = length (ci (layout_of xs) a b)
[PROOF STEP]
apply(rename_tac A B)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B. (A, B) \<in> set (tpairs_of xs) \<Longrightarrow> length (ci (layout_of xs @ [length_of x]) A B) = length (ci (layout_of xs) A B)
[PROOF STEP]
apply(case_tac B, auto simp: ci.simps adjust.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done