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

theorem Th38:
  for T being TopSpace holds LattStr(#Open_Domains_of T,OPD-Union
    T,OPD-Meet T#) is B_Lattice
proof
  let T be TopSpace;
  set L = LattStr(#Open_Domains_of T,OPD-Union T,OPD-Meet T#);
A1: L is join-commutative
  proof
    let a,b be Element of L;
    reconsider A = a, B = b as Element of Open_Domains_of T;
    thus a"\/"b = Int(Cl(B \/ A)) by Def10
      .= b"\/"a by Def10;
  end;
A2: L is meet-absorbing
  proof
    let a,b be Element of L;
    reconsider A = a, B = b as Element of Open_Domains_of T;
    B in { D where D is Subset of T : D is open_condensed };
    then
A3: ex D being Subset of T st D = B & D is open_condensed;
    a"/\"b = A /\ B by Def11;
    hence (a"/\"b)"\/"b = Int(Cl((A /\ B) \/ B)) by Def10
      .= Int(Cl(B))by XBOOLE_1:22
      .= b by A3,TOPS_1:def 8;
  end;
A4: L is join-absorbing
  proof
    let a,b be Element of L;
    reconsider A = a, B = b as Element of Open_Domains_of T;
A5: A c= A \/ Int Cl B by XBOOLE_1:7;
    A in { D where D is Subset of T : D is open_condensed };
    then ex D being Subset of T st D = A & D is open_condensed;
    then
A6: A = Int Cl A by TOPS_1:def 8;
    Int(Cl A \/ Cl B) = Int(Cl(A \/ B)) by PRE_TOPC:20;
    then
A7: A \/ Int Cl B c= Int(Cl(A \/ B)) by A6,TOPS_1:20;
    a"\/"b = Int(Cl(A \/ B)) by Def10;
    hence a"/\"(a"\/"b) = A /\ Int(Cl(A \/ B)) by Def11
      .= a by A5,A7,XBOOLE_1:1,28;
  end;
A8: L is meet-associative
  proof
    let a,b,c be Element of L;
    reconsider A = a, B = b, C = c as Element of Open_Domains_of T;
A9: a"/\"b = A /\ B by Def11;
    b"/\"c = B /\ C by Def11;
    hence a"/\"(b"/\"c) = A /\ (B /\ C) by Def11
      .= (A /\ B) /\ C by XBOOLE_1:16
      .= (a"/\"b)"/\"c by A9,Def11;
  end;
A10: L is join-associative
  proof
    let a,b,c be Element of L;
    reconsider A = a, B = b, C = c as Element of Open_Domains_of T;
    A in { D where D is Subset of T : D is open_condensed };
    then
A11: ex D being Subset of T st D = A & D is open_condensed;
    B in { E where E is Subset of T : E is open_condensed };
    then
A12: ex E being Subset of T st E = B & E is open_condensed;
    C in { F where F is Subset of T : F is open_condensed };
    then
A13: ex F being Subset of T st F = C & F is open_condensed;
A14: a"\/"b = Int(Cl(A \/ B)) by Def10;
    b"\/"c = Int(Cl(B \/ C)) by Def10;
    hence a"\/"(b"\/"c) = Int(Cl(A \/ (Int(Cl(B \/ C))))) by Def10
      .= Int(Cl((Int(Cl(A \/ B)) \/ C))) by A11,A12,A13,Th29
      .= (a"\/"b)"\/"c by A14,Def10;
  end;
  L is meet-commutative
  proof
    let a,b be Element of L;
    reconsider A = a, B = b as Element of Open_Domains_of T;
    thus a"/\"b = B /\ A by Def11
      .= b"/\"a by Def11;
  end;
  then reconsider L as Lattice by A1,A10,A2,A8,A4;
A15: L is upper-bounded
  proof
A16: [#] T is open_condensed by Th21;
    then [#] T in { D where D is Subset of T : D is open_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 Open_Domains_of T;
    thus c"\/"a = Int(Cl(C \/ A)) by Def10
      .= Int(Cl(C)) by XBOOLE_1:12
      .= c by A16,TOPS_1:def 8;
    hence a"\/"c = c;
  end;
A17: L is distributive
  proof
    let a,b,c be Element of L;
    reconsider A = a, B = b, C = c as Element of Open_Domains_of T;
    A in { D where D is Subset of T : D is open_condensed };
    then consider D being Subset of T such that
A18: D = A and
A19: D is open_condensed;
A20: D is open by A19,TOPS_1:67;
A21: a"/\"c = A /\ C by Def11;
    C in { F where F is Subset of T : F is open_condensed };
    then consider F being Subset of T such that
A22: F = C and
    F is open_condensed;
    B in { E where E is Subset of T : E is open_condensed };
    then consider E being Subset of T such that
A23: E = B and
    E is open_condensed;
A24: a"/\"b = A /\ B by Def11;
    b"\/"c = Int(Cl(B \/ C)) by Def10;
    hence a"/\"(b"\/"c) = A /\ Int(Cl(B \/ C)) by Def11
      .= Int Cl A /\ Int(Cl(B \/ C)) by A18,A19,TOPS_1:def 8
      .= Int(Cl(D /\ (E \/ F))) by A18,A23,A22,A20,Th7
      .= Int(Cl((A /\ B) \/ (A /\ C))) by A18,A23,A22,XBOOLE_1:23
      .= (a"/\"b)"\/"(a"/\"c) by A24,A21,Def10;
  end;
A25: L is complemented
  proof
    [#] T is open_condensed by Th21;
    then [#] T in { K where K is Subset of T : K is open_condensed};
    then reconsider c = [#] T as Element of L;
    let b be Element of L;
    reconsider B = b as Element of Open_Domains_of T;
    B in { D where D is Subset of T : D is open_condensed};
    then consider D being Subset of T such that
A26: D = B and
A27: D is open_condensed;
A28: D is open by A27,TOPS_1:67;
    D is condensed by A27,TOPS_1:67;
    then Int B` is open_condensed by A26,Th16,Th25;
    then Int B` in { K where K is Subset of T : K is open_condensed};
    then reconsider a = Int B` as Element of L;
    take a;
A29: (B`) misses B by XBOOLE_1:79;
A30: 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 Open_Domains_of T;
      thus (the L_meet of L).(c,v) = [#] T /\ V by Def11
        .= v by XBOOLE_1:28;
    end;
    thus a"\/"b = Int(Cl(B \/ Int B`)) by Def10
      .= Int([#] T) by Th9
      .= c by TOPS_1:15
      .= Top L by A30,LATTICE2:17;
    hence b"\/"a = Top L;
    {} T is open_condensed by Th20;
    then {} T in { K where K is Subset of T : K is open_condensed};
    then reconsider c = {} T as Element of L;
A31: 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 Open_Domains_of T;
      V in { K where K is Subset of T : K is open_condensed};
      then
A32:  ex D being Subset of T st D = V & D is open_condensed;
      thus (the L_join of L).(c,v) = Int(Cl({} T \/ V)) by Def10
        .= Int Cl((([#]T)`) \/ (V``)) by XBOOLE_1:37
        .= Int Cl([#] T /\ V`)` by XBOOLE_1:54
        .= Int Cl(V``) by XBOOLE_1:28
        .= v by A32,TOPS_1:def 8;
    end;
    thus a"/\"b = (Int B`) /\ B by Def11
      .= (Int D`) /\ Int D by A26,A28,TOPS_1:23
      .= Int((B`) /\ B) by A26,TOPS_1:17
      .= Int {} T by A29
      .= Bottom L by A31,LATTICE2:15;
    hence b"/\"a = Bottom L;
  end;
  L is lower-bounded
  proof
    {} T is open_condensed by Th20;
    then {} T in { D where D is Subset of T : D is open_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 Open_Domains_of T;
    thus c"/\"a = C /\ A by Def11
      .= c;
    hence a"/\"c = c;
  end;
  hence thesis by A15,A25,A17;
end;
