reserve X,Y for set,
  x,x1,x2,y,y1,y2,z for set,
  f,g,h for Function;
reserve M for non empty set;
reserve D for non empty set;
reserve P for Relation;
reserve O for Order of X;
reserve R,P for Relation,
  X,X1,X2,Y,Z,x,y,z,u for set,
  g,h for Function,
  O for Order of X,
  D for non empty set,
  d,d1,d2 for Element of D,
  A1,A2,B for Ordinal,
  L,L1,L2 for Sequence;
reserve A,C for Ordinal;

theorem Th65:
  for X st X <> {} & for Z st Z c= X & Z is c=-linear ex Y st Y
in X & for X1 st X1 in Z holds X1 c= Y ex Y st Y in X & for Z st Z in X & Z <>
  Y holds not Y c= Z
proof
  let X;
  assume that
A1: X <> {} and
A2: for Z st Z c= X & Z is c=-linear ex Y st Y in X & for X1 st X1 in Z
  holds X1 c= Y;
  reconsider D = X as non empty set by A1;
  set R = RelIncl D;
A3: D has_upper_Zorn_property_wrt R
  proof
    let Z;
    assume that
A4: Z c= D and
A5: R|_2 Z is being_linear-order;
    set Q = R|_2 Z;
A6: Z c= field(R|_2 Z)
    proof
      let x be object;
      assume
A7:   x in Z;
      then
A8:   [x,x] in [:Z,Z:] by ZFMISC_1:87;
      [x,x] in R by A4,A7,WELLORD2:def 1;
      then [x,x] in R|_2 Z by A8,XBOOLE_0:def 4;
      hence thesis by RELAT_1:15;
    end;
    R|_2 Z is connected by A5;
    then
A9: R|_2 Z is_connected_in field(R|_2 Z);
    Z is c=-linear
    proof
      let X1,X2;
      assume that
A10:  X1 in Z and
A11:  X2 in Z;
      X1 <> X2 implies [X1,X2] in Q or [X2,X1] in Q by A9,A6,A10,A11;
      then X1 <> X2 implies [X1,X2] in R or [X2,X1] in R by XBOOLE_0:def 4;
      hence X1 c= X2 or X2 c= X1 by A4,A10,A11,WELLORD2:def 1;
    end;
    then consider Y such that
A12: Y in X and
A13: for X1 st X1 in Z holds X1 c= Y by A2,A4;
    take x = Y;
    thus x in D by A12;
    let y;
    assume
A14: y in Z;
    then y c= Y by A13;
    hence thesis by A4,A12,A14,WELLORD2:def 1;
  end;
A15: field R = D by WELLORD2:def 1;
A16: R is_antisymmetric_in D by A15,RELAT_2:def 12;
A17: R is_transitive_in D by A15,RELAT_2:def 16;
  R is_reflexive_in D by A15,RELAT_2:def 9;
  then R partially_orders D by A17,A16;
  then consider x such that
A18: x is_maximal_in R by A15,A3,Th63;
  take Y = x;
A19: Y in field R by A18;
  thus Y in X by A15,A18;
  let Z;
  assume that
A20: Z in X and
A21: Z <> Y;
  not [Y,Z] in R by A15,A18,A20,A21;
  hence thesis by A15,A19,A20,WELLORD2:def 1;
end;
