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;

theorem Th45:
  R partially_orders X implies R |_2 X is Order of X
proof
  set S = R |_2 X;
A1: field S c= X by WELLORD1:13;
  rng S c= field S by XBOOLE_1:7;
  then
A2: rng S c= X by A1;
  dom S c= field S by XBOOLE_1:7;
  then dom S c= X by A1;
  then reconsider S as Relation of X by A2,RELSET_1:4;
  assume
A3: R partially_orders X;
A4: R |_2 X is_antisymmetric_in X
  proof
A5: R is_antisymmetric_in X by A3;
    let x,y be object;
    assume that
A6: x in X and
A7: y in X and
A8: [x,y] in R |_2 X and
A9: [y,x] in R |_2 X;
A10: [y,x] in R by A9,XBOOLE_0:def 4;
    [x,y] in R by A8,XBOOLE_0:def 4;
    hence thesis by A6,A7,A10,A5;
  end;
A11: R |_2 X is_transitive_in X
  proof
A12: R is_transitive_in X by A3;
    let x,y,z be object;
    assume that
A13: x in X and
A14: y in X and
A15: z in X and
A16: [x,y] in R |_2 X and
A17: [y,z] in R |_2 X;
A18: [x,z] in [:X,X:] by A13,A15,ZFMISC_1:87;
A19: [y,z] in R by A17,XBOOLE_0:def 4;
    [x,y] in R by A16,XBOOLE_0:def 4;
    then [x,z] in R by A13,A14,A15,A19,A12;
    hence thesis by A18,XBOOLE_0:def 4;
  end;
A20: R is_reflexive_in X by A3;
A21: R |_2 X is_reflexive_in X
  proof
    let x be object;
    assume
A22: x in X;
    then
A23: [x,x] in [:X,X:] by ZFMISC_1:87;
    [x,x] in R by A20,A22;
    hence thesis by A23,XBOOLE_0:def 4;
  end;
  then
A24: field S = X by Th13;
  dom S = X by A21,Th13;
  hence thesis by A21,A24,A4,A11,PARTFUN1:def 2,RELAT_2:def 9,def 12,def 16;
end;
