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;

theorem Th19:
  f is onto "increasing implies for m st m < k holds min* f"{m} <= n-k+m
proof
  assume that
A1: f is onto "increasing;
  now
    per cases;
    suppose
      k=0;
      hence thesis;
    end;
    suppose
      k>0;
      then reconsider k1=k-1 as Element of NAT by NAT_1:20;
      defpred I[Integer] means 0<=$1 implies min* f"{$1} <= n-k+$1;
A2:   k1<k1+1 by NAT_1:13;
A3:   for m be Integer st m <= k1 holds I[m] implies I[m-1]
      proof
        reconsider nk=n-k as Element of NAT by A1,Th17,NAT_1:21;
A4:     k = rng f by A1,FUNCT_2:def 3;
        let m be Integer;
        assume m <= k1;
        then
A5:     m < k by A2,XXREAL_0:2;
        assume
A6:     I[m];
        assume 0<=m-1;
        then reconsider m1=m-1 as Element of NAT by INT_1:3;
A7:     m1<m1+1 by NAT_1:19;
        then m1<k by A5,XXREAL_0:2;
        then
A8:     m1 in Segm k by NAT_1:44;
        m1+1 in Segm k by A5,NAT_1:44;
        then min* f"{m1}<min* f"{m1+1} by A1,A7,A8,A4;
        then min* f"{m1} < (nk+m1)+1 by A6,XXREAL_0:2;
        hence thesis by NAT_1:13;
      end;
A9:   I[k1]
      proof
        assume 0<= k1;
        k=0 iff n=0 by A1;
        then min* f"{k1}<=n-1 by Th16;
        hence thesis;
      end;
A10:  for m be Integer st m <= k1 holds I[m] from INT_1:sch 3(A9,A3);
      now
        let m;
        assume m < k;
        then m<k1+1;
        then m<=k1 by NAT_1:13;
        hence min* f"{m} <= n-k+m by A10;
      end;
      hence thesis;
    end;
  end;
  hence thesis;
end;
