reserve T for 1-sorted;
reserve T for TopSpace;

theorem Th30:
  for T being TopSpace holds LattStr(#Domains_of T,D-Union T,
    D-Meet T#) is C_Lattice
proof
  let T be TopSpace;
  set L = LattStr(#Domains_of T,D-Union T,D-Meet T#);
A1: L is join-commutative
  proof
    let a,b be Element of L;
    reconsider A = a, B = b as Element of Domains_of T;
    thus a"\/"b = Int(Cl(B \/ A)) \/ (B \/ A) by Def2
      .= b"\/"a by Def2;
  end;
A2: L is meet-absorbing
  proof
    let a,b be Element of L;
    reconsider A = a, B = b as Element of Domains_of T;
A3: Cl(Int(A /\ B)) /\ (A /\ B) c= A /\ B by XBOOLE_1:17;
    B in { D where D is Subset of T : D is condensed };
    then ex D being Subset of T st D = B & D is condensed;
    then
A4: Int(Cl(B)) c= B by TOPS_1:def 6;
A5: A /\ B c= B by XBOOLE_1:17;
    a"/\"b = Cl(Int(A /\ B)) /\ (A /\ B) by Def3;
    hence (a"/\"b)"\/"b = Int(Cl((Cl(Int(A /\ B)) /\ (A /\ B)) \/ B)) \/ ((Cl(
    Int(A /\ B)) /\ (A /\ B)) \/ B) by Def2
      .= Int(Cl((Cl(Int(A /\ B)) /\ (A /\ B)) \/ B)) \/ B by A3,A5,XBOOLE_1:1
,12
      .= Int(Cl(B)) \/ B by A3,A5,XBOOLE_1:1,12
      .= b by A4,XBOOLE_1:12;
  end;
A6: L is join-associative
  proof
    let a,b,c be Element of L;
    reconsider A = a, B = b, C = c as Element of Domains_of T;
A7: a"\/"b = Int(Cl(A \/ B)) \/ (A \/ B) by Def2;
    b"\/"c = Int(Cl(B \/ C)) \/ (B \/ C) by Def2;
    hence a"\/"(b"\/"c) = Int(Cl(A \/ (Int(Cl(B \/ C)) \/ (B \/ C)))) \/ (A \/
    (Int(Cl(B \/ C)) \/ (B \/ C))) by Def2
      .= Int Cl(A \/ (B \/ C)) \/ (A \/ (B \/ C)) by Th10
      .= Int Cl(A \/ (B \/ C)) \/ (A \/ B \/ C) by XBOOLE_1:4
      .= Int Cl(A \/ B \/ C) \/ (A \/ B \/ C) by XBOOLE_1:4
      .= Int(Cl((Int(Cl(A \/ B)) \/ (A \/ B)) \/ C)) \/ ((Int(Cl(A \/ B)) \/
    (A \/ B)) \/ C) by Th10
      .= (a"\/"b)"\/"c by A7,Def2;
  end;
A8: L is meet-commutative
  proof
    let a,b be Element of L;
    reconsider A = a, B = b as Element of Domains_of T;
    thus a"/\"b = Cl(Int(B /\ A)) /\ (B /\ A) by Def3
      .= b"/\"a by Def3;
  end;
A9: L is join-absorbing
  proof
    let a,b be Element of L;
    reconsider A = a, B = b as Element of Domains_of T;
A10: A c= (A \/ B) by XBOOLE_1:7;
    A in { D where D is Subset of T : D is condensed };
    then ex D being Subset of T st D = A & D is condensed;
    then
A11: A c= Cl(Int(A)) by TOPS_1:def 6;
A12: (A \/ B) c= Int(Cl(A \/ B)) \/ (A \/ B) by XBOOLE_1:7;
    a"\/"b = Int(Cl(A \/ B)) \/ (A \/ B) by Def2;
    hence a"/\"(a"\/"b) = Cl(Int(A /\ (Int(Cl(A \/ B)) \/ (A \/ B)))) /\ (A /\
    (Int(Cl(A \/ B)) \/ (A \/ B))) by Def3
      .= Cl(Int(A /\ (Int(Cl(A \/ B)) \/ (A \/ B)))) /\ A by A10,A12,XBOOLE_1:1
,28
      .= Cl(Int(A)) /\ A by A10,A12,XBOOLE_1:1,28
      .= a by A11,XBOOLE_1:28;
  end;
  L is meet-associative
  proof
    let a,b,c be Element of L;
    reconsider A = a, B = b, C = c as Element of Domains_of T;
