reserve x, y for object, X for set,
  i, j, k, l, n, m for Nat,
  D for non empty set,
  K for commutative Ring,
  a,b for Element of K,
  perm, p, q for Element of Permutations(n),
  Perm,P for Permutation of Seg n,
  F for Function of Seg n,Seg n,
  perm2, p2, q2, pq2 for Element of Permutations(n+2),
  Perm2 for Permutation of Seg (n+2);
reserve s for Element of 2Set Seg (n+2);
reserve pD for FinSequence of D,
  M for Matrix of n,m,D,
  pK,qK for FinSequence of K,
  A for Matrix of n,K;

theorem Th60:
  for A,B be Matrix of n,K st 0 < n ex P be Function of Funcs(Seg
  n,Seg n),the carrier of K st ( for F be Function of Seg n,Seg n ex Path be
  FinSequence of K st len Path = n & (for Fj,j be Nat st j in Seg n & Fj = F.j
holds Path.j = A*(j,Fj))& P.F= (the multF of K) $$ Path * Det (B*F) ) & Det(A*B
  ) = (the addF of K) $$ (In(Funcs(Seg n,Seg n),Fin Funcs(Seg n,Seg n)),P)
proof
  let A,B be Matrix of n,K such that
A1: 0 < n;
  set AB=A*B;
  set aa=the addF of K;
  set I=idseq n;
  set mm= the multF of K;
  set KK=the carrier of K;
  defpred FF[Function,Nat] means for F be Function of Seg $2,Seg n for M be
Matrix of n,n,K st M = A*B +* ((B*(I +* F)) | Seg $2) & for j holds
(j in Seg $2
  implies M.j=B.(F.j))& (not j in Seg $2 implies M.j=(A*B).j) ex Path be
  FinSequence of K st len Path=$2 & (for Fj,j be Nat st j in Seg $2 & Fj=F.j
  holds Path.j=A*(j,Fj)) & $1.F= mm $$ Path * Det M;
  defpred P[Nat] means $1<=n implies for FUNC be non empty set st FUNC=Funcs(
  Seg $1,Seg n) ex P be Function of FUNC,KK st FF[P,$1] & Det(AB) = aa $$ (
  In(FUNC,Fin FUNC),P);
A2: for k be Nat st P[k] holds P[k+1]
  proof
    set Y=Seg n;
    let k be Nat such that
A3: P[k];
    set X=Seg k;
    reconsider FUNC=Funcs(Seg k,Seg n) as non empty set by A1;
    set k1=k+1;
    assume
A4: k1 <= n;
    set Xx=Seg k\/{k1};
    let FUNC1 be non empty set such that
A5: FUNC1=Funcs(Seg k1,Seg n);
    consider P1 be Function of FUNC1,KK such that
A6: FF[P1,k1] by A4,A5,Lm10;
    reconsider FUNC19=Funcs(Xx,Y) as non empty set by A5,FINSEQ_1:9;
A7: FUNC1=Funcs(Xx,Y) by A5,FINSEQ_1:9;
    then reconsider P19=P1 as Function of FUNC19,KK;
A8: k+0<=k1 by XREAL_1:8;
    then consider P be Function of FUNC,KK such that
A9: FF[P,k] and
A10: Det(AB) = aa $$ (In(FUNC,Fin FUNC),P) by A3,A4,XXREAL_0:2;
A11: not k1 in X by FINSEQ_3:8;
A12: for H be Function of X,Y, SF be Element of Fin FUNC19 st SF={h where
    h is Function of Xx,Y: h|X=H} holds aa $$ (SF,P19)=P.H
    proof
      reconsider YY=Y as non empty set by A1;
      let H be Function of X,Y, SF be Element of Fin FUNC19 such that
A13:  SF={h where h is Function of Xx,Y: h|X=H};
      defpred Q[object,object] means
for h be Function of Xx,Y st h|X=H & h.k1=$1
      holds h=$2;
A14:  for y being object st y in YY ex f9 be object st f9 in SF & Q[y,f9]
      proof
        let y be object;
        assume y in YY;
        then Y\/{y}=Y by ZFMISC_1:40;
        then consider q be Function of Xx,Y such that
A15:    q|X=H and
A16:    q.k1=y by A11,STIRL2_1:57;
        take q;
        thus q in SF by A13,A15;
        let h be Function of Xx,Y such that
A17:    h|X=H and
A18:    h.k1=y;
        now
          let x be object;
          assume x in Xx;
          then
A19:      x in X or x in {k1} by XBOOLE_0:def 3;
          dom H=X by A1,FUNCT_2:def 1;
          then q.x=H.x & h.x=H.x or x=k1 by A15,A17,A19,FUNCT_1:47,TARSKI:def 1
