reserve a,b,k,m,n,s for Nat;
reserve c,c1,c2,c3 for Complex;
reserve i,j,z for Integer;
reserve p for Prime;
reserve x for object;
reserve f,g for complex-valued FinSequence;

theorem :: Problem 171 b
  for m, n being positive Integer st n > 40*m
  for A being finite set st
  A = { [x,y] where x,y is positive Integer: 3*x + 5*y = n }
  holds card A > m
  proof
    let m,n be positive Integer such that
A1: n > 40*m;
    let A be finite set such that
A2: A = { [x,y] where x,y is positive Integer: 3*x + 5*y = n };
    reconsider M = m as positive Nat by TARSKI:1;
    m >= 0+1 by NAT_1:13;
    then
A3: 40*m >= 40*1 by XREAL_1:64;
    then 40*m > 7 by XXREAL_0:2;
    then
A4: n > 7 by A1,XXREAL_0:2;
    now
      assume n in {9,10,12,15};
      then n = 9 or n = 10 or n = 12 or n = 15 by ENUMSET1:def 2;
      hence contradiction by A1,A3,XXREAL_0:2;
    end;
    then consider x0,y0 being positive Integer such that
A5: 3*x0+5*y0 = n by A4,Th74;
    now
      assume x0 <= 5*m & y0 <= 5*m;
      then 3*x0 <= 3*(5*m) & 5*y0 <= 5*(5*m) by XREAL_1:64;
      then n <= 15*m+25*m by A5,XREAL_1:7;
      hence contradiction by A1;
    end;
    then per cases;
    suppose
A6:   x0 > 5*m;
      deffunc A(Nat) = x0-5*$1;
      deffunc B(Nat) = y0+3*$1;
      deffunc Q(Nat) = [A($1),B($1)];
      deffunc R(Nat) = 3*A($1)+5*B($1);
      set K = { Q(k) where k is Nat: k <= m & R(k) > 0 & n = R(k) };
      m+1,K are_equipotent
      proof
        defpred P[object,object] means
        ex k being Nat st k = $1 & $2 = Q(k);
A7:     for e being object st e in M+1 ex u being object st P[e,u]
        proof
          let e be object;
          assume e in M+1;
          then reconsider e as Nat;
          take Q(e);
          take e;
          thus thesis;
        end;
        consider f being Function such that
A8:     dom f = M+1 and
A9:     for e being object st e in M+1 holds P[e,f.e] from CLASSES1:sch 1(A7);
        take f;
        thus f is one-to-one
        proof
          let x1,x2 be object such that
A10:      x1 in dom f and
A11:      x2 in dom f and
A12:      f.x1 = f.x2;
          consider k1 being Nat such that
A13:      k1 = x1 and
A14:      f.x1 = Q(k1) by A8,A9,A10;
          consider k2 being Nat such that
A15:      k2 = x2 and
A16:      f.x2 = Q(k2) by A8,A9,A11;
          A(k1) = A(k2) by A12,A14,A16,XTUPLE_0:1;
          hence x1 = x2 by A13,A15;
        end;
        thus dom f = m+1 by A8;
        thus rng f c= K
        proof
          let u be object;
          assume u in rng f;
          then consider e being object such that
A17:      e in dom f and
A18:      f.e = u by FUNCT_1:def 3;
          consider k being Nat such that
A19:      k = e and
A20:      f.e = Q(k) by A8,A9,A17;
          k in Segm(M+1) by A8,A17,A19;
          then k < M+1 by NAT_1:44;
          then
A21:      k <= m by NAT_1:13;
          n = R(k) by A5;
          hence u in K by A18,A20,A21;
        end;
        thus K c= rng f
        proof
          let u be object;
          assume u in K;
          then consider k being Nat such that
A22:      u = Q(k) and
A23:      k <= m and
          R(k) > 0 & n = R(k);
          k < m+1 by A23,NAT_1:13;
          then
