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 Th56:
  for A,B,C be (Matrix of n,K), i st i in Seg n ex P be
  FinSequence of K st len P = n & Det RLine(C,i,Line(A*B,i)) = (the addF of K)
  "**" P & for j st j in Seg n holds P.j = A*(i,j) * Det RLine(C,i,Line(B,j))
proof
  let A,B,C be (Matrix of n,K), i such that
A1: i in Seg n;
 Seg n <> {} by A1;
   then
A2: n <> 0;
  set a=addFinS(K);
A3: len B=n by MATRIX_0:24;
  deffunc F(Nat)=A*(i,$1) * Det RLine(C,i,Line(B,$1));
  set aa=the addF of K;
  set KK=the carrier of K;
A4: len A=n by MATRIX_0:24;
  consider D be FinSequence of KK such that
A5: len D = len A and
A6: for j be Nat st j in dom D holds D.j = F(j) from FINSEQ_2:sch 1;
A7: n<>0 by A1;
  then len D >= 1 by A4,A5,NAT_1:14;
  then consider Fd be sequence of KK such that
A8: Fd.1 = D.1 and
A9: for k be Nat st 0 <> k & k < n holds Fd.(k+1) = aa.(Fd.k,D.(k+1)) and
A10: aa"**"D = Fd.n by A4,A5,FINSOP_1:def 1;
A11: dom D = Seg len A by A5,FINSEQ_1:def 3;
  width A=n by MATRIX_0:24;
  then consider P be FinSequence of KK* such that
A12: len P = n and
A13: Line(A*B,i) = a "**" P and
A14: for j st j in Seg len B holds P.j = A*(i,j) * Line(B,j) by A1,A7,A3,A4
,Th55;
  len P >= 1 by A12,A2,NAT_1:14;
  then consider Fp be sequence of KK* such that
A15: Fp.1 = P.1 and
A16: for k be Nat st 0 <> k & k < n holds Fp.(k+1) = a.(Fp.k,P.(k+1)) and
A17: Line(A*B,i) = Fp.n by A12,A13,FINSOP_1:def 1;
  defpred P[Nat] means 1 <= $1 & $1<= n implies for pK
    being FinSequence of K st pK=Fp.$1 holds len
  pK=n & Fd.$1=Det RLine(C,i,pK);
A18: width B=n by MATRIX_0:24;
A19: for k be Nat st P[k] holds P[k+1]
  proof
    let k be Nat such that
A20: P[k];
    set k1=k+1;
    set A9=A*(i,k1);
    set L=Line(B,k1);
    assume that
A21: 1 <= k1 and
A22: k1 <= n;
A23: k1 in Seg n by A21,A22;
    let Fpk1 be FinSequence of KK such that
A24: Fpk1=Fp.k1;
    per cases;
    suppose
A25:  k=0;
A26:  P.k1=A9*L by A3,A14,A23;
A27:  len L = n by A18,MATRIX_0:def 7;
      D.k1=F(1) by A4,A6,A11,A23,A25;
      hence thesis by A1,A15,A8,A24,A25,A26,A27,Lm5,Th34;
    end;
    suppose
A28:  k>0;
      k1 in dom P by A12,A23,FINSEQ_1:def 3;
      then
A29:  P.k1 in rng P by FUNCT_1:def 3;
      rng P c= KK* by FINSEQ_1:def 4;
      then reconsider Pk1=P.k1,Fpk=Fp.k as Element of KK*
      by A29,FINSEQ_1:def 11;
A30:  k+0<k1 by XREAL_1:8;
      then
A31:  Fd.k=Det RLine(C,i,Fpk) by A20,A22,A28,NAT_1:14,XXREAL_0:2;
A32:  len Fpk=n by A20,A22,A28,A30,NAT_1:14,XXREAL_0:2;
A33:  k<n by A22,A30,XXREAL_0:2;
      then
A34:  Fd.k1 = aa.(Fd.k,D.k1) by A9,A28;
A35:  P.k1=A9 * L by A3,A14,A23;
      Fpk1 = a.(Fpk,Pk1) by A16,A24,A28,A33;
      then
A36:  Fpk1=Fpk+(A9*L) by A35,Def5;
A37:  len L=n by A18,MATRIX_0:def 7;
      then
A38:  len (A9*L)=n by Lm5;
      Det RLine(C,i,A9*L)=A9* Det RLine(C,i,L) by A1,A37,Th34;
      then
      Det RLine(C,i,Fpk1)=Det RLine(C,i,Fpk) + A9*Det RLine(C,i,L) by A1,A32
,A36,A38,Th36;
      hence thesis by A4,A6,A11,A23,A31,A34,A32,A36,A38,Lm6;
    end;
  end;
  take D;
  thus len D=n by A5,MATRIX_0:24;
A39: P[0];
  for k be Nat holds P[k] from NAT_1:sch 2(A39,A19);
  then P[len P];
  hence thesis by A4,A12,A6,A11,A17,A10,A2,NAT_1:14;
end;
