Theory Topology_ZF_4a

(* 
    This file is a part of IsarMathLib - 
    a library of formalized mathematics written for Isabelle/Isar.

    Copyright (C) 2019-2022 Slawomir Kolodynski

    This program is free software; Redistribution and use in source and binary forms, 
    with or without modification, are permitted provided that the following conditions are met:

   1. Redistributions of source code must retain the above copyright notice, 
   this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright notice, 
   this list of conditions and the following disclaimer in the documentation and/or 
   other materials provided with the distribution.
   3. The name of the author may not be used to endorse or promote products 
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)

section  Topology and neighborhoods 

theory Topology_ZF_4a imports Topology_ZF_4
begin

text This theory considers the relations between topology and systems of neighborhood filters. 

subsection Neighborhood systems 

text The standard way of defining a topological space is by specifying a collection
of sets that we consider "open" (see the Topology_ZF› theory). 
An alternative of this approach is to define a collection of neighborhoods for each point of 
the space.  

text We define a neighborhood system as a function that takes each point $x\in X$ and assigns it 
  a collection of subsets of $X$ which is called the neighborhoods of $x$. 
  The neighborhoods of a point $x$ form a filter that satisfies an additional
  axiom that for every neighborhood $N$ of $x$ we can find another one $U$ such that $N$ 
  is a neighborhood of every point of $U$. 

definition
  IsNeighSystem ("_ {is a neighborhood system on} _" 90)
  where " {is a neighborhood system on} X  ( : XPow(Pow(X))) 
  (xX. (`(x) {is a filter on} X)  (N`(x). xN  (U`(x).yU.(N`(y)) ) ))"

text A neighborhood system on $X$ consists of collections of subsets of $X$. 

lemma neighborhood_subset:
  assumes " {is a neighborhood system on} X" and "xX" and "N`(x)"
  shows "NX" and "xN"
proof -
  from  {is a neighborhood system on} X have " : XPow(Pow(X))"
    unfolding IsNeighSystem_def by simp
  with xX have "`(x)  Pow(Pow(X))" using apply_funtype by blast
  with N`(x) show "NX" by blast
  from assms show "xN" using IsNeighSystem_def by simp
qed

textSome sources (like Wikipedia) use a bit different definition of neighborhood systems
where the $U$ is required to be contained in $N$. The next lemma shows that this stronger version 
can be recovered from our definition. 

lemma neigh_def_stronger:
  assumes " {is a neighborhood system on} X" and "xX" and "N`(x)"
  shows "U`(x).UN  (yU.(N`(y)))" 
proof -
  from assms obtain W where "W`(x)" and areNeigh:"yW.(N`(y))"
    using  IsNeighSystem_def by blast
  let ?U = "NW"
  from assms W`(x) have "?U  `(x)" 
    unfolding IsNeighSystem_def IsFilter_def by blast 
  moreover have "?UN" by blast
  moreover from areNeigh have "y?U.(N`(y))" by auto 
  ultimately show ?thesis by auto 
qed

subsection From a neighborhood system to topology 

textGiven a neighborhood system $\{\mathcal{M}_x\}_{x\in X}$ we can define a topology on $X$.
Namely, we consider a subset of $X$ open if $U \in \mathcal{M}_x$ for every element $x$ of $U$. 

textThe collection of sets defined as above is indeed a topology. 

theorem topology_from_neighs: 
  assumes " {is a neighborhood system on} X"
  defines Tdef: "T  {UPow(X). xU. U  `(x)}"
  shows "T {is a topology}" and "T = X"
proof -
  { fix 𝔘 assume "𝔘  Pow(T)"
    have "𝔘  T"
    proof -
      from 𝔘  Pow(T) Tdef have "𝔘  Pow(X)" by blast
      moreover
      { fix x assume "x  𝔘"
        then obtain U where "U𝔘" and "xU" by blast
        with assms 𝔘  Pow(T) 
        have "U  `(x)" and "U  𝔘" and  "`(x) {is a filter on} X"
          unfolding IsNeighSystem_def by auto
        with 𝔘  Pow(X) have "𝔘  `(x)" unfolding IsFilter_def
          by simp
      } 
      ultimately show "𝔘  T" using Tdef by blast
    qed 
  }        
  moreover
  { fix U V assume "UT" and "VT"
    have "UV  T"
    proof -
      from Tdef UT  UT have "UV  Pow(X)" by auto 
      moreover
      { fix x assume "x  UV"
        with assms UT VT Tdef have "U  `(x)" "V  `(x)" and  "`(x) {is a filter on} X"
          unfolding IsNeighSystem_def by auto 
        then have "UV  `(x)" unfolding IsFilter_def by simp
      }
      ultimately show "UV T" using Tdef by simp
    qed
  }
  ultimately show "T {is a topology}" unfolding IsATopology_def by blast 
  from assms show "T = X" unfolding IsNeighSystem_def IsFilter_def by blast
