reserve x,y for object,X,Y for set,
  D for non empty set,
  i,j,k,l,m,n,m9,n9 for Nat,
  i0,j0,n0,m0 for non zero Nat,
  K for Field,
  a,b for Element of K,
  p for FinSequence of K,
  M for Matrix of n,K;

theorem Th3:
  diagonal_of_Matrix M = diagonal_of_Matrix M@
proof
  set DM=diagonal_of_Matrix M;
  set DM9=diagonal_of_Matrix M@;
A1: len DM=n by MATRIX_3:def 10;
A2: now
    let i such that
A3: 1<= i and
A4: i <= len DM;
A5: i in Seg n by A1,A3,A4;
    then
A6: DM9.i=M@*(i,i) by MATRIX_3:def 10;
    Indices M=[:Seg n,Seg n:] by MATRIX_0:24;
    then
A7: [i,i] in Indices M by A5,ZFMISC_1:87;
    DM.i=M*(i,i) by A5,MATRIX_3:def 10;
    hence DM.i=DM9.i by A7,A6,MATRIX_0:def 6;
  end;
  len DM9=n by MATRIX_3:def 10;
  hence thesis by A1,A2;
end;