A24:      k in Segm(M+1) by NAT_1:44;
          then P[k,f.k] by A9;
          hence thesis by A8,A22,A24,FUNCT_1:def 3;
        end;
      end;
      then
A25:  card K = card(M+1) by CARD_1:5;
      then reconsider K as finite set;
      K c= A
      proof
        let q be object;
        assume q in K;
        then consider k being Nat such that
A26:    q = Q(k) and
A27:    k <= m and
A28:    R(k) > 0 & n = R(k);
        5*k <= 5*m by A27,XREAL_1:64;
        then A(k) > 5*m-5*m by A6,XREAL_1:14;
        hence thesis by A2,A26,A28;
      end;
      then card K <= card A by NAT_1:43;
      hence m < card A by A25,XXREAL_0:2,NAT_1:16;
    end;
    suppose
A29:  y0 > 5*m;
      deffunc A(Nat) = x0+5*$1;
      deffunc B(Nat) = y0-3*$1;
      deffunc Q(Nat) = [A($1),B($1)];
      deffunc R(Nat) = 3*A($1)+5*B($1);
      set K = { Q(k) where k is Nat: k <= m & R(k) > 0 & n = R(k) };
      m+1,K are_equipotent
      proof
        defpred P[object,object] means
        ex k being Nat st k = $1 & $2 = Q(k);
A30:    for e being object st e in M+1 ex u being object st P[e,u]
        proof
          let e be object;
          assume e in M+1;
          then reconsider e as Nat;
          take Q(e);
          take e;
          thus thesis;
        end;
        consider f being Function such that
A31:    dom f = M+1 and
A32:    for e being object st e in M+1 holds P[e,f.e] from CLASSES1:sch 1(A30);
        take f;
        thus f is one-to-one
        proof
          let x1,x2 be object such that
A33:      x1 in dom f and
A34:      x2 in dom f and
A35:      f.x1 = f.x2;
          consider k1 being Nat such that
A36:      k1 = x1 and
A37:      f.x1 = Q(k1) by A31,A32,A33;
          consider k2 being Nat such that
A38:      k2 = x2 and
A39:      f.x2 = Q(k2) by A31,A32,A34;
          A(k1) = A(k2) by A35,A37,A39,XTUPLE_0:1;
          hence x1 = x2 by A36,A38;
        end;
        thus dom f = m+1 by A31;
        thus rng f c= K
        proof
          let u be object;
          assume u in rng f;
          then consider e being object such that
A40:      e in dom f and
A41:      f.e = u by FUNCT_1:def 3;
          consider k being Nat such that
A42:      k = e and
A43:      f.e = Q(k) by A31,A32,A40;
          k in Segm(M+1) by A31,A40,A42;
          then k < M+1 by NAT_1:44;
          then
A44:      k <= m by NAT_1:13;
          n = R(k) by A5;
          hence u in K by A41,A43,A44;
        end;
        thus K c= rng f
        proof
          let u be object;
          assume u in K;
          then consider k being Nat such that
A45:      u = Q(k) and
A46:      k <= m and
          R(k) > 0 & n = R(k);
          k < m+1 by A46,NAT_1:13;
          then
A47:      k in Segm(M+1) by NAT_1:44;
          then P[k,f.k] by A32;
          hence thesis by A31,A45,A47,FUNCT_1:def 3;
        end;
      end;
      then
A48:  card K = card(M+1) by CARD_1:5;
      then reconsider K as finite set;
      K c= A
      proof
        let q be object;
        assume q in K;
        then consider k being Nat such that
A49:    q = Q(k) and
A50:    k <= m and
A51:    R(k) > 0 & n = R(k);
        3*k <= 3*m by A50,XREAL_1:64;
        then B(k) > 5*m-3*m by A29,XREAL_1:14;
        then B(k) > 2*m;
        hence thesis by A2,A49,A51;
      end;
      then card K <= card A by NAT_1:43;
      hence m < card A by A48,XXREAL_0:2,NAT_1:16;
    end;
  end;