qed

text Some sources (like Wikipedia) define the open sets generated by a neighborhood system
  "as those sets containing a neighborhood of each of their points". The next lemma shows that
  this definition is equivalent to the one we are using.

lemma topology_from_neighs1:
  assumes " {is a neighborhood system on} X"
  shows "{UPow(X). xU. U  `(x)} = {UPow(X). xU. V  `(x). VU}"
proof
  let ?T = "{UPow(X). xU. U  `(x)}"
  let ?S = "{UPow(X). xU. V  `(x). VU}"
  show "?S?T"
  proof -
    { fix U assume "U?S"
      then have "UPow(X)" by simp
      moreover
      from assms U?S UPow(X) have "xU. U  `(x)"
        unfolding IsNeighSystem_def IsFilter_def by blast 
      ultimately have "U?T" by auto
    } thus ?thesis by auto
  qed
  show "?T?S" by auto
qed

subsectionFrom a topology to a neighborhood system

text Once we have a topology $T$ we can define a natural neighborhood system on $X=\bigcup T$. 
  In this section we define such neighborhood system and prove its basic properties.  

textFor a topology $T$ we define a neighborhood system of $T$ as a function that takes an $x\in X=\bigcup T$ 
and assigns it the collection of supersets of open sets containing $x$. 
We call that the "neighborhood system of $T$"

definition
  NeighSystem ("{neighborhood system of} _" 91)
  where "{neighborhood system of} T  { x,{NPow(T).UT.(xU  UN)}. x  T }" 

textThe way we defined the neighborhood system of $T$ means that
  it is a function on $\bigcup T$. 

lemma neigh_fun: shows "({neighborhood system of} T): T  Pow(Pow(T))"
proof -
  let ?X = "T"
  have "x?X. {NPow(?X).UT.(xU  UN)}  Pow(Pow(?X))"
    by blast
  then show ?thesis unfolding NeighSystem_def using ZF_fun_from_total
    by simp
qed 

textThe value of the neighborhood system of $T$ at $x\in \bigcup T$ 
  is the collection of supersets of open sets containing $x$.

lemma neigh_val: assumes "xT"
  shows "({neighborhood system of} T)`(x) = {NPow(T).UT.(xU  UN)}"
  using assms ZF_fun_from_tot_val1 unfolding NeighSystem_def
  by simp
  
text The next lemma shows that open sets are members of (what we will prove later to be)
   the natural neighborhood system on $X=\bigcup T$. 

lemma open_are_neighs:
  assumes "UT" "xU"
  shows "x  T" and "U  {VPow(T).UT.(xU  UV)}"
  using assms by auto
  
text Another fact we will need is that for every $x\in X=\bigcup T$ the neighborhoods of $x$
  form a filter 

lemma neighs_is_filter:
  assumes "T {is a topology}" and "x  T" 
  defines Mdef: "  {neighborhood system of} T"
  shows "`(x) {is a filter on} (T)"
proof -
  let ?X = "T"
  let ?𝔉 = "{VPow(?X).UT.(xU  UV)}"
  have "0?𝔉" by blast 
  moreover have "?X?𝔉"
  proof -
    from assms x?X have "?X  Pow(?X)" "?XT" and "x?X  ?X?X" using carr_open 
      by auto
    hence "UT.(xU  U?X)" by auto
    thus ?thesis by auto
  qed
  moreover have "A?𝔉. B?𝔉. AB  ?𝔉"
  proof -
    { fix A B assume "A?𝔉" "B?𝔉"
      then obtain UA UB where "UAT" "xUA" "UAA" "UBT" "xUB" "UBB" 
        by auto
      with T {is a topology} A?𝔉 B?𝔉 have "AB  Pow(?X)" and 
        "UAUB  T" "x  UAUB" "UAUB  AB" using IsATopology_def 
        by auto
      hence "AB  ?𝔉" by blast
    } thus ?thesis by blast
  qed
  moreover have "B?𝔉. CPow(?X). BC  C?𝔉"
  proof -
    { fix B C assume "B?𝔉" "C  Pow(?X)" "BC"
      then obtain U where "UT" and "xU" "UB" by blast
      with C  Pow(?X) BC have "C?𝔉" by blast
    } thus ?thesis by auto
  qed
  ultimately have "?𝔉 {is a filter on} ?X" unfolding IsFilter_def by blast
  with Mdef x?X show "`(x) {is a filter on} ?X" using ZF_fun_from_tot_val1 NeighSystem_def
    by simp
