reserve x, x1, x2, y, X, D for set,
  i, j, k, l, m, n, N for Nat,
  p, q for XFinSequence of NAT,
  q9 for XFinSequence,
  pd, qd for XFinSequence of D;
reserve pN, qN for Element of NAT^omega;

theorem Th40:
  card {pN:pN in Domin_0(n+1,m) & {N: 2*Sum(pN|N) = N & N > 0} =
  {}} = card Domin_0(n,m)
proof
  defpred P[object,object]
means ex p st $1=<%0%>^p & $2=p;
  set F={pN: pN in Domin_0(n+1,m) & {N: 2*Sum(pN|N)=N & N>0}={}};
  set Z=Domin_0(n,m);
A1: for x being object st x in F ex y being object st y in Z & P[x,y]
  proof
A2: len <%0%> =1 by AFINSQ_1:33;
    let x be object;
A3: Sum <%0%>=0 by AFINSQ_2:53;
    assume x in F;
    then consider pN such that
A4: x=pN & pN in Domin_0(n+1,m) & {N: 2*Sum(pN|N)=N & N>0}={};
    pN is dominated_by_0 & dom pN=n+1 by A4,Th20;
    then consider q such that
A6: pN=<%0%>^q and
A7: q is dominated_by_0 by A4,Th17;
    dom pN=len <%0%>+ len q by A6,AFINSQ_1:def 3;
    then
A8: n+1=len q+1 by A4,A2,Th20;
    take q;
    Sum pN=Sum <%0%>+Sum q by A6,AFINSQ_2:55;
    then Sum q=m by A4,A3,Th20;
    hence thesis by A4,A6,A7,A8,Th20;
  end;
  consider f being Function of F,Z such that
A9: for x being object st x in F holds P[x,f.x] from FUNCT_2:sch 1(A1);
A10: Z={} implies F={}
  proof
    assume Z={};
    then 2*m >n by Th22;
    then
A11: 2*m >= n+1 by NAT_1:13;
    assume F<>{};
    then consider x being object such that
A12: x in F by XBOOLE_0:def 1;
    consider pN such that
A13: x=pN & pN in Domin_0(n+1,m) & {N: 2*Sum(pN|N)=N & N>0}={} by A12;
    dom pN=n+1 by A13,Th20;
    then pN|(n+1)=pN;
    then
A14: Sum(pN|(n+1))=m by A13,Th20;
    pN is dominated_by_0 by A13,Th20;
    then 2*m <= n +1 by A14,Th2;
    then 2*Sum(pN|(n+1)) =n+1 by A14,A11,XXREAL_0:1;
    then n+1 in {N:2*Sum(pN|N)=N&N>0};
    hence thesis by A13;
  end;
  then
A15: dom f=F by FUNCT_2:def 1;
A16: rng f=Z
  proof
    thus rng f c= Z;
    let x be object;
    assume x in Z;
    then consider p such that
A17: p = x and
A18: p is dominated_by_0 and
A19: dom p = n and
A20: Sum p = m by Def2;
    set q=<%0%>^p;
A21: {N: 2*Sum(q|N)=N & N>0}={} by A18,Th18;
    Sum q=Sum <%0%>+Sum p by AFINSQ_2:55;
    then
A22: Sum q=(0 qua Nat)+m by A20,AFINSQ_2:53;
A23: q in NAT^omega by AFINSQ_1:def 7;
    dom q=len <%0%>+len p by AFINSQ_1:def 3;
    then
A24: dom q=1+n by A19,AFINSQ_1:33;
    q is dominated_by_0 by A18,Th18;
    then q in Domin_0(n+1,m) by A24,A22,Th20;
    then
A25: q in F by A21,A23;
    then consider r be XFinSequence of NAT such that
A26: q=<%0%>^r and
A27: f.q=r by A9;
    r=p by A26,AFINSQ_1:28;
    hence thesis by A15,A17,A25,A27,FUNCT_1:3;
  end;
  for x,y being object st x in F & y in F & f.x = f.y holds x = y
  proof
    let x,y being object such that
A28: x in F & y in F and
A29: f.x = f.y;
    ( ex p st x=<%0%>^p & f.x=p)& ex q st y=<%0%>^q & f.y=q by A9,A28;
    hence thesis by A29;
  end;
  then f is one-to-one by A10,FUNCT_2:19;
  then F,Z are_equipotent by A15,A16,WELLORD2:def 4;
  hence thesis by CARD_1:5;
end;
