reserve a,b,x,y,z,z1,z2,z3,y1,y3,y4,A,B,C,D,G,M,N,X,Y,Z,W0,W00 for set,
  R,S,T, W,W1,W2 for Relation,
  F,H,H1 for Function;

theorem
  for N ex R st R is well-ordering & field R = N
proof
  let N;
  consider M such that
A1: N in M & for X,Y holds X in M & Y c= X implies Y in M and
A2: for X holds X in M implies bool X in M and
A3: for X holds X c= M implies X,M are_equipotent or X in M by ZFMISC_1:112;
  defpred P[set] means not $1,M are_equipotent;
  consider D such that
A4: A in D iff A in bool M & P[A] from XFAMILY:sch 1;
A5: union D c= M
  proof
    let x be object;
    assume x in union D;
    then consider A such that
A6: x in A and
A7: A in D by TARSKI:def 4;
    A in bool M by A4,A7;
    hence thesis by A6;
  end;
  set F = id D;
  for Z st Z in D holds not F.Z in Z & F.Z in union D
  proof
    let Z;
    assume
A8: Z in D;
    not Z in Z;
    hence not F.Z in Z by A8,FUNCT_1:18;
    X in D implies X in union D
    proof
A9:   X in { X } by TARSKI:def 1;
      assume X in D;
      then
A10:  X in bool M & not X,M are_equipotent by A4;
A11:  not { X },M are_equipotent
      proof
A12:    X <> bool X
        proof
          assume X = bool X;
          then not X in bool X;
          hence contradiction by ZFMISC_1:def 1;
        end;
        assume { X },M are_equipotent;
        then consider Z such that
        for x being object st x in { X }
    ex y being object st y in M & [x,y] in Z and
A13:    for y being object st y in M
    ex x being object st x in { X } & [x,y] in Z and
A14:    for x,z1,y,z2 being object st [x,z1] in Z & [y,z2] in Z
         holds x = y iff z1 = z2;
        bool X in M by A2,A3,A10;
        then consider y being object such that
A15:    y in {X} and
A16:    [y,bool X] in Z by A13;
        consider x being object such that
A17:    x in {X} and
A18:    [x,X] in Z by A3,A10,A13;
        x=X by A17,TARSKI:def 1;
        then y=x by A15,TARSKI:def 1;
        hence contradiction by A14,A12,A18,A16;
      end;
      X in M by A3,A10;
      then for x being object holds x in {X} implies x in M by TARSKI:def 1;
      then { X } c= M;
      then { X } in D by A4,A11;
      hence thesis by A9,TARSKI:def 4;
    end;
    then Z in union D by A8;
    hence thesis by A8,FUNCT_1:18;
  end;
  then consider S such that
A19: field S c= union D and
A20: S is well-ordering and
A21: not field S in D and
  for y st y in field S holds S-Seg(y) in D & F.(S-Seg(y)) = y by Th5;
  not field S c= M or field S,M are_equipotent by A4,A21;
  then consider Z such that
A22: for x being object st x in field S
       ex y being object st y in M & [x,y] in Z and
A23: for y being object st y in M
          ex x being object st x in field S & [x,y] in Z and
A24: for x,z1,y,z2 being object
st [x,z1] in Z & [y,z2] in Z holds x = y iff z1 = z2
  by A5,A19;
  defpred Q[object,object] means [$2,$1] in Z;
A25: for x being object st x in M ex y being object st Q[x,y]
  proof
    let x be object;
    assume x in M;
    then ex y being object st y in field S & [y,x] in Z by A23;
    hence thesis;
  end;
A26: for x,z1,z2 being object st x in M & Q[x,z1] & Q[x,z2]
     holds z1 = z2 by A24;
  consider H such that
A27: dom H = M and
A28: for x being object st x in M holds Q[x, H.x] from FUNCT_1:sch 2(A26,A25);
  defpred R[object,object] means $2={$1};
  defpred P[object] means ex x,y being object st $1=[x,y] & [H.x,H.y] in S;
  consider W0 such that
A29: for z being object holds z in W0 iff z in [: M,M :] & P[z]
    from XBOOLE_0:sch 1;
A30: for x being object holds x in field S implies x in rng H
  proof let x be object;
    assume x in field S;
    then consider y being object such that
A31: y in M and
A32: [x,y] in Z by A22;
    set z1= H.y;
    z1 in rng H & [z1,y] in Z by A27,A28,A31,FUNCT_1:def 3;
    hence thesis by A24,A32;
  end;
  for z1,z2 being object
st z1 in dom H & z2 in dom H & H.z1 = H.z2 holds z1 = z2
  proof
    let z1,z2 be object;
    assume that
A33: z1 in dom H & z2 in dom H and
A34: H.z1 = H.z2;
    [H.z1,z1] in Z & [H.z2,z2] in Z by A27,A28,A33;
    hence thesis by A24,A34;
  end;
  then