qed

textThe next theorem states that the the natural 
  neighborhood system on $X=\bigcup T$ indeed is a neighborhood system. 

theorem neigh_from_topology:
  assumes "T {is a topology}"
  shows "({neighborhood system of} T) {is a neighborhood system on} (T)"
proof -
  let ?X = "T"
  let ?ℳ = "{neighborhood system of} T" 
  have "?ℳ : ?XPow(Pow(?X))"
  proof -
    { fix x assume "x?X"
      hence "{VPow(T).UT.(xU  UV)}  Pow(Pow(?X))" by auto
    } hence "x?X. {VPow(T).UT.(xU  UV)}  Pow(Pow(?X))" by auto
    then show ?thesis using ZF_fun_from_total NeighSystem_def by simp
  qed
  moreover from assms have "x?X. (?ℳ`(x) {is a filter on} ?X)"
    using neighs_is_filter NeighSystem_def by auto 
  moreover have "x?X. N?ℳ`(x). xN  (U?ℳ`(x).yU.(N?ℳ`(y)))"
  proof -
    { fix x N assume "x?X" "N  ?ℳ`(x)"
      let ?𝔉 = "{VPow(?X).UT.(xU  UV)}"
      from x?X have "?ℳ`(x) = ?𝔉" using ZF_fun_from_tot_val1 NeighSystem_def 
        by simp
      with N  ?ℳ`(x) have "N?𝔉" by simp
      hence "xN" by blast
      from N?𝔉 obtain U where "UT" "xU" and "UN" by blast 
      with N?𝔉 ?ℳ`(x) = ?𝔉 have "U  ?ℳ`(x)" by auto 
      moreover from assms UT  UN N?𝔉 have  "yU.(N  ?ℳ`(y))"
        using ZF_fun_from_tot_val1 open_are_neighs neighs_is_filter 
                NeighSystem_def IsFilter_def by auto
      ultimately have "U?ℳ`(x).yU.(N?ℳ`(y))" by blast
      with xN have "xN  (U?ℳ`(x).yU.(N?ℳ`(y)))" by simp      
    } thus ?thesis by auto 
  qed
  ultimately show ?thesis unfolding IsNeighSystem_def by blast
qed

textAny neighborhood of an element of the closure of a subset intersects the subset.

lemma neigh_inter_nempty: 
  assumes "T {is a topology}" "AT" "x  Closure(A,T)" and
  "N  ({neighborhood system of} T)`(x)"
  shows "NA  0"
proof -
  let ?X = "T"
  from assms(1) have cntx: "topology0(T)" 
    unfolding topology0_def by simp
  with assms(2,3) have "x?X"
    using topology0.Top_3_L11(1) by blast
  with assms(4) obtain U where "UT" "xU" and "UN"
    using neigh_val by auto
  from assms(2,3) cntx UT xU have "AU  0"
    using topology0.cl_inter_neigh by simp
  with UN show "NA  0" by blast
qed

subsection Neighborhood systems are 1:1 with topologies 

textWe can create a topology from a neighborhood system and neighborhood system from topology.
  The question is then if we start from a neighborhood system, create a topology from it 
  then create the topology's natural neighborhood system, do we get back the neighborhood system 
  we started from? Similarly, if we start from a topology, create its neighborhood system and then
  create a topology from that, do we get the original topology? This section provides 
  the affirmative answer (for now only for the first question). 
  This means that there is a one-to-one correspondence between the set of topologies on a set 
  and the set of abstract neighborhood systems on the set. 

textEach abstract neighborhood of $x$ contains an open neighborhood of $x$.

