reserve Y for TopStruct;
reserve X for non empty TopSpace;
reserve X for almost_discrete non empty TopSpace;

theorem Th59:
  for A being Subset of X holds A is discrete implies ex M being
  Subset of X st A c= M & M is maximal_discrete
proof
  let A be Subset of X;
  set D = [#]X \ Cl A;
  set F = {Cl {d} where d is Point of X : d in D};
  now
    let C be object;
    assume C in F;
    then ex a being Point of X st C = Cl {a} & a in D;
    hence C in bool the carrier of X;
  end;
  then reconsider F as Subset-Family of X by TARSKI:def 3;
  assume
A1: A is discrete;
  defpred X[set,set] means $2 in D & $2 in $1;
A2: D = (Cl A)`;
  then D is closed by TDLAT_3:21;
  then
A3: D = Cl D by PRE_TOPC:22;
  A c= Cl A by PRE_TOPC:18;
  then A misses D by A2,SUBSET_1:24;
  then
A4: A /\ D = {};
  reconsider F as Subset-Family of X;
A5: for S being Subset of X st S in F ex x being Point of X st X[S,x]
  proof
    let S be Subset of X;
    assume S in F;
    then consider d being Point of X such that
A6: S = Cl {d} and
A7: d in D;
    take d;
    {d} c= Cl {d} by PRE_TOPC:18;
    hence thesis by A6,A7,ZFMISC_1:31;
  end;
  consider f being Function of F,the carrier of X such that
A8: for S being Subset of X st S in F holds X[S,f.S] from ExChoiceFCol(
  A5);
  set M = A \/ (f.: F);
  now
    let x be object;
    assume x in f.: F;
    then ex S being object st S in F & S in F & x = f.S by FUNCT_2:64;
    hence x in D by A8;
  end;
  then
A9: f.: F c= D by TARSKI:def 3;
  D misses Cl A by A2,SUBSET_1:24;
  then
A10: Cl A misses (f.: F) by A9,XBOOLE_1:63;
  thus ex M being Subset of X st A c= M & M is maximal_discrete
  proof
    take M;
    thus
A11: A c= M by XBOOLE_1:7;
    for x being Point of X ex a being Point of X st a in M & M /\ Cl {x} = {a}
    proof
      let x be Point of X;
A12:  [#]X = Cl A \/ D by XBOOLE_1:45;
      now
        per cases by A12,XBOOLE_0:def 3;
        suppose
A13:      x in Cl A;
          now
            consider a being Point of X such that
A14:        a in A and
A15:        A /\ Cl {x} = {a} by A1,A13,Th54;
            take a;
            thus a in M by A11,A14;
            {x} c= Cl A by A13,ZFMISC_1:31;
            then (f.: F) misses Cl {x} by A10,TOPS_1:5,XBOOLE_1:63;
            then (f.: F) /\ Cl {x} = {};
            then M /\ Cl {x} = (A /\ Cl {x}) \/ {} by XBOOLE_1:23;
            hence M /\ Cl {x} = {a} by A15;
          end;
          hence thesis;
        end;
        suppose
A16:      x in D;
          then
A17:      Cl {x} in F;
          now
            reconsider a = f.(Cl {x}) as Point of X by A17,FUNCT_2:5;
            take a;
A18:        f.: F c= M by XBOOLE_1:7;
            now
              let y be object;
              assume
A19:          y in M /\ Cl {x};
              then reconsider z = y as Point of X;
A20:          z in Cl {x} by A19,XBOOLE_0:def 4;
A21:          z in M by A19,XBOOLE_0:def 4;
              {x} c= D by A16,ZFMISC_1:31;
              then Cl {x} c= D by A3,PRE_TOPC:19;
              then not z in A by A4,A20,XBOOLE_0:def 4;
              then z in f.: F by A21,XBOOLE_0:def 3;
              then consider C being object such that
A22:          C in F and
              C in F and
A23:          z = f.C by FUNCT_2:64;
              reconsider C as Subset of X by A22;
              consider w being Point of X such that
A24:          C = Cl {w} and
              w in D by A22;
              Cl {z} = Cl {x} by A20,Th49;
              then f.(Cl {w}) = a by A8,A22,A23,A24,Th49;
              hence y in {a} by A23,A24,TARSKI:def 1;
            end;
            then
A25:        M /\ Cl {x} c= {a} by TARSKI:def 3;
A26:        a in f.: F by A17,FUNCT_2:35;
            hence a in M by A18;
            a in Cl {x} by A8,A17;
            then
A27:        {a} c= Cl {x} by ZFMISC_1:31;
            {a} c= M by A18,A26,ZFMISC_1:31;
            then {a} c= M /\ Cl {x} by A27,XBOOLE_1:19;
            hence M /\ Cl {x} = {a} by A25;
          end;
          hence thesis;
        end;
      end;
      hence thesis;
    end;
    hence M is maximal_discrete by Th58;
  end;
end;
