reserve X,Y,Z,x,y,z for set;
reserve T,R for Tolerance of X;

theorem Th19:
  for Y being TolSet of T ex Z being TolClass of T st Y c= Z
proof
  let Y be TolSet of T;
  defpred X[set] means $1 is TolSet of T & ex Z st $1=Z & Y c= Z;
  consider TS being set such that
A1: for x holds x in TS iff x in bool X & X[x] from XFAMILY:sch 1;
A2: for x being set holds x in TS iff x in bool X & x is TolSet of T & Y c= x
  proof
    let x be set;
    thus x in TS implies x in bool X & x is TolSet of T & Y c= x
    proof
      assume
A3:   x in TS;
      hence x in bool X & x is TolSet of T by A1;
      ex Z st x=Z & Y c= Z by A1,A3;
      hence thesis;
    end;
    thus thesis by A1;
  end;
  Y c= X by Th18;
  then
A4: TS <> {} by A2;
A5: TS c= bool X
  by A1;
  for Z st Z c= TS & Z is c=-linear ex Y st Y in TS & for X1 being set st
  X1 in Z holds X1 c= Y
  proof
    let Z such that
A6: Z c= TS and
A7: Z is c=-linear;
A8: for x,y st x in union Z & y in union Z holds [x,y] in T
    proof
      let x,y;
      assume that
A9:   x in union Z and
A10:  y in union Z;
      consider Zy being set such that
A11:  y in Zy and
A12:  Zy in Z by A10,TARSKI:def 4;
      reconsider Zy as TolSet of T by A1,A6,A12;
      consider Zx being set such that
A13:  x in Zx and
A14:  Zx in Z by A9,TARSKI:def 4;
      reconsider Zx as TolSet of T by A1,A6,A14;
      Zx, Zy are_c=-comparable by A7,A14,A12,ORDINAL1:def 8;
      then Zx c= Zy or Zy c= Zx by XBOOLE_0:def 9;
      hence thesis by A13,A11,Def1;
    end;
A15: Z <> {} implies thesis
    proof
      assume
A16:  Z <> {};
A17:  Y c= union Z
      proof
        set y = the Element of Z;
        y in TS by A6,A16;
        then
A18:    Y c= y by A2;
        let x be object;
        assume x in Y;
        hence thesis by A16,A18,TARSKI:def 4;
      end;
      Z c= bool X by A5,A6;
      then union Z c= union bool X by ZFMISC_1:77;
      then
A19:  union Z c= X by ZFMISC_1:81;
      take union Z;
      union Z is TolSet of T by A8,Def1;
      hence union Z in TS by A2,A19,A17;
      let X1 be set;
      assume X1 in Z;
      hence thesis by ZFMISC_1:74;
    end;
    Z = {} implies thesis
    proof
      set Y = the Element of TS;
      assume
A20:  Z = {};
      take Y;
      thus Y in TS by A4;
      let X1 be set;
      assume X1 in Z;
      hence thesis by A20;
    end;
    hence thesis by A15;
  end;
  then consider Z1 being set such that
A21: Z1 in TS and
A22: for Z st Z in TS & Z<>Z1 holds not Z1 c= Z by A4,ORDERS_1:65;
  reconsider Z1 as TolSet of T by A1,A21;
  Z1 is TolClass of T
  proof
    assume not thesis;
    then consider x such that
A23: not x in Z1 and
A24: x in X and
A25: for y st y in Z1 holds [x,y] in T by Def2;
    set Y1 = Z1 \/ {x};
A26: {x} c= X by A24,ZFMISC_1:31;
    for y,z st y in Y1 & z in Y1 holds [y,z] in T
    proof
      let y,z;
      assume that
A27:  y in Y1 and
A28:  z in Y1;
      y in Z1 or y in {x} by A27,XBOOLE_0:def 3;
      then
A29:  y in Z1 or y = x by TARSKI:def 1;
      z in Z1 or z in {x} by A28,XBOOLE_0:def 3;
      then
A30:  z in Z1 or z = x by TARSKI:def 1;
      assume
A31:  not [y,z] in T;
      then not [z,y] in T by EQREL_1:6;
      hence contradiction by A24,A25,A29,A30,A31,Def1,Th7;
    end;
    then
A32: Y1 is TolSet of T by Def1;
    Y c= Z1 & Z1 c= Y1 by A2,A21,XBOOLE_1:7;
    then
A33: Y c= Y1;
A34: Y1 <> Z1
    proof
A35:  x in {x} by TARSKI:def 1;
      assume Y1 = Z1;
      hence contradiction by A23,A35,XBOOLE_0:def 3;
    end;
    Z1 in bool X by A1,A21;
    then Y1 c= X by A26,XBOOLE_1:8;
    then Y1 in TS by A2,A32,A33;
    hence contradiction by A22,A34,XBOOLE_1:7;
  end;
  then reconsider Z1 as TolClass of T;
  take Z1;
  thus thesis by A2,A21;
end;
