reserve k, l, m, n, i, j for Nat,
  K, N for non empty Subset of NAT,
  Ke, Ne, Me for Subset of NAT,
  X,Y for set;
reserve f for Function of Segm n,Segm k;
reserve x,y for set;

theorem Th42:
  card{f where f is Function of Segm(n+1),Segm(k+1):
    f is onto "increasing & f
  "{f.n}={n}}=
card{f where f is Function of Segm n,Segm k: f is onto "increasing}
proof
  set F1={f where f is Function of Segm(n+1),Segm(k+1):
    f is onto "increasing & f"{f.n}={n
  }};
  set F2={f where f is Function of Segm n,Segm k: f is onto "increasing};
  now
    per cases;
    suppose
A1:   k=0 & n<>0;
A2:   F1 is empty
      proof
        assume F1 is non empty;
        then consider x be object such that
A3:     x in F1;
        consider f be Function of Segm(n+1),Segm(k+1) such that
        x=f and
        f is onto "increasing and
A4:     f"{f.n}={n} by A3;
        0 in Segm(n+1) by NAT_1:44;
        then
A5:     0 in dom f by FUNCT_2:def 1;
A6:     0 in {0} by TARSKI:def 1;
A7:     f.0=0 by A1,CARD_1:49,TARSKI:def 1;
        f.n=0 by A1,CARD_1:49,TARSKI:def 1;
        then 0 in {n} by A4,A7,A5,A6,FUNCT_1:def 7;
        hence thesis by A1;
      end;
      n block k =0 by A1,Th31;
      hence thesis by A2;
    end;
    suppose
A8:   k=0 implies n=0;
      defpred P[object,set,set] means for i,j st Segm i=$2 & Segm j=$3
       ex f be Function of Segm i,Segm j
        st f=$1 & f is onto "increasing & (n < i implies f"{f.n}={n});
A9:   not n in Segm n;
      set FF2={f where f is Function of Segm n,Segm k: P[f,Segm n,Segm k]};
      set FF1={f where f is Function of (Segm n\/{n}),(Segm k\/{k}):
        P[f,Segm n\/{n},Segm k\/{k}]& rng (f|Segm n) c= Segm k & f.n=k};
A10:  for f be Function of Segm n\/{n},Segm k\/{k} st f.n=k
        holds P[f,Segm n\/{n}, Segm k\/{k}] iff P[f|Segm n,Segm n,Segm k]
      proof
        let f9 be Function of Segm n\/{n},Segm k\/{k} such that
A11:    f9.n=k;
        thus P[f9,Segm n\/{n},Segm k\/{k}] implies P[f9|Segm n,Segm n,Segm k]
        proof
          n<=n+1 by NAT_1:11;
          then
A12:      Segm n c= Segm(n+1) by NAT_1:39;
A13:      Segm(n+1)= Segm n \/ {n} by AFINSQ_1:2;
A14:      Segm(k+1)= Segm k \/ {k} by AFINSQ_1:2;
          assume P[f9,Segm n\/{n},Segm k\/{k}];
          then consider f be Function of Segm(n+1),Segm(k+1) such that
A15:      f=f9 and
A16:      f is onto "increasing and
A17:      n < n+1 implies f"{f.n}={n} by A13,A14;
A18:      rng (f|n) c= Segm k by A16,A17,Th37,NAT_1:13;
A19:      dom (f|n)=dom f /\ n by RELAT_1:61;
          dom f=n+1 by FUNCT_2:def 1;
          then dom (f|n)=n by A12,A19,XBOOLE_1:28;
          then reconsider fn=f|n as Function of n,k by A18,FUNCT_2:2;
          let i,j such that
A20:      Segm i= Segm n and
A21:      Segm j= Segm k;
          reconsider fi=fn as Function of Segm i,Segm j by A20,A21;
          fi is onto "increasing by A16,A17,A20,A21,Th37,NAT_1:13;
          hence thesis by A15,A20;
        end;
        thus P[f9|Segm n,Segm n,Segm k] implies P[f9,Segm n\/{n},Segm k\/{k}]
        proof
          Segm n\/{n}= Segm(n+1) by AFINSQ_1:2;
          then reconsider f=f9 as Function of Segm(n+1),Segm(k+1)
             by AFINSQ_1:2;
          assume P[f9|Segm n,Segm n,Segm k];
          then
A22:      ex fn be Function of Segm n,Segm k
            st fn=f9|n & fn is onto "increasing
          &( n < n implies fn"{fn.n}={n});
          let i,j such that
A23:      Segm i= Segm n\/{n} and
A24:      Segm j= Segm k\/{k};
          reconsider f1=f as Function of Segm i,Segm j by A23,A24;

A25:  for f be Function of Segm n,Segm k,
         f1 being Function of Segm(n+1),Segm(k+1)
       st f is onto
  "increasing & f=f1|Segm n & f1.n = k
  holds f1"{f1.n}={n} by Th40;

A26:      n < i implies f1"{f1.n}={n} by A11,A22,A25;
A27:      Segm(k+1) =j by A24,AFINSQ_1:2;
          Segm(n+1)=i by A23,AFINSQ_1:2;
          then f1 is onto "increasing by A11,A22,A27,Th40;
          hence thesis by A26;
        end;
      end;
A28:  Segm k is empty implies Segm n is empty by A8;
A29:  card FF2 = card FF1 from Sch4(A28,A9,A10);
A30:  F2 c=FF2
      proof
        let x be object;
        assume x in F2;
        then
A31:    ex f be Function of Segm n,Segm k st x=f & f is onto "increasing;
        then P[x,n,k];
        hence thesis by A31;
      end;
A32:  F1 c=FF1
      proof
        let x be object;
        assume x in F1;
        then consider f be Function of Segm(n+1),Segm(k+1) such that
A33:    f=x and
A34:    f is onto "increasing and
A35:    f"{f.n}={n};
A36:    rng (f|n) c= Segm k by A34,A35,Th37;
A37:    P[f,Segm n\/{n}, Segm k\/{k}]
        proof
          let i,j such that
A38:      Segm i= Segm n\/{n} and
A39:      Segm j= Segm k\/{k};
A40:      Segm j= Segm(k+1) by A39,AFINSQ_1:2;
          Segm i= Segm(n+1) by A38,AFINSQ_1:2;
          hence thesis by A34,A35,A40;
        end;
A41:    Segm(k+1)= Segm k\/{k} by AFINSQ_1:2;
A42:    Segm(n+1)= Segm n\/{n} by AFINSQ_1:2;
        f.n=k by A34,A35,Th34;
        hence thesis by A33,A37,A36,A42,A41;
      end;
A43:  FF2 c= F2
      proof
        let x be object;
        assume x in FF2;
        then consider f be Function of n,k such that
A44:    x=f and
A45:    P[f,n,k];
        ex g be Function of Segm n,Segm k
        st g=f & g is onto "increasing & (n < n
        implies g"{g.n}={n}) by A45;
        hence thesis by A44;
      end;
      FF1 c=F1
      proof
        let x be object;
        assume x in FF1;
        then consider f be Function of (Segm n\/{n}),(Segm k\/{k})such that
A46:    x=f and
A47:    P[f,Segm n\/{n},Segm k\/{k}] and
        rng (f|Segm n) c= Segm k and
        f.n=k;
A48:    Segm(k+1)= Segm k\/{k} by AFINSQ_1:2;
        Segm(n+1)= Segm n\/{n} by AFINSQ_1:2;
        then
        ex f9 be Function of Segm(n+1),Segm(k+1)
         st f=f9 & f9 is onto "increasing & (
        n < n+1 implies f9"{f9.n}={n}) by A47,A48;
        hence thesis by A46,NAT_1:13;
      end;
      then F1=FF1 by A32;
      hence thesis by A29,A30,A43,XBOOLE_0:def 10;
    end;
  end;
  hence thesis;
end;
