reserve X,Y,x,y for set;
reserve A for non empty Poset;
reserve a,a1,a2,a3,b,c for Element of A;
reserve S,T for Subset of A;
reserve f for Choice_Function of BOOL(the carrier of A);
reserve fC,fC1,fC2 for Chain of f;

theorem Th45:
  union(Chains(f)) is Chain of f
proof
  reconsider C = union(Chains(f)) as Chain of A by Lm3;
A1: now
    let a;
    assume a in C;
    then consider X such that
A2: a in X and
A3: X in Chains(f) by TARSKI:def 4;
    reconsider X as Chain of f by A3,Def13;
    now
        InitSegm(C,a) = InitSegm(X,a) by A2,Th33,Th44;
        hence f.UpperCone(InitSegm(C,a)) = a by A2,Def12;
    end;
    hence f.UpperCone(InitSegm(C,a)) = a;
  end;
A4: the InternalRel of A well_orders C
  proof
A5: the InternalRel of A is_antisymmetric_in the carrier of A by Def4;
    the InternalRel of A is_reflexive_in the carrier of A & the
    InternalRel of A is_transitive_in the carrier of A by Def2,Def3;
    hence the InternalRel of A is_reflexive_in C & the InternalRel of A
    is_transitive_in C & the InternalRel of A is_antisymmetric_in C by A5;
    the InternalRel of A is_strongly_connected_in C by Def7;
    hence the InternalRel of A is_connected_in C;
    let Y;
    set x = the Element of Y;
    assume that
A6: Y c= C and
A7: Y <> {};
    x in C by A6,A7;
    then consider X such that
A8: x in X and
A9: X in Chains(f) by TARSKI:def 4;
    reconsider X as Chain of f by A9,Def13;
A10: the InternalRel of A well_orders X by Def12;
    X /\ Y <> {} by A7,A8,XBOOLE_0:def 4;
    then consider a being object such that
A11: a in X /\ Y and
A12: for x being object st x in X /\ Y holds [a,x] in the InternalRel of A
by A10,WELLORD1:5
,XBOOLE_1:17;
    take a;
    thus a in Y by A11,XBOOLE_0:def 4;
    reconsider aa = a as Element of A by A11;
    thus (the InternalRel of A)-Seg(a) /\ Y c= {}
    proof
      let y be object;
      assume
A13:  y in (the InternalRel of A)-Seg(a) /\ Y;
      then
A14:  y in Y by XBOOLE_0:def 4;
      then y in C by A6;
      then reconsider b = y as Element of A;
A15:  y in (the InternalRel of A)-Seg(a) by A13,XBOOLE_0:def 4;
      then
A16:  y <> a by WELLORD1:1;
      [y,a] in the InternalRel of A by A15,WELLORD1:1;
      then
A17:  b <= aa;
      now
        per cases;
        suppose
A18:      X <> C;
          a in X & b < aa by A11,A16,A17,XBOOLE_0:def 4;
          hence y in X by A6,A14,A18,Th32,Th44;
        end;
        suppose
          X = C;
          hence y in X by A6,A14;
        end;
      end;
      then y in X /\ Y by A14,XBOOLE_0:def 4;
      then [a,y] in the InternalRel of A by A12;
      then aa <= b;
      hence thesis by A16,A17,Th2;
    end;
    thus thesis;
  end;
  C <> {} by Th43;
  hence thesis by A4,A1,Def12;
end;
