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 Th63:
  for R,X st R partially_orders X & field R = X & X
  has_upper_Zorn_property_wrt R ex x st x is_maximal_in R
proof
  let R;
  let FIELD be set;
  assume that
A1: R is_reflexive_in FIELD and
A2: R is_transitive_in FIELD and
A3: R is_antisymmetric_in FIELD and
A4: field R = FIELD and
A5: FIELD has_upper_Zorn_property_wrt R;
  reconsider XD = FIELD as non empty set by A5,Th49;
  consider D such that
A6: D = XD;
A7: D in bool D by ZFMISC_1:def 1;
  not D in {{}} by TARSKI:def 1;
  then reconsider M = (bool D) \ {{}} as non empty set by A7,XBOOLE_0:def 5;
  set f = the Choice_Function of M;
  defpred P[object,object] means $1 <> {} & $2 = f.$1 or $1 = {} & $2 = D;
A8: for x being object st x in bool D ex y being object st P[x,y]
  proof
    let x being object such that
    x in bool D;
    x = {} implies thesis;
    hence thesis;
  end;
A9: for x,y,z being object st x in bool D & P[x,y] & P[x,z] holds y = z;
  consider g such that
A10: dom g = bool D &
for x being object st x in bool D holds P[x,g.x] from FUNCT_1:
  sch 2 (A9,A8);
  defpred ON[Ordinal,object] means
    ex L st $2 = g.{ d : for x st x in rng L holds
x <> d & [x,d] in R } & dom L = $1 & for A,L1 st A in $1 & L1 = L|A holds L.A =
  g.{ d1 : for x st x in rng L1 holds x <> d1 & [x,d1] in R };
A11: ON[A,x] & ON[A,y] implies x = y
  proof
    given L1 such that
A12: x = g.{ d1 : for x st x in rng L1 holds x <> d1 & [x,d1] in R } and
A13: dom L1 = A & for C,L st C in A & L = L1|C holds L1.C = g.{ d2 :
    for x st x in rng L holds x <> d2 & [x,d2] in R };
A14: L1 = L1|A by A13;
    given L2 such that
A15: y = g.{ d1 : for x st x in rng L2 holds x <> d1 & [x,d1] in R } and
A16: dom L2 = A & for C,L st C in A & L = L2|C holds L2.C = g.{ d2 :
    for x st x in rng L holds x <> d2 & [x,d2] in R };
    defpred P[Ordinal] means $1 c= A implies L1|$1 = L2|$1;
A17: for A1 st for A2 st A2 in A1 holds P[A2] holds P[A1]
    proof
      let A1 such that
A18:  for A2 st A2 in A1 holds A2 c= A implies L1|A2 = L2|A2 and
A19:  A1 c= A;
A20:  dom(L2|A1) = A1 by A16,A19,RELAT_1:62;
A21:  now
        let x be object;
        assume
A22:    x in A1;
        then reconsider A3 = x as Ordinal;
A23:    L1.x = L1|A1.x by A22,FUNCT_1:49;
        A3 c= A by A19,A22,ORDINAL1:def 2;
        then
A24:    L1|A3 = L2|A3 by A18,A22;
A25:    L2.A3 = g.{ d2 : for x st x in rng(L2|A3) holds x <> d2 & [x,d2]
        in R } by A16,A19,A22;
        L1.A3 = g.{ d1 : for x st x in rng(L1|A3) holds x <> d1 & [x,d1]
        in R } by A13,A19,A22;
        hence L1|A1.x = L2|A1.x by A22,A24,A23,A25,FUNCT_1:49;
      end;
      dom(L1|A1) = A1 by A13,A19,RELAT_1:62;
      hence thesis by A20,A21,FUNCT_1:2;
    end;
    for A1 holds P[A1] from ORDINAL1:sch 2(A17);
    then
A26: L1|A = L2|A;
    L2 = L2|A by A16;
    hence thesis by A12,A15,A26,A14;
  end;
  {} in {{}} by TARSKI:def 1;
  then
A27: not {} in M by XBOOLE_0:def 5;
A28: X in bool D & X <> {} implies g.X in X
  proof
    assume that
A29: X in bool D and
A30: X <> {};
    not X in {{}} by A30,TARSKI:def 1;
    then
A31: X in M by A29,XBOOLE_0:def 5;
    f.X = g.X by A10,A29,A30;
    hence thesis by A27,A31,Lm2;
  end;
  defpred OM[Ordinal] means ON[$1,D];
  {} c= D;
  then
A32: g.{} = D by A10;
A33: now
    let A,B,L1,L2;
    assume that