A35: H is one-to-one by FUNCT_1:def 4;
  for z being object st z in W0 ex x,y being object st z=[x,y]
  proof let z be object;
    assume z in W0;
    then ex z1,z2 being object st z=[z1,z2] & [H.z1,H.z2] in S by A29;
    hence thesis;
  end;
  then reconsider W0 as Relation by RELAT_1:def 1;
A36: for z being object holds z in field W0 implies z in M
  proof let z be object;
    assume z in field W0;
    then consider z1 being object such that
A37: [z,z1] in W0 or [z1,z] in W0 by Th1;
A38: [z1,z] in W0 implies z in M
    proof
      assume [z1,z] in W0;
      then [z1,z] in [: M,M :] by A29;
      hence thesis by ZFMISC_1:87;
    end;
    [z,z1] in W0 implies z in M
    proof
      assume [z,z1] in W0;
      then [z,z1] in [: M,M :] by A29;
      hence thesis by ZFMISC_1:87;
    end;
    hence thesis by A37,A38;
  end;
A39: for x being object st x in N ex y being object st R[x,y];
A40: for x,z1,z2 being object st x in N & R[x,z1] & R[x,z2] holds z1 = z2;
  consider H1 such that
A41: dom H1 = N and
A42: for x being object st x in N holds R[x, H1.x]
  from FUNCT_1:sch 2(A40,A39);
  for z1,z2 being object
   st z1 in dom H1 & z2 in dom H1 & H1.z1 = H1.z2 holds z1 = z2
  proof
    let z1,z2 be object;
    assume that
A43: z1 in dom H1 and
A44: z2 in dom H1 and
A45: H1.z1 = H1.z2;
    H1.z1={z1} by A41,A42,A43;
    then
A46: z1 in H1.z2 by A45,TARSKI:def 1;
    H1.z2={z2} by A41,A42,A44;
    hence thesis by A46,TARSKI:def 1;
  end;
  then
A47: H1 is one-to-one by FUNCT_1:def 4;
  set S1=W0 |_2 rng H1;
  for x being object holds x in rng H implies x in field S
  proof let x be object;
    assume x in rng H;
    then consider z1 being object such that
A48: z1 in dom H & x = H.z1 by FUNCT_1:def 3;
    ( ex z2 being object st z2 in field S & [z2,z1] in Z)& [x,z1] in Z
   by A23,A27,A28,A48;
    hence thesis by A24;
  end;
  then
A49: rng H = field S by A30,TARSKI:2;
  for z being object holds z in M implies z in field W0
  proof let z be object;
    assume
A50: z in M;
    ex z1 being object st [z,z1] in W0 or [z1,z] in W0
    proof
      H.z in field S by A27,A49,A50,FUNCT_1:def 3;
      then consider z2 being object such that
A51:  [H.z,z2] in S or [z2,H.z] in S by Th1;
A52:  [H.z,z2] in S implies ex z1 being object st [z,z1] in W0 or [z1,z] in W0
      proof
        assume
A53:    [H.z,z2] in S;
        then z2 in rng H by A49,RELAT_1:15;
        then consider z3 being object such that
A54:    z3 in dom H and
A55:    z2=H.z3 by FUNCT_1:def 3;
        take z3;
        [z,z3] in [: M,M :] by A27,A50,A54,ZFMISC_1:87;
        hence thesis by A29,A53,A55;
      end;
      [z2,H.z] in S implies ex z1 being object st [z,z1] in W0 or [z1,z] in W0
      proof
        assume
A56:    [z2,H.z] in S;
        then z2 in rng H by A49,RELAT_1:15;
        then consider z3 being object such that
A57:    z3 in dom H and
A58:    z2=H.z3 by FUNCT_1:def 3;
        take z3;
        [z3,z] in [: M,M :] by A27,A50,A57,ZFMISC_1:87;
        hence thesis by A29,A56,A58;
      end;
      hence thesis by A51,A52;
    end;
    hence thesis by Th1;
  end;
  then
A59: field W0 = M by A36,TARSKI:2;
  for a,b being object
holds [a,b] in W0 iff a in field W0 & b in field W0 & [H.a,H.b ] in S
  proof
    let a,b be object;
A60: [a,b] in W0 implies a in field W0 & b in field W0 & [H.a,H.b] in S
    proof
      assume
A61:  [a,b] in W0;
      then
A62:  [a,b] in [: M,M :] by A29;
      consider x,y being object such that
A63:  [a,b] = [x,y] and
A64:  [H.x,H.y] in S by A29,A61;
      a=x by A63,XTUPLE_0:1;
      hence thesis by A59,A62,A63,A64,XTUPLE_0:1,ZFMISC_1:87;
    end;
    a in field W0 & b in field W0 & [H.a,H.b] in S implies [a,b] in W0
    proof
      assume that
A65:  a in field W0 & b in field W0 and
A66:  [H.a,H.b] in S;
      [a,b] in [: M,M :] by A59,A65,ZFMISC_1:87;
      hence thesis by A29,A66;
    end;
    hence thesis by A60;
  end;
  then H is_isomorphism_of W0,S by A27,A35,A49,A59;
  then
