Theory Topology_ZF_3

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

    Copyright (C) 2011, 2012  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 3

theory Topology_ZF_3 imports Topology_ZF_2 FiniteSeq_ZF

begin

textTopology_ZF_1› theory describes how we can define  a topology on a product
of two topological spaces. One way to generalize that is to construct topology for a cartesian
product of $n$ topological spaces. The cartesian product approach is somewhat inconvenient though.
Another way to approach product topology on $X^n$ is to model cartesian product as sets of 
sequences (of length $n$) of elements of $X$. This means that having a topology on $X$ we want
to define a toplogy on the space $n\rightarrow X$, where $n$ is a natural number (recall that 
$n = \{ 0,1,...,n-1\}$ in ZF). However, this in turn can be done more generally by defining a 
topology on any function space $I\rightarrow X$, where $I$ is any set of indices. This is what we 
do in this theory.

subsectionThe base of the product topology

textIn this section we define the base of the product topology.

textSuppose $\mathcal{X} = I\rightarrow \bigcup T$ is a space of functions from some index set $I$
to the carrier of a topology $T$. Then take a finite collection of open sets $W:N\rightarrow T$ 
indexed by $N\subseteq I$. We can define a subset of $\mathcal{X}$ that models the cartesian product of $W$.


definition
  "FinProd(𝒳,W)  {x𝒳.  idomain(W). x`(i)  W`(i)}"

textNow we define the base of the product topology as the collection of all finite products 
(in the sense defined above) of open sets. 


definition
  "ProductTopBase(I,T)   NFinPow(I).{FinProd(IT,W). WNT}"

textFinally, we define the product topology on sequences. We use the ''Seq'' 
prefix although the definition is good for any index sets, not only natural numbers.

definition
  "SeqProductTopology(I,T)  {B. B  Pow(ProductTopBase(I,T))}"

textProduct topology base is closed with respect to intersections.

lemma prod_top_base_inter: 
  assumes A1: "T {is a topology}" and  
  A2: "U  ProductTopBase(I,T)"  "V  ProductTopBase(I,T)"
  shows "UV  ProductTopBase(I,T)"