A13: a"/\"b = Cl(Int(A /\ B)) /\ (A /\ B) by Def3;
    b"/\"c = Cl(Int(B /\ C)) /\ (B /\ C) by Def3;
    hence a"/\"(b"/\"c) = Cl(Int(A /\ (Cl(Int(B /\ C)) /\ (B /\ C)))) /\ (A /\
    (Cl(Int(B /\ C)) /\ (B /\ C))) by Def3
      .= Cl Int(A /\ (B /\ C)) /\ (A /\ (B /\ C)) by Th12
      .= Cl Int(A /\ (B /\ C)) /\ (A /\ B /\ C) by XBOOLE_1:16
      .= Cl Int(A /\ B /\ C) /\ (A /\ B /\ C) by XBOOLE_1:16
      .= Cl(Int((Cl(Int(A /\ B)) /\ (A /\ B)) /\ C)) /\ ((Cl(Int(A /\ B)) /\
    (A /\ B)) /\ C) by Th12
      .= (a"/\"b)"/\"c by A13,Def3;
  end;
  then reconsider L as Lattice by A1,A6,A2,A8,A9;
A14: L is lower-bounded
  proof
    {} T is condensed by Th14;
    then {} T in { D where D is Subset of T : D is condensed };
    then reconsider c = {} T as Element of L;
    take c;
    let a be Element of L;
    reconsider C = c, A = a as Element of Domains_of T;
    C /\ A = C;
    hence c"/\"a = Cl(Int(C)) /\ C by Def3
      .= c;
    hence a"/\"c = c;
  end;
  L is upper-bounded
  proof
    [#] T is condensed by Th15;
    then [#] T in { D where D is Subset of T : D is condensed };
    then reconsider c = [#] T as Element of L;
    take c;
    let a be Element of L;
    reconsider C = c, A = a as Element of Domains_of T;
    C \/ A = C by XBOOLE_1:12;
    hence c"\/"a = Int(Cl(C)) \/ C by Def2
      .= c by XBOOLE_1:12;
    hence a"\/"c = c;
  end;
  then reconsider L as 01_Lattice by A14;
  L is complemented
  proof
    [#] T is condensed by Th15;
    then [#] T in { D where D is Subset of T : D is condensed};
    then reconsider c = [#] T as Element of L;
    let b be Element of L;
    reconsider B = b as Element of Domains_of T;
A15: (B`) misses B by XBOOLE_1:79;
    B in { D where D is Subset of T : D is condensed};
    then ex D being Subset of T st D = B & D is condensed;
    then B` is condensed by Th16;
    then B` in { D where D is Subset of T : D is condensed};
    then reconsider a = B` as Element of L;
    take a;
A16: for v being Element of L holds (the L_meet of L).(c,v) = v
    proof
      let v be Element of L;
      reconsider V = v as Element of Domains_of T;
      V in { D where D is Subset of T : D is condensed};
      then ex D being Subset of T st D = V & D is condensed;
      then
A17:  V c= Cl(Int V) by TOPS_1:def 6;
      thus (the L_meet of L).(c,v) = Cl(Int([#] T /\ V)) /\ ([#] T /\ V) by
Def3
        .= Cl(Int([#] T /\ V)) /\ V by XBOOLE_1:28
        .= Cl(Int V) /\ V by XBOOLE_1:28
        .= v by A17,XBOOLE_1:28;
    end;
    thus a"\/"b = Int(Cl(B` \/ B)) \/ (B` \/ B) by Def2
      .= Int(Cl(B` \/ B)) \/ ([#] T) by PRE_TOPC:2
      .= c by XBOOLE_1:12
      .= Top L by A16,LATTICE2:17;
    hence b"\/"a = Top L;
    {} T is condensed by Th14;
    then {} T in { D where D is Subset of T : D is condensed};
    then reconsider c = {} T as Element of L;
A18: for v being Element of L holds (the L_join of L).(c,v) = v
    proof
      let v be Element of L;
      reconsider V = v as Element of Domains_of T;
      V in { D where D is Subset of T : D is condensed};
      then ex D being Subset of T st D = V & D is condensed;
      then
A19:  Int(Cl V) c= V by TOPS_1:def 6;
      thus (the L_join of L).(c,v) = Int(Cl({} T \/ V)) \/ ({} T \/ V) by Def2
        .= Int(Cl((([#]T)`) \/ V)) \/ ({} T \/ V) by XBOOLE_1:37
        .= Int(Cl((([#]T)`) \/ (V``))) \/ ((([#]T)`) \/ V) by XBOOLE_1:37
        .= Int(Cl((([#] T) /\ V`)`)) \/ (([#] T)` \/ (V``)) by XBOOLE_1:54
        .= Int(Cl((([#] T) /\ V`)`)) \/ ((([#] T) /\ V`)`) by XBOOLE_1:54
        .= Int(Cl((V`)`)) \/ ((([#] T) /\ V`))` by XBOOLE_1:28
        .= Int(Cl V) \/ ((V``)) by XBOOLE_1:28
        .= v by A19,XBOOLE_1:12;
    end;
    thus a"/\"b = Cl(Int((B`) /\ B)) /\ ((B`) /\ B) by Def3
      .= Cl(Int((B`) /\ B)) /\ ({} T) by A15
      .= Bottom L by A18,LATTICE2:15;
    hence b"/\"a = Bottom L;
  end;
  hence thesis;
end;
