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

theorem Th41:
  for A being Subset of X st A is open holds A is maximal_discrete
  implies A is dense
proof
  let A be Subset of X;
  assume
A1: A is open;
  assume
A2: A is maximal_discrete;
  then
A3: A is discrete;
  assume A is not dense;
  then Cl A <> the carrier of X by TOPS_3:def 2;
  then (the carrier of X) \ Cl A <> {} by Lm3;
  then consider a being object such that
A4: a in (the carrier of X) \ Cl A by XBOOLE_0:def 1;
  reconsider a as Point of X by A4;
  set B = A \/ {a};
A5: A c= B by XBOOLE_1:7;
A6: now
    let x be Point of X;
    assume x in B;
    then
A7: x in A or x in {a} by XBOOLE_0:def 3;
    now
      per cases by A7,TARSKI:def 1;
      suppose
A8:     x in A;
        then
A9:     ex G being Subset of X st G is open & A /\ G = {x} by A3,Th26;
        now
          take E = {x};
          thus E is open by A1,A9;
          {x} c= B by A5,A8,ZFMISC_1:31;
          hence B /\ E = {x} by XBOOLE_1:28;
        end;
        hence ex E being Subset of X st E is open & B /\ E = {x};
      end;
      suppose
A10:    x = a;
        now
          take G = [#]X \ Cl A;
A11:      B /\ G = (A /\ G) \/ ({a} /\ G) by XBOOLE_1:23;
A12:      G = (Cl A)`;
          hence G is open;
          A c= Cl A by PRE_TOPC:18;
          then A misses G by A12,SUBSET_1:24;
          then
A13:      A /\ G = {};
          {a} c= G by A4,ZFMISC_1:31;
          hence B /\ G = {x} by A10,A13,A11,XBOOLE_1:28;
        end;
        hence ex G being Subset of X st G is open & B /\ G = {x};
      end;
    end;
    hence ex G being Subset of X st G is open & B /\ G = {x};
  end;
  A c= Cl A by PRE_TOPC:18;
  then
A14: not a in A by A4,XBOOLE_0:def 5;
  ex D being Subset of X st D is discrete & A c= D & A <> D
  proof
    take B;
    thus B is discrete by A6,Th31;
    thus A c= B by XBOOLE_1:7;
    A <> B by A14,ZFMISC_1:31,XBOOLE_1:7;
    hence thesis;
  end;
  hence contradiction by A2;
end;
