reserve x,y for object,
  N for Element of NAT,
  c,i,j,k,m,n for Nat,
  D for non empty set,
  s for Element of 2Set Seg (n+2),
  p for Element of Permutations(n) ,
  p1, q1 for Element of Permutations(n+1),
  p2 for Element of Permutations(n +2),
  K for Field,
  a for Element of K,
  f for FinSequence of K,
  A for (Matrix of K),
  AD for Matrix of n,m,D,
  pD for FinSequence of D,
  M for Matrix of n,K;

theorem Th23:
  for i,j st i in Seg n & j in Seg n for P be Element of Fin
Permutations n st P = {p:p.i = j} for M be Matrix of n,K holds (the addF of K)
  $$ (P,Path_product(M)) = M*(i,j)*Cofactor(M,i,j)
proof
  let i,j be Nat such that
A1: i in Seg n and
A2: j in Seg n;
  n>0 by A1;
  then reconsider n9=n-1 as Element of NAT by NAT_1:20;
  set P=Permutations (n-'1);
  set n91=n9+1;
  set P1=Permutations n;
A3: n91-'1=n9+1-1 by XREAL_0:def 2;
  set aa=the addF of K;
  P in Fin P by FINSUB_1:def 5; then
A4: In(P,Fin P)=P by SUBSET_1:def 8;
  let PP be Element of Fin P1 such that
A5: PP={p:p.i=j};
  consider Proj be Function of PP,P such that
A6: Proj is bijective and
A7: for q be Element of Permutations n91 st q.i=j holds Proj.q = Rem(q,i
  ) by A1,A2,A5,A3,Th20;
  let M be Matrix of n,K;
  set DM=Delete(M,i,j);
  set PathM=Path_product(M);
  set PathDM=Path_product(DM);
  set pm=power(K).(-1_K,i+j)*(M*(i,j));
  defpred P[set] means for D be Element of Fin P1,ProjD be Element of Fin P st
D=$1 & ProjD=Proj.:D & D c= PP holds aa $$ (D,PathM) = pm * aa $$ (ProjD,PathDM
  );
A8: for B9 be (Element of Fin P1), b be Element of P1 holds P[B9] & not b
  in B9 implies P[B9 \/ {b}]
  proof
    let B9 be (Element of Fin P1), b be Element of P1 such that
A9: P[B9] and
A10: not b in B9;
A11: b in {b} by TARSKI:def 1;
A12: rng Proj=P by A6,FUNCT_2:def 3;
    then Proj.:B9 c= P by RELAT_1:111;
    then reconsider ProjB9=Proj.:B9 as Element of Fin P by FINSUB_1:def 5;
    let D be Element of Fin P1,ProjD be Element of Fin P such that
A13: D=B9\/{b} and
A14: ProjD=Proj.:D and
A15: D c= PP;
A16: B9 c= D by A13,XBOOLE_1:7;
    B9 c= D by A13,XBOOLE_1:7;
    then
A17: B9 c= PP by A15;
    {b}c=D by A13,XBOOLE_1:7;
    then
A18: b in PP by A15,A11;
    then consider Q1 be Element of P1 such that
A19: Q1=b and
A20: Q1.i=j by A5;
A21: dom Proj = PP by FUNCT_2:def 1;
    then
A22: Im(Proj,b)={Proj.b} by A18,FUNCT_1:59;
    reconsider Q=Proj.b as Element of P by A18,A21,A12,FUNCT_1:def 3;
A23: Proj.b in rng Proj by A18,A21,FUNCT_1:def 3;
    reconsider Q19=Q1 as Element of Permutations (n9+1);
A24: Rem(Q19,i)=Q by A7,A19,A20;
    then
A25: PathM.Q1=pm*PathDM.Q by A1,A3,A20,Th22;
A26: not Q in ProjB9
    proof
      assume Q in ProjB9;
      then ex x being object st x in dom Proj & x in B9 & Proj.x=Q
by FUNCT_1:def 6;
      hence thesis by A6,A10,A18,A21,FUNCT_1:def 4;
    end;
    per cases;
    suppose
A27:  B9={};
      then
A28:  aa $$ (D,PathM)=PathM.b by A13,SETWISEO:17;
      aa $$ (ProjD,PathDM)=PathDM.(Proj.b) by A13,A14,A22,A23,A12,A27,
SETWISEO:17;
      hence thesis by A1,A3,A19,A20,A24,A28,Th22;
    end;
    suppose
A29:  B9<>{};
      ProjD=ProjB9\/{Q} by A13,A14,A22,RELAT_1:120;
      hence pm *aa $$ (ProjD,PathDM) = pm*(aa $$(ProjB9,PathDM)+PathDM.Q) by
A18,A17,A21,A26,A29,SETWOP_2:2
        .= (pm * aa $$ (ProjB9,PathDM))+(pm * PathDM.Q) by VECTSP_1:def 2
        .= aa.(aa $$ (B9,PathM),PathM.b) by A9,A15,A19,A16,A25,XBOOLE_1:1
        .= aa $$ (D,PathM) by A10,A13,A29,SETWOP_2:2;
    end;
  end;
A30: P[{}.P1]
  proof
    let B be Element of Fin P1,ProjB be Element of Fin P such that
A31: B = {}.P1 and
A32: ProjB = Proj.:B and
    B c= PP;
    ProjB={}.P by A31,A32;
    then
A33: aa $$ (ProjB,PathDM)=the_unity_wrt aa by FVSUM_1:8,SETWISEO:31;
A34: the_unity_wrt aa=0.K by FVSUM_1:7;
    aa $$ (B,PathM)=the_unity_wrt aa by A31,FVSUM_1:8,SETWISEO:31;
    hence thesis by A33,A34;
  end;
A35: for B being Element of Fin P1 holds P[B] from SETWISEO:sch 2(A30,A8 );
A36: dom Proj=PP by FUNCT_2:def 1;
  rng Proj=P by A6,FUNCT_2:def 3;
  then Proj.:PP=In(P,Fin P) by A4,A36,RELAT_1:113;
  hence aa $$ (PP,PathM) = M*(i,j) * power(K).(-1_K,i+j)* Det (Delete(M,i,j))
  by A35
    .= M*(i,j) * Cofactor(M,i,j) by GROUP_1:def 3;
end;
