reserve k,n,i,j for Nat;

theorem
  for n being Nat, K being commutative Ring, A being Matrix of n,K st n
  >=1 holds Det (A) = Det (A@)
proof
  let n be Nat, K be commutative Ring, A be Matrix of n,K;
  set f=Path_product(A);
  set f2=Path_product(A@);
  set F=(the addF of K);
  set Y=the carrier of K;
  set X=Permutations(n);
  set B=In(X,Fin X);
  set I=(the addF of K) $$ (B,Path_product(A@));
A1: Det A = (the addF of K) $$ (B,Path_product A) by
MATRIX_3:def 9;
    X in Fin X by FINSUB_1:def 5; then
A2: B=Permutations(n) by SUBSET_1:def 8;
A3: {p" where p is Permutation of Seg n : p in B} c= B
  proof
    let z be object;
    assume z in {p" where p is Permutation of Seg n : p in B};
    then ex p being Permutation of Seg n st z=p" & p in B;
    hence thesis by A2,MATRIX_1:def 12;
  end;
A4: B c= {p" where p is Permutation of Seg n : p in B}
  proof
    let z be object;
    assume z in B;
    then reconsider q2=z as Permutation of Seg n by A2,MATRIX_1:def 12;
    set q3=q2";
    q3"=q2 & q3 in B by A2,FUNCT_1:43,MATRIX_1:def 12;
    hence thesis;
  end;
  X in Fin X by FINSUB_1:def 5; then
A5: B <> {} or F is having_a_unity by SUBSET_1:def 8;
  then consider G0 being Function of Fin X, Y such that
A6: I = G0.B and
A7: for e being Element of Y st e is_a_unity_wrt F holds G0.{} = e and
A8: for x being Element of X holds G0.{x} = f2.x and
A9: for B9 being Element of Fin X st B9 c= B & B9 <> {} for x being
  Element of X st x in B \ B9 holds G0.(B9 \/ {x}) = F.(G0.B9,f2.x) by
SETWISEO:def 3;
  deffunc F8(set) = G0.{p" where p is Permutation of Seg n : p in $1};
A10: for x2 being set st x2 in Fin X holds F8(x2) in Y
  proof
    let x2 be set;
    assume x2 in Fin X;
    {p" where p is Permutation of Seg n : p in x2} c= X
    proof
      let r be object;
      assume r in {p" where p is Permutation of Seg n : p in x2};
      then ex p being Permutation of Seg n st r=p" & p in x2;
      hence thesis by MATRIX_1:def 12;
    end;
    then {p" where p is Permutation of Seg n : p in x2} is Element of Fin X
    by FINSUB_1:17;
    hence thesis by FUNCT_2:5;
  end;
  consider G1 being Function of Fin X,Y such that
A11: for x5 being set st x5 in Fin X holds G1.x5 = F8(x5) from FUNCT_2:
  sch 11(A10);
  assume
A12: n>=1;
A13: for x being Element of X holds G1.{x} = f.x
  proof
    let x be Element of X;
    reconsider B4={.x.} as Element of Fin X;
    reconsider q=x as Permutation of Seg n by MATRIX_1:def 12;
A14: q" is Element of X by MATRIX_1:def 12;
A15: {p" where p is Permutation of Seg n : p in B4} c= {q"}
    proof
      let z be object;
      assume z in {p" where p is Permutation of Seg n : p in B4};
      then consider p being Permutation of Seg n such that
A16:  z=p" and
A17:  p in B4;
      p=x by A17,TARSKI:def 1;
      hence thesis by A16,TARSKI:def 1;
    end;
    {q"} c= {p" where p is Permutation of Seg n : p in B4}
    proof
      let z be object;
      assume z in {q"};
      then q in B4 & z=q" by TARSKI:def 1;
      hence thesis;
    end;
    then {p" where p is Permutation of Seg n : p in B4}={q"} by A15;
    then G1.B4=G0.{q"} by A11
      .=f2.(q") by A8,A14
      .=(Path_product A).q by A12,Th35;
    hence thesis;
  end;
A18: for B9 being Element of Fin X st B9 c= B & B9 <> {} for x being Element
  of X st x in B \ B9 holds G1.(B9 \/ {x}) = F.(G1.B9,f.x)
  proof
    let B9 be Element of Fin X;
    assume that
A19: B9 c= B and
A20: B9 <> {};
    thus for x being Element of X st x in B \ B9 holds G1.(B9 \/ {x}) = F.(G1.
    B9,f.x)
    proof
      {p" where p is Permutation of Seg n : p in B9} c= X
      proof
        let v be object;
        assume v in {p" where p is Permutation of Seg n : p in B9};
        then ex p being Permutation of Seg n st p"=v & p in B9;
        hence thesis by MATRIX_1:def 12;
      end;
      then reconsider
      B2={p" where p is Permutation of Seg n : p in B9} as Element
      of Fin X by FINSUB_1:17;
      set d = the Element of B9;
      let x be Element of X;
      reconsider px=x as Permutation of Seg n by MATRIX_1:def 12;
      reconsider y=px" as Element of X by MATRIX_1:def 12;
A21:  B2 \/ {y} c={p" where p is Permutation of Seg n : p in B9 \/ {x}}
      proof
        let z be object;
        assume z in B2 \/ {y};
        then
A22:    z in B2 or z in {y} by XBOOLE_0:def 3;
        now
          per cases by A22,TARSKI:def 1;
          case
            z in B2;
            then consider p being Permutation of Seg n such that
A23:        z=p" and
A24:        p in B9;
            p in B9 \/ {x} by A24,XBOOLE_0:def 3;
            hence thesis by A23;
          end;
          case
A25:        z=y;
            px in {x} by TARSKI:def 1;
            then px in B9 \/ {x} by XBOOLE_0:def 3;
            hence thesis by A25;
          end;
        end;
        hence thesis;
      end;
A26:  B2 c= B
      proof
        let u be object;
        assume u in B2;
        then ex p being Permutation of Seg n st p"=u & p in B9;
        hence thesis by A2,MATRIX_1:def 12;
      end;
      assume x in B \ B9;
      then
A27:  not x in B9 by XBOOLE_0:def 5;
      now
        assume y in B2;
        then consider pp being Permutation of Seg n such that
A28:    y=pp" and
A29:    pp in B9;
        px=(pp")" by A28,FUNCT_1:43;
        hence contradiction by A27,A29,FUNCT_1:43;
      end;
      then
A30:  y in B\B2 by A2,XBOOLE_0:def 5;
      d in B by A19,A20;
      then reconsider pd=d as Permutation of Seg n by A2,MATRIX_1:def 12;
A31:  pd" in B2 by A20;
A32:  G1.(B9 \/ {.x.})= G0.{p" where p is Permutation of Seg n : p in B9
      \/ {x}} & G0.B2=G1.B9 by A11;
      {p" where p is Permutation of Seg n : p in B9 \/ {x}} c= B2 \/ {y}
      proof
        let z be object;
        assume z in {p" where p is Permutation of Seg n : p in B9 \/ {x}};
        then consider p being Permutation of Seg n such that
A33:    z=p" and
A34:    p in B9 \/ {x};
        now
          per cases by A34,XBOOLE_0:def 3;
          case
            p in B9;
            hence z in B2 or z in {y} by A33;
          end;
          case
            p in {x};
            then p=x by TARSKI:def 1;
            hence z in B2 or z in {y} by A33,TARSKI:def 1;
          end;
        end;
        hence thesis by XBOOLE_0:def 3;
      end;
      then
      B2 \/ {y} ={p" where p is Permutation of Seg n : p in B9 \/ {x}} by A21;
      then
      G0.{p" where p is Permutation of Seg n : p in B9 \/ {x}} = F.(G0.B2
      ,f2.y) by A9,A26,A31,A30;
      hence thesis by A12,A32,Th35;
    end;
  end;
A35: for e being Element of Y st e is_a_unity_wrt F holds G1.{} = e
  proof
    {} is Subset of X by SUBSET_1:1;
    then reconsider B3={} as Element of Fin X by FINSUB_1:17;
    let e be Element of Y;
    {p" where p is Permutation of Seg n : p in B3} c= {}
    proof
      let s be object;
      assume s in {p" where p is Permutation of Seg n : p in B3};
      then ex p being Permutation of Seg n st s=p" & p in B3;
      hence thesis;
    end;
    then
A36: {p" where p is Permutation of Seg n : p in B3}= {};
    assume e is_a_unity_wrt F;
    then G0.{p" where p is Permutation of Seg n : p in B3}=e by A7,A36;
    hence thesis by A11;
  end;
  G1.B =G0.{p" where p is Permutation of Seg n : p in B} by A11;
  then I=G1.B by A6,A3,A4,XBOOLE_0:def 10;
  then
  (the addF of K) $$ (In(Permutations n,Fin Permutations n),
Path_product A) =(the addF
  of K) $$ (In(Permutations n,Fin Permutations n),
Path_product(A@)) by A5,A35,A13,A18,SETWISEO:def 3;
  hence thesis by A1,MATRIX_3:def 9;
end;