A67: (H") is_isomorphism_of S, W0 by WELLORD1:39;
  then W0 is well-ordering by A20,WELLORD1:44;
  then
A68: S1 is well-ordering by WELLORD1:25;
  defpred P[object] means
ex x,y being object st $1=[x,y] & [H1.x,H1.y] in S1;
  consider W00 such that
A69: for z being object holds z in W00 iff z in [: N,N :] & P[z]
from XBOOLE_0:sch 1;
  for z being object st z in W00 ex x,y being object st z=[x,y]
  proof let z be object;
    assume z in W00;
    then ex z1,z2 being object st z=[z1,z2] & [H1.z1,H1.z2] in S1 by A69;
    hence thesis;
  end;
  then reconsider W00 as Relation by RELAT_1:def 1;
A70: for z being object holds z in field W00 implies z in N
  proof let z be object;
    assume z in field W00;
    then consider z1 being object such that
A71: [z,z1] in W00 or [z1,z] in W00 by Th1;
A72: [z1,z] in W00 implies z in N
    proof
      assume [z1,z] in W00;
      then [z1,z] in [: N,N :] by A69;
      hence thesis by ZFMISC_1:87;
    end;
    [z,z1] in W00 implies z in N
    proof
      assume [z,z1] in W00;
      then [z,z1] in [: N,N :] by A69;
      hence thesis by ZFMISC_1:87;
    end;
    hence thesis by A71,A72;
  end;
  rng H1 c= M
  proof
    let x be object;
    assume x in rng H1;
    then consider y being object such that
A73: y in dom H1 and
A74: x = H1.y by FUNCT_1:def 3;
    for z1 being object holds z1 in { y } implies z1 in N
       by A41,A73,TARSKI:def 1;
    then
A75: { y } c= N;
    x = { y } by A41,A42,A73,A74;
    hence thesis by A1,A75;
  end;
  then
A76: field S1 = rng H1 by A20,A59,A67,WELLORD1:31,44;
  for z being object holds z in N implies z in field W00
  proof let z be object;
    assume
A77: z in N;
    ex z1 being object st [z,z1] in W00 or [z1,z] in W00
    proof
      H1.z in field S1 by A41,A76,A77,FUNCT_1:def 3;
      then consider z2 being object such that
A78:  [H1.z,z2] in S1 or [z2,H1.z] in S1 by Th1;
A79:  [H1.z,z2] in S1 implies
    ex z1 being object st [z,z1] in W00 or [z1,z] in W00
      proof
        assume
A80:    [H1.z,z2] in S1;
        then z2 in rng H1 by A76,RELAT_1:15;
        then consider z3 being object such that
A81:    z3 in dom H1 and
A82:    z2=H1.z3 by FUNCT_1:def 3;
        take z3;
        [z,z3] in [: N,N :] by A41,A77,A81,ZFMISC_1:87;
        hence thesis by A69,A80,A82;
      end;
      [z2,H1.z] in S1 implies
       ex z1 being object st [z,z1] in W00 or [z1,z] in W00
      proof
        assume
A83:    [z2,H1.z] in S1;
        then z2 in rng H1 by A76,RELAT_1:15;
        then consider z3 being object such that
A84:    z3 in dom H1 and
A85:    z2=H1.z3 by FUNCT_1:def 3;
        take z3;
        [z3,z] in [: N,N :] by A41,A77,A84,ZFMISC_1:87;
        hence thesis by A69,A83,A85;
      end;
      hence thesis by A78,A79;
    end;
    hence thesis by Th1;
  end;
  then
A86: field W00 = N by A70,TARSKI:2;
  for a,b being object
holds [a,b] in W00 iff a in field W00 & b in field W00 & [H1.a
  ,H1.b] in S1
  proof
    let a,b be object;
A87: [a,b] in W00 implies a in field W00 & b in field W00 & [H1.a,H1.b] in S1
    proof
      assume
A88:  [a,b] in W00;
      then
A89:  [a,b] in [: N,N :] by A69;
      consider x,y being object such that
A90:  [a,b] = [x,y] and
A91:  [H1.x,H1.y] in S1 by A69,A88;
      a=x by A90,XTUPLE_0:1;
      hence thesis by A86,A89,A90,A91,XTUPLE_0:1,ZFMISC_1:87;
    end;
    a in field W00 & b in field W00 & [H1.a,H1.b] in S1 implies [a,b] in W00
    proof
      assume that
A92:  a in field W00 & b in field W00 and
A93:  [H1.a,H1.b] in S1;
      [a,b] in [: N,N :] by A86,A92,ZFMISC_1:87;
      hence thesis by A69,A93;
    end;
    hence thesis by A87;
  end;
  then H1 is_isomorphism_of W00,S1 by A41,A47,A76,A86;
  then (H1") is_isomorphism_of S1, W00 by WELLORD1:39;
  hence thesis by A68,A86,WELLORD1:44;
end;