proof -
  let ?𝒳 = "IT"  
  from A2 obtain N1  W1 N2 W2 where 
    I: "N1  FinPow(I)"  "W1N1T"  "U = FinProd(?𝒳,W1)" and
    II: "N2  FinPow(I)"  "W2N2T"  "V = FinProd(?𝒳,W2)"
    using ProductTopBase_def by auto
  let ?N3 = "N1  N2"
  let ?W3 = "{i,if i  N1-N2 then W1`(i) 
        else if i  N2-N1 then  W2`(i) 
        else (W1`(i))  (W2`(i)). i  ?N3}"
  from A1 I II have "i  N1  N2.  (W1`(i)  W2`(i))  T"
      using apply_funtype IsATopology_def by auto
  moreover from I II have "iN1-N2. W1`(i)  T" and "iN2-N1. W2`(i)  T" 
      using apply_funtype by auto
  ultimately have  "?W3:?N3T" by (rule fun_union_overlap)
  with I II have "FinProd(?𝒳,?W3)  ProductTopBase(I,T)" using union_finpow ProductTopBase_def
    by auto
  moreover have "UV = FinProd(?𝒳,?W3)"
  proof
    { fix x assume "xU" and "xV"
      with U = FinProd(?𝒳,W1)  W1N1T and  V = FinProd(?𝒳,W2)  W2N2T
      have "x?𝒳" and "iN1. x`(i)  W1`(i)" and "iN2. x`(i)  W2`(i)"
        using func1_1_L1 FinProd_def by auto
      with ?W3:?N3T x?𝒳 have "x  FinProd(?𝒳,?W3)"  
        using ZF_fun_from_tot_val func1_1_L1 FinProd_def by auto
    } thus "UV  FinProd(?𝒳,?W3)" by auto
    { fix x assume "x  FinProd(?𝒳,?W3)"
      with ?W3:?N3T have "x:IT" and III: "i?N3. x`(i)  ?W3`(i)"
        using FinProd_def func1_1_L1 by auto
     { fix i assume "iN1" 
       with ?W3:?N3T have "?W3`(i)  W1`(i)" using ZF_fun_from_tot_val by auto
       with III iN1 have "x`(i)  W1`(i)" by auto
     } with W1N1T x:IT U = FinProd(?𝒳,W1) 
      have "x  U" using func1_1_L1 FinProd_def by auto
      moreover
      { fix i assume "iN2" 
        with ?W3:?N3T have "?W3`(i)  W2`(i)" using ZF_fun_from_tot_val by auto
        with III iN2 have "x`(i)  W2`(i)" by auto
      } with W2N2T x:IT V = FinProd(?𝒳,W2) have "xV" 
          using func1_1_L1 FinProd_def by auto 
      ultimately have "x  UV" by simp
    } thus "FinProd(?𝒳,?W3)  UV" by auto
  qed
    ultimately show ?thesis by simp
qed 

textIn the next theorem we show the collection of sets defined above as 
ProductTopBase(𝒳,T)› satisfies the base condition. This is a condition, defined in 
Topology_ZF_1› that allows to claim that this collection is a base for some topology.

theorem prod_top_base_is_base: assumes "T {is a topology}" 
  shows "ProductTopBase(I,T) {satisfies the base condition}"
  using assms prod_top_base_inter inter_closed_base by simp

textThe (sequence) product topology is indeed a topology on the space of sequences.
In the proof we are using the fact that $(\emptyset\rightarrow X) = \{\emptyset\}$.

theorem seq_prod_top_is_top:  assumes "T {is a topology}"
  shows 
  "SeqProductTopology(I,T) {is a topology}" and 
  "ProductTopBase(I,T) {is a base for} SeqProductTopology(I,T)" and
  "SeqProductTopology(I,T) = (IT)"
proof -
  from assms show "SeqProductTopology(I,T) {is a topology}" and 
    I: "ProductTopBase(I,T) {is a base for} SeqProductTopology(I,T)"
      using prod_top_base_is_base SeqProductTopology_def Top_1_2_T1
        by auto
  from I have "SeqProductTopology(I,T) = ProductTopBase(I,T)"
    using Top_1_2_L5 by simp
  also have "ProductTopBase(I,T) = (IT)"
  proof
    show "ProductTopBase(I,T)  (IT)" using ProductTopBase_def FinProd_def
      by auto
    have "0  FinPow(I)" using empty_in_finpow by simp
    hence "{FinProd(IT,W). W0T}  (NFinPow(I).{FinProd(IT,W). WNT})"
      by blast
    then show "(IT)  ProductTopBase(I,T)" using ProductTopBase_def FinProd_def
      by auto
  qed     
  finally show "SeqProductTopology(I,T) = (IT)" by simp
qed

subsectionFinite product of topologies

textAs a special case of the space of functions $I\rightarrow X$ we can consider space of lists
of elements of $X$, i.e. space $n\rightarrow X$, where $n$ is a natural number (recall that in ZF 
set theory $n=\{0,1,...,n-1\}$). Such spaces model finite cartesian products $X^n$ 
but are easier to deal with in formalized way (than the said products). 
This section discusses natural topology defined on $n\rightarrow X$ where $X$ is a topological space.


textWhen the index set is finite, the definition of ProductTopBase(I,T)› 
can be simplifed.

lemma fin_prod_def_nat: assumes A1: "nnat" and A2: "T {is a topology}"  
  shows "ProductTopBase(n,T) = {FinProd(nT,W). WnT}"
proof
  from A1 have "n  FinPow(n)" using nat_finpow_nat fin_finpow_self by auto
  then show "{FinProd(nT,W). WnT}  ProductTopBase(n,T)" using ProductTopBase_def
    by auto
  { fix B assume "B  ProductTopBase(n,T)"
    then obtain N W where  "N  FinPow(n)" and "W  NT" and "B = FinProd(nT,W)"
      using ProductTopBase_def by auto
    let ?Wn = "{i,if iN then W`(i) else T. in}"
    from A2  N  FinPow(n)  WNT have "in. (if iN then W`(i) else T)  T"
      using apply_funtype FinPow_def IsATopology_def by auto
    then have "?Wn:nT" by (rule ZF_fun_from_total)
    moreover have "B = FinProd(nT,?Wn)"
    proof
      { fix x assume "xB"
        with B = FinProd(nT,W) have "x  nT" using FinProd_def by simp
        moreover have "idomain(?Wn). x`(i)  ?Wn`(i)"
        proof
          fix i assume "i  domain(?Wn)"
          with ?Wn:nT have "in" using func1_1_L1 by simp 
          with x:nT have "x`(i)  T" using apply_funtype by blast
          with xB B = FinProd(nT,W) W  NT ?Wn:nT in
          show "x`(i)  ?Wn`(i)" using func1_1_L1 FinProd_def ZF_fun_from_tot_val 
            by simp
        qed
        ultimately have "x  FinProd(nT,?Wn)" using FinProd_def by simp
      } thus "B  FinProd(nT,?Wn)" by auto
      next
      { fix x assume "x  FinProd(nT,?Wn)"    
        then have "x  nT" and "idomain(?Wn). x`(i)  ?Wn`(i)" 
          using  FinProd_def by auto
        with ?Wn:nT and N  FinPow(n) have "iN. x`(i)  ?Wn`(i)"
          using func1_1_L1 FinPow_def by auto
        moreover from ?Wn:nT and N  FinPow(n) 
        have "iN. ?Wn`(i) = W`(i)"
          using ZF_fun_from_tot_val FinPow_def by auto
        ultimately have "iN. x`(i)  W`(i)" by simp
        with W  NT x  nT B = FinProd(nT,W) have "xB"
          using func1_1_L1 FinProd_def by simp
     } thus "FinProd(nT,?Wn)  B" by auto
  qed 
    ultimately have "B  {FinProd(nT,W). WnT}" by auto
  } thus "ProductTopBase(n,T)  {FinProd(nT,W). WnT}" by auto