;
          hence h.x = q.x by A16,A18;
        end;
        hence thesis by FUNCT_2:12;
      end;
      consider QQ be Function of YY,SF such that
A20:  for y being object st y in YY holds Q[y,QQ.y] from FUNCT_2:sch 1(A14);
A21:  SF c= rng QQ
      proof
        let y be object;
        k1 in {k1} by TARSKI:def 1;
        then
A22:    k1 in Xx by XBOOLE_0:def 3;
        assume
A23:    y in SF;
        then consider h be Function of Xx,Y such that
A24:    y=h and
A25:    h|X=H by A13;
        dom h=Xx by A1,FUNCT_2:def 1;
        then
A26:    h.k1 in rng h by A22,FUNCT_1:def 3;
A27:    rng h c= Y by RELAT_1:def 19;
        dom QQ=YY by A23,FUNCT_2:def 1;
        then QQ.(h.k1) in rng QQ by A26,A27,FUNCT_1:def 3;
        hence thesis by A20,A24,A25,A26,A27;
      end;
      rng QQ c= SF by RELAT_1:def 19;
      then
A28:  rng QQ=SF by A21;
      Y\/{n}=Y by A1,FINSEQ_1:3,ZFMISC_1:40;
      then consider h be Function of Xx,Y such that
A29:  h|X=H and
      h.k1=n by A11,STIRL2_1:57;
A30:  SF c= FUNC19 by FINSUB_1:def 5;
      k<=n by A4,A8,XXREAL_0:2;
      then consider Mh be Matrix of n,K such that
A31:  Mh = AB +* ((B*(I +* H)) | Seg k) and
A32:  for j holds (j in Seg k implies Mh.j=B.(H.j))& (not j in Seg k
      implies Mh.j=AB.j) by A1,Th59;
      consider Path be FinSequence of K such that
A33:  len Path=k and
A34:  for Hj,j be Nat st j in Seg k & Hj=H.j holds Path.j=A*(j,Hj) and
A35:  P.H= mm $$ Path * Det Mh by A9,A31,A32;
A36:  Mh.k1=AB.k1 by A11,A32;
      h in SF by A13,A29;
      then reconsider QQ as Function of YY,FUNC19 by A28,A30,FUNCT_2:6;
A37:  dom (P19*QQ)=Y by FUNCT_2:def 1;
A38:  QQ.:dom QQ= SF by A28,RELAT_1:113;
      1+0<=k1 by XREAL_1:7;
      then
A39:  k1 in Seg n by A4;
      then
A40:  AB.k1=Line(AB,k1) by MATRIX_0:52;
      Mh.k1=Line(Mh,k1) by A39,MATRIX_0:52;
      then Mh=RLine(Mh,k1,Line(AB,k1)) by A36,A40,Th30;
      then consider SUM1 be FinSequence of KK such that
A41:  len SUM1 = n and
A42:  Det Mh = aa"**" SUM1 and
A43:  for j st j in Y holds SUM1.j= A*(k1,j)*Det RLine(Mh,k1,Line(B,j
      )) by A39,Th56;
A44:  dom id Y=Y;
      set PA=mm "**" Path;
      set PS=PA*SUM1;
      len PS=n by A41,Lm5;
      then
