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 Th7:
  for M be upper_triangular Matrix of n,K holds Det M = (the multF
  of K) $$ diagonal_of_Matrix M
proof
  let M be upper_triangular Matrix of n,K;
  set aa=the addF of K;
  set mm=the multF of K;
  set P=Permutations n;
  set F=In(P,Fin P);
  set PP=Path_product M;
  idseq n is Element of Group_of_Perm(n) by MATRIX_1:11;
  then reconsider I=idseq n as Element of P by MATRIX_1:def 13;
  len P=n by MATRIX_1:9;
  then
A1: I is even by MATRIX_1:16;
  reconsider II={I},PI=P\{I} as Element of Fin P by FINSUB_1:def 5;
   P in Fin P by FINSUB_1:def 5; then
A2: F=P by SUBSET_1:def 8;
  now
    per cases;
    suppose
      PI={};
      then P c= II by XBOOLE_1:37;
      hence aa $$ (F,PP)=aa $$ (II,PP) by A2,XBOOLE_0:def 10;
    end;
    suppose
A3:   PI<>{};
A4:   PP.:PI c= {0.K}
      proof
        let y be object;
        assume y in PP.:PI;
        then consider x being object such that
A5:     x in dom PP and
A6:     x in PI and
A7:     y = PP.x by FUNCT_1:def 6;
        reconsider f=x as Element of P by A5;
        not f in {I} by A6,XBOOLE_0:def 5;
        then f <> I by TARSKI:def 1;
        then PP.f=0.K by Th5;
        hence thesis by A7,TARSKI:def 1;
      end;
A8:   0.K = the_unity_wrt aa by FVSUM_1:7;
      dom PP=P by FUNCT_2:def 1;
      then PP.:PI={0.K} by A3,A4,ZFMISC_1:33;
      then
A9:   aa $$ (PI,PP)=0.K by A8,FVSUM_1:8,SETWOP_2:8;
A10:  PI\/II=II\/P by XBOOLE_1:39;
A11:  II\/P=P by XBOOLE_1:12;
      PI misses II by XBOOLE_1:79;
      hence aa $$ (F,PP) = aa $$ (II,PP)+0.K by A2,A3,A9,A10,A11,SETWOP_2:4
        .= aa $$ (II,PP) by RLVECT_1:def 4;
    end;
  end;
  hence Det M = PP.I by SETWISEO:17
    .= -(mm"**"Path_matrix(I,M),I) by MATRIX_3:def 8
    .= mm"**"Path_matrix(I,M) by A1,MATRIX_1:def 16
    .= mm"**"diagonal_of_Matrix M by Th6;
end;
