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 Th9:
  for X be finite set, n holds card {Y where Y is Subset of X: card
  Y = n} = card X choose n
proof
  let X be finite set, n;
  reconsider N=n as Element of NAT by ORDINAL1:def 12;
  set YY={Y where Y is Subset of X: card Y=n};
  set CH=Choose(X,N,1,0);
  deffunc F(set)=(X-->0)+*($1-->1);
  consider f be Function such that
A1: dom f = YY & for x being set st x in YY holds f.x = F(x)
     from FUNCT_1:sch 5;
A2: CH c= rng f
  proof
    let y be object;
A3: dom (X-->0)= X;
    assume y in CH;
    then consider g be Function of X,{0,1} such that
A4: g = y and
A5: card (g"{1})=n by CARD_FIN:def 1;
    X=dom g by FUNCT_2:def 1;
    then reconsider Y=g"{1} as Subset of X by RELAT_1:132;
A6: Y in YY by A5;
A7: now
      let x being object such that
A8:   x in dom g;
      now
        per cases;
        suppose
A9:       x in Y;
          then g.x in {1} by FUNCT_1:def 7;
          then
A10:      g.x=1 by TARSKI:def 1;
A11:      (Y-->1).x=1 by A9,FUNCOP_1:7;
          x in dom (Y-->1) by A9;
          hence g.x=F(Y).x by A11,A10,FUNCT_4:13;
        end;
        suppose
A12:      not x in Y;
          then not g.x in {1} by A8,FUNCT_1:def 7;
          then
A13:      g.x<> 1 by TARSKI:def 1;
A14:      rng g c= {0,1} by RELAT_1:def 19;
A15:      (X-->0).x=0 by A8,FUNCOP_1:7;
A16:      dom (Y-->1)=Y;
          g.x in rng g by A8,FUNCT_1:def 3;
          then g.x=0 by A14,A13,TARSKI:def 2;
          hence g.x=F(Y).x by A12,A15,A16,FUNCT_4:11;
        end;
      end;
      hence g.x=F(Y).x;
    end;
    dom (Y-->1)= Y;
    then
A17: dom F(Y) = X\/Y by A3,FUNCT_4:def 1
      .= X by XBOOLE_1:12;
    dom g=X by FUNCT_2:def 1;
    then F(Y)=g by A17,A7;
    then f.Y=g by A1,A6;
    hence thesis by A1,A4,A6,FUNCT_1:def 3;
  end;
  for x1,x2 be object st x1 in dom f & x2 in dom f & f.x1 = f.x2 holds x1 = x2
  proof
    let x1,x2 be object such that
A18: x1 in dom f and
A19: x2 in dom f and
A20: f.x1 = f.x2;
    consider Y2 be Subset of X such that
A21: x2=Y2 and
A22: card Y2=n by A1,A19;
    consider Y1 be Subset of X such that
A23: x1=Y1 and
A24: card Y1=n by A1,A18;
    Y1 c= Y2
    proof
A25:  dom (Y1-->1)=Y1;
      let y be object such that
A26:  y in Y1;
      (Y1-->1).y=1 by A26,FUNCOP_1:7;
      then
A27:  F(Y1).y=1 by A26,A25,FUNCT_4:13;
A28:  F(Y1)=f.x1 by A1,A18,A23;
A29:  dom (Y2-->1)=Y2;
      assume
A30:  not y in Y2;
      (X-->0).y=0 by A26,FUNCOP_1:7;
      then F(Y2).y=0 by A30,A29,FUNCT_4:11;
      hence thesis by A1,A19,A20,A21,A27,A28;
    end;
    hence thesis by A23,A24,A21,A22,CARD_2:102;
  end;
  then
A31: f is one-to-one;
  rng f c= CH
  proof
    let y be object;
    assume y in rng f;
    then consider x being object such that
A32: x in dom f and
A33: f.x=y by FUNCT_1:def 3;
    consider Y be Subset of X such that
A34: x=Y and
A35: card Y=n by A1,A32;
    Y\/X=X by XBOOLE_1:12;
    then F(Y) in CH by A35,CARD_FIN:17;
    hence thesis by A1,A32,A33,A34;
  end;
  then rng f=CH by A2,XBOOLE_0:def 10;
  then YY,CH are_equipotent by A1,A31,WELLORD2:def 4;
  then card YY=card CH by CARD_1:5;
  hence thesis by CARD_FIN:16;
end;
