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
  for R be Element of Permutations(n) st R=Rev idseq n holds R is even
  iff (n choose 2) mod 2 = 0
proof
  let r be Element of Permutations(n) such that
A1: r=Rev idseq n;
  per cases;
  suppose
A2: n<2;
    then
 n=0 or n=1 by NAT_1:23;
    then n*(n-1)/2=0;
    then n choose 2=0 by STIRL2_1:51;
    hence thesis by A2,LAPLACE:11,NAT_D:26;
  end;
  suppose
A3: n>=2;
    set CH=n choose 2;
    reconsider n2=n-2 as Nat by A3,NAT_1:21;
    reconsider R=r as Element of Permutations(n2+2);
    set K = the Fanoian Field;
    set S=2Set Seg (n2+2);
    S in Fin S by FINSUB_1:def 5; then
A4: In(S,Fin S)=S by SUBSET_1:def 8;
    idseq (n2+2) is Element of Group_of_Perm(n2+2) by MATRIX_1:11;
    then reconsider I=idseq (n2+2) as Element of Permutations(n2+2) by
MATRIX_1:def 13;
    set D={s where s is Element of S:s in S & Part_sgn(I,K).s <> Part_sgn(R,K)
    .s};
A5: D c= S
    proof
      let x be object;
      assume x in D;
      then
      ex s be Element of S st x=s & s in S & Part_sgn(I,K).s <> Part_sgn(
      R,K).s;
      hence thesis;
    end;
    then reconsider D as finite set;
    S c= D
    proof
      let x be object;
      assume x in S;
      then reconsider s=x as Element of S;
      consider i,j such that
A6:   i in Seg (n2+2) and
A7:   j in Seg (n2+2) and
A8:   i < j and
A9:  s={i,j} by MATRIX11:1;
A10:  I.j=j by A7,FUNCT_1:17;
      reconsider i9=i,j9=j,n29=n2 as Element of NAT by ORDINAL1:def 12;
A11:  j9<=n2+2 by A7,FINSEQ_1:1;
      i9<=n29+2 by A6,FINSEQ_1:1;
      then reconsider ni=(n29+2)-i9+1,nj=(n29+2)-j9+1 as Element of NAT by A11,
FINSEQ_5:1;
      ni in Seg (n2+2) by A6,FINSEQ_5:2;
      then
A12:  I.ni=ni by FUNCT_1:17;
A13:  len idseq (n2+2)=n29+2 by CARD_1:def 7;
      i in dom I by A6;
      then
A14:  R.i9=I.ni by A1,A13,FINSEQ_5:58;
      j in dom I by A7;
      then
A15:  R.j9=I.nj by A1,A13,FINSEQ_5:58;
      nj in Seg (n2+2) by A7,FINSEQ_5:2;
      then
A16:  I.nj=nj by FUNCT_1:17;
      I.i=i by A6,FUNCT_1:17;
      then
A17:  Part_sgn(I,K).s=1_K by A6,A7,A8,A9,A10,MATRIX11:def 1;
      (n29+2)+1-i9 > (n29+2)+1-j9 by A8,XREAL_1:15;
      then Part_sgn(R,K).s=-1_K by A6,A7,A8,A9,A14,A15,A12,A16,MATRIX11:def 1;
      then Part_sgn(I,K).s <> Part_sgn(R,K).s by A17,MATRIX11:22;
      hence thesis;
    end;
    then
A18: S=D by A5,XBOOLE_0:def 10;
A19: card S=n choose 2 by Th10;
    per cases by NAT_D:12;
    suppose
A20:  CH mod 2=0;
A21:  sgn (I,K)=1_K by MATRIX11:12;
      sgn(I,K)= sgn(R,K) by A18,A4,A19,A20,MATRIX11:7;
      hence thesis by A20,A21,MATRIX11:23;
    end;
    suppose
A22:  CH mod 2=1;
A23:  sgn (I,K)=1_K by MATRIX11:12;
      sgn(R,K)= -sgn(I,K) by A18,A4,A19,A22,MATRIX11:7;
      hence thesis by A22,A23,MATRIX11:23;
    end;
  end;
end;