A34: dom L1 = A & for C,L st C in A & L = L1|C holds L1.C = g.{ d2 :
    for x st x in rng L holds x <> d2 & [x,d2] in R } and
A35: dom L2 = B & for C,L st C in B & L = L2|C holds L2.C = g.{ d2 :
    for x st x in rng L holds x <> d2 & [x,d2] in R };
    let C such that
A36: C c= A and
A37: C c= B;
    defpred P[Ordinal] means $1 c= C implies L1|$1 = L2|$1;
A38: for A1 st for A2 st A2 in A1 holds P[A2] holds P[A1]
    proof
      let A1 such that
A39:  for A2 st A2 in A1 holds A2 c= C implies L1|A2 = L2|A2 and
A40:  A1 c= C;
A41:  dom(L2|A1) = A1 by A35,A37,A40,RELAT_1:62,XBOOLE_1:1;
A42:  now
        let x be object;
        assume
A43:    x in A1;
        then reconsider A3 = x as Ordinal;
A44:    L1.x = L1|A1.x by A43,FUNCT_1:49;
        A3 c= C by A40,A43,ORDINAL1:def 2;
        then
A45:    L1|A3 = L2|A3 by A39,A43;
A46:    A3 in C by A40,A43;
        then
A47:    L2.A3 = g.{ d2 : for x st x in rng(L2|A3) holds x <> d2 & [x,d2]
        in R } by A35,A37;
        L1.A3 = g.{ d1 : for x st x in rng(L1|A3) holds x <> d1 & [x,d1]
        in R } by A34,A36,A46;
        hence L1|A1.x = L2|A1.x by A43,A45,A44,A47,FUNCT_1:49;
      end;
      dom(L1|A1) = A1 by A34,A36,A40,RELAT_1:62,XBOOLE_1:1;
      hence thesis by A41,A42,FUNCT_1:2;
    end;
    for A1 holds P[A1] from ORDINAL1:sch 2(A38);
    hence L1|C = L2|C;
  end;
A48: for d,A,B st ON[A,d] & ON[B,d] holds A = B
  proof
    let d,A,B;
    given L1 such that
A49: d = g.{ d1 : for x st x in rng L1 holds x <> d1 & [x,d1] in R } and
A50: dom L1 = A & for C,L st C in A & L = L1|C holds L1.C = g.{ d2 :
    for x st x in rng L holds x <> d2 & [x,d2] in R };
    given L2 such that
A51: d = g.{ d1 : for x st x in rng L2 holds x <> d1 & [x,d1] in R } and
A52: dom L2 = B & for C,L st C in B & L = L2|C holds L2.C = g.{ d2 :
    for x st x in rng L holds x <> d2 & [x,d2] in R };
A53: now
      set Y = { d1 : for x st x in rng L1 holds x <> d1 & [x,d1] in R };
      set X = { d1 : for x st x in rng(L1|B) holds x <> d1 & [x,d1] in R };
A54:  Y c= D
      proof
        let x be object;
        assume x in Y;
        then ex d1 st x = d1 & for x st x in rng L1 holds x <> d1 & [x,d1] in
        R;
        hence thesis;
      end;
      assume
A55:  B in A;
      then B c= A by ORDINAL1:def 2;
      then
A56:  L1|B = L2|B by A33,A50,A52
        .= L2 by A52;
      L1.B = g.X by A50,A55;
      then
A57:  d in rng L1 by A50,A51,A55,A56,FUNCT_1:def 3;
A58:  now
        assume
A59:    Y <> {};
        then not Y in {{}} by TARSKI:def 1;
        then
A60:    Y in M by A54,XBOOLE_0:def 5;
        g.Y = f.Y by A10,A54,A59;
        then d in Y by A27,A49,A60,Lm2;
        then ex d1 st d = d1 & for x st x in rng L1 holds x <> d1 & [x,d1] in
        R;
        hence contradiction by A57;
      end;
A61:  not d in d;
      P[Y,g.Y] by A10,A54;
      hence contradiction by A49,A61,A58;
    end;
    now
      set Y = { d1 : for x st x in rng L2 holds x <> d1 & [x,d1] in R };
      set X = { d1 : for x st x in rng(L2|A) holds x <> d1 & [x,d1] in R };
A62:  Y c= D
      proof
        let x be object;
        assume x in Y;
        then ex d1 st x = d1 & for x st x in rng L2 holds x <> d1 & [x,d1] in
        R;
        hence thesis;
      end;
      assume
A63:  A in B;
      then A c= B by ORDINAL1:def 2;
      then