qed

textA technical lemma providing a formula for finite product on one topological space.

lemma single_top_prod: assumes A1: "W:1τ" 
  shows "FinProd(1τ,W) = { {0,y}. y  W`(0)}"
proof -
  have "1 = {0}" by auto
  from A1 have "domain(W) = {0}" using func1_1_L1 by auto
  then have "FinProd(1τ,W) = {x  1τ. x`(0)  W`(0)}"
    using FinProd_def by simp
  also have "{x  1τ. x`(0)  W`(0)} = { {0,y}. y  W`(0)}"
  proof
    from 1 = {0} show "{x  1τ. x`(0)  W`(0)}  { {0,y}. y  W`(0)}"
      using func_singleton_pair by auto 
    { fix x assume "x  { {0,y}. y  W`(0)}"
      then obtain y where "x = {0,y}" and II: "y  W`(0)" by auto
      with A1 have "y  τ" using apply_funtype by auto
      with x = {0,y}  1 = {0} have "x:1τ" using pair_func_singleton
        by auto
      with x = {0,y} II have "x  {x  1τ. x`(0)  W`(0)}"
        using pair_val by simp
    } thus "{ {0,y}. y  W`(0)}  {x  1τ. x`(0)  W`(0)}" by auto
  qed
  finally show ?thesis by simp 
qed

textIntuitively, the topological space of singleton lists valued in $X$ 
  is the same as $X$. However, each element of this space is a list of length one,
  i.e a set consisting of a pair $\langle 0, x\rangle$ where $x$ is an element of $X$.
  The next lemma provides a formula for the product topology in the corner case when we have 
  only one factor and shows that the product topology of one space is essentially the same as 
  the space.

lemma singleton_prod_top: assumes A1: "τ {is a topology}" 
  shows 
    "SeqProductTopology(1,τ) = { { {0,y}. yU }. Uτ}" and
    "IsAhomeomorphism(τ,SeqProductTopology(1,τ),{y,{0,y}.y  τ})"
