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 Th6:
  for M be (Matrix of n,K), I be Element of Permutations n st I =
  idseq n holds diagonal_of_Matrix M = Path_matrix(I,M)
proof
  let M be (Matrix of n,K), I be Element of Permutations n such that
A1: I=idseq n;
  set P=Path_matrix(I,M);
  set D=diagonal_of_Matrix M;
A2: len P=n by MATRIX_3:def 7;
A3: now
    let i such that
A4: 1<=i and
A5: i<= n;
A6: i in Seg n by A4,A5;
    then
A7: I.i=i by A1,FINSEQ_2:49;
    i in dom P by A2,A6,FINSEQ_1:def 3;
    then P.i=M*(i,i) by A7,MATRIX_3:def 7;
    hence P.i=D.i by A6,MATRIX_3:def 10;
  end;
  len D=n by MATRIX_3:def 10;
  hence thesis by A2,A3;
end;
