reserve n,m,k for Nat,
  X,Y,Z for set,
  f for Function of X,Y,
  H for Subset of X;

theorem
  for m being Nat holds
  ex r being Nat st
  for X being finite set, P being a_partition of the_subsets_of_card(2,X)
  st card X >= r & card P = 2 holds ex S being Subset of X st card S >= m &
  S is_homogeneous_for P
proof
  let m be Nat;
  per cases;
  suppose
A1: m<2;
    set r=1;
    take r;
    let X be finite set;
    let P be a_partition of the_subsets_of_card(2,X);
    assume card X >= r;
    then consider x be object such that
A2: x in X by CARD_1:27,XBOOLE_0:def 1;
    reconsider S = {x} as Subset of X by A2,ZFMISC_1:31;
    assume card P = 2;
    take S;
    m<1+1 by A1;
    then m<=1 by NAT_1:13;
    hence card S >= m by CARD_1:30;
A3: card S = 1 by CARD_1:30;
    ex p being Element of P st the_subsets_of_card(2,S) c= p
    proof
      take p = the Element of P;
      thus thesis by A3,Th6;
    end;
    hence thesis;
  end;
  suppose
    m>=2;
    then consider r be Nat such that
    r <= (m + m -' 2) choose (m -' 1) and
A4: r >= 2 and
A5: for X being finite set, F being Function of the_subsets_of_card(2
,X), Seg 2 st card X >= r holds ex S being Subset of X st card S >= m & rng(F|
the_subsets_of_card(2,S)) = {1} or card S >= m & rng(F|the_subsets_of_card(2,S)
    ) = {2} by Th16;
    take r;
    let X be finite set;
    let P be a_partition of the_subsets_of_card(2,X);
    assume that
A6: card X >= r and
A7: card P = 2;
    2 <= card X by A4,A6,XXREAL_0:2;
    then card Seg 2 <= card X by FINSEQ_1:57;
    then Segm card Seg 2 c= Segm card X by NAT_1:39;
    then card 2 c= card X by FINSEQ_1:55;
    then reconsider X9 = the_subsets_of_card(2,X) as non empty set by A4,A6,
CARD_1:27,GROUP_10:1;
    reconsider P9=P as a_partition of X9;
    card P9 = card Seg 2 by A7,FINSEQ_1:57;
    then P9, Seg 2 are_equipotent by CARD_1:5;
    then consider F1 be Function such that
A8: F1 is one-to-one and
A9: dom F1 = P9 and
A10: rng F1 = Seg 2 by WELLORD2:def 4;
    reconsider F1 as Function of P9,Seg 2 by A9,A10,FUNCT_2:1;
    set F=F1*(proj P9);
    reconsider F as Function of the_subsets_of_card(2,X),Seg 2;
    consider S be Subset of X such that
A11: card S >= m & rng(F|the_subsets_of_card(2,S)) = {1} or card S >=
    m & rng(F|the_subsets_of_card(2,S)) = {2} by A5,A6;
    take S;
    thus card S >= m by A11;
    set h = the Element of the_subsets_of_card(2,S);
A12: the_subsets_of_card(2,S) is non empty by A11;
    then
A13: h in the_subsets_of_card(2,S);
A14: the_subsets_of_card(2,S) c= the_subsets_of_card(2,X) by Lm1;
    then reconsider h as Element of X9 by A13;
    set E = EqClass(h,P9);
    reconsider E as Element of P by EQREL_1:def 6;
A15: F|the_subsets_of_card(2,S) is constant by A11;
    for x being object holds x in the_subsets_of_card(2,S) implies x in E
    proof
      let x be object;
      assume
A16:  x in the_subsets_of_card(2,S);
      then reconsider x9=x as Element of the_subsets_of_card(2,X) by A14;
      reconsider x99=x as Element of X9 by A14,A16;
A17:  dom F = the_subsets_of_card(2,X) by FUNCT_2:def 1;
      then h in dom F /\ the_subsets_of_card(2,S) by A12,XBOOLE_0:def 4;
      then
A18:  h in dom(F|the_subsets_of_card(2,S)) by RELAT_1:61;
      x9 in dom F /\ the_subsets_of_card(2,S) by A16,A17,XBOOLE_0:def 4;
      then
A19:  x9 in dom(F|the_subsets_of_card(2,S)) by RELAT_1:61;
      F.x9 = F|the_subsets_of_card(2,S).x9 by A16,FUNCT_1:49
        .= F|the_subsets_of_card(2,S).h by A15,A19,A18,FUNCT_1:def 10
        .= F.h by A12,FUNCT_1:49;
      then
A20:  F1.((proj P9).x9) = (F1*proj P9).h by A17,FUNCT_1:12
        .= F1.((proj P9).h) by A17,FUNCT_1:12;
      (proj P9).x99 in P9;
      then h in E & (proj P9).h = (proj P9).x9 by A8,A9,A20,EQREL_1:def 6
,FUNCT_1:def 4;
      hence thesis by Th13;
    end;
    then the_subsets_of_card(2,S) c= E;
    hence thesis;
  end;
end;
