reserve i for Nat;
reserve R for Relation;
reserve A for set;

theorem Th1:
  R well_orders A implies R |_2 A well_orders A & A = field (R |_2 A)
proof
  assume
A1: R well_orders A;
  then
A2: R is_reflexive_in A;
A3: R |_2 A is_reflexive_in A
  proof
    let x be object;
    assume x in A;
    then [x,x] in R & [x,x] in [:A,A:] by A2,ZFMISC_1:87;
    hence thesis by XBOOLE_0:def 4;
  end;
A4: R |_2 A is_connected_in A
  proof
    let x,y be object;
    assume that
A5: x in A & y in A and
A6: x <>y;
A7: R is_connected_in A by A1;
    now
      per cases by A5,A6,A7;
      case
A8:     [x,y] in R;
        [x,y] in [:A,A:] by A5,ZFMISC_1:87;
        hence [x,y] in R |_2 A by A8,XBOOLE_0:def 4;
      end;
      case
A9:     [y,x] in R;
        [y,x] in [:A,A:] by A5,ZFMISC_1:87;
        hence [y,x] in R |_2 A by A9,XBOOLE_0:def 4;
      end;
    end;
    hence thesis;
  end;
A10: R |_2 A c= R by XBOOLE_1:17;
A11: R |_2 A is_antisymmetric_in A
  proof
    let x,y be object;
    assume
A12: x in A & y in A & [x,y] in R |_2 A & [y,x] in R |_2 A;
    R is_antisymmetric_in A by A1;
    hence thesis by A10,A12;
  end;
A13: R |_2 A is_well_founded_in A
  proof
    let Y be set;
    assume
A14: Y c= A & Y <> {};
    R is_well_founded_in A by A1;
    then consider a be object such that
A15: a in Y & R-Seg(a) misses Y by A14;
    (R |_2 A)-Seg(a) c= R-Seg(a) by WELLORD1:14;
    hence thesis by A15,XBOOLE_1:63;
  end;
A16: A c= field (R |_2 A)
  proof
    let x be object;
    assume x in A;
    then [x,x] in [:A,A:] & [x,x] in R by A2,ZFMISC_1:87;
    then [x,x] in R |_2 A by XBOOLE_0:def 4;
    hence thesis by RELAT_1:15;
  end;
A17: R |_2 A is_transitive_in A
  proof
    let x,y,z be object;
    assume that
A18: x in A and
A19: y in A and
A20: z in A and
A21: [x,y] in R |_2 A & [y,z] in R |_2 A;
A22: [x,z] in [:A,A:] by A18,A20,ZFMISC_1:87;
    R is_transitive_in A by A1;
    then [x,z] in R by A10,A18,A19,A20,A21;
    hence thesis by A22,XBOOLE_0:def 4;
  end;
  field (R |_2 A) c= A by WELLORD1:13;
  hence thesis by A16,A3,A17,A11,A4,A13;
end;
