reserve X for TopSpace;
reserve X for non empty TopSpace;
reserve X1, X2, X3 for non empty SubSpace of X;
reserve X1, X2, X3 for non empty SubSpace of X;
reserve X for TopSpace;
reserve A1, A2 for Subset of X;
reserve A1,A2 for Subset of X;
reserve X for TopSpace,
  A1, A2 for Subset of X;
reserve X for non empty TopSpace,
  A1, A2 for Subset of X;
reserve X for non empty TopSpace;
reserve X1, X2 for non empty SubSpace of X;
reserve X1, X2 for non empty SubSpace of X;

theorem
  X = X1 union X2 & X1 meets X2 implies (X1,X2 are_weakly_separated iff
  (X1 is SubSpace of X2 or X2 is SubSpace of X1 or ex Y1, Y2 being closed non
  empty SubSpace of X st Y1 is SubSpace of X1 & Y2 is SubSpace of X2 & (X = Y1
union Y2 or ex Y being open non empty SubSpace of X st X = (Y1 union Y2) union
  Y & Y is SubSpace of X1 meet X2)))
proof
  reconsider A2 = the carrier of X2 as Subset of X by Th1;
  reconsider A1 = the carrier of X1 as Subset of X by Th1;
  assume
A1: X = X1 union X2;
  then
A2: A1 \/ A2 = the carrier of X by Def2;
  assume
A3: X1 meets X2;
A4: now
    assume
A5: X1 is SubSpace of X2 or X2 is SubSpace of X1 or (not X1 is
SubSpace of X2 & not X2 is SubSpace of X1 implies ex Y1, Y2 being closed non
empty SubSpace of X st Y1 is SubSpace of X1 & Y2 is SubSpace of X2 & (X = Y1
union Y2 or ex Y being open non empty SubSpace of X st X = (Y1 union Y2) union
    Y & Y is SubSpace of X1 meet X2));
    now
      assume ( not X1 is SubSpace of X2)& not X2 is SubSpace of X1;
      then consider Y1, Y2 being closed non empty SubSpace of X such that
A6:   Y1 is SubSpace of X1 & Y2 is SubSpace of X2 and
A7:   X = Y1 union Y2 or ex Y being open non empty SubSpace of X st X
      = (Y1 union Y2) union Y & Y is SubSpace of X1 meet X2 by A5;
      reconsider C2 = the carrier of Y2 as Subset of X by Th1;
      reconsider C1 = the carrier of Y1 as Subset of X by Th1;
A8:   now
        per cases;
        suppose
A9:       A1 \/ A2 = C1 \/ C2;
          thus ex C being Subset of X st A1 \/ A2 = (C1 \/ C2) \/ C & C c= A1
          /\ A2 & C is open
          proof
            take {}X;
            thus thesis by A9,XBOOLE_1:2;
          end;
        end;
        suppose
A10:      A1 \/ A2 <> C1 \/ C2;
          thus ex C being Subset of X st A1 \/ A2 = (C1 \/ C2) \/ C & C c= A1
          /\ A2 & C is open
          proof
            consider Y being open non empty SubSpace of X such that
A11:        X = (Y1 union Y2) union Y and
A12:        Y is SubSpace of X1 meet X2 by A2,A7,A10,Def2;
            reconsider C = the carrier of Y as Subset of X by Th1;
            A1 /\ A2 = the carrier of X1 meet X2 by A3,Def4;
            then
A13:        C c= A1 /\ A2 by A12,Th4;
A14:        C is open by Th16;
            A1 \/ A2 = (the carrier of Y1 union Y2) \/ C by A2,A11,Def2
              .= (C1 \/ C2) \/ C by Def2;
            hence thesis by A14,A13;
          end;
        end;
      end;
A15:  C1 is closed & C2 is closed by Th11;
      C1 c= A1 & C2 c= A2 by A6,Th4;
      then for A1, A2 be Subset of X holds A1 = the carrier of X1 & A2 = the
      carrier of X2 implies A1,A2 are_weakly_separated by A2,A15,A8,Th56;
      hence X1,X2 are_weakly_separated;
    end;
    hence X1,X2 are_weakly_separated by Th79;
  end;
  now
    assume X1,X2 are_weakly_separated;
    then
A16: A1,A2 are_weakly_separated;
    now
      assume ( not X1 is SubSpace of X2)& not X2 is SubSpace of X1;
      then ( not A1 c= A2)& not A2 c= A1 by Th4;
      then consider C1, C2 being non empty Subset of X such that
A17:  C1 is closed and
A18:  C2 is closed and
A19:  C1 c= A1 & C2 c= A2 and
A20:  A1 \/ A2 = C1 \/ C2 or ex C being non empty Subset of X st A1
      \/ A2 = (C1 \/ C2) \/ C & C c= A1 /\ A2 & C is open by A2,A16,Th57;
      thus ex Y1, Y2 being closed non empty SubSpace of X st Y1 is SubSpace of
      X1 & Y2 is SubSpace of X2 & (X = Y1 union Y2 or ex Y being open non empty
      SubSpace of X st X = (Y1 union Y2) union Y & Y is SubSpace of X1 meet X2)
      proof
        consider Y2 being strict closed non empty SubSpace of X such that
A21:    C2 = the carrier of Y2 by A18,Th15;
        consider Y1 being strict closed non empty SubSpace of X such that
A22:    C1 = the carrier of Y1 by A17,Th15;
        take Y1,Y2;
        now
          assume X <> Y1 union Y2;
          then consider C being non empty Subset of X such that
A23:      A1 \/ A2 = (C1 \/ C2) \/ C and
A24:      C c= A1 /\ A2 and
A25:      C is open by A1,A2,A20,A22,A21,Def2;
          thus ex Y being open non empty SubSpace of X st X = (Y1 union Y2)
          union Y & Y is SubSpace of X1 meet X2
          proof
A26:        C c= the carrier of X1 meet X2 by A3,A24,Def4;
            consider Y being strict open non empty SubSpace of X such that
A27:        C = the carrier of Y by A25,Th20;
            take Y;
            the carrier of X = (the carrier of Y1 union Y2) \/ C by A2,A22,A21
,A23,Def2
              .= the carrier of (Y1 union Y2) union Y by A27,Def2;
            hence thesis by A1,A27,A26,Th4,Th5;
          end;
        end;
        hence thesis by A19,A22,A21,Th4;
      end;
    end;
    hence X1 is SubSpace of X2 or X2 is SubSpace of X1 or ex Y1, Y2 being
closed non empty SubSpace of X st Y1 is SubSpace of X1 & Y2 is SubSpace of X2 &
(X = Y1 union Y2 or ex Y being open non empty SubSpace of X st X = (Y1 union Y2
    ) union Y & Y is SubSpace of X1 meet X2);
  end;
  hence thesis by A4;
end;
