reserve x, x1, x2, y, z, X9 for set,
  X, Y for finite set,
  n, k, m for Nat,
  f for Function;

theorem Th3:
  (Y={} implies X={}) implies card Funcs(X,Y) = card Y |^ card X
proof
  assume
A1: Y={} implies X={};
  per cases;
  suppose
A2: Y is empty;
    then card Funcs(X,Y)=1 by A1,CARD_1:30,FUNCT_2:127;
    hence thesis by A1,A2,NEWTON:4;
  end;
  suppose
A3: Y is non empty;
    defpred P[Nat] means for X,Y st Y is non empty & card X= $1
    holds card Funcs(X,Y)=card Y |^ card X;
A4: for n st P[n] holds P[n+1]
    proof
      defpred Q[set] means 1=1;
      let n such that
A5:   P[n];
      let X,Y such that
A6:   Y is non empty and
A7:   card X=n+1;
      reconsider nn=n as Element of NAT by ORDINAL1:def 12;
      reconsider cY=card Y |^ nn as Element of NAT;
      card Y,Y are_equipotent by CARD_1:def 2;
      then consider f be Function such that
A8:   f is one-to-one and
A9:   dom f= card Y and
A10:  rng f= Y by WELLORD2:def 4;
      reconsider f as Function of card Y,Y by A9,A10,FUNCT_2:1;
      consider x being object such that
A11:  x in X by A7,CARD_1:27,XBOOLE_0:def 1;
      reconsider x as set by TARSKI:1;
A12:  x in X by A11;
A13:  f is onto one-to-one by A8,A10,FUNCT_2:def 3;
      consider F be XFinSequence of NAT such that
A14:  dom F = card Y and
A15:  card{g where g is Function of X,Y:Q[g]} = Sum(F) and
A16:  for k st k in dom F holds F.k = card{g where g is Function of X
      ,Y:Q[g] & g.x=f.k} from STIRL2_1:sch 6(A13,A6,A12);
A17:  for k be Nat st k in dom F holds F.k=cY
      proof
        set Xx=X\{x};
        let k be Nat such that
A18:    k in dom F;
A19:    f.k in rng f by A9,A14,A18,FUNCT_1:def 3;
        set F3={g where g is Function of X,Y:Q[g] & g.x=f.k};
        set F2={g where g is Function of Xx\/{x},Y: g.x=f.k};
A20:    F3 c= F2
        proof
          let G be object;
          assume G in F3;
          then
A21:      ex g be Function of X,Y st g=G & Q[g] & g.x=f.k;
          Xx\/{x}=X by A12,ZFMISC_1:116;
          hence thesis by A21;
        end;
        F2 c=F3
        proof
          let G be object;
          assume G in F2;
          then
A22:      ex g be Function of Xx\/{x},Y st g=G & g.x=f.k;
          Xx\/{x}=X by A12,ZFMISC_1:116;
          hence thesis by A22;
        end;
        then
A23:    F2=F3 by A20;
        card Xx=n by A7,A12,STIRL2_1:55;
        then
A24:    card Funcs(Xx,Y)=cY by A5,A19;
        x in {x} by TARSKI:def 1;
        then not x in Xx by XBOOLE_0:def 5;
        then card Funcs(Xx,Y)=card F2 by A19,Th2;
        hence thesis by A16,A18,A23,A24;
      end;
      then for k be Nat st k in dom F holds F.k >= cY;
      then
A25:  Sum F >= len F*card Y|^n by AFINSQ_2:60;
      set F1={g where g is Function of X,Y:Q[g]};
A26:  Funcs(X,Y) c= F1
      proof
        let G be object;
        assume G in Funcs(X,Y);
        then G is Function of X,Y by FUNCT_2:66;
        hence thesis;
      end;
      F1 c= Funcs(X,Y)
      proof
        let G be object;
        assume G in F1;
        then ex g be Function of X,Y st g=G & Q[g];
        hence thesis by A6,FUNCT_2:8;
      end;
      then
A27:  Funcs(X,Y) = F1 by A26;
      for k be Nat st k in dom F holds F.k <= cY by A17;
      then Sum F<=len F*card Y|^n by AFINSQ_2:59;
      then Sum F = card Y * card Y |^ n by A14,A25,XXREAL_0:1;
      hence thesis by A7,A15,A27,NEWTON:6;
    end;
A28: P[0]
    proof
      let X,Y such that
      Y is non empty and
A29:  card X=0;
      X is empty by A29;
      then Funcs(X,Y) = {{}} by FUNCT_5:57;
      then card Funcs(X,Y)=1 by CARD_1:30;
      hence thesis by A29,NEWTON:4;
    end;
    for n holds P[n] from NAT_1:sch 2(A28,A4);
    hence thesis by A3;
  end;
end;