A45:  dom PS=Y by FINSEQ_1:def 3;
      set PSaa=[#](PS,the_unity_wrt aa);
A46:  for j be Nat st j in Y holds (P19*QQ).j=PA*(A*(k1,j))* Det RLine(Mh
      ,k1,Line(B,j))
      proof
A47:    width B=n by MATRIX_0:24;
A48:    len Mh=n by MATRIX_0:24;
A49:    dom (P19*QQ)=Y by FUNCT_2:def 1;
A50:    width Mh=n by MATRIX_0:24;
        let j be Nat such that
A51:    j in Y;
        Y\/{j}=Y by A51,ZFMISC_1:40;
        then consider hj be Function of Xx,Y such that
A52:    hj|X=H and
A53:    hj.k1=j by A11,STIRL2_1:57;
        set L=Line(B,j);
        set R=RLine(Mh,k1,L);
        Xx=Seg k1 by FINSEQ_1:9;
        then reconsider hj9=hj as Function of Seg k1,Y;
        consider Mhj be Matrix of n,K such that
A54:    Mhj = AB +* ((B*(I +* hj9)) | Seg k1) and
A55:    for i holds (i in Seg k1 implies Mhj.i=B.(hj9.i))& (not i in
        Seg k1 implies Mhj.i=AB.i) by A4,Th59;
A56:    len Mhj=n by MATRIX_0:24;
A57:    len L=width B by MATRIX_0:def 7;
A58:    now
A59:      k+0 < k1 by XREAL_1:8;
          let i be Nat such that
A60:      1 <=i and
A61:      i <= len Mhj;
A62:      i in Seg n by A56,A60,A61;
          per cases;
          suppose
A63:        i <=k;
            then i<=k1 by A59,XXREAL_0:2;
            then
A64:        i in Seg k1 by A60;
A65:        Line(R,i)=R.i by A62,MATRIX_0:52;
A66:        i in X by A60,A63;
            then
A67:        Mh.i=B.(H.i) by A32;
            dom H=X by A56,A60,A61,FUNCT_2:def 1;
            then
A68:        H.i=hj.i by A52,A66,FUNCT_1:47;
A69:        Line(Mh,i)=Mh.i by A62,MATRIX_0:52;
            Line(R,i)=Line(Mh,i) by A62,A59,A63,Th28;
            hence Mhj.i=R.i by A55,A65,A69,A67,A68,A64;
          end;
          suppose
A70:        i>k & i<=k1;
A71:        k1 in Seg k1 by FINSEQ_1:4;
A72:        L=B.j by A51,MATRIX_0:52;
A73:        R.i=Line(R,i) by A62,MATRIX_0:52;
A74:        i=k1 by A70,NAT_1:9;
            then L=Line(R,i) by A57,A47,A50,A62,Th28;
            hence Mhj.i=R.i by A53,A55,A74,A71,A73,A72;
          end;
          suppose
A75:        i>k & i>k1;
            then not i in Seg k1 by FINSEQ_1:1;
            then
A76:        Mhj.i=AB.i by A55;
A77:        Line(R,i)=R.i by A62,MATRIX_0:52;
A78:        not i in X by A75,FINSEQ_1:1;
A79:        Line(Mh,i)=Mh.i by A62,MATRIX_0:52;
            Line(R,i)=Line(Mh,i) by A62,A75,Th28;
            hence Mhj.i=R.i by A32,A77,A79,A78,A76;
          end;
        end;
        len R=len Mh by Lm4;
        then R=Mhj by A48,A56,A58;
        then consider Pathj be FinSequence of K such that
A80:    len Pathj=k1 and
A81:    for m,j be Nat st j in Seg k1 & m=hj.j holds Pathj.j=A*(j,m) and
A82:    P1.hj= (mm "**" Pathj) * Det R by A6,A54,A55;
A83:    Pathj.k1=A*(k1,j) by A53,A81,FINSEQ_1:4;
A84:    now
A85:      rng H c= Y by RELAT_1:def 19;
A86:      X=dom H by A51,FUNCT_2:def 1;
          let i be Nat such that
A87:      1 <=i and
A88:      i <= len Path;
A89:      (Pathj|k).i=Pathj.i by A33,A88,FINSEQ_3:112;
A90:      i in X by A33,A87,A88;
          then H.i in rng H by A86,FUNCT_1:def 3;
          then H.i in Y by A85;
          then reconsider Hi=H.i as Nat;
          i<=k1 by A8,A33,A88,XXREAL_0:2;
          then
A91:      i in Seg k1 by A87;
          i in X by A33,A87,A88;
          then
A92:      Path.i=A*(i,Hi) by A34;
          H.i=hj.i by A52,A90,A86,FUNCT_1:47;
          hence Path.i=(Pathj|X).i by A81,A91,A92,A89;
        end;
        len (Pathj|k)=k by A8,A80,FINSEQ_1:59;
        then Pathj=Path^<*Pathj.k1*> by A33,A80,A84,FINSEQ_1:14,FINSEQ_3:55;
        then
A93:    mm "**" Pathj = PA*(A*(k1,j)) by A83,FINSOP_1:4;
        QQ.j=hj by A20,A51,A52,A53;
        hence thesis by A51,A82,A49,A93,FUNCT_1:12;
      end;
      now
        let y being object such that
A94:    y in dom PS;
        reconsider j=y as Nat by A94;
        SUM1.j = A*(k1,j)*Det RLine(Mh,k1,Line(B,j)) by A43,A45,A94;
        hence PS.y =PA*(A*(k1,j)*Det RLine(Mh,k1,Line(B,j))) by A94,FVSUM_1:50
          .=PA*(A*(k1,j))*Det RLine(Mh,k1,Line(B,j)) by GROUP_1:def 3
          .=(P19*QQ).y by A46,A45,A94;
      end;
      then PS=P19*QQ by A37,A45,FUNCT_1:2;
      then
A95:  PSaa| (dom PS)=(P19*QQ) by SETWOP_2:21;
      now
        let x1,x2 be object such that
A96:    x1 in Y and
A97:    x2 in Y and
A98:   QQ.x1 = QQ.x2;
        Y\/{x2}=Y by A97,ZFMISC_1:40;
        then
A99:   ex h2 be Function of Xx,Y st h2|X=H & h2.k1=x2 by A11,STIRL2_1:57;
        Y\/{x1}=Y by A96,ZFMISC_1:40;
        then consider h1 be Function of Xx,Y such that
A100:   h1|X=H and
A101:   h1.k1=x1 by A11,STIRL2_1:57;
        QQ.x1=h1 by A20,A96,A100,A101;
        hence x1=x2 by A20,A97,A98,A101,A99;
      end;
      then
A102: QQ is one-to-one by FUNCT_2:19;
      reconsider Y9=Y as Element of Fin YY by FINSUB_1:def 5;
A103: dom QQ=Y9 by FUNCT_2:def 1;
A104: rng id Y =Y;
      (P19*QQ)*(id Y)=P19*QQ by A37,RELAT_1:52;
      then aa $$ (Y9,P19*QQ) = aa $$(findom PS,PSaa) by A45,A44,A104,A95,
SETWOP_2:5
        .= Sum(PS) by FVSUM_1:8,SETWOP_2:def 2
        .= PA*Sum(SUM1) by FVSUM_1:73
        .= P.H by A35,A42;
      hence thesis by A102,A38,A103,SETWOP_2:6;
    end;
    aa is having_a_unity by FVSUM_1:8;
    then Det AB=aa $$(In(FUNC19,Fin FUNC19),P19) by A1,A10,A11,A12,Th58;
    hence thesis by A6,A7;
  end;
  set FUN=Funcs(Seg n,Seg n);
A105: P[0]
  proof
    reconsider E={} as Function of Seg 0,Seg n by XBOOLE_1:2;
    assume 0<=n;
A106: the_unity_wrt mm=1_K by GROUP_1:22;
    let FUNC be non empty set such that
A107: FUNC=Funcs(Seg 0,Seg n);
    consider P be Function of FUNC,KK such that
A108: FF[P,0] by A1,A107,Lm10;
A109: FUNC={E} by A107,FUNCT_5:57;
    then
A110: E in FUNC by TARSKI:def 1;
    FUNC is finite by A109; then
    FUNC in Fin FUNC by FINSUB_1:def 5; then
    In(FUNC,Fin FUNC)={E} by SUBSET_1:def 8,A109;
    then
A111: aa $$ (In(FUNC,Fin FUNC),P)=P.E by A110,SETWISEO:17;
    consider M be Matrix of n,K such that
A112: M = AB +* ((B*(I +* E)) | (Seg 0 qua set)) and
A113: for j holds (j in Seg 0 implies M.j=B.(E.j))& (not j in Seg 0
    implies M.j=AB.j)by A1,Th59;
A114: M=AB +* {} by A112;
    consider Path be FinSequence of K such that
A115: len Path=0 and
    for Fj,j be Nat st j in Seg 0 & Fj=E.j holds Path.j=A*(j,Fj) and
A116: P.E= mm $$ Path * Det M by A108,A112,A113;
    Path=<*>KK by A115;
    then mm "**" Path= 1_K by A106,FINSOP_1:10;
    then P.E=Det AB by A116,A114;
    hence thesis by A108,A111;
  end;
  for k be Nat holds P[k] from NAT_1:sch 2(A105,A2);
  then consider P be Function of FUN,KK such that
A117: FF[P,n] and
A118: Det(AB) = aa $$ (In(FUN,Fin FUN),P);
  take P;
  thus for F be Function of Seg n,Seg n ex Path be FinSequence of K st len
Path=n & (for Fj,j be Nat st j in Seg n & Fj=F.j holds Path.j=A*(j,Fj)) & P.F=
  (the multF of K) $$ Path * Det (B*F)
  proof
    len AB=n by MATRIX_0:24;
    then
A119: dom AB=Seg n by FINSEQ_1:def 3;
    let F be Function of Seg n,Seg n;
A120: dom I=Seg n;
    dom F=Seg n by FUNCT_2:52;
    then
A121: I+*F=F by A120,FUNCT_4:19;
A122: len B=n by MATRIX_0:24;
 len (B*F)=len B by Def4;
    then
A123: dom (B*F)=Seg n by A122,FINSEQ_1:def 3;
    consider M be Matrix of n,K such that
A124: M = AB +* ((B*(I +* F)) | Seg n) and
A125: for j holds (j in Seg n implies M.j=B.(F.j))& (not j in Seg n
    implies M.j=AB.j)by A1,Th59;
    M=B*F by A124,A121,A123,A119,FUNCT_4:19;
    hence thesis by A117,A124,A125;
  end;
  thus thesis by A118;
end;