proof -
  have "{0} = 1" by auto
  let ?b = "{y,{0,y}.y  τ}"
  have "?b  bij(τ,1τ)" using list_singleton_bij by blast
  with A1 have "{?b``(U). Uτ} {is a topology}" and "IsAhomeomorphism(τ, {?b``(U). Uτ},?b)"
    using bij_induced_top by auto
  moreover have "Uτ. ?b``(U) = { {0,y}. yU }"
  proof
    fix U assume "Uτ"
    from ?b  bij(τ,1τ) have "?b:τ(1τ)" using bij_def inj_def
      by simp
    { fix y assume "y  τ"
      with ?b:τ(1τ) have "?b`(y) = {0,y}" using ZF_fun_from_tot_val
        by simp
    } hence "y  τ. ?b`(y) = {0,y}" by auto
    with  Uτ ?b:τ(1τ) show " ?b``(U) = { {0,y}. yU }"
      using func_imagedef by auto 
  qed
  moreover have "ProductTopBase(1,τ) = { { {0,y}. yU }. Uτ}"
  proof
    { fix V assume "V  ProductTopBase(1,τ)"
      with A1 obtain W where "W:1τ" and "V = FinProd(1τ,W)"
        using fin_prod_def_nat by auto
      then have "V  { { {0,y}. yU }. Uτ}" using apply_funtype single_top_prod
        by auto 
    } thus "ProductTopBase(1,τ)  { { {0,y}. yU }. Uτ}" by auto
  { fix V assume "V  { { {0,y}. yU }. Uτ}"
    then obtain U where "Uτ" and "V = { {0,y}. yU }" by auto 
    let ?W = "{0,U}"
    from Uτ have "?W:{0}τ" using pair_func_singleton by simp   
    with {0} = 1 have "?W:1τ" and "?W`(0) = U" using pair_val by auto
    with V = { {0,y}. yU } have "V = FinProd(1τ,?W)"
      using single_top_prod by simp 
    with A1 ?W:1τ have "V  ProductTopBase(1,τ)" using fin_prod_def_nat
      by auto
   } thus "{ { {0,y}. yU }. Uτ}  ProductTopBase(1,τ)" by auto 
  qed
  ultimately have I: "ProductTopBase(1,τ) {is a topology}" and 
    II: "IsAhomeomorphism(τ, ProductTopBase(1,τ),?b)" by auto
  from A1 have "ProductTopBase(1,τ) {is a base for} SeqProductTopology(1,τ)" 
    using seq_prod_top_is_top by simp
  with I have "ProductTopBase(1,τ) = SeqProductTopology(1,τ)" by (rule base_topology)
  with ProductTopBase(1,τ) = { { {0,y}. yU }. Uτ} II show
    "SeqProductTopology(1,τ) = { { {0,y}. yU }. Uτ}" and
    "IsAhomeomorphism(τ,SeqProductTopology(1,τ),{y,{0,y}.y  τ})" by auto
qed

textA special corner case of finite_top_prod_homeo›: a space $X$ 
  is homeomorphic to the space of one element lists of $X$.

theorem singleton_prod_top1: assumes A1: "τ {is a topology}" 
  shows "IsAhomeomorphism(SeqProductTopology(1,τ),τ,{x,x`(0). x1τ})"
proof -
  have "{x,x`(0). x1τ} = converse({y,{0,y}.yτ})" 
    using list_singleton_bij by blast
  with A1 show ?thesis using singleton_prod_top homeo_inv by simp
qed 
 
textA technical lemma describing the carrier of a (cartesian) product topology of  
the (sequence) product topology of $n$ copies of topology $\tau$ and another 
copy of $\tau$.

lemma finite_prod_top: assumes "τ {is a topology}" and  "T = SeqProductTopology(n,τ)"
  shows "(ProductTopology(T,τ)) = (nτ)×τ"
  using assms Top_1_4_T1 seq_prod_top_is_top by simp

textIf $U$ is a set from the base of $X^n$ and $V$ is open in $X$, then $U\times V$
is in the base of $X^{n+1}$. The next lemma is an analogue of this fact for the 
function space approach.