A64:  L2|A = L1|A by A33,A50,A52
        .= L1 by A50;
      L2.A = g.X by A52,A63;
      then
A65:  d in rng L2 by A49,A52,A63,A64,FUNCT_1:def 3;
A66:  now
        assume
A67:    Y <> {};
        then not Y in {{}} by TARSKI:def 1;
        then
A68:    Y in M by A62,XBOOLE_0:def 5;
        g.Y = f.Y by A10,A62,A67;
        then d in Y by A27,A51,A68,Lm2;
        then ex d1 st d = d1 & for x st x in rng L2 holds x <> d1 & [x,d1] in
        R;
        hence contradiction by A65;
      end;
A69:  not d in d;
      P[Y,g.Y] by A10,A62;
      hence contradiction by A51,A69,A66;
    end;
    hence thesis by A53,ORDINAL1:14;
  end;
A70: ex A1 st OM[A1]
  proof
    defpred P[object,object] means ex A st $2 = A & ON[A,$1];
    defpred OO[Ordinal] means ex d st ON[$1,d];
    assume
A71: for A1 holds not ON[A1,D];
A72: for A st for B st B in A holds OO[B] holds OO[A]
    proof
      defpred P[object,object] means ex C st $1 = C & ON[C,$2];
      let A such that
A73:  for B st B in A ex d st ON[B,d];
A74:  for x being object st x in A ex y being object st P[x,y]
      proof
        let x be object;
        assume
A75:    x in A;
        then reconsider C = x as Ordinal;
        consider d such that
A76:    ON[C,d] by A73,A75;
        reconsider y = d as set;
        take y,C;
        thus thesis by A76;
      end;
A77:  for x,y,z being object st x in A & P[x,y] & P[x,z] holds y = z by A11;
      consider h such that
A78:  dom h = A & for x being object st x in A holds P[x,h.x]
from FUNCT_1:sch 2(
      A77,A74 );
      reconsider h as Sequence by A78,ORDINAL1:def 7;
      set X = { d1 : for x st x in rng h holds x <> d1 & [x,d1] in R };
A79:  X c= D
      proof
        let x be object;
        assume x in X;
        then ex d1 st x = d1 & for x st x in rng h holds x <> d1 & [x,d1] in R;
        hence thesis;
      end;
A80:  ON[A,g.X]
      proof
        take h;
        thus g.X = g.{ d1 : for x st x in rng h holds x <> d1 & [x,d1] in R }
        & dom h = A by A78;
        let B,L;
        assume that
A81:    B in A and
A82:    L = h|B;
        ex C st B = C & ON[C,h.B] by A78,A81;
        then consider L1 such that
A83:    h.B = g.{d1: for x st x in rng L1 holds x <> d1 & [x,d1] in R } and
A84:    dom L1 = B & for C,L st C in B & L = L1|C holds L1.C = g.{
d1:     for x st x in rng L holds x <> d1 & [x,d1] in R };
A85:    for x being object st x in B holds L1.x = h|B.x
        proof
          let x be object;
          assume
A86:      x in B;
          then reconsider A1 = x as Ordinal;
A87:      h|B.x = h.x by A86,FUNCT_1:49;
A88:      ON[A1,L1.x]
          proof
            reconsider K = L1|A1 as Sequence;
            take K;
            thus L1.x = g.{d1: for x st x in rng K holds x <> d1 & [x,d1] in R
            } by A84,A86;
            A1 c= B by A86,ORDINAL1:def 2;
            hence dom K = A1 by A84,RELAT_1:62;
            let A2,L2;
            assume that
A89:        A2 in A1 and
A90:        L2 = K|A2;
            A2 c= A1 by A89,ORDINAL1:def 2;
            then
A91:        L2 = L1|A2 by A90,FUNCT_1:51;
            K.A2 = L1.A2 by A89,FUNCT_1:49;
            hence thesis by A84,A86,A89,A91,ORDINAL1:10;
          end;
          ex A2 st x = A2 & ON[A2,h.x] by A78,A81,A86,ORDINAL1:10;
          hence thesis by A11,A88,A87;
        end;
        B c= A by A81,ORDINAL1:def 2;
        then dom(h|B) = B by A78,RELAT_1:62;
        then h|B = L1 by A84,A85,FUNCT_1:2;
        hence thesis by A82,A83;
      end;
      then X <> {} by A32,A71;
      then g.X in X by A28,A79;
      then reconsider dd = g.X as Element of D by A79;
      take dd;
      thus thesis by A80;
    end;