lemma open_nei_in_nei: 
  assumes " {is a neighborhood system on} X" "xX" "N`(x)"
  defines Tdef: "T  {UPow(X). xU. U  `(x)}"
  shows "NPow(X)" and "UT. (xU  UN)"
proof -
  from assms(1) have ":XPow(Pow(X))" unfolding IsNeighSystem_def 
    by simp
  with assms(2,3) show "NPow(X)"using apply_funtype by blast
  let ?U = "{yX. N  `(y)}"
  have "?UT"
  proof -
    have "?U  Pow(X)" by auto
    moreover have "y?U. ?U`(y)"
    proof -
      { fix y assume "y?U"
        then have "yX" and "N`(y)" by auto
        with assms(1) obtain V where "V`(y)" and "zV. N  `(z)"
          unfolding IsNeighSystem_def by blast
        with assms(1) yX V`(y) have "V?U"
          using neighborhood_subset(1) by blast
        with assms(1) yX V`(y) ?U  Pow(X) have "?U`(y)"
          unfolding IsNeighSystem_def using is_filter_def_split(5) by blast
      } thus ?thesis by simp
    qed
    ultimately have "?U  {UPow(X). xU. U  `(x)}" by simp
    with assms(4) show "?UT" by simp
  qed
  moreover from assms(1,2) N`(x) have "x?U  ?U  N"
    using neighborhood_subset(2) by auto
  ultimately show "UT. (xU  UN)" by (rule witness_exists)
qed

textIn the the next theorem we show that if we start from 
  a neighborhood system, create a topology from it, then create it's natural neighborhood system,
  we get back the original neighborhood system.

theorem nei_top_nei_round_trip: 
  assumes " {is a neighborhood system on} X"
  defines Tdef: "T  {UPow(X). xU. U  `(x)}"
  shows "({neighborhood system of} T) = "
proof -
  let ?M = "{neighborhood system of} T"
  from assms have "T {is a topology}" and "T = X" using topology_from_neighs 
    by auto
  then have "?M {is a neighborhood system on} X" using neigh_from_topology 
    by blast
  with assms(1) have "?M:XPow(Pow(X))" and ":XPow(Pow(X))"
    unfolding IsNeighSystem_def by auto
  moreover
  { fix x assume "xX"
    from T = X xX have I: "?M`(x) = {VPow(X).UT.(xU  UV)}"
      unfolding NeighSystem_def using ZF_fun_from_tot_val1 by simp
    have "?M`(x) = `(x)"
    proof
      { fix V assume "V?M`(x)"
        with I obtain U where "UT" "xU" "UV" by auto
        from assms(2) UT xU have "U  `(x)" by simp
        from assms(1) xX have "`(x) {is a filter on} X"
          unfolding IsNeighSystem_def by simp
        with U  `(x) V?M`(x) I UV  have "V  `(x)"
          unfolding IsFilter_def by simp
      } thus "?M`(x)  `(x)" by auto
      { fix N assume "N`(x)"
        with assms xX T = X I have "N?M`(x)" using open_nei_in_nei 
          by auto
      } thus "`(x)  ?M`(x)" by auto
    qed
  } hence "xX. ?M`(x) = `(x)" by simp
  ultimately show ?thesis by (rule func_eq)
qed

subsectionSet neighborhoods