lemma finite_prod_succ_base: assumes A1: "τ {is a topology}" and A2: "n  nat" and 
  A3: "U  ProductTopBase(n,τ)" and A4: "Vτ"
  shows "{x  succ(n)τ. Init(x)  U  x`(n)  V}  ProductTopBase(succ(n),τ)"
  proof -
    let ?B = "{x  succ(n)τ. Init(x)  U  x`(n)  V}"
    from A1 A2 have "ProductTopBase(n,τ) = {FinProd(nτ,W). Wnτ}"
      using fin_prod_def_nat by simp
    with A3 obtain WU where "WU:nτ" and "U =FinProd(nτ,WU)" by auto
    let ?W = "Append(WU,V)"
    from A4 and WU:nτ have "?W:succ(n)τ" using append_props by simp
    moreover have "?B = FinProd(succ(n)τ,?W)"
    proof
      { fix x assume "x?B"
        with ?W:succ(n)τ have "x  succ(n)τ" and "domain(?W) = succ(n)" using func1_1_L1 
          by auto
        moreover from A2 A4 x?B U =FinProd(nτ,WU) WU:nτ x  succ(n)τ 
        have "isucc(n). x`(i)  ?W`(i)" using func1_1_L1 FinProd_def init_props append_props
          by simp 
        ultimately have "x  FinProd(succ(n)τ,?W)" using FinProd_def by simp 
      } thus "?B  FinProd(succ(n)τ,?W)" by auto
      next
      { fix x assume "x  FinProd(succ(n)τ,?W)"
        then have "x:succ(n)τ" and I: "i  domain(?W). x`(i)  ?W`(i)"
          using FinProd_def by auto
        moreover have "Init(x)  U"
        proof -
          from A2 and x:succ(n)τ have "Init(x):nτ" using init_props by simp 
          moreover have "idomain(WU). Init(x)`(i)  WU`(i)"
          proof -
            from A2 x  FinProd(succ(n)τ,?W) ?W:succ(n)τ have "in. x`(i)  ?W`(i)"
              using FinProd_def func1_1_L1 by simp 
            moreover from A2 x: succ(n)τ have "in. Init(x)`(i) = x`(i)"
              using init_props by simp
            moreover from A4 and WU:nτ have "in. ?W`(i) =  WU`(i)"
              using append_props by simp
            ultimately have "in. Init(x)`(i)  WU`(i)" by simp
            with WU:nτ show ?thesis using func1_1_L1 by simp 
          qed
          ultimately have "Init(x)  FinProd(nτ,WU)" using FinProd_def by simp
          with U =FinProd(nτ,WU) show ?thesis by simp 
        qed
        moreover have "x`(n)  V"       
        proof -  
          from ?W:succ(n)τ I  have "x`(n)  ?W`(n)" using func1_1_L1 by simp
          moreover from A4 WU:nτ have "?W`(n) = V" using append_props by simp
          ultimately show ?thesis by simp 
        qed
        ultimately have "x?B" by simp  
      } thus "FinProd(succ(n)τ,?W)  ?B" by auto
    qed
    moreover from A1 A2 have 
      "ProductTopBase(succ(n),τ) = {FinProd(succ(n)τ,W). Wsucc(n)τ}"
      using fin_prod_def_nat by simp
    ultimately show ?thesis by auto
 qed

textIf $U$ is open in $X^n$ and $V$ is open in $X$, then $U\times V$ is open in $X^{n+1}$. 
The next lemma is an analogue of this fact for the function space approach.

lemma finite_prod_succ: assumes A1: "τ {is a topology}" and A2: "n  nat" and 
  A3: "U  SeqProductTopology(n,τ)" and A4: "Vτ"
  shows "{x  succ(n)τ. Init(x)  U  x`(n)  V}  SeqProductTopology(succ(n),τ)"
  proof -
     from A1 have "ProductTopBase(n,τ) {is a base for} SeqProductTopology(n,τ)" and 
      I: "ProductTopBase(succ(n),τ) {is a base for} SeqProductTopology(succ(n),τ)" and 
      II: "SeqProductTopology(succ(n),τ) {is a topology}"
        using seq_prod_top_is_top by auto
    with A3 have "  Pow(ProductTopBase(n,τ)). U = " using Top_1_2_L1 by simp
    then obtain  where "  ProductTopBase(n,τ)" and "U = " by auto
    then have 
    "{x:succ(n)τ. Init(x)  U  x`(n)  V} = (B.{x:succ(n)τ. Init(x)  B  x`(n)  V})"
      by auto
    moreover from A1 A2 A4   ProductTopBase(n,τ) have
      "B. ({x:succ(n)τ. Init(x)  B  x`(n)  V}  ProductTopBase(succ(n),τ))"
      using finite_prod_succ_base by auto
    with I II have 
      "(B.{x:succ(n)τ. Init(x)  B  x`(n)  V})  SeqProductTopology(succ(n),τ)"
      using base_sets_open union_indexed_open by auto
    ultimately show ?thesis by simp
  qed

    