A92: for A holds OO[A] from ORDINAL1:sch 2(A72);
A93: for x,y,z being object st P[x,y] & P[x,z] holds y = z
    proof
      let x,y,z be object;
      given A1 such that
A94:  y = A1 and
A95:  ON[A1,x];
      consider d1 such that
A96:  ON[A1,d1] by A92;
      given A2 such that
A97:  z = A2 and
A98:  ON[A2,x];
      d1 = x by A11,A95,A96;
      hence thesis by A48,A94,A95,A97,A98;
    end;
    consider X such that
A99: for x being object holds x in X iff
      ex y being object st y in D & P[y,x] from TARSKI:sch 1(A93);
    for A holds A in X
    proof
      let A;
      ex d st ON[A,d] by A92;
      hence thesis by A99;
    end;
    hence contradiction by ORDINAL1:26;
  end;
  consider A such that
A100: OM[A] & for B st OM[B] holds A c= B from ORDINAL1:sch 1(A70);
A101: for L
    holds { d : for x st x in rng L holds x <> d & [x,d] in R } c= D
  proof
    let L; let x be object;
    assume x in { d : for x st x in rng L holds x <> d & [x,d] in R };
    then ex d1 st x = d1 & for x st x in rng L holds x <> d1 & [x,d1] in R;
    hence thesis;
  end;
  D in bool D by ZFMISC_1:def 1;
  then reconsider d = g.D as Element of D by A28;
A102: d in D & ON[{},d]
  proof
    deffunc H(set) = {};
    thus d in D;
    consider L such that
A103: dom L = {} & for B,L1 st B in {} & L1 = L|B holds L.B = H(L1)
    from ORDINAL1:sch 4;
    take L;
A104: D c= { d1 : for x st x in rng L holds x <> d1 & [x,d1] in R }
    proof
      let x be object;
      assume x in D;
      then reconsider d = x as Element of D;
      for x st x in rng L holds x <> d & [x,d] in R by A103,RELAT_1:42;
      hence thesis;
    end;
    { d1 : for x st x in rng L holds x <> d1 & [x,d1] in R } c= D by A101;
    hence d = g.{ d1 : for x st x in rng L holds x <> d1 & [x,d1] in R } by
A104,XBOOLE_0:def 10;
    thus dom L = {} by A103;
    thus thesis;
  end;
A105: {} c= A;
  defpred P[object] means ex B st B in A & ON[B,$1];
  consider X such that
A106: for x being object holds x in X iff x in D & P[x] from XBOOLE_0:sch 1;
  not Y in Y;
  then d <> D;
  then {} <> A by A11,A100,A102;
  then {} c< A by A105;
  then {} in A by ORDINAL1:11;
  then reconsider X as non empty set by A106,A102;
  consider L such that
A107: D = g.{ d1 : for x st x in rng L holds x <> d1 & [x,d1] in R } and
A108: dom L = A & for B,L1 st B in A & L1 = L|B holds L.B = g.{ d2 : for
  x st x in rng L1 holds x <> d2 & [x,d2] in R } by A100;
  R is transitive by A2,A4;
  then
A109: R|_2 X is transitive by WELLORD1:17;
A110: rng L c= X
  proof
    let z be object;
    assume z in rng L;
    then consider y being object such that
A111: y in dom L and
A112: z = L.y by FUNCT_1:def 3;
    reconsider y as Ordinal by A111;
    set Z = { d2 : for x st x in rng(L|y) holds x <> d2 & [x,d2] in R };
A113: Z c= D by A101;
A114: ON[y,z]
    proof
      reconsider K = L|y as Sequence;
      take K;
      thus z = g.{ d2 : for x st x in rng K holds x <> d2 & [x,d2] in R } by
A108,A111,A112;
      y c= dom L by A111,ORDINAL1:def 2;
      hence
A115: dom K = y by RELAT_1:62;
      let B,L1;
      assume that
A116: B in y and
A117: L1 = K|B;
      B c= y by A116,ORDINAL1:def 2;
      then
A118: L1 = L|B by A117,FUNCT_1:51;
      K.B = L.B by A115,A116,FUNCT_1:47;
      hence thesis by A108,A111,A116,A118,ORDINAL1:10;
    end;
    now
      assume Z = {};
      then z = D by A32,A108,A111,A112;
      then dom L c= y by A100,A108,A114;
      hence contradiction by A111,ORDINAL1:5;
    end;
    then g.Z in Z by A28,A113;
    then z in Z by A108,A111,A112;
    hence thesis by A106,A108,A111,A114,A113;
  end;
A119: R|_2 X is connected
  proof
    let x,y be object;
    assume that
