reserve i,j,m,n,k for Nat,
  x,y for set,
  K for Field,
  a,L for Element of K;
reserve V1,V2 for finite-dimensional VectSp of K,
  W1,W2 for Subspace of V1,
  U1 ,U2 for Subspace of V2,
  b1 for OrdBasis of V1,
  B1 for FinSequence of V1,
  b2 for OrdBasis of V2,
  B2 for FinSequence of V2,
  bw1 for OrdBasis of W1,
  bw2 for OrdBasis of W2,
  Bu1 for FinSequence of U1,
  Bu2 for FinSequence of U2;

theorem
  for K be algebraic-closed Field, M be Matrix of n,K ex J be non-empty
(FinSequence_of_Jordan_block of K), P be Matrix of n,K st Sum Len J = n & P is
  invertible & M = P * block_diagonal(J,0.K) * (P~)
proof
  let K be algebraic-closed Field, M be Matrix of n,K;
  per cases;
  suppose
A1: n=0;
    then reconsider P={} as Matrix of n,K by MATRIX_0:13;
    reconsider J ={} as FinSequence_of_Jordan_block of K by Lm2;
    reconsider J as non-empty FinSequence_of_Jordan_block of K;
    take J,P;
A2: Len J = <*>NAT
      .= <*>REAL;
    thus Sum Len J=n by A1,RVSUM_1:72;
A3: 1_K <>0.K;
    Det P=1_K by A1,MATRIXR2:41;
    hence P is invertible by A3,LAPLACE:34;
    reconsider B=block_diagonal(J,0.K) as Matrix of n,K by A1,A2,RVSUM_1:72;
    M = P * B * (P~) by A1,MATRIX_0:45;
    hence thesis;
  end;
  suppose
A4: n>0;
    set V=n-VectSp_over K;
    set B = the OrdBasis of V;
A5: len B = dim V by MATRLIN2:21
      .= n by MATRIX13:112;
    then reconsider M9=M as Matrix of len B,K;
    set T=Mx2Tran(M9,B,B);
    dim V=n by MATRIX13:112;
    then V is non trivial by A4,MATRLIN2:42;
    then consider
    J be non-empty (FinSequence_of_Jordan_block of K), b1 be OrdBasis
    of V such that
A6: AutMt(T,b1,b1) = block_diagonal(J,0.K) and
    for L be Scalar of K holds L is eigenvalue of T iff ex i st i in dom J
    & J.i = Jordan_block(L,len (J.i)) by Th31;
A7: dom T=[#]V by FUNCT_2:def 1;
    reconsider P=AutEqMt(id V,B,b1) as Matrix of n,K by A5;
    take J,P;
A8: width P=n & len (P~)=n by A4,MATRIX_0:23;
A9: rng T c= [#]V by RELAT_1:def 19;
A10: len b1 = dim V by MATRLIN2:21
      .= n by MATRIX13:112;
    then
A11: len AutMt(T,b1,b1) = n & width AutMt(T,b1,b1)=n by A4,MATRIX_0:23;
    thus Sum Len J=len AutMt(T,b1,b1) by A6,MATRIXJ1:def 5
      .=n by A10,MATRIX_0:def 2;
    thus P is invertible by A5,MATRLIN2:29;
    thus M = AutMt(T,B,B) by MATRLIN2:36
      .= AutMt(T*id V,B,B) by A7,RELAT_1:52
      .= AutMt(id V,B,b1)* AutMt(T,b1,B) by A4,A5,A10,MATRLIN:41
      .= P* AutMt(T,b1,B) by A5,A10,MATRLIN2:def 2
      .= P* AutMt((id V)*T,b1,B) by A9,RELAT_1:53
      .= P* (AutMt(T,b1,b1)*AutMt(id V,b1,B)) by A4,A10,MATRLIN:41
      .= P*(AutMt(T,b1,b1) *AutEqMt(id V,b1,B)) by A5,A10,MATRLIN2:def 2
      .= P*(AutMt(T,b1,b1)*(P~)) by A5,MATRLIN2:29
      .= P*block_diagonal(J,0.K) *(P~) by A6,A8,A11,MATRIX_3:33;
  end;
end;