textSome sources (like Metamath) take a somewhat different approach where instead of defining
  the collection of neighborhoods of a point $x\in X$ they define a collection of neighborhoods
  of a subset of $X$ (where $X$ is the carrier of a topology  $T$ (i.e. $X=\bigcup T$).
  In this approach a neighborhood system is a function whose domain is the powerset of $X$, i.e.
  the set of subsets of $X$. The two approaches are equivalent in a sense as
  having a neighborhood system we can create a set neighborhood system and vice versa. 

textWe define a set neighborhood system as a function that takes a subset $A$ of the carrier of the
  topology and assigns it the collection of supersets of all open sets that contain $A$. 

definition
  SetNeighSystem ( "{set neighborhood system of} _" 91)
  where "{set neighborhood system of} T 
           {A,{NPow(T). UT. (AU  UN)}. APow(T)}" 

textGiven a set neighborhood system we can recover the (standard)
  neighborhood system by taking the values of the set neighborhood system
  at singletons ${x}$ where $x\in X=\bigcup T$.

lemma neigh_from_nei: assumes "xT"
  shows "({neighborhood system of} T)`(x) = ({set neighborhood system of} T)`{x}"
  using assms ZF_fun_from_tot_val1
  unfolding NeighSystem_def SetNeighSystem_def
  by simp

textThe set neighborhood system of $T$ is a function mapping subsets of $\bigcup T$
  to collections of subsets of $\bigcup T$. 

lemma nei_fun: 
  shows "({set neighborhood system of} T):Pow(T) Pow(Pow(T))"
proof -
  let ?X = "T"
  have "APow(?X). {NPow(?X). UT. (AU  UN)}  Pow(Pow(?X))"
    by blast
  then have 
    "{A,{NPow(?X). UT. (AU  UN)}. APow(?X)}:Pow(?X)Pow(Pow(?X))"
    by (rule ZF_fun_from_total)
  then show ?thesis unfolding SetNeighSystem_def by simp
qed

textThe value of the set neighborhood system of $T$ at subset $A$ of $\bigcup T$
  is the collection of subsets $N$ of $\bigcup T$ for which exists an open subset
  $U\subseteq N$ that contains $A$. 

lemma nei_val: assumes "A  T"
  shows
  "({set neighborhood system of} T)`(A) = {NPow(T). UT. (AU  UN)}"
  using assms ZF_fun_from_tot_val1 unfolding SetNeighSystem_def by simp

textA member of the value of the set neighborhood system of $T$ at $A$ is
  a subset of $\bigcup T$. The interesting part is that we can show it without any
  assumption on $A$. 

lemma nei_val_subset: 
  assumes "N  ({set neighborhood system of} T)`(A)"
  shows "A  T" and "N  T"
proof -
  let ?f = "{set neighborhood system of} T"
  have "?f:Pow(T) Pow(Pow(T))" using nei_fun by simp
  with assms show "A  T" using arg_in_domain by blast
  with assms show "N  T" using nei_val by simp
qed

textIf $T$ is a topology, then every subset of its carrier (i.e. $\bigcup T$) 
  is a (set) neighborhood of the empty set. 

lemma nei_empty: assumes "T {is a topology}" "N  T"
  shows "N  ({set neighborhood system of} T)`(0)"
  using assms empty_open nei_val by auto

textIf $T$ is a topology, then the (set) neighborhoods of a nonempty subset of 
  $\bigcup T$ form a filter on $X=\bigcup T$.

theorem nei_filter: assumes "T {is a topology}" "D  (T)" "D0"
  shows "({set neighborhood system of} T)`(D) {is a filter on} (T)"
proof -
  let ?X = "T"
  let ?ℱ = "({set neighborhood system of} T)`(D)"
  from assms(2) have I: "?ℱ = {NPow(?X). UT. (DU  UN)}"
    using nei_val by simp
  with assms(3) have "0  ?ℱ" by auto
  moreover from assms(1,2) I have "?X?ℱ"
    using carr_open by auto
  moreover from I have "?ℱ  Pow(?X)" by auto
  moreover have "A?ℱ. B?ℱ. AB  ?ℱ"
  proof -
    { fix A B assume "A?ℱ" "B?ℱ"
      with I obtain UA UB where 
        "UAT" "DUA" "UAA" and "UBT" "DUB" "UBB"
        by auto
      let ?U = "UAUB"
      from assms(1) UAT UBT DUA DUB UAA UBB
      have "?U  T" "D?U" "?U  AB"
        unfolding IsATopology_def by auto
      with I A?ℱ B?ℱ have "AB  ?ℱ" by auto
    } thus ?thesis by simp
  qed
  moreover have "B?ℱ. CPow(?X). BC  C?ℱ"
  proof -
    { fix B C assume "B?ℱ" "CPow(?X)" "BC"
      from I B?ℱ obtain U where "UT" "DU" and "UB"
        by auto
      with BC have "UT. (DU  UC)" by blast
      with I CPow(?X) have "C?ℱ" by simp
    } thus ?thesis by blast
  qed
  ultimately show "?ℱ {is a filter on} ?X"
    unfolding IsFilter_def by simp
qed  
    
textIf $N$ is a (set) neighborhood of $A$ in $T$, then exist an open set $U$ such that
  $N$ contains $U$ which contains $A$. This is similar to the Metamath's theorem
  with the same name, except that here we do not need assume that $T$ is a topology
  (which is a bit worrying).

lemma neii2: assumes "N  ({set neighborhood system of} T)`(A)"
  shows "UT. (AU  UN)"
proof -
  from assms have "APow(T)" using nei_fun arg_in_domain
    by blast
  with assms show ?thesis
    unfolding SetNeighSystem_def using ZF_fun_from_tot_val1
    by simp
qed

textAn open set $U$ covering a set $A$ is a set neighborhood of $A$. 

lemma open_superset_nei: assumes "VT" "AV"
  shows "V  ({set neighborhood system of} T)`(A)"
proof -
  from assms have 
    "({set neighborhood system of} T)`(A) = {NPow(T). UT. (AU  UN)}"
    using nei_val by blast
  with assms show ?thesis by auto
qed

textAn open set is a set neighborhood of itself.

corollary open_is_nei: assumes "VT"
  shows "V  ({set neighborhood system of} T)`(V)"
  using assms open_superset_nei by simp

textAn open neighborhood of $x$ is a set neighborhood of $\{ x\}$. 

corollary open_nei_singl: assumes "VT" "xV"
  shows  "V  ({set neighborhood system of} T)`{x}"
  using assms open_superset_nei by simp

textThe Cartesian product of two neighborhoods is a neighborhood in the 
  product topology. Similar to the Metamath's theorem with the same name. 

lemma neitx: 
  assumes "T {is a topology}" "S {is a topology}" and
  "A  ({set neighborhood system of} T)`(C)" and
  "B  ({set neighborhood system of} S)`(D)"
  shows "A×B  ({set neighborhood system of} (T×tS))`(C×D)"
proof -
  have "A×B  (T×tS)"
  proof -
    from assms(3,4) have "A×B  (T)×(S)"
      using nei_val_subset(2) by blast
    with assms(1,2) show ?thesis using Top_1_4_T1 by simp
  qed
  let ?ℱ = "({set neighborhood system of} (T×tS))`(C×D)"
  { assume "C=0  D=0"
    with assms(1,2) A×B  (T×tS) have "A×B  ?ℱ"
      using Top_1_4_T1(1) nei_empty by auto
  }
  moreover
  { assume "C0" "D0"
    from assms(3) obtain UA where 
      "UAT" "CUA" "UAA" using neii2 by blast
    from assms(4) obtain UB where 
      "UBS" "DUB" "UBB" using neii2 by blast
    from assms(1,2) UAT UBS CUA DUB
    have "UA×UB  T×tS" and "C×D  UA×UB"
      using prod_open_open_prod by auto
    then have "UA×UB  ?ℱ" using open_superset_nei 
      by simp
    from UAA UBB have "UA×UB  A×B" by auto
    have "?ℱ {is a filter on} ((T×tS))"
    proof -
      from assms(1,2) have "(T×tS) {is a topology}"
        using Top_1_4_T1(1) by simp
      moreover have "C×D  (T×tS)"
      proof -
        from assms(3,4) have "C×D  (T)×(S)"
          using nei_val_subset(1) by blast
        with assms(1,2) show ?thesis using Top_1_4_T1(3) by simp
      qed 
      moreover from C0 D0 have "C×D  0" by auto
      ultimately show "?ℱ {is a filter on} ((T×tS))"
        using nei_filter by simp
    qed
    with UA×UB  ?ℱ A×B  (T×tS) UA×UB  A×B 
    have "A×B  ?ℱ" using is_filter_def_split(5) by simp
  }
  ultimately show ?thesis by auto
qed

textAny neighborhood of an element of the closure of a subset intersects the subset.
  This is practically the same as neigh_inter_nempty›, just formulated in terms 
  of set neighborhoods of singletons. 
  Compare with Metamath's theorem with the same name.

lemma neindisj: assumes "T {is a topology}" "AT" "x  Closure(A,T)" and
  "N  ({set neighborhood system of} T)`{x}"
  shows "NA  0"
proof -
  let ?X = "T"
  from assms(1) have cntx: "topology0(T)" 
    unfolding topology0_def by simp
  with assms(2,3) have "x?X"
    using topology0.Top_3_L11(1) by blast
  with assms show ?thesis using neigh_from_nei neigh_inter_nempty
    by simp
qed

end