A120: x in field(R|_2 X) and
A121: y in field(R|_2 X);
A122: x in X by A120,WELLORD1:12;
    then consider A1 such that
    A1 in A and
A123: ON[A1,x] by A106;
A124: y in X by A121,WELLORD1:12;
    then consider A2 such that
    A2 in A and
A125: ON[A2,y] by A106;
    reconsider x9 = x, y9 = y as Element of D by A106,A122,A124;
    consider L1 such that
A126: x9 = g.{ d1 : for x st x in rng L1 holds x <> d1 & [x,d1] in R } and
A127: dom L1 = A1 & for C,L st C in A1 & L = L1|C holds L1.C = g.{ d2
    : for x st x in rng L holds x <> d2 & [x,d2] in R } by A123;
    consider L2 such that
A128: y9 = g.{ d1 : for x st x in rng L2 holds x <> d1 & [x,d1] in R } and
A129: dom L2 = A2 & for C,L st C in A2 & L = L2|C holds L2.C = g.{ d2
    : for x st x in rng L holds x <> d2 & [x,d2] in R } by A125;
A130: [x,y] in [:X,X:] by A122,A124,ZFMISC_1:87;
A131: now
      set Y = { d1 : for x st x in rng L2 holds x <> d1 & [x,d1] in R };
      set Z = { d1 : for x st x in rng(L2|A1) holds x <> d1 & [x,d1] in R };
      not y9 in y9;
      then
A132: Y <> {} by A32,A128;
      Y c= D by A101;
      then y9 in Y by A28,A128,A132;
      then
A133: ex d1 st y9 = d1 & for x st x in rng L2 holds x <> d1 & [x,d1] in R;
      assume
A134: A1 in A2;
      then A1 c= A2 by ORDINAL1:def 2;
      then
A135: L2|A1 = L1|A1 by A33,A127,A129
        .= L1 by A127;
      L2.A1 = g.Z by A129,A134;
      then x9 in rng L2 by A126,A129,A134,A135,FUNCT_1:def 3;
      then [x,y] in R by A133;
      hence thesis by A130,XBOOLE_0:def 4;
    end;
A136: [y,x] in [:X,X:] by A122,A124,ZFMISC_1:87;
A137: now
      set Y = { d1 : for x st x in rng L1 holds x <> d1 & [x,d1] in R };
      set Z = { d1 : for x st x in rng(L1|A2) holds x <> d1 & [x,d1] in R };
      not d1 in d1;
      then
A138: Y <> {} by A32,A126;
      Y c= D by A101;
      then x9 in Y by A28,A126,A138;
      then
A139: ex d1 st x9 = d1 & for x st x in rng L1 holds x <> d1 & [x,d1] in R;
      assume
A140: A2 in A1;
      then A2 c= A1 by ORDINAL1:def 2;
      then
A141: L1|A2 = L2|A2 by A33,A127,A129
        .= L2 by A129;
      L1.A2 = g.Z by A127,A140;
      then y9 in rng L1 by A127,A128,A140,A141,FUNCT_1:def 3;
      then [y,x] in R by A139;
      hence thesis by A136,XBOOLE_0:def 4;
    end;
    A1 = A2 implies thesis by A11,A123,A125;
    hence thesis by A131,A137,ORDINAL1:14;
  end;
  R is antisymmetric by A3,A4;
  then
A142: R|_2 X is antisymmetric;
  set Z = { d1 : for x st x in rng L holds x <> d1 & [x,d1] in R };
A143: X c= D
  by A106;
  R is reflexive by A1,A4;
  then R|_2 X is reflexive by WELLORD1:15;
  then R|_2 X is being_linear-order by A109,A142,A119;
  then consider x such that
A144: x in D and
A145: for y st y in X holds [y,x] in R by A5,A6,A143;
  take x;
  thus x in field R by A4,A6,A144;
  let y such that
A146: y in field R and
A147: y <> x and
A148: [x,y] in R;
  reconsider y9 = y as Element of D by A4,A6,A146;
A149: now
    assume y in X;
    then [y,x] in R by A145;
    hence contradiction by A3,A4,A6,A144,A146,A147,A148;
  end;
  now
    let z;
    assume
A150: z in rng L;
    then reconsider z9 = z as Element of X by A110;
    thus z <> y9 by A110,A149,A150;
A151: [z9,x] in R by A145;
    z in D by A106,A110,A150;
    hence [z,y] in R by A2,A4,A6,A144,A146,A148,A151;
  end;
  then
A152: y in Z;
  Z c= D by A101;
  hence contradiction by A28,A107,A152,ORDINAL1:5;
end;