textIn the Topology_ZF_2› theory we define product topology of two topological spaces.
The next lemma explains in what sense the topology on finite lists of length $n$ of 
elements of topological space $X$ can be thought as a model of the product topology on the cartesian 
product of $n$ copies of that space. Namely, we show that the space of lists of length $n+1$ 
of elements of $X$  is homeomorphic to the product topology (as defined in Topology_ZF_2›) 
of two spaces: the space of lists of length $n$ and $X$. Recall that if $\mathcal{B}$ is a base 
(i.e. satisfies the base condition), then the collection $\{\bigcup B| B \in Pow(\mathcal{B})\}$ 
is a topology (generated by $\mathcal{B}$).

theorem finite_top_prod_homeo: assumes A1: "τ {is a topology}" and A2: "n  nat" and 
  A3: "f = {x,Init(x),x`(n). x  succ(n)τ}" and
  A4: "T = SeqProductTopology(n,τ)" and
  A5: "S = SeqProductTopology(succ(n),τ)"
shows "IsAhomeomorphism(S,ProductTopology(T,τ),f)"
proof -
  let ?C = "ProductCollection(T,τ)"
  let ?B = "ProductTopBase(succ(n),τ)"
  from A1 A4 have "T {is a topology}" using seq_prod_top_is_top by simp
  with A1 A5  have "S {is a topology}" and " ProductTopology(T,τ) {is a topology}" 
        using seq_prod_top_is_top  Top_1_4_T1 by auto
  moreover 
  from assms have "f  bij(S,ProductTopology(T,τ))"
    using lists_cart_prod seq_prod_top_is_top Top_1_4_T1 by simp
  then have "f: SProductTopology(T,τ)" using bij_is_fun by simp
  ultimately have "two_top_spaces0(S,ProductTopology(T,τ),f)" using two_top_spaces0_def by simp
  moreover note f  bij(S,ProductTopology(T,τ))
  moreover from A1 A5 have "?B {is a base for} S"
    using seq_prod_top_is_top by simp
  moreover from A1 T {is a topology} have "?C {is a base for} ProductTopology(T,τ)" 
    using Top_1_4_T1 by auto
  moreover have  "W?C. f-``(W)  S"
  proof
      fix W assume "W?C"
      then obtain U V where "UT" "Vτ" and "W = U×V" using ProductCollection_def by auto  
      from A1 A5 f: SProductTopology(T,τ) have "f: (succ(n)τ)ProductTopology(T,τ)"
        using seq_prod_top_is_top by simp
      with assms W = U×V UT Vτ show "f-``(W)  S" 
        using ZF_fun_from_tot_val func1_1_L15 finite_prod_succ by simp 
  qed
  moreover have "V?B. f``(V)  ProductTopology(T,τ)"
  proof
    fix V assume "V?B"
    with A1 A2 obtain WV where "WV  succ(n)τ" and "V = FinProd(succ(n)τ,WV)" 
      using fin_prod_def_nat by auto
    let ?U = "FinProd(nτ,Init(WV))"
    let ?W = "WV`(n)"
    have "?U  T"
    proof - 
      from A1 A2 WV  succ(n)τ have "?U  ProductTopBase(n,τ)" 
        using fin_prod_def_nat init_props by auto
      with A1 A4 show ?thesis using seq_prod_top_is_top base_sets_open by blast
    qed
    from A1 WV  succ(n)τ T {is a topology} ?U  T have "?U×?W  ProductTopology(T,τ)"
      using apply_funtype prod_open_open_prod by simp
    moreover have "f``(V) = ?U×?W"
    proof -
      from A2 WV: succ(n)τ have "Init(WV): nτ" and III: "kn. Init(WV)`(k) = WV`(k)" 
        using init_props by auto
      then have "domain(Init(WV)) = n" using func1_1_L1 by simp
      have "f``(V) = {Init(x),x`(n). xV}"
      proof -
        have "f``(V) = {f`(x). xV}"
        proof -
          from A1 A5 have "?B {is a base for} S" using seq_prod_top_is_top by simp 
          with V?B have "V  S" using IsAbaseFor_def by auto
          with f: SProductTopology(T,τ) show ?thesis using func_imagedef by simp
        qed
        moreover have "xV. f`(x) = Init(x),x`(n)"
        proof -
          from A1 A3 A5 V = FinProd(succ(n)τ,WV) have "V  S" and 
            fdef: "f = {x,Init(x),x`(n). x  S}" using seq_prod_top_is_top FinProd_def 
            by auto 
          from f: SProductTopology(T,τ) fdef have "x  S. f`(x) = Init(x),x`(n)" 
            by (rule ZF_fun_from_tot_val0)  
          with V  S show ?thesis by auto  
        qed
        ultimately show ?thesis by simp 
      qed
      also have "{Init(x),x`(n). xV} = ?U×?W"
      proof
        { fix y assume "y  {Init(x),x`(n). xV}"
          then obtain x where I: "y = Init(x),x`(n)" and "xV" by auto 
          with V = FinProd(succ(n)τ,WV) have 
            "x:succ(n)τ" and II: "kdomain(WV). x`(k)  WV`(k)" 
            unfolding FinProd_def by auto
          with A2 WV: succ(n)τ have IV: "kn. Init(x)`(k) = x`(k)" 
            using init_props by simp 
          have "Init(x)  ?U"
          proof -
            from A2 x:succ(n)τ have "Init(x): nτ" using init_props by simp 
            moreover have "kdomain(Init(WV)). Init(x)`(k)  Init(WV)`(k)"
            proof -
              from A2 WV: succ(n)τ have "Init(WV): nτ" using init_props by simp
              then have "domain(Init(WV)) = n" using func1_1_L1 by simp
              note III IV  domain(Init(WV)) = n
              moreover from II WV  succ(n)τ have "kn. x`(k)  WV`(k)" 
                using func1_1_L1 by simp
              ultimately show ?thesis by simp 
            qed
            ultimately show "Init(x)  ?U" using FinProd_def by simp
          qed
          moreover from WV: succ(n)τ II have "x`(n)  ?W" using func1_1_L1 by simp
          ultimately have "Init(x),x`(n)  ?U×?W" by simp 
          with I have "y  ?U×?W" by simp 
        } thus "{Init(x),x`(n). xV}  ?U×?W" by auto
        { fix y assume "y  ?U×?W"
          then have "fst(y)  ?U" and "snd(y)  ?W" by auto
          with domain(Init(WV)) = n have "fst(y): nτ" and 
            V: "kn. fst(y)`(k)  Init(WV)`(k)"
            using FinProd_def by auto
          from WV: succ(n)τ have "?W  τ" using apply_funtype by simp
          with snd(y)  ?W have "snd(y)  τ" by auto     
          let ?x = "Append(fst(y),snd(y))"
          have "?xV"
          proof -
            from fst(y): nτ snd(y)  τ have "?x:succ(n)τ" using append_props by simp
            moreover have "idomain(WV). ?x`(i)  WV`(i)"             
            proof -
              from fst(y): nτ snd(y)  τ 
                have "kn. ?x`(k) = fst(y)`(k)" and "?x`(n) = snd(y)" 
                using append_props by auto
              moreover from III V have "kn. fst(y)`(k)  WV`(k)" by simp 
              moreover note snd(y)  ?W
              ultimately have "isucc(n). ?x`(i)  WV`(i)" by simp
              with WV  succ(n)τ show ?thesis using func1_1_L1 by simp 
            qed
            ultimately have "?x  FinProd(succ(n)τ,WV)" using FinProd_def by simp
            with V = FinProd(succ(n)τ,WV) show "?xV" by simp  
          qed
          moreover from A2 y  ?U×?W fst(y): nτ snd(y)  τ have "y = Init(?x),?x`(n)"
            using init_append append_props by auto  
          ultimately have "y  {Init(x),x`(n). xV}" by auto 
        } thus "?U×?W  {Init(x),x`(n). xV}" by auto
      qed
      finally show "f``(V) = ?U×?W" by simp 
    qed
    ultimately show "f``(V)  ProductTopology(T,τ)" by simp 
  qed
  ultimately show ?thesis using two_top_spaces0.bij_base_open_homeo by simp 
qed
   

end